mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 11:06:14 +01:00
Bye bye, Spout.
This commit is contained in:
parent
a3ab2203be
commit
22723d883a
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<ClassButton> 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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<ClassButton> buttons = new LinkedList<ClassButton>();
|
||||
for (String s : arena.getClasses().keySet())
|
||||
buttons.add(new ClassButton(s));
|
||||
|
||||
ClassPopup popup = new ClassPopup(plugin, sp, buttons);
|
||||
sp.getMainScreen().attachPopupScreen(popup);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user