mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Spout support cleanup
This commit is contained in:
parent
fe17906047
commit
e380ef440b
@ -975,6 +975,14 @@ public class McMMOPlayer {
|
|||||||
profile.resetCooldowns();
|
profile.resetCooldowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public McMMOHud getSpoutHud() {
|
||||||
|
return profile.getSpoutHud();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpoutHud(McMMOHud spoutHud) {
|
||||||
|
profile.setSpoutHud(spoutHud);
|
||||||
|
}
|
||||||
|
|
||||||
public FixedMetadataValue getPlayerMetadata() {
|
public FixedMetadataValue getPlayerMetadata() {
|
||||||
return playerMetadata;
|
return playerMetadata;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class SpoutListener implements Listener {
|
|||||||
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", spoutPlayer.getTitle(), mcMMOPlayer.getPowerLevel()));
|
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", spoutPlayer.getTitle(), mcMMOPlayer.getPowerLevel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.getProfile().setSpoutHud(new McMMOHud(mcMMOPlayer)); // Setup Party HUD stuff
|
mcMMOPlayer.setSpoutHud(new McMMOHud(mcMMOPlayer)); // Setup Party HUD stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,7 +66,7 @@ public class SpoutListener implements Listener {
|
|||||||
if (event.getScreen() instanceof McMMOMenu) {
|
if (event.getScreen() instanceof McMMOMenu) {
|
||||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||||
|
|
||||||
UserManager.getPlayer(spoutPlayer).getProfile().getSpoutHud().onMenuClose();
|
UserManager.getPlayer(spoutPlayer).getSpoutHud().onMenuClose();
|
||||||
spoutPlayer.getMainScreen().setDirty(true);
|
spoutPlayer.getMainScreen().setDirty(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class SpoutListener implements Listener {
|
|||||||
* @param event The event to watch
|
* @param event The event to watch
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onKeyPressedEvent(KeyPressedEvent event) {
|
public void onKeyPressed(KeyPressedEvent event) {
|
||||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||||
|
|
||||||
if (spoutPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
|
if (spoutPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
|
||||||
@ -85,7 +85,7 @@ public class SpoutListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.getKey() == SpoutConfig.getInstance().getMenuKey()) {
|
if (event.getKey() == SpoutConfig.getInstance().getMenuKey()) {
|
||||||
McMMOHud spoutHud = UserManager.getPlayer(spoutPlayer).getProfile().getSpoutHud();
|
McMMOHud spoutHud = UserManager.getPlayer(spoutPlayer).getSpoutHud();
|
||||||
|
|
||||||
if (!spoutHud.isMenuOpened()) {
|
if (!spoutHud.isMenuOpened()) {
|
||||||
spoutHud.openMenu();
|
spoutHud.openMenu();
|
||||||
|
@ -129,7 +129,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getLogger().setFilter(new LogFilter(this));
|
getLogger().setFilter(new LogFilter(this));
|
||||||
metadataValue = new FixedMetadataValue(this, true);
|
metadataValue = new FixedMetadataValue(this, true);
|
||||||
|
|
||||||
setupSpout();
|
spoutEnabled = getServer().getPluginManager().getPlugin("Spout") != null;
|
||||||
mcpcEnabled = getServer().getName().equals("MCPC+");
|
mcpcEnabled = getServer().getName().equals("MCPC+");
|
||||||
combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null;
|
combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null;
|
||||||
healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null;
|
healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null;
|
||||||
@ -138,6 +138,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
setupFilePaths();
|
setupFilePaths();
|
||||||
|
|
||||||
|
if (spoutEnabled) {
|
||||||
|
setupSpout();
|
||||||
|
}
|
||||||
|
|
||||||
modManager = new ModManager();
|
modManager = new ModManager();
|
||||||
|
|
||||||
loadConfigFiles();
|
loadConfigFiles();
|
||||||
@ -445,12 +449,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpout() {
|
private void setupSpout() {
|
||||||
if (!getServer().getPluginManager().isPluginEnabled("Spout")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
spoutEnabled = true;
|
|
||||||
|
|
||||||
SpoutConfig.getInstance();
|
SpoutConfig.getInstance();
|
||||||
getServer().getPluginManager().registerEvents(new SpoutListener(), this);
|
getServer().getPluginManager().registerEvents(new SpoutListener(), this);
|
||||||
SpoutUtils.preCacheFiles();
|
SpoutUtils.preCacheFiles();
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
||||||
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -153,15 +152,12 @@ public final class Misc {
|
|||||||
|
|
||||||
public static void profileCleanup(String playerName) {
|
public static void profileCleanup(String playerName) {
|
||||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOHud spoutHud = UserManager.getPlayer(player).getSpoutHud();
|
||||||
McMMOHud spoutHud = mcMMOPlayer.getProfile().getSpoutHud();
|
|
||||||
|
|
||||||
if (spoutHud != null) {
|
if (spoutHud != null) {
|
||||||
spoutHud.removeWidgets();
|
spoutHud.removeWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserManager.remove(playerName);
|
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UserManager.remove(player);
|
UserManager.remove(player);
|
||||||
UserManager.addUser(player);
|
UserManager.addUser(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user