Even more bug fixes (#94)

- Clean up /commandlist
- /ov now displays proper unknown command message
- /toggle doesnt check for case
- Trailer will now check if CoreProtect is enabled before trying to log
- Temporarily disable master builder world restrictions, causing spam in console everytime a command is one
This commit is contained in:
Telesphoreo 2018-07-25 15:09:35 -07:00 committed by Seth
parent 0d0ad7d947
commit 25aa28194b
5 changed files with 24 additions and 25 deletions

View File

@ -176,7 +176,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
nu = services.registerService(AntiNuke.class);
as = services.registerService(AntiSpam.class);
mbl = services.registerService(MasterBuilderList.class);
mbwr = services.registerService(MasterBuilderWorldRestrictions.class);
//mbwr = services.registerService(MasterBuilderWorldRestrictions.class);
pl = services.registerService(PlayerList.class);
an = services.registerService(Announcer.class);

View File

@ -28,13 +28,13 @@ public class Command_commandlist extends FreedomCommand
try
{
PluginDescriptionFile desc = targetPlugin.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
Map<String, Map<String, Object>> map = desc.getCommands();
if (map != null)
{
for (Entry<String, Map<String, Object>> entry : map.entrySet())
{
String command_name = (String) entry.getKey();
String command_name = entry.getKey();
commands.add(command_name);
}
}
@ -46,7 +46,7 @@ public class Command_commandlist extends FreedomCommand
Collections.sort(commands);
sender.sendMessage(StringUtils.join(commands, ","));
sender.sendMessage(StringUtils.join(commands, ", "));
return true;
}

View File

@ -34,7 +34,7 @@ public class Command_ov extends FreedomCommand
}
catch (Exception ignored)
{
msg(ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
msg(ChatColor.WHITE + "Unknown command. Type \"/help\" for help.");
return true;
}
}

View File

@ -36,70 +36,70 @@ public class Command_toggle extends FreedomCommand
return false;
}
if (args[0].equals("waterplace"))
if (args[0].equalsIgnoreCase("waterplace"))
{
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
return true;
}
else if (args[0].equals("frostwalk"))
else if (args[0].equalsIgnoreCase("frostwalk"))
{
toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
return true;
}
else if (args[0].equals("fireplace"))
else if (args[0].equalsIgnoreCase("fireplace"))
{
toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
return true;
}
else if (args[0].equals("lavaplace"))
else if (args[0].equalsIgnoreCase("lavaplace"))
{
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
return true;
}
else if (args[0].equals("fluidspread"))
else if (args[0].equalsIgnoreCase("fluidspread"))
{
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
return true;
}
else if (args[0].equals("lavadmg"))
else if (args[0].equalsIgnoreCase("lavadmg"))
{
toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
return true;
}
else if (args[0].equals("firespread"))
else if (args[0].equalsIgnoreCase("firespread"))
{
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
return true;
}
else if (args[0].equals("prelog"))
else if (args[0].equalsIgnoreCase("prelog"))
{
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
return true;
}
else if (args[0].equals("lockdown"))
else if (args[0].equalsIgnoreCase("lockdown"))
{
boolean active = !plugin.lp.isLockdownEnabled();
plugin.lp.setLockdownEnabled(active);
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
return true;
}
else if (args[0].equals("petprotect"))
else if (args[0].equalsIgnoreCase("petprotect"))
{
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
return true;
}
else if (args[0].equals("entitywipe"))
else if (args[0].equalsIgnoreCase("entitywipe"))
{
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
return true;
}
else if (args[0].equals("firework"))
else if (args[0].equalsIgnoreCase("firework"))
{
toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
return true;
}
else if (args[0].equals("nonuke"))
else if (args[0].equalsIgnoreCase("nonuke"))
{
if (args.length >= 2)
{
@ -129,7 +129,7 @@ public class Command_toggle extends FreedomCommand
}
return true;
}
else if (args[0].equals("explosives"))
else if (args[0].equalsIgnoreCase("explosives"))
{
if (args.length == 2)
{

View File

@ -48,10 +48,10 @@ public class Trailer extends FreedomService
return;
}
if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()))
{
return;
}
//if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()))
//{
// return;
//}
Block fromBlock = event.getFrom().getBlock();
if (!fromBlock.isEmpty())
@ -65,7 +65,6 @@ public class Trailer extends FreedomService
return;
}
final Location location = fromBlock.getLocation();
fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size())));
byte data = DepreciationAggregator.getData_Block(fromBlock);
Material material = Material.getMaterial(String.valueOf(fromBlock.getType()));
@ -75,7 +74,7 @@ public class Trailer extends FreedomService
{
final Location trail_pos;
trail_pos = new Location(event.getPlayer().getWorld(), fromBlock.getX() + x, fromBlock.getY(), fromBlock.getZ() + z);
if (trailPlayers.contains(event.getPlayer().getName()))
if (trailPlayers.contains(event.getPlayer().getName()) && plugin.cpb.isEnabled())
{
plugin.cpb.getCoreProtectAPI().logPlacement(event.getPlayer().getName(), trail_pos, material, data);
}