From c6fa21c247750544025d08fd2d69fa9f20dfcad3 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 15 Apr 2014 22:08:16 +0200 Subject: [PATCH] Make use of MCoreEvent. Make some fields private instead of protected. --- .../event/MCoreAfterPlayerRespawnEvent.java | 18 +++--------------- .../event/MCoreAfterPlayerTeleportEvent.java | 16 ++-------------- .../mcore/event/MCorePlayerLeaveEvent.java | 8 ++++---- 3 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/com/massivecraft/mcore/event/MCoreAfterPlayerRespawnEvent.java b/src/com/massivecraft/mcore/event/MCoreAfterPlayerRespawnEvent.java index 22cf3b69..641624db 100644 --- a/src/com/massivecraft/mcore/event/MCoreAfterPlayerRespawnEvent.java +++ b/src/com/massivecraft/mcore/event/MCoreAfterPlayerRespawnEvent.java @@ -1,13 +1,11 @@ package com.massivecraft.mcore.event; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerRespawnEvent; -public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable +public class MCoreAfterPlayerRespawnEvent extends MCoreEvent { // -------------------------------------------- // // REQUIRED EVENT CODE @@ -21,10 +19,10 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable // FIELD // -------------------------------------------- // - protected final Location deathLocation; + private final Location deathLocation; public Location getDeathLocation() { return this.deathLocation; } - protected final PlayerRespawnEvent bukkitEvent; + private final PlayerRespawnEvent bukkitEvent; public PlayerRespawnEvent getBukkitEvent() { return this.bukkitEvent; } public Location getRespawnLocation() { return this.bukkitEvent.getRespawnLocation(); } @@ -40,14 +38,4 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable this.deathLocation = deathLocation; } - // -------------------------------------------- // - // HANDY RUN SHORTCUT - // -------------------------------------------- // - - @Override - public void run() - { - Bukkit.getPluginManager().callEvent(this); - } - } diff --git a/src/com/massivecraft/mcore/event/MCoreAfterPlayerTeleportEvent.java b/src/com/massivecraft/mcore/event/MCoreAfterPlayerTeleportEvent.java index 73ab9ef6..7fe5406a 100644 --- a/src/com/massivecraft/mcore/event/MCoreAfterPlayerTeleportEvent.java +++ b/src/com/massivecraft/mcore/event/MCoreAfterPlayerTeleportEvent.java @@ -1,15 +1,13 @@ package com.massivecraft.mcore.event; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable +public class MCoreAfterPlayerTeleportEvent extends MCoreEvent { // -------------------------------------------- // // REQUIRED EVENT CODE @@ -23,7 +21,7 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable // FIELD // -------------------------------------------- // - protected final PlayerTeleportEvent bukkitEvent; + private final PlayerTeleportEvent bukkitEvent; public PlayerTeleportEvent getBukkitEvent() { return this.bukkitEvent; } public Location getFrom() { return this.bukkitEvent.getFrom(); } @@ -47,14 +45,4 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable this.bukkitEvent = bukkitEvent; } - // -------------------------------------------- // - // HANDY RUN SHORTCUT - // -------------------------------------------- // - - @Override - public void run() - { - Bukkit.getPluginManager().callEvent(this); - } - } diff --git a/src/com/massivecraft/mcore/event/MCorePlayerLeaveEvent.java b/src/com/massivecraft/mcore/event/MCorePlayerLeaveEvent.java index 4e962fe8..d433e6e3 100644 --- a/src/com/massivecraft/mcore/event/MCorePlayerLeaveEvent.java +++ b/src/com/massivecraft/mcore/event/MCorePlayerLeaveEvent.java @@ -32,19 +32,19 @@ public class MCorePlayerLeaveEvent extends Event implements Runnable // FIELD // -------------------------------------------- // - protected final Player player; + private final Player player; public Player getPlayer() { return this.player; } - protected final boolean preDisconnect; + private final boolean preDisconnect; public boolean isPreDisconnect() { return this.preDisconnect; } public boolean isPostDisconnect() { return !this.isPreDisconnect(); } - protected final String caller; + private final String caller; public String getCaller() { return this.caller; } public boolean isQuit() { return "quit".equals(caller); } public boolean isKick() { return "kick".equals(caller); } - protected final String message; + private final String message; public String getMessage() { return this.message; } // -------------------------------------------- //