summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-02-21 18:34:53 +0100
committersnowleo <schneeleo@gmail.com>2012-02-21 18:34:53 +0100
commit4da3f52164f118825ace616408b4ce13571cab63 (patch)
tree05b19c7261df84eaa8a6bda460af562bd72eb484 /EssentialsUpdate
parentcae3c5a03e2a3306c09132e277b2ea010ec8385b (diff)
parentcf7da7a83fef4d7734ed1ed5b672f2e07749b679 (diff)
downloadEssentials-4da3f52164f118825ace616408b4ce13571cab63.tar
Essentials-4da3f52164f118825ace616408b4ce13571cab63.tar.gz
Essentials-4da3f52164f118825ace616408b4ce13571cab63.tar.lz
Essentials-4da3f52164f118825ace616408b4ce13571cab63.tar.xz
Essentials-4da3f52164f118825ace616408b4ce13571cab63.zip
Merge branch 'refs/heads/master' into 3.0
Conflicts: .gitignore Essentials/src/com/earth2me/essentials/Essentials.java Essentials/src/com/earth2me/essentials/EssentialsTimer.java Essentials/src/com/earth2me/essentials/ISettings.java Essentials/src/com/earth2me/essentials/Jails.java Essentials/src/com/earth2me/essentials/OfflinePlayer.java Essentials/src/com/earth2me/essentials/Settings.java Essentials/src/com/earth2me/essentials/User.java Essentials/src/com/earth2me/essentials/UserData.java Essentials/src/com/earth2me/essentials/UserMap.java Essentials/src/com/earth2me/essentials/Util.java Essentials/src/com/earth2me/essentials/commands/Commandnear.java Essentials/src/com/earth2me/essentials/commands/Commandping.java Essentials/src/com/earth2me/essentials/commands/Commandspawner.java Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java Essentials/src/com/earth2me/essentials/commands/Commandwarp.java Essentials/src/messages_en.properties Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java EssentialsChat/src/plugin.yml EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
Diffstat (limited to 'EssentialsUpdate')
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java15
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java37
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java2
3 files changed, 20 insertions, 34 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
index 4ed1df602..7dd46451a 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
@@ -7,16 +7,15 @@ import java.util.Map;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
-public class EssentialsHelp extends PlayerListener
+public class EssentialsHelp implements Listener
{
private transient Player chatUser;
private final transient Server server;
@@ -39,8 +38,7 @@ public class EssentialsHelp extends PlayerListener
public void registerEvents()
{
final PluginManager pluginManager = server.getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Low, plugin);
+ pluginManager.registerEvents(this, plugin);
}
public void onCommand(final CommandSender sender)
@@ -155,18 +153,17 @@ public class EssentialsHelp extends PlayerListener
ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player));
}
- @Override
+ @EventHandler
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == chatUser)
{
final boolean success = sendChatMessage(event.getPlayer(), event.getMessage());
event.setCancelled(success);
- return;
}
}
- @Override
+ @EventHandler
public void onPlayerQuit(final PlayerQuitEvent event)
{
closeConnection();
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
index 1b26f1d32..9fa587f8f 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
@@ -7,18 +7,15 @@ import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.CustomEventListener;
-import org.bukkit.event.Event;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-public class UpdateProcess extends PlayerListener
+public class UpdateProcess implements Listener
{
private transient Player currentPlayer;
private final transient Plugin plugin;
@@ -34,21 +31,7 @@ public class UpdateProcess extends PlayerListener
public void registerEvents()
{
- final PluginManager pluginManager = plugin.getServer().getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Lowest, plugin);
- pluginManager.registerEvent(Type.PLAYER_JOIN, this, Priority.Normal, plugin);
- pluginManager.registerEvent(Type.CUSTOM_EVENT, new CustomEventListener()
- {
- @Override
- public void onCustomEvent(final Event event)
- {
- if (event instanceof InstallationFinishedEvent)
- {
- UpdateProcess.this.currentPlayer = null;
- }
- }
- }, Priority.Normal, plugin);
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public boolean selfUpdate()
@@ -110,7 +93,13 @@ public class UpdateProcess extends PlayerListener
return false;
}
- @Override
+ @EventHandler
+ public void onInstallationFinished(final InstallationFinishedEvent event)
+ {
+ UpdateProcess.this.currentPlayer = null;
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == currentPlayer)
@@ -130,7 +119,7 @@ public class UpdateProcess extends PlayerListener
}
}
- @Override
+ @EventHandler
public void onPlayerJoin(final PlayerJoinEvent event)
{
final Player player = event.getPlayer();
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
index 930a31bda..02b35c3d6 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
@@ -7,6 +7,6 @@ public class InstallationFinishedEvent extends Event
{
public InstallationFinishedEvent()
{
- super(Type.CUSTOM_EVENT);
+ super();
}
}