Finished implementation of CommandPermissions and conversion of all commands.

This commit is contained in:
Steven Lawson 2012-11-23 20:22:52 -05:00
parent 13af6cb6a3
commit 9c05e8e2fb
72 changed files with 737 additions and 1183 deletions

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Random;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Material;
@ -10,12 +9,11 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_cake extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
StringBuilder output = new StringBuilder();
Random randomGenerator = new Random();
@ -33,11 +31,6 @@ public class Command_cake extends TFM_Command
}
TFM_Util.bcastMsg(output.toString());
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_cartsit extends TFM_Command
{
@Override

View File

@ -1,36 +1,18 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//This command was coded initially by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_clearall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
CommandSender cSender;
if (senderIsConsole)
{
cSender = server.getConsoleSender();
}
else
{
cSender = sender;
}
server.dispatchCommand(cSender, "rd"); // remove entities
server.dispatchCommand(cSender, "denick"); // remove nicks
server.dispatchCommand(cSender, "uall"); // undisguise all
server.dispatchCommand(sender, "rd");
server.dispatchCommand(sender, "denick");
server.dispatchCommand(sender, "uall");
return true;
}

View File

@ -5,13 +5,14 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_cmdlist extends TFM_Command
{
@Override
@ -42,7 +43,7 @@ public class Command_cmdlist extends TFM_Command
Collections.sort(commands);
sender.sendMessage(TFM_Util.implodeStringList(",", commands));
sender.sendMessage(StringUtils.join(commands, ","));
return true;
}

View File

@ -1,12 +1,12 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_creative extends TFM_Command
{
@Override
@ -21,12 +21,6 @@ public class Command_creative extends TFM_Command
}
}
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
Player p;
if (args.length == 0)
{

View File

@ -1,35 +1,21 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, ignore_permissions = false)
public class Command_csay extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
if (args.length > 0)
{
String sender_name = sender.getName();
sender_name = sender_name.split("-")[0];
StringBuilder outmessage_bldr = new StringBuilder();
for (int i = 0; i < args.length; i++)
{
outmessage_bldr.append(args[i]).append(" ");
TFM_Util.bcastMsg(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender.getName(), StringUtils.join(args, " ")));
}
TFM_Util.bcastMsg(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender_name, outmessage_bldr.toString().trim()));
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}
}

View File

@ -1,26 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//This command was coded initially by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_deop extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;

View File

@ -1,18 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_deopall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
@ -21,11 +19,6 @@ public class Command_deopall extends TFM_Command
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -2,24 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, ignore_permissions = false)
public class Command_doom extends TFM_Command
{
@Override
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(senderIsConsole && TFM_SuperadminList.isSeniorAdmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;

View File

@ -1,29 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_enchant extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
return true;
}
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length < 1)
{
return false;

View File

@ -5,6 +5,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_ender extends TFM_Command
{
@Override

View File

@ -1,23 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_expel extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
else if (TFM_SuperadminList.isUserSuperadmin(sender))
{
double radius = 50.0;
double strength = 100.0;
@ -68,11 +61,6 @@ public class Command_expel extends TFM_Command
}
}
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_explosives extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length == 0)
{
@ -39,11 +37,6 @@ public class Command_explosives extends TFM_Command
TotalFreedomMod.allowExplosions = false;
sender.sendMessage("Explosives are now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_fireplace extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_fireplace extends TFM_Command
TotalFreedomMod.allowFirePlace = false;
sender.sendMessage("Fire placement is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_firespread extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_firespread extends TFM_Command
TotalFreedomMod.allowFireSpread = false;
sender.sendMessage("Fire spread is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_flatlands extends TFM_Command
{
@Override

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_fluidspread extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_fluidspread extends TFM_Command
TotalFreedomMod.allowFliudSpread = false;
sender.sendMessage("Lava and water spread is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,6 +1,5 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
@ -9,12 +8,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_fr extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length == 0)
{
@ -67,11 +65,6 @@ public class Command_fr extends TFM_Command
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
}
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,6 +1,5 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
@ -9,6 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_gadmin extends TFM_Command
{
@Override
@ -21,8 +21,6 @@ public class Command_gadmin extends TFM_Command
String mode = args[0].toLowerCase();
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (mode.equals("list"))
{
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
@ -46,7 +44,6 @@ public class Command_gadmin extends TFM_Command
}
else if (mode.equals("nameban"))
{
//server.getOfflinePlayer(p.getName()).setBanned(true);
TFM_Util.banUsername(p.getName(), null, null, null);
TFM_Util.bcastMsg(String.format("Banning Name: %s.", p.getName()), ChatColor.RED);
p.kickPlayer("Username banned by Administrator.");
@ -60,7 +57,6 @@ public class Command_gadmin extends TFM_Command
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.bcastMsg(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED);
//server.banIP(user_ip);
TFM_Util.banIP(user_ip, null, null, null);
p.kickPlayer("IP address banned by Administrator.");
}
@ -73,8 +69,6 @@ public class Command_gadmin extends TFM_Command
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
TFM_Util.bcastMsg(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
//server.banIP(user_ip);
//server.getOfflinePlayer(p.getName()).setBanned(true);
TFM_Util.banIP(user_ip, null, null, null);
TFM_Util.banUsername(p.getName(), null, null, null);
p.kickPlayer("IP and username banned by Administrator.");
@ -112,11 +106,6 @@ public class Command_gadmin extends TFM_Command
{
sender.sendMessage(ChatColor.RED + "Invalid hash.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,18 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_gcmd extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length < 2)
{
@ -62,11 +59,6 @@ public class Command_gcmd extends TFM_Command
{
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + ex.getMessage());
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -2,15 +2,15 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_glist extends TFM_Command
{
@Override
@ -21,8 +21,6 @@ public class Command_glist extends TFM_Command
return false;
}
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("purge"))
@ -68,7 +66,7 @@ public class Command_glist extends TFM_Command
String mode = args[0].toLowerCase();
if (mode.equalsIgnoreCase("ban"))
{
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
Player p = server.getPlayerExact(username);
if (p != null)
@ -94,7 +92,7 @@ public class Command_glist extends TFM_Command
}
else if (mode.equalsIgnoreCase("unban"))
{
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
//server.getOfflinePlayer(username).setBanned(false);
TFM_Util.unbanUsername(username);
@ -108,11 +106,6 @@ public class Command_glist extends TFM_Command
TFM_Util.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
}
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,8 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -10,6 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_gtfo extends TFM_Command
{
@Override
@ -20,8 +19,6 @@ public class Command_gtfo extends TFM_Command
return false;
}
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
Player p;
try
{
@ -81,13 +78,7 @@ public class Command_gtfo extends TFM_Command
// kick Player:
p.kickPlayer("GTFO");
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}
}

View File

@ -3,23 +3,17 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_halt extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;
@ -107,7 +101,7 @@ public class Command_halt extends TFM_Command
}
}
private void setHalted(Player p, boolean is_halted)
private static void setHalted(Player p, boolean is_halted)
{
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);

View File

@ -2,22 +2,16 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.BOTH, block_web_console = true, ignore_permissions = false)
public class Command_kicknoob extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
TFM_Util.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
for (Player p : server.getOnlinePlayers())

View File

@ -10,16 +10,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_landmine extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
else if (!TotalFreedomMod.landminesEnabled)
if (!TotalFreedomMod.landminesEnabled)
{
sender.sendMessage(ChatColor.GREEN + "The landmine is currently disabled.");
}
@ -47,10 +44,6 @@ public class Command_landmine extends TFM_Command
sender.sendMessage(ChatColor.GREEN + "Landmine planted. Radius: " + radius + " blocks.");
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_lavadmg extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_lavadmg extends TFM_Command
TotalFreedomMod.allowLavaDamage = false;
sender.sendMessage("Lava damage is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_lavaplace extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_lavaplace extends TFM_Command
TotalFreedomMod.allowLavaPlace = false;
sender.sendMessage("Lava placement is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_list extends TFM_Command
{
@Override

View File

@ -1,27 +1,20 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Random;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitScheduler;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_lockup extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(senderIsConsole && TFM_SuperadminList.isSeniorAdmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("all"))

View File

@ -1,23 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, ignore_permissions = false)
public class Command_moblimiter extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
if (args.length < 1)
{
return false;

View File

@ -1,18 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_mp extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || sender.isOp())
{
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
@ -30,11 +28,6 @@ public class Command_mp extends TFM_Command
}
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -9,21 +9,18 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_mp44 extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
else if (!TotalFreedomMod.mp44Enabled)
if (!TotalFreedomMod.mp44Enabled)
{
sender.sendMessage(ChatColor.GREEN + "The mp44 is currently disabled.");
return true;
}
else if (sender.isOp())
{
if (args.length == 0)
{
return false;
@ -46,11 +43,6 @@ public class Command_mp44 extends TFM_Command
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -5,6 +5,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_nether extends TFM_Command
{
@Override

View File

@ -1,23 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_nonuke extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
if (args.length < 1)
{
return false;

View File

@ -2,24 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PropertyManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_onlinemode extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length < 1)
{
sender.sendMessage("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");

View File

@ -2,26 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//This command was coded initially by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_op extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;
@ -54,7 +46,6 @@ public class Command_op extends TFM_Command
TFM_Util.playerMsg(sender, "That player is not online.");
TFM_Util.playerMsg(sender, "You don't have permissions to OP offline players.", ChatColor.YELLOW);
return true;
}
}

View File

@ -1,6 +1,5 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
@ -8,12 +7,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_opall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
{
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
@ -43,11 +41,6 @@ public class Command_opall extends TFM_Command
p.setGameMode(targetGamemode);
}
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,31 +1,20 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_opme extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
else if (TFM_SuperadminList.isUserSuperadmin(sender))
{
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
sender.setOp(true);
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -8,17 +8,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_ops extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(senderIsConsole || sender.isOp()))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length < 1 || args.length > 1)
{
return false;

View File

@ -1,9 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@ -11,12 +9,11 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_orbit extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length == 0)
{
@ -62,11 +59,6 @@ public class Command_orbit extends TFM_Command
p.setVelocity(new Vector(0, strength, 0));
sender.sendMessage(ChatColor.GRAY + "Orbiting " + p.getName());
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -7,17 +7,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_permban extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;
@ -26,24 +21,19 @@ public class Command_permban extends TFM_Command
if (args[0].equalsIgnoreCase("list"))
{
dumplist(sender);
return true;
}
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("reload"))
else if (args[0].equalsIgnoreCase("reload"))
{
TFM_Util.playerMsg(sender, "Reloading permban list...", ChatColor.RED);
plugin.loadPermbanConfig();
dumplist(sender);
return true;
}
else
{
return false;
}
return false;
return true;
}
private void dumplist(CommandSender sender)

View File

@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -12,17 +11,12 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_potion extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length == 1 || args.length == 2)
{
if (args[0].equalsIgnoreCase("list"))

View File

@ -1,17 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_prelog extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
@ -28,11 +26,6 @@ public class Command_prelog extends TFM_Command
TotalFreedomMod.preprocessLogEnabled = false;
sender.sendMessage("Command preprocess logging is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,24 +1,18 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_protectarea extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (!TotalFreedomMod.protectedAreasEnabled)
{
sender.sendMessage("Protected areas are currently disabled in the TotalFreedomMod configuration.");
@ -97,7 +91,9 @@ public class Command_protectarea extends TFM_Command
return true;
}
else
{
return false;
}
}
}

View File

@ -1,12 +1,12 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_qdeop extends TFM_Command
{
@Override
@ -17,12 +17,6 @@ public class Command_qdeop extends TFM_Command
return false;
}
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
boolean silent = false;
if (args.length == 2)
{

View File

@ -1,12 +1,12 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_qop extends TFM_Command
{
@Override
@ -17,12 +17,6 @@ public class Command_qop extends TFM_Command
return false;
}
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
boolean silent = false;
if (args.length == 2)
{

View File

@ -4,24 +4,18 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_radar extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
return true;
}
Location sender_pos = sender_p.getLocation();
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();

View File

@ -6,6 +6,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_rank extends TFM_Command
{
@Override

View File

@ -1,30 +1,22 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_rawsay extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
if (args.length > 0)
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
TFM_Util.bcastMsg(StringUtils.join(args, " "));
}
if (args.length == 0)
{
return false;
}
TFM_Util.bcastMsg(TFM_Util.implodeStringList(" ", Arrays.asList(args)));
return true;
}
}

View File

@ -1,24 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_rd extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
//This terminology is wrong, this doesn't remove *all* entities, by far. - Madgeek
TFM_Util.adminAction(sender.getName(), "Removing all server entities.", false);
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed.");

View File

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_saconfig extends TFM_Command
{
@Override

View File

@ -1,14 +1,13 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_say extends TFM_Command
{
@Override
@ -19,11 +18,11 @@ public class Command_say extends TFM_Command
return false;
}
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
String message = StringUtils.join(args, " ");
if (senderIsConsole && sender.getName().equals("Rcon"))
if (senderIsConsole && TFM_Util.isFromClanforge(sender.getName()))
{
if (message.equals("WARNING: Server is restarting, you will be kicked"))
if (message.equalsIgnoreCase("WARNING: Server is restarting, you will be kicked"))
{
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
@ -38,14 +37,7 @@ public class Command_say extends TFM_Command
}
}
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,28 +1,16 @@
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;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_setlevel extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
return true;
}
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;

View File

@ -1,7 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
@ -10,23 +9,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_setspawnworld extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
return true;
}
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
Location pos = sender_p.getLocation();
sender_p.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());

View File

@ -1,8 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -11,7 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
// readded by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_smite extends TFM_Command
{
@Override
@ -22,12 +20,6 @@ public class Command_smite extends TFM_Command
return false;
}
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
Player p;
try
{

View File

@ -7,6 +7,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.ALL, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = true)
public class Command_status extends TFM_Command
{
@Override

View File

@ -3,12 +3,11 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//This command was coded initially by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_stfu extends TFM_Command
{
@Override
@ -19,12 +18,6 @@ public class Command_stfu extends TFM_Command
return false;
}
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("list"))
{
TFM_Util.playerMsg(sender, "Muted players:");

View File

@ -1,19 +1,16 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_stop extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
@ -23,11 +20,6 @@ public class Command_stop extends TFM_Command
}
server.shutdown();
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,12 +1,12 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_survival extends TFM_Command
{
@Override
@ -21,12 +21,6 @@ public class Command_survival extends TFM_Command
}
}
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
Player p;
if (args.length == 0)
{

View File

@ -2,15 +2,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.text.SimpleDateFormat;
import java.util.Date;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_tempban extends TFM_Command
{
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@ -23,12 +22,6 @@ public class Command_tempban extends TFM_Command
return false;
}
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
Player p;
try
{

View File

@ -1,23 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_terminal extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
String command;
try
{

View File

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_tfbanlist extends TFM_Command
{
@Override

View File

@ -12,6 +12,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_tfipbanlist extends TFM_Command
{
@Override

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false)
public class Command_tossmob extends TFM_Command
{
@Override
@ -23,12 +24,6 @@ public class Command_tossmob extends TFM_Command
return true;
}
if (senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
}
else if (sender.isOp())
{
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p);
EntityType creature = EntityType.PIG;
@ -86,11 +81,6 @@ public class Command_tossmob extends TFM_Command
sender.sendMessage(ChatColor.GREEN + "Type '/tossmob off' to disable. -By Madgeek1450");
sender_p.setItemInHand(new ItemStack(Material.STICK, 1));
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,37 +1,29 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//This command was coded initially by JeromSar
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_uall extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
TFM_Util.adminAction(sender.getName(), "Undisguising all players", true);
try
if (senderIsConsole)
{
for (Player p : server.getOnlinePlayers())
for (Player p : Bukkit.getOnlinePlayers())
{
server.dispatchCommand(p, "u");
}
}
catch (Throwable e)
else
{
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + e.getMessage());
server.dispatchCommand(sender, "u *");
}
return true;

View File

@ -6,13 +6,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_waterplace extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args.length != 1)
{
return false;
@ -28,11 +28,6 @@ public class Command_waterplace extends TFM_Command
TotalFreedomMod.allowWaterPlace = false;
sender.sendMessage("Water placement is now disabled.");
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -11,6 +11,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_whitelist extends TFM_Command
{
@Override
@ -21,12 +22,6 @@ public class Command_whitelist extends TFM_Command
return false;
}
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
// list
if (args[0].equalsIgnoreCase("list"))
{

View File

@ -1,19 +1,15 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
public class Command_wildcard extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{
if (args[0].equals("wildcard"))
{
@ -21,7 +17,7 @@ public class Command_wildcard extends TFM_Command
return true;
}
String base_command = TFM_Util.implodeStringList(" ", Arrays.asList(args));
String base_command = StringUtils.join(args, " ");
for (Player p : server.getOnlinePlayers())
{
@ -29,11 +25,6 @@ public class Command_wildcard extends TFM_Command
sender.sendMessage("Running Command: " + out_command);
server.dispatchCommand(sender, out_command);
}
}
else
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
}
return true;
}

View File

@ -1,24 +1,17 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_wipeflatlands extends TFM_Command
{
@Override
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!(senderIsConsole && TFM_SuperadminList.isSeniorAdmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
TFM_Util.setSavedFlag("do_wipe_flatlands", true);
TFM_Util.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);

View File

@ -4,22 +4,16 @@ import java.io.File;
import java.io.IOException;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_ziptool extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!senderIsConsole || TFM_Util.isFromClanforge(sender.getName()))
{
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
if (args.length <= 1)
{
return false;

View File

@ -86,6 +86,7 @@ public class TFM_Util
TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
}
@Deprecated
public static String implodeStringList(String glue, List<String> pieces)
{
return StringUtils.join(pieces, glue);

View File

@ -8,6 +8,7 @@ import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -122,7 +123,7 @@ public class TotalFreedomMod extends JavaPlugin
sender_p.getName(),
ChatColor.stripColor(sender_p.getDisplayName()),
commandLabel,
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
StringUtils.join(args, " ")), true);
}
else
{
@ -130,7 +131,7 @@ public class TotalFreedomMod extends JavaPlugin
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
sender.getName(),
commandLabel,
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
StringUtils.join(args, " ")), true);
}
TFM_Command dispatcher;