Move Spout events to new event system

This commit is contained in:
NuclearW 2012-02-01 06:36:15 -05:00
parent 3fcfde1697
commit 00d8ed9ec7
4 changed files with 17 additions and 11 deletions

View File

@ -16,7 +16,8 @@
*/ */
package com.gmail.nossr50.listeners; 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.event.input.KeyPressedEvent;
import org.getspout.spoutapi.gui.ScreenType; import org.getspout.spoutapi.gui.ScreenType;
import org.getspout.spoutapi.player.SpoutPlayer; 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.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutInputListener extends InputListener public class mcSpoutInputListener implements Listener
{ {
mcMMO plugin = null; mcMMO plugin = null;
@ -35,6 +36,7 @@ public class mcSpoutInputListener extends InputListener
plugin = pluginx; plugin = pluginx;
} }
@EventHandler
public void onKeyPressedEvent(KeyPressedEvent event) public void onKeyPressedEvent(KeyPressedEvent event)
{ {
if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null) if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null)

View File

@ -16,8 +16,9 @@
*/ */
package com.gmail.nossr50.listeners; 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.SpoutCraftEnableEvent;
import org.getspout.spoutapi.event.spout.SpoutListener;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
@ -25,7 +26,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutListener extends SpoutListener public class mcSpoutListener implements Listener
{ {
mcMMO plugin = null; mcMMO plugin = null;
@ -34,6 +35,7 @@ public class mcSpoutListener extends SpoutListener
plugin = pluginx; plugin = pluginx;
} }
@EventHandler
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
{ {
SpoutPlayer sPlayer = event.getPlayer(); SpoutPlayer sPlayer = event.getPlayer();

View File

@ -16,9 +16,10 @@
*/ */
package com.gmail.nossr50.listeners; 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.ButtonClickEvent;
import org.getspout.spoutapi.event.screen.ScreenCloseEvent; import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
import org.getspout.spoutapi.event.screen.ScreenListener;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users; 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.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutScreenListener extends ScreenListener public class mcSpoutScreenListener implements Listener
{ {
mcMMO plugin = null; mcMMO plugin = null;
public mcSpoutScreenListener(mcMMO pluginx) public mcSpoutScreenListener(mcMMO pluginx)
{ {
plugin = pluginx; plugin = pluginx;
} }
@EventHandler
public void onButtonClick(ButtonClickEvent event) public void onButtonClick(ButtonClickEvent event)
{ {
SpoutPlayer sPlayer = event.getPlayer(); SpoutPlayer sPlayer = event.getPlayer();
@ -83,6 +86,7 @@ public class mcSpoutScreenListener extends ScreenListener
} }
} }
@EventHandler
public void onScreenClose(ScreenCloseEvent event) public void onScreenClose(ScreenCloseEvent event)
{ {
if(event.getScreen() instanceof PopupMMO) if(event.getScreen() instanceof PopupMMO)

View File

@ -33,8 +33,6 @@ import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; 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.SpoutManager;
import org.getspout.spoutapi.gui.Color; import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.keyboard.Keyboard; import org.getspout.spoutapi.keyboard.Keyboard;
@ -209,9 +207,9 @@ public class SpoutStuff
} }
public static void registerCustomEvent() public static void registerCustomEvent()
{ {
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin); Bukkit.getServer().getPluginManager().registerEvents(spoutListener, plugin);
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutInputListener, Priority.Normal, plugin); Bukkit.getServer().getPluginManager().registerEvents(spoutInputListener, plugin);
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutScreenListener, Priority.Normal, plugin); Bukkit.getServer().getPluginManager().registerEvents(spoutScreenListener, plugin);
} }
public static Color getRetroColor(SkillType type) public static Color getRetroColor(SkillType type)