From 22723d883aa83f7023b122333c3e649201c701e5 Mon Sep 17 00:00:00 2001 From: garbagemule Date: Thu, 15 Aug 2013 15:12:37 +0200 Subject: [PATCH] Bye bye, Spout. --- resources/plugin.yml | 4 +- src/com/garbagemule/MobArena/ArenaImpl.java | 4 -- src/com/garbagemule/MobArena/Messenger.java | 48 ++----------------- src/com/garbagemule/MobArena/MobArena.java | 19 -------- .../listeners/SpoutScreenListener.java | 36 -------------- .../MobArena/spout/ClassButton.java | 12 ----- .../MobArena/spout/ClassPopup.java | 42 ---------------- .../garbagemule/MobArena/spout/Spouty.java | 27 ----------- 8 files changed, 5 insertions(+), 187 deletions(-) delete mode 100644 src/com/garbagemule/MobArena/listeners/SpoutScreenListener.java delete mode 100644 src/com/garbagemule/MobArena/spout/ClassButton.java delete mode 100644 src/com/garbagemule/MobArena/spout/ClassPopup.java delete mode 100644 src/com/garbagemule/MobArena/spout/Spouty.java diff --git a/resources/plugin.yml b/resources/plugin.yml index dc0258f..b6230c1 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,8 +1,8 @@ name: MobArena author: garbagemule main: com.garbagemule.MobArena.MobArena -version: 0.95.5.17 -softdepend: [Multiverse-Core,Spout,Towny,Heroes,MagicSpells,Vault] +version: 0.95.5.18 +softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] commands: ma: description: Base command for MobArena diff --git a/src/com/garbagemule/MobArena/ArenaImpl.java b/src/com/garbagemule/MobArena/ArenaImpl.java index ea35985..0b192a1 100644 --- a/src/com/garbagemule/MobArena/ArenaImpl.java +++ b/src/com/garbagemule/MobArena/ArenaImpl.java @@ -30,7 +30,6 @@ import com.garbagemule.MobArena.framework.Arena; import com.garbagemule.MobArena.leaderboards.Leaderboard; import com.garbagemule.MobArena.region.ArenaRegion; import com.garbagemule.MobArena.repairable.*; -import com.garbagemule.MobArena.spout.Spouty; import com.garbagemule.MobArena.time.Time; import com.garbagemule.MobArena.time.TimeStrategy; import com.garbagemule.MobArena.time.TimeStrategyLocked; @@ -593,9 +592,6 @@ public class ArenaImpl implements Arena arenaPlayerMap.put(p, new ArenaPlayer(p, this, plugin)); - if (MobArena.hasSpout && settings.getBoolean("spout-class-select")) - Spouty.classSelectionScreen(plugin, this, p); - // Start the auto-start-timer autoStartTimer.start(); diff --git a/src/com/garbagemule/MobArena/Messenger.java b/src/com/garbagemule/MobArena/Messenger.java index 9ea8a4e..c636747 100644 --- a/src/com/garbagemule/MobArena/Messenger.java +++ b/src/com/garbagemule/MobArena/Messenger.java @@ -8,8 +8,6 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.getspout.spoutapi.SpoutManager; -import org.getspout.spoutapi.player.SpoutPlayer; import com.garbagemule.MobArena.framework.Arena; @@ -20,43 +18,6 @@ public class Messenger private static final String prefix = "[MobArena] "; private Messenger() {} - - public static boolean tellSpoutPlayer(Player p, Msg msg, String s, Material logo) { - // Grab the SpoutPlayer. - SpoutPlayer sp = MobArena.hasSpout ? SpoutManager.getPlayer(p) : null; - - if (msg.hasSpoutMsg() && sp != null && sp.isSpoutCraftEnabled()) { - // Grab the message text. - String text = msg.toSpoutString(s); - - // If more than 26 characters, truncate. - if (text.length() > 26) - text = text.substring(0, 26); - - // If the logo is null, use an iron sword. - if (logo == null) - logo = msg.getLogo(); - - // Send the notification. - sp.sendNotification("MobArena", text, logo, (short) 0, 2000); - return true; - } - else { - return tellPlayer(p, msg.toString(s)); - } - } - - public static boolean tellSpoutPlayer(Player p, Msg msg, Material logo) { - return tellSpoutPlayer(p, msg, null, logo); - } - - public static boolean tellSpoutPlayer(Player p, Msg msg, String s) { - return tellSpoutPlayer(p, msg, s, null); - } - - public static boolean tellSpoutPlayer(Player p, Msg msg) { - return tellSpoutPlayer(p, msg, null, null); - } public static boolean tellPlayer(CommandSender p, String msg) { // If the input sender is null or the string is empty, return. @@ -69,22 +30,19 @@ public class Messenger } public static boolean tellPlayer(CommandSender p, Msg msg, String s, boolean spout, Material logo) { - if (spout && p instanceof Player) - return tellSpoutPlayer((Player) p, msg, s, logo); - return tellPlayer(p, msg.toString(s)); } public static boolean tellPlayer(CommandSender p, Msg msg, String s, Material logo) { - return tellPlayer(p, msg, s, MobArena.hasSpout, logo); + return tellPlayer(p, msg.toString(s)); } public static boolean tellPlayer(CommandSender p, Msg msg, String s) { - return tellPlayer(p, msg, s, MobArena.hasSpout, null); + return tellPlayer(p, msg.toString(s)); } public static boolean tellPlayer(CommandSender p, Msg msg) { - return tellPlayer(p, msg, null, MobArena.hasSpout, null); + return tellPlayer(p, msg.toString()); } public static void tellAll(Arena arena, Msg msg, String s, boolean notifyPlayers) { diff --git a/src/com/garbagemule/MobArena/MobArena.java b/src/com/garbagemule/MobArena/MobArena.java index 7abb8ba..fdcb6b0 100644 --- a/src/com/garbagemule/MobArena/MobArena.java +++ b/src/com/garbagemule/MobArena/MobArena.java @@ -27,7 +27,6 @@ import com.garbagemule.MobArena.health.HealthStrategyHeroes; import com.garbagemule.MobArena.health.HealthStrategyStandard; import com.garbagemule.MobArena.listeners.MAGlobalListener; import com.garbagemule.MobArena.listeners.MagicSpellsListener; -import com.garbagemule.MobArena.listeners.SpoutScreenListener; import com.garbagemule.MobArena.metrics.Metrics; import com.garbagemule.MobArena.util.VersionChecker; import com.garbagemule.MobArena.util.config.ConfigUtils; @@ -53,9 +52,6 @@ public class MobArena extends JavaPlugin // Vault private Economy economy; - // Spout stuff - public static boolean hasSpout; - public static final double MIN_PLAYER_DISTANCE_SQUARED = 225D; public static final int ECONOMY_MONEY_ID = -29; public static Random random = new Random(); @@ -70,7 +66,6 @@ public class MobArena extends JavaPlugin // Set up soft dependencies setupVault(); setupHeroes(); - setupSpout(); setupMagicSpells(); setupStrategies(); @@ -100,9 +95,6 @@ public class MobArena extends JavaPlugin } public void onDisable() { - // Disable Spout features. - hasSpout = false; - // Force all arenas to end. if (arenaMaster == null) return; for (Arena arena : arenaMaster.getArenas()) { @@ -130,10 +122,6 @@ public class MobArena extends JavaPlugin PluginManager pm = this.getServer().getPluginManager(); pm.registerEvents(new MAGlobalListener(this, arenaMaster), this); - - if (hasSpout) { - pm.registerEvents(new SpoutScreenListener(this), this); - } } // Permissions stuff @@ -172,13 +160,6 @@ public class MobArena extends JavaPlugin hasHeroes = true; } - private void setupSpout() { - Plugin spoutPlugin = this.getServer().getPluginManager().getPlugin("Spout"); - if (spoutPlugin == null) return; - - hasSpout = true; - } - private void setupMagicSpells() { Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells"); if (spells == null) return; diff --git a/src/com/garbagemule/MobArena/listeners/SpoutScreenListener.java b/src/com/garbagemule/MobArena/listeners/SpoutScreenListener.java deleted file mode 100644 index 458d596..0000000 --- a/src/com/garbagemule/MobArena/listeners/SpoutScreenListener.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.garbagemule.MobArena.listeners; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.getspout.spoutapi.event.screen.ButtonClickEvent; -import org.getspout.spoutapi.gui.Button; - -import com.garbagemule.MobArena.framework.Arena; -import com.garbagemule.MobArena.spout.ClassButton; -import com.garbagemule.MobArena.MobArena; - -public class SpoutScreenListener implements Listener -{ - private MobArena plugin; - - public SpoutScreenListener(MobArena plugin) - { - this.plugin = plugin; - } - - @EventHandler(priority = EventPriority.NORMAL) - public void onButtonClick(ButtonClickEvent event) - { - Button b = event.getButton(); - if (!(b instanceof ClassButton)) return; - - Player p = event.getPlayer(); - Arena arena = plugin.getArenaMaster().getArenaWithPlayer(p); - if (arena == null) return; - - arena.assignClass(p, b.getText()); - event.getPlayer().getMainScreen().closePopup(); - } -} diff --git a/src/com/garbagemule/MobArena/spout/ClassButton.java b/src/com/garbagemule/MobArena/spout/ClassButton.java deleted file mode 100644 index 432183e..0000000 --- a/src/com/garbagemule/MobArena/spout/ClassButton.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.garbagemule.MobArena.spout; - -import org.getspout.spoutapi.gui.GenericButton; - -public class ClassButton extends GenericButton -{ - public ClassButton(String className) - { - this.setText(className); - this.setWidth(100).setHeight(20); - } -} diff --git a/src/com/garbagemule/MobArena/spout/ClassPopup.java b/src/com/garbagemule/MobArena/spout/ClassPopup.java deleted file mode 100644 index 6397ece..0000000 --- a/src/com/garbagemule/MobArena/spout/ClassPopup.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.garbagemule.MobArena.spout; - -import java.util.List; - -import org.getspout.spoutapi.gui.GenericLabel; -import org.getspout.spoutapi.gui.GenericPopup; -import org.getspout.spoutapi.gui.WidgetAnchor; -import org.getspout.spoutapi.player.SpoutPlayer; - -import com.garbagemule.MobArena.MobArena; - -public class ClassPopup extends GenericPopup -{ - private GenericLabel arenaTitle = new GenericLabel(); - - public ClassPopup(MobArena plugin, SpoutPlayer sp, List buttons) - { - int screenWidth = sp.getMainScreen().getWidth(); - int screenHeight = sp.getMainScreen().getHeight(); - - int buttonAmount = buttons.size(); - int buttonsHeight = buttonAmount * 20; - int buttonsX = (screenWidth - 100) / 2; - int buttonsY = (screenHeight - buttonsHeight) / 2 + 20; - - // Apparently Spout complains if these aren't set - arenaTitle.setWidth(30); - arenaTitle.setHeight(10); - - arenaTitle.setText("Choose your class!"); - arenaTitle.setAlign(WidgetAnchor.CENTER_CENTER); - arenaTitle.setX((screenWidth - arenaTitle.getWidth()) / 2).setY(buttonsY - 20); - this.attachWidget(plugin, arenaTitle); - - for (int i = 0; i < buttons.size(); i++) - { - ClassButton b = buttons.get(i); - b.setX(buttonsX).setY(buttonsY + i*20); - this.attachWidget(plugin, b); - } - } -} diff --git a/src/com/garbagemule/MobArena/spout/Spouty.java b/src/com/garbagemule/MobArena/spout/Spouty.java deleted file mode 100644 index 7d12bc2..0000000 --- a/src/com/garbagemule/MobArena/spout/Spouty.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.garbagemule.MobArena.spout; - -import java.util.LinkedList; -import java.util.List; - -import org.bukkit.entity.Player; -import org.getspout.spoutapi.SpoutManager; -import org.getspout.spoutapi.player.SpoutPlayer; - -import com.garbagemule.MobArena.MobArena; -import com.garbagemule.MobArena.framework.Arena; - -public class Spouty -{ - public static void classSelectionScreen(MobArena plugin, Arena arena, Player p) - { - SpoutPlayer sp = SpoutManager.getPlayer(p); - if (sp == null) return; - - List buttons = new LinkedList(); - for (String s : arena.getClasses().keySet()) - buttons.add(new ClassButton(s)); - - ClassPopup popup = new ClassPopup(plugin, sp, buttons); - sp.getMainScreen().attachPopupScreen(popup); - } -}