mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Added DisguiseCraft API functionality.
This commit is contained in:
parent
5868540cbb
commit
c70e3ad8fd
@ -1,5 +1,5 @@
|
||||
#Fri, 05 Jul 2013 14:02:15 +0200
|
||||
#Sun, 07 Jul 2013 21:09:26 -0400
|
||||
|
||||
program.VERSION=2.21
|
||||
program.BUILDNUM=287
|
||||
program.BUILDDATE=07/05/2013 02\:02 PM
|
||||
program.BUILDNUM=289
|
||||
program.BUILDDATE=07/07/2013 09\:09 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Fri Jul 05 14:02:15 CEST 2013
|
||||
build.number=288
|
||||
#Sun Jul 07 21:09:26 EDT 2013
|
||||
build.number=290
|
||||
|
@ -33,7 +33,8 @@ jar.compress=false
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=\
|
||||
${libs.CraftBukkit.classpath}:\
|
||||
${libs.WorldEdit.classpath}
|
||||
${libs.WorldEdit.classpath}:\
|
||||
${libs.DisguiseCraft.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
|
||||
javac.deprecation=false
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
@ -29,8 +30,7 @@ public class Command_purgeall extends TFM_Command
|
||||
TFM_Util.wipeEntities(true, true);
|
||||
|
||||
// Undisguise all players
|
||||
server.dispatchCommand(sender, "u *");
|
||||
|
||||
TFM_DisguiseCraftBridge.getInstance().undisguiseAllPlayers();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_DisguiseCraftBridge;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,17 +15,7 @@ public class Command_uall extends TFM_Command
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Undisguising all players", true);
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
server.dispatchCommand(p, "u");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server.dispatchCommand(sender, "u *");
|
||||
}
|
||||
TFM_DisguiseCraftBridge.getInstance().undisguiseAllPlayers();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
|
||||
import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
|
||||
|
||||
public class TFM_DisguiseCraftBridge
|
||||
{
|
||||
private TFM_DisguiseCraftBridge()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean undisguisePlayer(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
DisguiseCraftAPI api = DisguiseCraft.getAPI();
|
||||
if (api != null)
|
||||
{
|
||||
return api.undisguisePlayer(player);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void undisguiseAllPlayers()
|
||||
{
|
||||
try
|
||||
{
|
||||
DisguiseCraftAPI api = DisguiseCraft.getAPI();
|
||||
if (api != null)
|
||||
{
|
||||
Player[] players = Bukkit.getOnlinePlayers();
|
||||
for (Player player : players)
|
||||
{
|
||||
api.undisguisePlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static TFM_DisguiseCraftBridge getInstance()
|
||||
{
|
||||
return TFM_DisguiseCraftBridgeHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class TFM_DisguiseCraftBridgeHolder
|
||||
{
|
||||
private static final TFM_DisguiseCraftBridge INSTANCE = new TFM_DisguiseCraftBridge();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user