Some cleanup. More to come.

This commit is contained in:
Steven Lawson 2013-08-03 16:08:16 -04:00
parent 0901c02c7e
commit 218fd21774
8 changed files with 66 additions and 57 deletions

View File

@ -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

View File

@ -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

View File

@ -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())
{

View File

@ -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<TFM_RadarData>
{
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;
}
}
}
}

View File

@ -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",

View File

@ -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;
}

View File

@ -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;
boolean pluginEnabled = false;
try
{
pluginEnabled = Bukkit.getPluginManager().isPluginEnabled("DisguiseCraft");
}
private static class TFM_DisguiseCraftBridgeHolder
catch (Exception ex)
{
private static final TFM_DisguiseCraftBridge INSTANCE = new TFM_DisguiseCraftBridge();
}
return pluginEnabled;
}
}

View File

@ -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<TFM_RadarData>
{
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;
}
}
}