From 00d8ed9ec7c76432e3099cfe8524540baa89a20a Mon Sep 17 00:00:00 2001 From: NuclearW Date: Wed, 1 Feb 2012 06:36:15 -0500 Subject: [PATCH] Move Spout events to new event system --- .../com/gmail/nossr50/listeners/mcSpoutInputListener.java | 6 ++++-- .../java/com/gmail/nossr50/listeners/mcSpoutListener.java | 6 ++++-- .../gmail/nossr50/listeners/mcSpoutScreenListener.java | 8 ++++++-- src/main/java/com/gmail/nossr50/spout/SpoutStuff.java | 8 +++----- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcSpoutInputListener.java b/src/main/java/com/gmail/nossr50/listeners/mcSpoutInputListener.java index 0d1e7c9c7..03cdb8ec2 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcSpoutInputListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcSpoutInputListener.java @@ -16,7 +16,8 @@ */ package com.gmail.nossr50.listeners; -import org.getspout.spoutapi.event.input.InputListener; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.getspout.spoutapi.event.input.KeyPressedEvent; import org.getspout.spoutapi.gui.ScreenType; import org.getspout.spoutapi.player.SpoutPlayer; @@ -26,7 +27,7 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.spout.SpoutStuff; -public class mcSpoutInputListener extends InputListener +public class mcSpoutInputListener implements Listener { mcMMO plugin = null; @@ -35,6 +36,7 @@ public class mcSpoutInputListener extends InputListener plugin = pluginx; } + @EventHandler public void onKeyPressedEvent(KeyPressedEvent event) { if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java b/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java index fc79ff7a2..96619d535 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java @@ -16,8 +16,9 @@ */ package com.gmail.nossr50.listeners; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent; -import org.getspout.spoutapi.event.spout.SpoutListener; import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; @@ -25,7 +26,7 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.spout.SpoutStuff; -public class mcSpoutListener extends SpoutListener +public class mcSpoutListener implements Listener { mcMMO plugin = null; @@ -34,6 +35,7 @@ public class mcSpoutListener extends SpoutListener plugin = pluginx; } + @EventHandler public void onSpoutCraftEnable(SpoutCraftEnableEvent event) { SpoutPlayer sPlayer = event.getPlayer(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcSpoutScreenListener.java b/src/main/java/com/gmail/nossr50/listeners/mcSpoutScreenListener.java index 86df87ccd..b27262809 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcSpoutScreenListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcSpoutScreenListener.java @@ -16,9 +16,10 @@ */ package com.gmail.nossr50.listeners; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.getspout.spoutapi.event.screen.ButtonClickEvent; import org.getspout.spoutapi.event.screen.ScreenCloseEvent; -import org.getspout.spoutapi.event.screen.ScreenListener; import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; @@ -32,13 +33,15 @@ import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle; import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.spout.SpoutStuff; -public class mcSpoutScreenListener extends ScreenListener +public class mcSpoutScreenListener implements Listener { mcMMO plugin = null; public mcSpoutScreenListener(mcMMO pluginx) { plugin = pluginx; } + + @EventHandler public void onButtonClick(ButtonClickEvent event) { SpoutPlayer sPlayer = event.getPlayer(); @@ -83,6 +86,7 @@ public class mcSpoutScreenListener extends ScreenListener } } + @EventHandler public void onScreenClose(ScreenCloseEvent event) { if(event.getScreen() instanceof PopupMMO) diff --git a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java index b82c81843..7898eb676 100644 --- a/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java +++ b/src/main/java/com/gmail/nossr50/spout/SpoutStuff.java @@ -33,8 +33,6 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.Event.Priority; import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.gui.Color; import org.getspout.spoutapi.keyboard.Keyboard; @@ -209,9 +207,9 @@ public class SpoutStuff } public static void registerCustomEvent() { - Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin); - Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutInputListener, Priority.Normal, plugin); - Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutScreenListener, Priority.Normal, plugin); + Bukkit.getServer().getPluginManager().registerEvents(spoutListener, plugin); + Bukkit.getServer().getPluginManager().registerEvents(spoutInputListener, plugin); + Bukkit.getServer().getPluginManager().registerEvents(spoutScreenListener, plugin); } public static Color getRetroColor(SkillType type)