Solved Annoying Problem I don't know how to fix

Discussion in 'Plugin Development' started by BladdonB, Jun 21, 2015.

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

    BladdonB

    Hi, I am making a KitPVP plugin and when the play leaves it says "BladDon has lefteded the server" (BladDon is my username). That was when I was joking around, in the code I changed it to left.

    Code:
    Bukkit.broadcastMessage("" + ChatColor.AQUA + ChatColor.BOLD + pname + ChatColor.RESET + ChatColor.GOLD + " has left the KIT PVP server");
    How Do I fix this? Please reply as soon as possible.

    EDIT: The problem is that it is saying leftededed the server instead of left
     
    Last edited: Jun 23, 2015
  2. Offline

    ImSxYN

    Do you want it to not say that or actually say the right username?
     
  3. Offline

    Boomer

    What is broken?
     
  4. Offline

    Zombie_Striker

    @BladdonB
    Either
    A) You have not updated your code/ there is something changing the text.
    or
    B) You are not showing us your full code, and you have something that might be overriding that.
     
  5. Offline

    xTrollxDudex

    Did you recompile and reload/restart the server?
     
  6. Offline

    BladdonB

    Yes I Did

    Code:
    package me.pvp.listeners;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    import org.bukkit.event.player.PlayerRespawnEvent;
    import me.pvp.main.Main;
    
    public class PlayerListeners implements Listener{
       
        Main plugin;
        public PlayerListeners(Main instance) {
            this.plugin = instance;
        }
       
        //When player join the server
        @EventHandler
        public void PlayerJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            String pname = p.getName();
            p.getInventory().clear();
            //Message to send the seerver on join
            Bukkit.broadcastMessage("" + ChatColor.AQUA + ChatColor.BOLD + pname + ChatColor.RESET + ChatColor.GOLD + " has join the KIT PVP server");
       
        }
       
        //END OF PLAYER JOINING SERVER
       
        //When player leaves servah
        @EventHandler
        public void PlayerLeave(PlayerQuitEvent e) {
            Player p = e.getPlayer();
            String pname = p.getName();
            p.getInventory().clear();
            //Message to send the server on quit
            Bukkit.broadcastMessage("" + ChatColor.AQUA + ChatColor.BOLD + pname + ChatColor.RESET + ChatColor.GOLD + " has left the KIT PVP server");
    
        }
       
        //End OF PLAYER LEAVING DA SERVAH
        @EventHandler
        public void Death(PlayerDeathEvent e) {
       
            Player p = e.getEntity();
            Player k = p.getKiller();
            e.setDeathMessage("" + ChatColor.BLUE + p.getName() + ChatColor.AQUA + " was killed by " + ChatColor.RED + k.getName());
            p.sendMessage(ChatColor.AQUA + "You were killed by " + ChatColor.RED + k.getName() + ChatColor.BLUE + " you have lost 50 dollars");
            String cmd = "money " + "give " + k.getName() + " 100";
            String cmd1 = "money " + "take " + p.getName() + " 50";
            //Console commands don't have a "/"
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd1);
            k.sendMessage(ChatColor.AQUA + "Congrats! You killed " + ChatColor.RED + p.getName() + ChatColor.BLUE + " you got 100 dollars");
        }
    
        @EventHandler
        public void Respawn(PlayerRespawnEvent e) {
            Player p = getPlayer();
            String cmd = "money " + "take " + p.getName() + " 5"; //Console commands don't have a "/"
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
          
        }
    
        private Player getPlayer() {
            // TODO Auto-generated method stub
            return null;
        }}
       
       
       
    
     
  7. Offline

    567legodude

    This isn't really important but to get bold Aqua color it's much easier to use §b§l instead of ChatColor.
     
  8. Offline

    Boomer

    Well, its very clear - your plugin does not contain a single instance of the string that is being broadcast.
    If the server is broadcasting a message that you do not have in this plugin, then this string is coming from some other plugin file.

    -you haven't replaced the plugin in the server plugin folder with this version
    OR
    - your server log startup shows an ambiguous plugin name between (file1) and (file2) for your plugin, meaning that you have two different jar files repesenting this plugin (myplug.jar, myplug(1).jar .. myplugV2.jar etc) and the server is forced to FLIP A COIN to decide which jar file to load each time you run it, not always running the most recent version, smallest file, largest file, or anything favorable over the other, just randomly selected, and in this case, is loading your older one.
    OR
    You programmed yet a different plugin to do that message elsewhere...
     
  9. Offline

    BladdonB

    There was something weird happening with my thing, I just remade the files and copied them into there and it started working again, thanks everybody!

    xD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page