mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 20:46:41 +00:00
More improvements. (#15)
* This is rediculous * Forgot some final and this * Fixed and improved skull caging * Windows wanted this yeah
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler;
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler.GameRule;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
@ -38,103 +37,129 @@ public class Command_toggle extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("waterplace")) {
|
||||
this.toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
if (args[0].equals("waterplace"))
|
||||
{
|
||||
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("frostwalk")) {
|
||||
this.toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
else if (args[0].equals("frostwalk"))
|
||||
{
|
||||
toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("fireplace")) {
|
||||
this.toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
else if (args[0].equals("fireplace"))
|
||||
{
|
||||
toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lavaplace")) {
|
||||
this.toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
else if (args[0].equals("lavaplace"))
|
||||
{
|
||||
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
/*if (args[0].equals("explosivearrows"))
|
||||
else if (args[0].equals("fluidspread"))
|
||||
{
|
||||
toggle("Explosive arrows are now", ConfigEntry.MAKE_ARROW_EXPLOSIVE);
|
||||
return true;
|
||||
}*/
|
||||
if (args[0].equals("fluidspread")) {
|
||||
this.toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lavadmg")) {
|
||||
this.toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
else if (args[0].equals("lavadmg"))
|
||||
{
|
||||
toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("firespread")) {
|
||||
this.toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
else if (args[0].equals("firespread"))
|
||||
{
|
||||
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
((TotalFreedomMod)this.plugin).gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("prelog")) {
|
||||
this.toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
else if (args[0].equals("prelog"))
|
||||
{
|
||||
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lockdown")) {
|
||||
final boolean active = !((TotalFreedomMod)this.plugin).lp.isLockdownEnabled();
|
||||
((TotalFreedomMod)this.plugin).lp.setLockdownEnabled(active);
|
||||
else if (args[0].equals("lockdown"))
|
||||
{
|
||||
boolean active = !plugin.lp.isLockdownEnabled();
|
||||
plugin.lp.setLockdownEnabled(active);
|
||||
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("petprotect")) {
|
||||
this.toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
else if (args[0].equals("petprotect"))
|
||||
{
|
||||
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("entitywipe")) {
|
||||
this.toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
else if (args[0].equals("entitywipe"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("firework")) {
|
||||
this.toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
else if (args[0].equals("firework"))
|
||||
{
|
||||
toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("nonuke")) {
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
else if (args[0].equals("nonuke"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex2) {}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (args.length >= 3) {
|
||||
try {
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
|
||||
}
|
||||
catch (NumberFormatException ex3) {}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
this.toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) {
|
||||
this.msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
this.msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("explosives")) {
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
else if (args[0].equals("explosives"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
this.msg(ex.getMessage());
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("The input provided is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) {
|
||||
this.msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void toggle(final String name, final ConfigEntry entry) {
|
||||
this.msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
private void toggle(final String name, final ConfigEntry entry)
|
||||
{
|
||||
msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user