mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Moved PlayerQuit to use normal PlayerEvent, dropped Reason param
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
a3ff0f1177
commit
8f8f4aef90
4 changed files with 3 additions and 49 deletions
|
@ -3,7 +3,6 @@ package com.dinnerbone.bukkit.sample;
|
||||||
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle events for all Player related events
|
* Handle events for all Player related events
|
||||||
|
@ -22,7 +21,7 @@ public class SamplePlayerListener extends PlayerListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerEvent event) {
|
||||||
System.out.println(event.getPlayer().getName() + " left the server! :'(");
|
System.out.println(event.getPlayer().getName() + " left the server! :'(");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,6 @@ public class PlayerListener implements Listener {
|
||||||
* Called when a player leaves a server
|
* Called when a player leaves a server
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerEvent event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
|
|
||||||
package org.bukkit.event.player;
|
|
||||||
|
|
||||||
import org.bukkit.Player;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles all event arguments in relation to a player joining a server
|
|
||||||
*/
|
|
||||||
public class PlayerQuitEvent extends PlayerEvent {
|
|
||||||
private final PlayerQuitReason reason;
|
|
||||||
|
|
||||||
public PlayerQuitEvent(final Server server, final Player player, final PlayerQuitReason because) {
|
|
||||||
super(server, player);
|
|
||||||
reason = because;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the reason for a player quitting the game
|
|
||||||
* @return PlayerQuitReason with the relevant reason
|
|
||||||
*/
|
|
||||||
public PlayerQuitReason getReason() {
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The reason a player quit the game
|
|
||||||
*/
|
|
||||||
public enum PlayerQuitReason {
|
|
||||||
/**
|
|
||||||
* A player willingly quit the game
|
|
||||||
*/
|
|
||||||
Quit,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A player disconnected due to a technical fault
|
|
||||||
*/
|
|
||||||
Disconnected,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A player was kicked by another player
|
|
||||||
*/
|
|
||||||
Kicked
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -85,7 +85,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
trueListener.onPlayerJoin((PlayerEvent)event);
|
trueListener.onPlayerJoin((PlayerEvent)event);
|
||||||
break;
|
break;
|
||||||
case Quit:
|
case Quit:
|
||||||
trueListener.onPlayerQuit((PlayerQuitEvent)event);
|
trueListener.onPlayerQuit((PlayerEvent)event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue