*CLEANUP* - mcSelfListener.java & mcSpoutInputListener.java

This commit is contained in:
GJ 2012-03-11 01:19:19 -05:00
parent 4359dc764f
commit def65282dd
2 changed files with 55 additions and 46 deletions

View File

@ -9,13 +9,21 @@ import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
* Listener for listening to our own events, only really useful for catching errors
*/
public class mcSelfListener implements Listener {
/**
* Monitor internal XP gain events.
*
* @param event The event to watch
*/
@EventHandler
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
int xp = event.getXpGained();
if(xp < 0) {
try {
throw new Exception("Gained negative XP!");
} catch (Exception e) {
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}

View File

@ -11,34 +11,35 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutInputListener implements Listener
{
mcMMO plugin = null;
public class mcSpoutInputListener implements Listener {
private mcMMO plugin;
public mcSpoutInputListener(mcMMO pluginx)
{
plugin = pluginx;
public mcSpoutInputListener(mcMMO plugin) {
this.plugin = plugin;
}
/**
* Monitor Spout KeyPressed events.
*
* @param event The event to watch
*/
@EventHandler
public void onKeyPressedEvent(KeyPressedEvent event)
{
if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null)
return;
if(event.getScreenType() != ScreenType.GAME_SCREEN)
return;
public void onKeyPressedEvent(KeyPressedEvent event) {
SpoutPlayer sPlayer = event.getPlayer();
if(event.getKey() == SpoutStuff.keypress)
{
if(!SpoutStuff.playerScreens.containsKey(sPlayer))
{
if (!sPlayer.isSpoutCraftEnabled() || sPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
return;
}
if (event.getKey() == SpoutStuff.keypress) {
if (!SpoutStuff.playerScreens.containsKey(sPlayer)) {
PopupMMO mmoPop = new PopupMMO(sPlayer, Users.getProfile(sPlayer), plugin);
SpoutStuff.playerScreens.put(sPlayer, mmoPop);
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
sPlayer.getMainScreen().setDirty(true);
} else {
}
else {
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
sPlayer.getMainScreen().setDirty(true);
}