2017-10-13 18:35:11 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
2018-07-31 07:01:29 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2017-10-13 18:35:11 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
2018-07-31 07:01:29 +00:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
2017-10-13 18:35:11 +00:00
|
|
|
|
2020-09-28 02:51:15 +00:00
|
|
|
@CommandPermissions(level = Rank.NEW_ADMIN, source = SourceType.BOTH)
|
2017-10-13 18:35:11 +00:00
|
|
|
@CommandParameters(description = "Blocks redstone on the server.", usage = "/<command>", aliases = "bre")
|
|
|
|
public class Command_blockredstone extends FreedomCommand
|
|
|
|
{
|
|
|
|
|
|
|
|
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
|
|
|
{
|
|
|
|
if (ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
|
|
|
{
|
|
|
|
ConfigEntry.ALLOW_REDSTONE.setBoolean(false);
|
2020-08-15 22:42:46 +00:00
|
|
|
FUtil.staffAction(sender.getName(), "Blocking all redstone", true);
|
2017-10-13 18:35:11 +00:00
|
|
|
new BukkitRunnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
|
|
|
{
|
2020-08-15 22:42:46 +00:00
|
|
|
FUtil.staffAction("TotalFreedom", "Unblocking all redstone", false);
|
2017-10-13 18:35:11 +00:00
|
|
|
ConfigEntry.ALLOW_REDSTONE.setBoolean(true);
|
|
|
|
}
|
|
|
|
}
|
2018-01-01 03:43:10 +00:00
|
|
|
}.runTaskLater(plugin, 6000L);
|
2017-10-13 18:35:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ConfigEntry.ALLOW_REDSTONE.setBoolean(true);
|
2020-08-15 22:42:46 +00:00
|
|
|
FUtil.staffAction(sender.getName(), "Unblocking all redstone", true);
|
2017-10-13 18:35:11 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|