PlayerQuitEvent. What to make the player?!?

Discussion in 'Plugin Development' started by jamw, May 25, 2012.

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


    So this is my code :
    package com.github.jamw.Events;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerQuitEvent;
    public class QuitListener implements Listener {
     public void onLeave(PlayerQuitEvent event){
      Player player = event.getPlayer();
      event.setQuitMessage(event.getPlayer() + " Ditched us");

    What should i do for "Player player ="? It currently just gets some weird extended name
  2. Offline


    You're returning the Player object, you need their name.

    Change it to:
    1. String player = event.getPlayer().getName();
    jamw likes this.
  3. Offline


    Oh i didn't even think of that... thank you very much
Thread Status:
Not open for further replies.

Share This Page