Added nighttime disable.

Code cleanup.
This commit is contained in:
Steven Lawson 2011-10-13 14:30:45 -04:00
parent 9d56c343d2
commit 47279beb4d
9 changed files with 118 additions and 156 deletions

View File

@ -21,6 +21,9 @@ freecam_trigger_count: 10
# Show all attempted commands in the log, will result in duplicate log messages: # Show all attempted commands in the log, will result in duplicate log messages:
preprocess_log: true preprocess_log: true
# Disable nighttime:
disable_night: true
# Superadmins: Users that can always log in and use the most powerful commands: # Superadmins: Users that can always log in and use the most powerful commands:
# When online-mode = false, only superadmin_ips will be used. # When online-mode = false, only superadmin_ips will be used.
superadmins: superadmins:

View File

@ -69,7 +69,7 @@ public class TFM_BlockListener extends BlockListener
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
p.getInventory().clear(); p.getInventory().clear();
plugin.tfm_broadcastMessage(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
playerdata.resetFreecamDestroyCount(); playerdata.resetFreecamDestroyCount();
@ -81,7 +81,7 @@ public class TFM_BlockListener extends BlockListener
playerdata.incrementBlockDestroyCount(); playerdata.incrementBlockDestroyCount();
if (playerdata.getBlockDestroyCount() > plugin.nukeMonitorCountBreak) if (playerdata.getBlockDestroyCount() > plugin.nukeMonitorCountBreak)
{ {
plugin.tfm_broadcastMessage(p.getName() + " is breaking blocks too fast!", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " is breaking blocks too fast!", ChatColor.RED);
p.setOp(false); p.setOp(false);
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
@ -119,7 +119,7 @@ public class TFM_BlockListener extends BlockListener
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
p.getInventory().clear(); p.getInventory().clear();
plugin.tfm_broadcastMessage(p.getName() + " has been flagged for possible freecam building.", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " has been flagged for possible freecam building.", ChatColor.RED);
playerdata.resetFreecamPlaceCount(); playerdata.resetFreecamPlaceCount();
@ -136,7 +136,7 @@ public class TFM_BlockListener extends BlockListener
{ {
log.info(String.format("%s placed lava @ %s", log.info(String.format("%s placed lava @ %s",
p.getName(), p.getName(),
plugin.formatLocation(event.getBlock().getLocation()))); TotalFreedomMod.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot()); p.getInventory().clear(p.getInventory().getHeldItemSlot());
} }
@ -158,7 +158,7 @@ public class TFM_BlockListener extends BlockListener
{ {
log.info(String.format("%s placed water @ %s", log.info(String.format("%s placed water @ %s",
p.getName(), p.getName(),
plugin.formatLocation(event.getBlock().getLocation()))); TotalFreedomMod.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot()); p.getInventory().clear(p.getInventory().getHeldItemSlot());
} }
@ -180,7 +180,7 @@ public class TFM_BlockListener extends BlockListener
{ {
log.info(String.format("%s placed fire @ %s", log.info(String.format("%s placed fire @ %s",
p.getName(), p.getName(),
plugin.formatLocation(event.getBlock().getLocation()))); TotalFreedomMod.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot()); p.getInventory().clear(p.getInventory().getHeldItemSlot());
} }
@ -202,7 +202,7 @@ public class TFM_BlockListener extends BlockListener
{ {
log.info(String.format("%s placed TNT @ %s", log.info(String.format("%s placed TNT @ %s",
p.getName(), p.getName(),
plugin.formatLocation(event.getBlock().getLocation()))); TotalFreedomMod.formatLocation(event.getBlock().getLocation())));
p.getInventory().clear(p.getInventory().getHeldItemSlot()); p.getInventory().clear(p.getInventory().getHeldItemSlot());
} }

View File

@ -38,12 +38,12 @@ public class TFM_Cmds_Admin implements CommandExecutor
if (sender instanceof Player) if (sender instanceof Player)
{ {
sender_p = (Player) sender; sender_p = (Player) sender;
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
else else
{ {
senderIsConsole = true; senderIsConsole = true;
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
if (cmd.getName().equalsIgnoreCase("fr")) if (cmd.getName().equalsIgnoreCase("fr"))
@ -58,13 +58,13 @@ public class TFM_Cmds_Admin implements CommandExecutor
{ {
plugin.allPlayersFrozen = true; plugin.allPlayersFrozen = true;
sender.sendMessage("Players are now frozen."); sender.sendMessage("Players are now frozen.");
plugin.tfm_broadcastMessage(sender.getName() + " has temporarily frozen everyone on the server.", ChatColor.AQUA); TotalFreedomMod.tfm_broadcastMessage(sender.getName() + " has temporarily frozen everyone on the server.", ChatColor.AQUA);
} }
else else
{ {
plugin.allPlayersFrozen = false; plugin.allPlayersFrozen = false;
sender.sendMessage("Players are now free to move."); sender.sendMessage("Players are now free to move.");
plugin.tfm_broadcastMessage(sender.getName() + " has unfrozen everyone.", ChatColor.AQUA); TotalFreedomMod.tfm_broadcastMessage(sender.getName() + " has unfrozen everyone.", ChatColor.AQUA);
} }
} }
else else
@ -125,7 +125,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
p = matches.get(0); p = matches.get(0);
} }
plugin.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
//Undo WorldEdits: //Undo WorldEdits:
Bukkit.getServer().dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName())); Bukkit.getServer().dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
@ -152,7 +152,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
//Ban IP Address: //Ban IP Address:
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim(); String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
plugin.tfm_broadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
Bukkit.banIP(user_ip); Bukkit.banIP(user_ip);
//Ban Username: //Ban Username:
@ -203,33 +203,33 @@ public class TFM_Cmds_Admin implements CommandExecutor
else if (mode.equals("nameban")) else if (mode.equals("nameban"))
{ {
Bukkit.getOfflinePlayer(p.getName()).setBanned(true); Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
plugin.tfm_broadcastMessage(String.format("Banning Name: %s.", p.getName()), ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(String.format("Banning Name: %s.", p.getName()), ChatColor.RED);
p.kickPlayer("Username banned by Administrator."); p.kickPlayer("Username banned by Administrator.");
} }
else if (mode.equals("ipban")) else if (mode.equals("ipban"))
{ {
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim(); String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
plugin.tfm_broadcastMessage(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED);
Bukkit.banIP(user_ip); Bukkit.banIP(user_ip);
p.kickPlayer("IP address banned by Administrator."); p.kickPlayer("IP address banned by Administrator.");
} }
else if (mode.equals("ban")) else if (mode.equals("ban"))
{ {
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim(); String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
plugin.tfm_broadcastMessage(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
Bukkit.banIP(user_ip); Bukkit.banIP(user_ip);
Bukkit.getOfflinePlayer(p.getName()).setBanned(true); Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
p.kickPlayer("IP and username banned by Administrator."); p.kickPlayer("IP and username banned by Administrator.");
} }
else if (mode.equals("op")) else if (mode.equals("op"))
{ {
plugin.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
p.setOp(false); p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
} }
else if (mode.equals("deop")) else if (mode.equals("deop"))
{ {
plugin.tfm_broadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
p.setOp(false); p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
} }
@ -280,7 +280,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
return true; return true;
} }
String base_command = plugin.implodeStringList(" ", Arrays.asList(args)); String base_command = TotalFreedomMod.implodeStringList(" ", Arrays.asList(args));
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
{ {
@ -391,7 +391,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem); p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
} }
plugin.tfm_broadcastMessage(output.toString()); TotalFreedomMod.tfm_broadcastMessage(output.toString());
} }
else else
{ {
@ -504,7 +504,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
//Send to jail "mgjail": //Send to jail "mgjail":
Bukkit.getServer().dispatchCommand(sender, String.format("tjail %s mgjail", p.getName())); Bukkit.getServer().dispatchCommand(sender, String.format("tjail %s mgjail", p.getName()));
plugin.tfm_broadcastMessage(p.getName() + " has been JAILED!", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " has been JAILED!", ChatColor.RED);
} }
else else
{ {
@ -556,7 +556,7 @@ public class TFM_Cmds_Admin implements CommandExecutor
outmessage_bldr.append(args[i]).append(" "); outmessage_bldr.append(args[i]).append(" ");
} }
plugin.tfm_broadcastMessage(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender_name, outmessage_bldr.toString().trim())); TotalFreedomMod.tfm_broadcastMessage(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender_name, outmessage_bldr.toString().trim()));
} }
else else
{ {
@ -630,13 +630,13 @@ public class TFM_Cmds_Admin implements CommandExecutor
playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner); playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner);
playerdata.regenerateHistory(); playerdata.regenerateHistory();
playerdata.clearHistory(); playerdata.clearHistory();
plugin.buildHistory(target_pos, 2, playerdata); TotalFreedomMod.buildHistory(target_pos, 2, playerdata);
plugin.generateCube(target_pos, 2, playerdata.getCageMaterial(0)); TotalFreedomMod.generateCube(target_pos, 2, playerdata.getCageMaterial(0));
plugin.generateCube(target_pos, 1, playerdata.getCageMaterial(1)); TotalFreedomMod.generateCube(target_pos, 1, playerdata.getCageMaterial(1));
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
plugin.tfm_broadcastMessage(sender.getName() + " caged " + p.getName() + "!", ChatColor.YELLOW); TotalFreedomMod.tfm_broadcastMessage(sender.getName() + " caged " + p.getName() + "!", ChatColor.YELLOW);
} }
else else
{ {

View File

@ -29,12 +29,12 @@ public class TFM_Cmds_AntiBlock implements CommandExecutor
if (sender instanceof Player) if (sender instanceof Player)
{ {
sender_p = (Player) sender; sender_p = (Player) sender;
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
else else
{ {
senderIsConsole = true; senderIsConsole = true;
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
if (cmd.getName().equalsIgnoreCase("explosives")) if (cmd.getName().equalsIgnoreCase("explosives"))

View File

@ -38,12 +38,12 @@ public class TFM_Cmds_General implements CommandExecutor
if (sender instanceof Player) if (sender instanceof Player)
{ {
sender_p = (Player) sender; sender_p = (Player) sender;
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
else else
{ {
senderIsConsole = true; senderIsConsole = true;
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
if (cmd.getName().equalsIgnoreCase("creative")) if (cmd.getName().equalsIgnoreCase("creative"))
@ -233,17 +233,17 @@ public class TFM_Cmds_General implements CommandExecutor
} }
else if (cmd.getName().equalsIgnoreCase("flatlands")) else if (cmd.getName().equalsIgnoreCase("flatlands"))
{ {
plugin.gotoWorld(sender, "flatlands"); TotalFreedomMod.gotoWorld(sender, "flatlands");
return true; return true;
} }
else if (cmd.getName().equalsIgnoreCase("skylands")) else if (cmd.getName().equalsIgnoreCase("skylands"))
{ {
plugin.gotoWorld(sender, "skylands"); TotalFreedomMod.gotoWorld(sender, "skylands");
return true; return true;
} }
else if (cmd.getName().equalsIgnoreCase("nether")) else if (cmd.getName().equalsIgnoreCase("nether"))
{ {
plugin.gotoWorld(sender, "nether"); TotalFreedomMod.gotoWorld(sender, "nether");
return true; return true;
} }
else if (cmd.getName().equalsIgnoreCase("banlist")) else if (cmd.getName().equalsIgnoreCase("banlist"))

View File

@ -31,12 +31,12 @@ public class TFM_Cmds_OP implements CommandExecutor
if (sender instanceof Player) if (sender instanceof Player)
{ {
sender_p = (Player) sender; sender_p = (Player) sender;
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
else else
{ {
senderIsConsole = true; senderIsConsole = true;
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
if (cmd.getName().equalsIgnoreCase("opme")) if (cmd.getName().equalsIgnoreCase("opme"))
@ -49,7 +49,7 @@ public class TFM_Cmds_OP implements CommandExecutor
{ {
if (plugin.isUserSuperadmin(sender)) if (plugin.isUserSuperadmin(sender))
{ {
plugin.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY);
sender.setOp(true); sender.setOp(true);
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP); sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
} }
@ -65,7 +65,7 @@ public class TFM_Cmds_OP implements CommandExecutor
{ {
if (plugin.isUserSuperadmin(sender) || senderIsConsole) if (plugin.isUserSuperadmin(sender) || senderIsConsole)
{ {
plugin.tfm_broadcastMessage(String.format("(%s: Opping everyone)", sender.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: Opping everyone)", sender.getName()), ChatColor.GRAY);
boolean doSetGamemode = false; boolean doSetGamemode = false;
GameMode targetGamemode = GameMode.CREATIVE; GameMode targetGamemode = GameMode.CREATIVE;
@ -105,7 +105,7 @@ public class TFM_Cmds_OP implements CommandExecutor
{ {
if (plugin.isUserSuperadmin(sender) || senderIsConsole) if (plugin.isUserSuperadmin(sender) || senderIsConsole)
{ {
plugin.tfm_broadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY);
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
{ {
@ -137,7 +137,7 @@ public class TFM_Cmds_OP implements CommandExecutor
{ {
matched_player = true; matched_player = true;
plugin.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
p.setOp(true); p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
} }
@ -167,7 +167,7 @@ public class TFM_Cmds_OP implements CommandExecutor
{ {
matched_player = true; matched_player = true;
plugin.tfm_broadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
p.setOp(false); p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
} }

View File

@ -30,12 +30,12 @@ public class TFM_Cmds_Override implements CommandExecutor
if (sender instanceof Player) if (sender instanceof Player)
{ {
sender_p = (Player) sender; sender_p = (Player) sender;
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
else else
{ {
senderIsConsole = true; senderIsConsole = true;
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args)))); log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TotalFreedomMod.implodeStringList(" ", Arrays.asList(args))));
} }
if (cmd.getName().equalsIgnoreCase("say")) if (cmd.getName().equalsIgnoreCase("say"))
@ -47,8 +47,8 @@ public class TFM_Cmds_Override implements CommandExecutor
if (senderIsConsole || sender.isOp()) if (senderIsConsole || sender.isOp())
{ {
String message = plugin.implodeStringList(" ", Arrays.asList(args)); String message = TotalFreedomMod.implodeStringList(" ", Arrays.asList(args));
plugin.tfm_broadcastMessage(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE); TotalFreedomMod.tfm_broadcastMessage(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
} }
else else
{ {
@ -61,7 +61,7 @@ public class TFM_Cmds_Override implements CommandExecutor
{ {
if (senderIsConsole || plugin.isUserSuperadmin(sender)) if (senderIsConsole || plugin.isUserSuperadmin(sender))
{ {
plugin.tfm_broadcastMessage("Server is going offline.", ChatColor.GRAY); TotalFreedomMod.tfm_broadcastMessage("Server is going offline.", ChatColor.GRAY);
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
{ {

View File

@ -105,9 +105,9 @@ class TFM_PlayerListener extends PlayerListener
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(0), playerdata.getCageMaterial(1)); playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(0), playerdata.getCageMaterial(1));
playerdata.regenerateHistory(); playerdata.regenerateHistory();
playerdata.clearHistory(); playerdata.clearHistory();
plugin.buildHistory(target_pos, 2, playerdata); TotalFreedomMod.buildHistory(target_pos, 2, playerdata);
plugin.generateCube(target_pos, 2, playerdata.getCageMaterial(0)); TotalFreedomMod.generateCube(target_pos, 2, playerdata.getCageMaterial(0));
plugin.generateCube(target_pos, 1, playerdata.getCageMaterial(1)); TotalFreedomMod.generateCube(target_pos, 1, playerdata.getCageMaterial(1));
} }
} }
} }
@ -127,7 +127,7 @@ class TFM_PlayerListener extends PlayerListener
{ {
p.setOp(false); p.setOp(false);
p.kickPlayer("No Spamming"); p.kickPlayer("No Spamming");
plugin.tfm_broadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED); TotalFreedomMod.tfm_broadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -170,67 +170,6 @@ class TFM_PlayerListener extends PlayerListener
block_command = true; block_command = true;
} }
} }
// else if (command.matches("^/zeus"))
// {
// block_command = true;
// }
// else if (command.matches("^/vulcan"))
// {
// block_command = true;
// }
// else if (command.matches("^/myballsareonfire"))
// {
// block_command = true;
// }
// else if (command.matches("^/mv\\s*c"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*delete"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*im"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*m"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*reload"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*remove"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
// else if (command.matches("^/mv\\s*unload"))
// {
// if (!plugin.isUserSuperadmin(player))
// {
// block_command = true;
// }
// }
if (block_command) if (block_command)
{ {

View File

@ -92,50 +92,18 @@ public class TotalFreedomMod extends JavaPlugin
{ {
plugin.wipeDropEntities(); plugin.wipeDropEntities();
} }
}
}
public void tfm_broadcastMessage(String message, ChatColor color) if (plugin.disableNight)
{
log.info(message);
for (Player p : Bukkit.getOnlinePlayers())
{
p.sendMessage(color + message);
}
}
public void tfm_broadcastMessage(String message)
{
log.info(ChatColor.stripColor(message));
for (Player p : Bukkit.getOnlinePlayers())
{
p.sendMessage(message);
}
}
public String implodeStringList(String glue, List<String> pieces)
{
StringBuilder output = new StringBuilder();
for (int i = 0; i < pieces.size(); i++)
{
if (i != 0)
{ {
output.append(glue); for (World world : Bukkit.getWorlds())
{
if (world.getTime() > 12000L)
{
TotalFreedomMod.setWorldTime(world, 1000L);
}
}
} }
output.append(pieces.get(i));
} }
return output.toString();
}
public String formatLocation(Location in_loc)
{
return String.format("%s: (%d, %d, %d)",
in_loc.getWorld().getName(),
Math.round(in_loc.getX()),
Math.round(in_loc.getY()),
Math.round(in_loc.getZ()));
} }
public boolean isUserSuperadmin(CommandSender user) public boolean isUserSuperadmin(CommandSender user)
@ -197,7 +165,50 @@ public class TotalFreedomMod extends JavaPlugin
return removed; return removed;
} }
public void gotoWorld(CommandSender sender, String targetworld) public static void tfm_broadcastMessage(String message, ChatColor color)
{
log.info(message);
for (Player p : Bukkit.getOnlinePlayers())
{
p.sendMessage(color + message);
}
}
public static void tfm_broadcastMessage(String message)
{
log.info(ChatColor.stripColor(message));
for (Player p : Bukkit.getOnlinePlayers())
{
p.sendMessage(message);
}
}
public static String implodeStringList(String glue, List<String> pieces)
{
StringBuilder output = new StringBuilder();
for (int i = 0; i < pieces.size(); i++)
{
if (i != 0)
{
output.append(glue);
}
output.append(pieces.get(i));
}
return output.toString();
}
public static String formatLocation(Location in_loc)
{
return String.format("%s: (%d, %d, %d)",
in_loc.getWorld().getName(),
Math.round(in_loc.getX()),
Math.round(in_loc.getY()),
Math.round(in_loc.getZ()));
}
public static void gotoWorld(CommandSender sender, String targetworld)
{ {
if (sender instanceof Player) if (sender instanceof Player)
{ {
@ -226,7 +237,7 @@ public class TotalFreedomMod extends JavaPlugin
} }
} }
public void buildHistory(Location location, int length, TFM_UserInfo playerdata) public static void buildHistory(Location location, int length, TFM_UserInfo playerdata)
{ {
Block center_block = location.getBlock(); Block center_block = location.getBlock();
for (int x_offset = -length; x_offset <= length; x_offset++) for (int x_offset = -length; x_offset <= length; x_offset++)
@ -242,7 +253,7 @@ public class TotalFreedomMod extends JavaPlugin
} }
} }
public void generateCube(Location location, int length, Material material) public static void generateCube(Location location, int length, Material material)
{ {
Block center_block = location.getBlock(); Block center_block = location.getBlock();
for (int x_offset = -length; x_offset <= length; x_offset++) for (int x_offset = -length; x_offset <= length; x_offset++)
@ -257,6 +268,13 @@ public class TotalFreedomMod extends JavaPlugin
} }
} }
public static void setWorldTime(World world, long ticks)
{
long time = world.getTime();
time -= time % 24000;
world.setTime(time + 24000 + ticks);
}
public boolean allowFirePlace = false; public boolean allowFirePlace = false;
public Boolean allowFireSpread = false; public Boolean allowFireSpread = false;
public Boolean allowLavaDamage = false; public Boolean allowLavaDamage = false;
@ -270,6 +288,7 @@ public class TotalFreedomMod extends JavaPlugin
public double nukeMonitorRange = 10.0D; public double nukeMonitorRange = 10.0D;
public int freecamTriggerCount = 10; public int freecamTriggerCount = 10;
public Boolean preprocessLogEnabled = true; public Boolean preprocessLogEnabled = true;
public Boolean disableNight = true;
public List<String> superadmins = new ArrayList<String>(); public List<String> superadmins = new ArrayList<String>();
public List<String> superadmin_ips = new ArrayList<String>(); public List<String> superadmin_ips = new ArrayList<String>();
@ -292,6 +311,7 @@ public class TotalFreedomMod extends JavaPlugin
nukeMonitorRange = config.getDouble("nuke_monitor_range", nukeMonitorRange); nukeMonitorRange = config.getDouble("nuke_monitor_range", nukeMonitorRange);
freecamTriggerCount = config.getInt("freecam_trigger_count", freecamTriggerCount); freecamTriggerCount = config.getInt("freecam_trigger_count", freecamTriggerCount);
preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled); preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);
disableNight = config.getBoolean("disable_night", disableNight);
superadmins = (List<String>) config.getList("superadmins", null); superadmins = (List<String>) config.getList("superadmins", null);
if (superadmins == null) if (superadmins == null)