mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Create Command_dtoggle
This is a replacement for DisdFreedom dtoggle, something we had to add on CJFreedom shortly after we lost his plugin :)
This commit is contained in:
parent
c1d0c01524
commit
c69918d725
52
src/me/StevenLawson/TotalFreedomMod/Commands/Command_dtoggle
Normal file
52
src/me/StevenLawson/TotalFreedomMod/Commands/Command_dtoggle
Normal file
@ -0,0 +1,52 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "CJFreedom Version To Manage DisguiseCraft ~ Thanks Dartheh <3.", usage = "/<command>")
|
||||
public class Command_dtoggle extends TFM_Command
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean toggled = false;
|
||||
boolean enabled = true;
|
||||
for (Plugin p : TotalFreedomMod.server.getPluginManager().getPlugins())
|
||||
{
|
||||
if (p.getName().equalsIgnoreCase("DisguiseCraft"))
|
||||
{
|
||||
if (p.isEnabled())
|
||||
{
|
||||
p.getPluginLoader().disablePlugin(p);
|
||||
enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.getPluginLoader().enablePlugin(p);
|
||||
enabled = true;
|
||||
}
|
||||
toggled = true;
|
||||
}
|
||||
}
|
||||
if (toggled)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
TotalFreedomMod.server.broadcastMessage(ChatColor.RED + sender.getName() + " - Disabling DisguiseCraft");
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalFreedomMod.server.broadcastMessage(ChatColor.GREEN + sender.getName() + " - Enabling DisguiseCraft");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user