mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Fixed /dtoggle
Apparantly LibsDisguises does not support plugin reloading. Now switched back to OxLemonxO's method, using a modified LibsDisguises method
This commit is contained in:
parent
cadf4e4fc7
commit
2008871658
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.bridge;
|
package me.totalfreedom.totalfreedommod.bridge;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.DisallowedDisguises;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
@ -49,6 +50,7 @@ public class LibsDisguisesBridge extends FreedomService
|
|||||||
FLog.severe(ex);
|
FLog.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return libsDisguisesPlugin;
|
return libsDisguisesPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,25 +100,28 @@ public class LibsDisguisesBridge extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setPluginEnabled(boolean enabled)
|
public void setDisguisesEnabled(boolean state)
|
||||||
{
|
{
|
||||||
Plugin ld = getLibsDisguisesPlugin();
|
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
||||||
|
|
||||||
if (ld == null)
|
if (libsDisguises == null)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enabled)
|
if (state)
|
||||||
{
|
{
|
||||||
server.getPluginManager().enablePlugin(ld);
|
DisguiseAPI.enableDisguises();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server.getPluginManager().disablePlugin(ld);
|
DisguiseAPI.disableDisguises();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
public boolean isDisguisesEnabled()
|
||||||
|
{
|
||||||
|
return !DisallowedDisguises.disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPluginEnabled()
|
public boolean isPluginEnabled()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.DisallowedDisguises;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -15,22 +16,25 @@ public class Command_disguisetoggle extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (plugin.ldb.getLibsDisguisesPlugin() == null)
|
if (!plugin.ldb.isPluginEnabled())
|
||||||
{
|
{
|
||||||
msg(ChatColor.RED + "LibsDisguises is not enabled.");
|
msg(ChatColor.RED + "LibsDisguises is not enabled.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newState = !plugin.ldb.isPluginEnabled();
|
FUtil.adminAction(sender.getName(), (DisallowedDisguises.disabled ? "Enabling" : "Disabling") + " Disguises", false);
|
||||||
FUtil.adminAction(sender.getName(), (newState ? "Enabling" : "Disabling") + " disguises", false);
|
|
||||||
|
|
||||||
if (!newState)
|
if (plugin.ldb.isDisguisesEnabled())
|
||||||
{
|
{
|
||||||
plugin.ldb.undisguiseAll(true);
|
plugin.ldb.undisguiseAll(true);
|
||||||
|
plugin.ldb.setDisguisesEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plugin.ldb.setDisguisesEnabled(true);
|
||||||
}
|
}
|
||||||
plugin.ldb.setPluginEnabled(newState);
|
|
||||||
|
|
||||||
msg("Disguises are now " + (newState ? "enabled." : "disabled."));
|
msg("Enabled " + (DisallowedDisguises.disabled ? "enabled." : "disabled."));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
public enum SourceType
|
public enum SourceType {
|
||||||
{
|
|
||||||
|
|
||||||
ONLY_IN_GAME, ONLY_CONSOLE, BOTH;
|
ONLY_IN_GAME, ONLY_CONSOLE, BOTH;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user