[Need Help] How to remove all death messages except PVP messages?

Discussion in 'Plugin Development' started by PlayFriik, Nov 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    PlayFriik

    So basically, I am editing Annihilation plugin (https://github.com/MCTyler/CrafterNexus) and I just don't like these "*name* died", "*name* fell out of the world" messages, so I need help at this..

    So basically, as far as I know, these are handling death messages, but I can't understand what I have to edit:
    Code:
        public static String formatDeathMessage(Player victim, Player killer,
                String original) {
            GameTeam killerTeam = PlayerMeta.getMeta(killer).getTeam();
            String killerColor = killerTeam != null ? killerTeam.color().toString()
                    : ChatColor.DARK_PURPLE.toString();
            String killerName = killerColor + killer.getName() + "(" + PlayerMeta.getMeta(killer).getKit() + ")" + ChatColor.GRAY;
     
            String message = ChatColor.GRAY + formatDeathMessage(victim, original);
            message = message.replace(killer.getName(), killerName);
     
            return message;
        }
     
        public static String formatDeathMessage(Player victim, String original) {
            GameTeam victimTeam = PlayerMeta.getMeta(victim).getTeam();
            String victimColor = victimTeam != null ? victimTeam.color().toString()
                    : ChatColor.DARK_PURPLE.toString();
            String victimName = victimColor + victim.getName() + "(" + PlayerMeta.getMeta(victim).getKit() + ")" + ChatColor.GRAY;
     
            String message = ChatColor.GRAY + original;
            message = message.replace(victim.getName(), victimName);
     
            if (message.contains(" �8�")) {
                String[] arr = message.split(" �8�");
                message = arr[0];
            }
            return message.replace("was slain by", "was killed by");
        }
     
  2. Offline

    mrCookieSlime

    Moved to Plugin Developement.
     
  3. Offline

    Skionz

    PlayFriik Shouldn't this work? You would have to check if the death wasn't due to a player but it should work.
    Code:
    public void onDeath(PlayerDeathEvent event) {
        event.setDeathMessage(null);
    }
     
  4. Offline

    PlayFriik

    Hmm, where should I put this..? Because I put this after the code and then it still says these messages..
     
  5. Offline

    Skionz

    PlayFriik Did you use it correctly? Do you have your events registered and the EventHandler notation above it?
     
  6. Offline

    PlayFriik

    Yes, I added EventHandler notation above it, but I don't know how to register it?
     
  7. Offline

    JordyPwner

    Learn the basics of java >.<
     
  8. Offline

    PlayFriik

    Well, I learned already the "basics".. Please don't get angry if I am just asking.

    And also, if I can get it to work, then I just learned a new thing.
     
  9. Offline

    BeastCraft3

    PlayFriik
    you won't learn out of sponge feeding, show us the entire code you made?
     
Thread Status:
Not open for further replies.

Share This Page