#421 Clean up events javadoc and interface
- Add proper javadoc to all events - Use proper handling of the Eventlist in all events: each event has its own EventList and its static method, as specified by Bukkit's Event class - Add common supertype to all AuthMe events - Remove unused events - Remove unused methods (setters to fields that we ignore entirely)
This commit is contained in:
@@ -28,8 +28,7 @@ import fr.xephi.authme.util.Utils.GroupType;
|
||||
|
||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
public class ProcessSyncPlayerLogin implements Runnable {
|
||||
|
||||
private final LimboPlayer limbo;
|
||||
@@ -63,24 +62,19 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getLimbo.
|
||||
*
|
||||
* @return LimboPlayer
|
||||
*/
|
||||
public LimboPlayer getLimbo() {
|
||||
return limbo;
|
||||
}
|
||||
|
||||
protected void restoreOpState() {
|
||||
private void restoreOpState() {
|
||||
player.setOp(limbo.getOperator());
|
||||
}
|
||||
|
||||
protected void packQuitLocation() {
|
||||
private void packQuitLocation() {
|
||||
Utils.packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
||||
}
|
||||
|
||||
protected void teleportBackFromSpawn() {
|
||||
private void teleportBackFromSpawn() {
|
||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
||||
pm.callEvent(tpEvent);
|
||||
if (!tpEvent.isCancelled() && tpEvent.getTo() != null) {
|
||||
@@ -88,7 +82,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void teleportToSpawn() {
|
||||
private void teleportToSpawn() {
|
||||
Location spawnL = plugin.getSpawnLocation(player);
|
||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
||||
pm.callEvent(tpEvent);
|
||||
@@ -97,14 +91,14 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void restoreSpeedEffects() {
|
||||
private void restoreSpeedEffects() {
|
||||
if (Settings.isRemoveSpeedEnabled) {
|
||||
player.setWalkSpeed(0.2F);
|
||||
player.setFlySpeed(0.1F);
|
||||
}
|
||||
}
|
||||
|
||||
protected void restoreInventory() {
|
||||
private void restoreInventory() {
|
||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
||||
pm.callEvent(event);
|
||||
if (!event.isCancelled() && plugin.inventoryProtector != null) {
|
||||
@@ -112,7 +106,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void forceCommands() {
|
||||
private void forceCommands() {
|
||||
for (String command : Settings.forceCommands) {
|
||||
player.performCommand(command.replace("%p", player.getName()));
|
||||
}
|
||||
@@ -121,7 +115,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendBungeeMessage() {
|
||||
private void sendBungeeMessage() {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ALL");
|
||||
@@ -130,11 +124,6 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method run.
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
// Limbo contains the State of the Player before /login
|
||||
@@ -175,8 +164,9 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
if (jm != null) {
|
||||
if (!jm.isEmpty()) {
|
||||
for (Player p : Utils.getOnlinePlayers()) {
|
||||
if (p.isOnline())
|
||||
if (p.isOnline()) {
|
||||
p.sendMessage(jm);
|
||||
}
|
||||
}
|
||||
}
|
||||
AuthMePlayerListener.joinMessage.remove(name);
|
||||
@@ -188,12 +178,13 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
}
|
||||
|
||||
// The Login event now fires (as intended) after everything is processed
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player));
|
||||
player.saveData();
|
||||
if (Settings.bungee)
|
||||
if (Settings.bungee) {
|
||||
sendBungeeMessage();
|
||||
}
|
||||
// Login is finish, display welcome message if we use email registration
|
||||
if (Settings.useWelcomeMessage && Settings.emailRegistration)
|
||||
if (Settings.useWelcomeMessage && Settings.emailRegistration) {
|
||||
if (Settings.broadcastWelcomeMessage) {
|
||||
for (String s : settings.getWelcomeMessage()) {
|
||||
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
|
||||
@@ -203,6 +194,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
||||
player.sendMessage(plugin.replaceAllInfo(s, player));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Login is now finished; we can force all commands
|
||||
forceCommands();
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ProcessSyncPasswordRegister implements Runnable {
|
||||
}
|
||||
|
||||
// The LoginEvent now fires (as intended) after everything is processed
|
||||
plugin.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||
plugin.getServer().getPluginManager().callEvent(new LoginEvent(player));
|
||||
player.saveData();
|
||||
|
||||
if (!Settings.noConsoleSpam) {
|
||||
|
||||
Reference in New Issue
Block a user