mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-04-19 00:33:02 +00:00
Lombok implementation removal. I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!! Thank you!!
101 lines
2.4 KiB
Java
101 lines
2.4 KiB
Java
package me.totalfreedom.totalfreedommod.bridge;
|
|
|
|
import me.libraryaddict.disguise.BlockedDisguises;
|
|
import me.libraryaddict.disguise.DisguiseAPI;
|
|
import me.libraryaddict.disguise.LibsDisguises;
|
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
public class LibsDisguisesBridge extends FreedomService
|
|
{
|
|
private LibsDisguises libsDisguisesPlugin = null;
|
|
|
|
@Override
|
|
public void onStart()
|
|
{
|
|
}
|
|
|
|
@Override
|
|
public void onStop()
|
|
{
|
|
}
|
|
|
|
public LibsDisguises getLibsDisguisesPlugin()
|
|
{
|
|
if (libsDisguisesPlugin == null)
|
|
{
|
|
try
|
|
{
|
|
final Plugin libsDisguises = server.getPluginManager().getPlugin("LibsDisguises");
|
|
if (libsDisguises != null)
|
|
{
|
|
if (libsDisguises instanceof LibsDisguises)
|
|
{
|
|
libsDisguisesPlugin = (LibsDisguises)libsDisguises;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
FLog.severe(ex);
|
|
}
|
|
}
|
|
|
|
return libsDisguisesPlugin;
|
|
}
|
|
|
|
public void undisguiseAll(boolean admin)
|
|
{
|
|
try
|
|
{
|
|
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
|
|
|
if (libsDisguises == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
for (Player player : server.getOnlinePlayers())
|
|
{
|
|
if (DisguiseAPI.isDisguised(player))
|
|
{
|
|
if (!admin && plugin.al.isAdmin(player))
|
|
{
|
|
continue;
|
|
}
|
|
DisguiseAPI.undisguiseToAll(player);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
FLog.severe(ex);
|
|
}
|
|
}
|
|
|
|
public boolean isDisguisesEnabled()
|
|
{
|
|
return !BlockedDisguises.disabled;
|
|
}
|
|
|
|
public void setDisguisesEnabled(boolean state)
|
|
{
|
|
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
|
|
|
if (libsDisguises == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
BlockedDisguises.disabled = !state;
|
|
}
|
|
|
|
public boolean isEnabled()
|
|
{
|
|
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
|
|
|
return libsDisguises != null;
|
|
}
|
|
} |