From 218fd217740cf061a720c5cf3b021c49c4ce8102 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sat, 3 Aug 2013 16:08:16 -0400 Subject: [PATCH] Some cleanup. More to come. --- appinfo.properties | 6 +-- buildnumber.properties | 4 +- .../Commands/Command_purgeall.java | 2 +- .../Commands/Command_radar.java | 37 ++++++++++++++++- .../Commands/Command_tfupdate.java | 1 + .../Commands/Command_uall.java | 2 +- .../TFM_DisguiseCraftBridge.java | 31 +++++++++----- .../TotalFreedomMod/TFM_RadarData.java | 40 ------------------- 8 files changed, 66 insertions(+), 57 deletions(-) delete mode 100644 src/me/StevenLawson/TotalFreedomMod/TFM_RadarData.java diff --git a/appinfo.properties b/appinfo.properties index c6ddfc3b..fd5a0e01 100644 --- a/appinfo.properties +++ b/appinfo.properties @@ -1,6 +1,6 @@ -#Mon, 29 Jul 2013 20:32:38 -0400 +#Sat, 03 Aug 2013 14:59:27 -0400 program.VERSION=2.21 -program.BUILDNUM=370 -program.BUILDDATE=07/29/2013 08\:32 PM +program.BUILDNUM=375 +program.BUILDDATE=08/03/2013 02\:59 PM diff --git a/buildnumber.properties b/buildnumber.properties index e5310d12..6fc46c45 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon Jul 29 20:32:38 EDT 2013 -build.number=371 +#Sat Aug 03 14:59:27 EDT 2013 +build.number=376 diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_purgeall.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_purgeall.java index ff0ed949..dbf31568 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_purgeall.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_purgeall.java @@ -22,7 +22,7 @@ public class Command_purgeall extends TFM_Command TFM_Util.wipeEntities(true, true); // Undisguise all players - TFM_DisguiseCraftBridge.getInstance().undisguiseAllPlayers(); + TFM_DisguiseCraftBridge.undisguiseAllPlayers(); for (Player p : server.getOnlinePlayers()) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_radar.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_radar.java index 3bc540ff..a2bc5053 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_radar.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_radar.java @@ -2,8 +2,8 @@ package me.StevenLawson.TotalFreedomMod.Commands; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.List; -import me.StevenLawson.TotalFreedomMod.TFM_RadarData; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.command.Command; @@ -71,4 +71,39 @@ public class Command_radar extends TFM_Command return true; } + + private class TFM_RadarData implements Comparator + { + public Player player; + public double distance; + public Location location; + + public TFM_RadarData(Player player, double distance, Location location) + { + this.player = player; + this.distance = distance; + this.location = location; + } + + public TFM_RadarData() + { + } + + @Override + public int compare(TFM_RadarData t1, TFM_RadarData t2) + { + if (t1.distance > t2.distance) + { + return 1; + } + else if (t1.distance < t2.distance) + { + return -1; + } + else + { + return 0; + } + } + } } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_tfupdate.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_tfupdate.java index c03619eb..ba68554a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_tfupdate.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_tfupdate.java @@ -17,6 +17,7 @@ public class Command_tfupdate extends TFM_Command { "http://s3.madgeekonline.com/totalfreedom/BukkitHttpd.jar", "http://s3.madgeekonline.com/totalfreedom/BukkitTelnet.jar", + "http://s3.madgeekonline.com/totalfreedom/DisguiseCraft.jar", "http://s3.madgeekonline.com/totalfreedom/Essentials.jar", "http://s3.madgeekonline.com/totalfreedom/EssentialsSpawn.jar", "http://s3.madgeekonline.com/totalfreedom/TotalFreedomMod.jar", diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_uall.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_uall.java index d6a3a757..c2716959 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_uall.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_uall.java @@ -15,7 +15,7 @@ public class Command_uall extends TFM_Command { TFM_Util.adminAction(sender.getName(), "Undisguising all players", true); - TFM_DisguiseCraftBridge.getInstance().undisguiseAllPlayers(); + TFM_DisguiseCraftBridge.undisguiseAllPlayers(); return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_DisguiseCraftBridge.java b/src/me/StevenLawson/TotalFreedomMod/TFM_DisguiseCraftBridge.java index f0cbb8b3..f114985d 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_DisguiseCraftBridge.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_DisguiseCraftBridge.java @@ -11,8 +11,13 @@ public class TFM_DisguiseCraftBridge { } - public boolean undisguisePlayer(Player player) + public static boolean undisguisePlayer(Player player) { + if (!disguiseCraftEnabled()) + { + return false; + } + try { DisguiseCraftAPI api = DisguiseCraft.getAPI(); @@ -29,8 +34,13 @@ public class TFM_DisguiseCraftBridge return false; } - public void undisguiseAllPlayers() + public static void undisguiseAllPlayers() { + if (!disguiseCraftEnabled()) + { + return; + } + try { DisguiseCraftAPI api = DisguiseCraft.getAPI(); @@ -49,13 +59,16 @@ public class TFM_DisguiseCraftBridge } } - public static TFM_DisguiseCraftBridge getInstance() + public static boolean disguiseCraftEnabled() { - return TFM_DisguiseCraftBridgeHolder.INSTANCE; - } - - private static class TFM_DisguiseCraftBridgeHolder - { - private static final TFM_DisguiseCraftBridge INSTANCE = new TFM_DisguiseCraftBridge(); + boolean pluginEnabled = false; + try + { + pluginEnabled = Bukkit.getPluginManager().isPluginEnabled("DisguiseCraft"); + } + catch (Exception ex) + { + } + return pluginEnabled; } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_RadarData.java b/src/me/StevenLawson/TotalFreedomMod/TFM_RadarData.java deleted file mode 100644 index a07d24cf..00000000 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_RadarData.java +++ /dev/null @@ -1,40 +0,0 @@ -package me.StevenLawson.TotalFreedomMod; - -import java.util.Comparator; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -public class TFM_RadarData implements Comparator -{ - public Player player; - public double distance; - public Location location; - - public TFM_RadarData(Player player, double distance, Location location) - { - this.player = player; - this.distance = distance; - this.location = location; - } - - public TFM_RadarData() - { - } - - @Override - public int compare(TFM_RadarData t1, TFM_RadarData t2) - { - if (t1.distance > t2.distance) - { - return 1; - } - else if (t1.distance < t2.distance) - { - return -1; - } - else - { - return 0; - } - } -}