mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-05-29 07:11:18 +00:00
77 lines
1.7 KiB
Java
77 lines
1.7 KiB
Java
package me.StevenLawson.TotalFreedomMod.Bridge;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
|
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()
|
|
{
|
|
throw new AssertionError();
|
|
}
|
|
|
|
public static boolean undisguisePlayer(Player player)
|
|
{
|
|
if (!disguiseCraftEnabled())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
try
|
|
{
|
|
DisguiseCraftAPI api = DisguiseCraft.getAPI();
|
|
if (api != null)
|
|
{
|
|
return api.undisguisePlayer(player);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TFM_Log.severe(ex);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static void undisguiseAllPlayers()
|
|
{
|
|
if (!disguiseCraftEnabled())
|
|
{
|
|
return;
|
|
}
|
|
|
|
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 boolean disguiseCraftEnabled()
|
|
{
|
|
boolean pluginEnabled = false;
|
|
try
|
|
{
|
|
pluginEnabled = Bukkit.getPluginManager().isPluginEnabled("DisguiseCraft");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
return pluginEnabled;
|
|
}
|
|
}
|