Make use of MCoreEvent. Make some fields private instead of protected.

This commit is contained in:
Olof Larsson 2014-04-15 22:08:16 +02:00
parent 2b6cce2607
commit c6fa21c247
3 changed files with 9 additions and 33 deletions

View File

@ -1,13 +1,11 @@
package com.massivecraft.mcore.event; package com.massivecraft.mcore.event;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable public class MCoreAfterPlayerRespawnEvent extends MCoreEvent
{ {
// -------------------------------------------- // // -------------------------------------------- //
// REQUIRED EVENT CODE // REQUIRED EVENT CODE
@ -21,10 +19,10 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable
// FIELD // FIELD
// -------------------------------------------- // // -------------------------------------------- //
protected final Location deathLocation; private final Location deathLocation;
public Location getDeathLocation() { return this.deathLocation; } public Location getDeathLocation() { return this.deathLocation; }
protected final PlayerRespawnEvent bukkitEvent; private final PlayerRespawnEvent bukkitEvent;
public PlayerRespawnEvent getBukkitEvent() { return this.bukkitEvent; } public PlayerRespawnEvent getBukkitEvent() { return this.bukkitEvent; }
public Location getRespawnLocation() { return this.bukkitEvent.getRespawnLocation(); } public Location getRespawnLocation() { return this.bukkitEvent.getRespawnLocation(); }
@ -40,14 +38,4 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable
this.deathLocation = deathLocation; this.deathLocation = deathLocation;
} }
// -------------------------------------------- //
// HANDY RUN SHORTCUT
// -------------------------------------------- //
@Override
public void run()
{
Bukkit.getPluginManager().callEvent(this);
}
} }

View File

@ -1,15 +1,13 @@
package com.massivecraft.mcore.event; package com.massivecraft.mcore.event;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable public class MCoreAfterPlayerTeleportEvent extends MCoreEvent
{ {
// -------------------------------------------- // // -------------------------------------------- //
// REQUIRED EVENT CODE // REQUIRED EVENT CODE
@ -23,7 +21,7 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable
// FIELD // FIELD
// -------------------------------------------- // // -------------------------------------------- //
protected final PlayerTeleportEvent bukkitEvent; private final PlayerTeleportEvent bukkitEvent;
public PlayerTeleportEvent getBukkitEvent() { return this.bukkitEvent; } public PlayerTeleportEvent getBukkitEvent() { return this.bukkitEvent; }
public Location getFrom() { return this.bukkitEvent.getFrom(); } public Location getFrom() { return this.bukkitEvent.getFrom(); }
@ -47,14 +45,4 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable
this.bukkitEvent = bukkitEvent; this.bukkitEvent = bukkitEvent;
} }
// -------------------------------------------- //
// HANDY RUN SHORTCUT
// -------------------------------------------- //
@Override
public void run()
{
Bukkit.getPluginManager().callEvent(this);
}
} }

View File

@ -32,19 +32,19 @@ public class MCorePlayerLeaveEvent extends Event implements Runnable
// FIELD // FIELD
// -------------------------------------------- // // -------------------------------------------- //
protected final Player player; private final Player player;
public Player getPlayer() { return this.player; } public Player getPlayer() { return this.player; }
protected final boolean preDisconnect; private final boolean preDisconnect;
public boolean isPreDisconnect() { return this.preDisconnect; } public boolean isPreDisconnect() { return this.preDisconnect; }
public boolean isPostDisconnect() { return !this.isPreDisconnect(); } public boolean isPostDisconnect() { return !this.isPreDisconnect(); }
protected final String caller; private final String caller;
public String getCaller() { return this.caller; } public String getCaller() { return this.caller; }
public boolean isQuit() { return "quit".equals(caller); } public boolean isQuit() { return "quit".equals(caller); }
public boolean isKick() { return "kick".equals(caller); } public boolean isKick() { return "kick".equals(caller); }
protected final String message; private final String message;
public String getMessage() { return this.message; } public String getMessage() { return this.message; }
// -------------------------------------------- // // -------------------------------------------- //