mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 13:46:46 +01:00
More cleanup.
This commit is contained in:
parent
3d275a4f53
commit
95fa688306
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.spout;
|
package com.gmail.nossr50.spout;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.getspout.spoutapi.event.input.KeyPressedEvent;
|
import org.getspout.spoutapi.event.input.KeyPressedEvent;
|
||||||
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
|
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
|
||||||
@ -19,19 +20,20 @@ import com.gmail.nossr50.spout.popups.Menu;
|
|||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class SpoutListener implements Listener {
|
public class SpoutListener implements Listener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor SpoutCraftEnable events.
|
* Monitor SpoutCraftEnable events.
|
||||||
*
|
*
|
||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
|
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
|
||||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(spoutPlayer);
|
McMMOPlayer mcMMOPlayer = Users.getPlayer(spoutPlayer);
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
//TODO: Add custom titles based on skills
|
//TODO: Add custom titles based on skills
|
||||||
if (SpoutConfig.getInstance().getShowPowerLevel()) {
|
if (SpoutStuff.showPowerLevel) {
|
||||||
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", new Object[] {spoutPlayer.getName(), mcMMOPlayer.getPowerLevel()}));
|
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", new Object[] {spoutPlayer.getName(), mcMMOPlayer.getPowerLevel()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ public class SpoutListener implements Listener {
|
|||||||
*
|
*
|
||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onButtonClick(ButtonClickEvent event) {
|
public void onButtonClick(ButtonClickEvent event) {
|
||||||
Button button = event.getButton();
|
Button button = event.getButton();
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ public class SpoutListener implements Listener {
|
|||||||
*
|
*
|
||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onScreenClose(ScreenCloseEvent event) {
|
public void onScreenClose(ScreenCloseEvent event) {
|
||||||
if (event.getScreen() instanceof Menu) {
|
if (event.getScreen() instanceof Menu) {
|
||||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||||
@ -72,7 +74,7 @@ public class SpoutListener implements Listener {
|
|||||||
*
|
*
|
||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onKeyPressedEvent(KeyPressedEvent event) {
|
public void onKeyPressedEvent(KeyPressedEvent event) {
|
||||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||||
|
|
||||||
@ -80,7 +82,7 @@ public class SpoutListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getKey() == SpoutStuff.keypress) {
|
if (event.getKey() == SpoutStuff.menuKey) {
|
||||||
SpoutHud spoutHud = Users.getProfile(spoutPlayer).getSpoutHud();
|
SpoutHud spoutHud = Users.getProfile(spoutPlayer).getSpoutHud();
|
||||||
|
|
||||||
if (!spoutHud.isMenuOpened()) {
|
if (!spoutHud.isMenuOpened()) {
|
||||||
|
@ -37,8 +37,10 @@ public class SpoutStuff {
|
|||||||
public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
|
public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
|
||||||
public final static String soundDirectory = spoutDirectory + "Sound" + File.separator;
|
public final static String soundDirectory = spoutDirectory + "Sound" + File.separator;
|
||||||
|
|
||||||
|
public static boolean showPowerLevel = SpoutConfig.getInstance().getShowPowerLevel();
|
||||||
|
|
||||||
private final static SpoutListener spoutListener = new SpoutListener();
|
private final static SpoutListener spoutListener = new SpoutListener();
|
||||||
public static Keyboard keypress;
|
public static Keyboard menuKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write file to disk.
|
* Write file to disk.
|
||||||
@ -163,13 +165,13 @@ public class SpoutStuff {
|
|||||||
|
|
||||||
for (Keyboard x : Keyboard.values()) {
|
for (Keyboard x : Keyboard.values()) {
|
||||||
if (x.toString().equalsIgnoreCase(temp)) {
|
if (x.toString().equalsIgnoreCase(temp)) {
|
||||||
keypress = x;
|
menuKey = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keypress == null) {
|
if (menuKey == null) {
|
||||||
System.out.println("Invalid KEY for Menu.Key, using KEY_M");
|
System.out.println("Invalid KEY for Menu.Key, using KEY_M");
|
||||||
keypress = Keyboard.KEY_M;
|
menuKey = Keyboard.KEY_M;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user