mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Finished implementation of CommandPermissions and conversion of all commands.
This commit is contained in:
parent
13af6cb6a3
commit
9c05e8e2fb
@ -1,7 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -10,35 +9,29 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
public class Command_cake extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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();
|
||||||
|
|
||||||
|
for (String word : TotalFreedomMod.CAKE_LYRICS.split(" "))
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
|
||||||
Random randomGenerator = new Random();
|
output.append("§").append(color_code).append(word).append(" ");
|
||||||
|
|
||||||
for (String word : TotalFreedomMod.CAKE_LYRICS.split(" "))
|
|
||||||
{
|
|
||||||
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
|
|
||||||
output.append("§").append(color_code).append(word).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
|
||||||
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_Util.bcastMsg(output.toString());
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||||
|
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TFM_Util.bcastMsg(output.toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Minecart;
|
import org.bukkit.entity.Minecart;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_cartsit extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,36 +1,18 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_clearall extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
server.dispatchCommand(sender, "rd");
|
||||||
{
|
server.dispatchCommand(sender, "denick");
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
server.dispatchCommand(sender, "uall");
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,14 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
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
|
public class Command_cmdlist extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -42,7 +43,7 @@ public class Command_cmdlist extends TFM_Command
|
|||||||
|
|
||||||
Collections.sort(commands);
|
Collections.sort(commands);
|
||||||
|
|
||||||
sender.sendMessage(TFM_Util.implodeStringList(",", commands));
|
sender.sendMessage(StringUtils.join(commands, ","));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_creative extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@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;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,35 +1,21 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_csay extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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();
|
TFM_Util.bcastMsg(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender.getName(), StringUtils.join(args, " ")));
|
||||||
|
|
||||||
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_name, outmessage_bldr.toString().trim()));
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_deop extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -43,7 +34,7 @@ public class Command_deop extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
||||||
|
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,30 +1,23 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_deopall extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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);
|
||||||
{
|
|
||||||
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
|
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
|
||||||
p.setOp(false);
|
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
p.setOp(false);
|
||||||
|
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,24 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_doom extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,29 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
public class Command_enchant extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -78,7 +66,7 @@ public class Command_enchant extends TFM_Command
|
|||||||
{
|
{
|
||||||
itemInHand.removeEnchantment(ench);
|
itemInHand.removeEnchantment(ench);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Removed all enchantments.");
|
sender.sendMessage("Removed all enchantments.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -109,18 +97,18 @@ public class Command_enchant extends TFM_Command
|
|||||||
if (ench.canEnchantItem(itemInHand))
|
if (ench.canEnchantItem(itemInHand))
|
||||||
{
|
{
|
||||||
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
itemInHand.addEnchantment(ench, ench.getMaxLevel());
|
||||||
|
|
||||||
sender.sendMessage("Added enchantment: " + ench.getName());
|
sender.sendMessage("Added enchantment: " + ench.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage("Can't use this enchantment on held item.");
|
sender.sendMessage("Can't use this enchantment on held item.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("remove"))
|
else if (args[0].equalsIgnoreCase("remove"))
|
||||||
{
|
{
|
||||||
itemInHand.removeEnchantment(ench);
|
itemInHand.removeEnchantment(ench);
|
||||||
|
|
||||||
sender.sendMessage("Removed enchantment: " + ench.getName());
|
sender.sendMessage("Removed enchantment: " + ench.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_ender extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,77 +1,65 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
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
|
public class Command_expel extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (senderIsConsole)
|
double radius = 50.0;
|
||||||
|
double strength = 100.0;
|
||||||
|
|
||||||
|
if (args.length >= 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
try
|
||||||
}
|
|
||||||
else if (TFM_SuperadminList.isUserSuperadmin(sender))
|
|
||||||
{
|
|
||||||
double radius = 50.0;
|
|
||||||
double strength = 100.0;
|
|
||||||
|
|
||||||
if (args.length >= 1)
|
|
||||||
{
|
{
|
||||||
try
|
radius = Math.max(1.0, Math.min(200.0, Double.parseDouble(args[0])));
|
||||||
{
|
|
||||||
radius = Math.max(1.0, Math.min(200.0, Double.parseDouble(args[0])));
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException nfex)
|
||||||
if (args.length >= 2)
|
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
strength = Math.max(0.0, Math.min(200.0, Double.parseDouble(args[1])));
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Location sender_pos = sender_p.getLocation();
|
|
||||||
for (Player p : sender_pos.getWorld().getPlayers())
|
|
||||||
{
|
|
||||||
if (!p.equals(sender_p))
|
|
||||||
{
|
|
||||||
Location target_pos = p.getLocation();
|
|
||||||
|
|
||||||
boolean in_range = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
in_range = target_pos.distanceSquared(sender_pos) < (radius * radius);
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException ex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_range)
|
|
||||||
{
|
|
||||||
sender.sendMessage("Pushing " + p.getName());
|
|
||||||
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
|
||||||
p.setVelocity(expel_direction.multiply(strength));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
try
|
||||||
|
{
|
||||||
|
strength = Math.max(0.0, Math.min(200.0, Double.parseDouble(args[1])));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException nfex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Location sender_pos = sender_p.getLocation();
|
||||||
|
for (Player p : sender_pos.getWorld().getPlayers())
|
||||||
|
{
|
||||||
|
if (!p.equals(sender_p))
|
||||||
|
{
|
||||||
|
Location target_pos = p.getLocation();
|
||||||
|
|
||||||
|
boolean in_range = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
in_range = target_pos.distanceSquared(sender_pos) < (radius * radius);
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_range)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Pushing " + p.getName());
|
||||||
|
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
||||||
|
p.setVelocity(expel_direction.multiply(strength));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,48 +1,41 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_explosives extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 2)
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
TotalFreedomMod.explosiveRadius = Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])));
|
||||||
{
|
|
||||||
TotalFreedomMod.explosiveRadius = Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1])));
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException nfex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowExplosions = true;
|
TotalFreedomMod.allowExplosions = true;
|
||||||
sender.sendMessage("Explosives are now enabled, radius set to " + TotalFreedomMod.explosiveRadius + " blocks.");
|
sender.sendMessage("Explosives are now enabled, radius set to " + TotalFreedomMod.explosiveRadius + " blocks.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowExplosions = false;
|
|
||||||
sender.sendMessage("Explosives are now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowExplosions = false;
|
||||||
|
sender.sendMessage("Explosives are now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_fireplace extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowFirePlace = true;
|
TotalFreedomMod.allowFirePlace = true;
|
||||||
sender.sendMessage("Fire placement is now enabled.");
|
sender.sendMessage("Fire placement is now enabled.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowFirePlace = false;
|
|
||||||
sender.sendMessage("Fire placement is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowFirePlace = false;
|
||||||
|
sender.sendMessage("Fire placement is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_firespread extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowFireSpread = true;
|
TotalFreedomMod.allowFireSpread = true;
|
||||||
sender.sendMessage("Fire spread is now enabled.");
|
sender.sendMessage("Fire spread is now enabled.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowFireSpread = false;
|
|
||||||
sender.sendMessage("Fire spread is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowFireSpread = false;
|
||||||
|
sender.sendMessage("Fire spread is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_flatlands extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_fluidspread extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowFliudSpread = true;
|
TotalFreedomMod.allowFliudSpread = true;
|
||||||
sender.sendMessage("Lava and water spread is now enabled.");
|
sender.sendMessage("Lava and water spread is now enabled.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowFliudSpread = false;
|
|
||||||
sender.sendMessage("Lava and water spread is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowFliudSpread = false;
|
||||||
|
sender.sendMessage("Lava and water spread is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -9,68 +8,62 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_fr extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
TotalFreedomMod.allPlayersFrozen = !TotalFreedomMod.allPlayersFrozen;
|
||||||
{
|
|
||||||
TotalFreedomMod.allPlayersFrozen = !TotalFreedomMod.allPlayersFrozen;
|
|
||||||
|
|
||||||
if (TotalFreedomMod.allPlayersFrozen)
|
if (TotalFreedomMod.allPlayersFrozen)
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allPlayersFrozen = true;
|
TotalFreedomMod.allPlayersFrozen = true;
|
||||||
sender.sendMessage("Players are now frozen.");
|
sender.sendMessage("Players are now frozen.");
|
||||||
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allPlayersFrozen = false;
|
|
||||||
sender.sendMessage("Players are now free to move.");
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (args[0].toLowerCase().equals("purge"))
|
TotalFreedomMod.allPlayersFrozen = false;
|
||||||
{
|
sender.sendMessage("Players are now free to move.");
|
||||||
TotalFreedomMod.allPlayersFrozen = false;
|
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
|
||||||
playerdata.setFrozen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Player p;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
p = getPlayer(args[0]);
|
|
||||||
}
|
|
||||||
catch (CantFindPlayerException ex)
|
|
||||||
{
|
|
||||||
sender.sendMessage(ex.getMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
|
||||||
playerdata.setFrozen(!playerdata.isFrozen());
|
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
||||||
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
if (args[0].toLowerCase().equals("purge"))
|
||||||
|
{
|
||||||
|
TotalFreedomMod.allPlayersFrozen = false;
|
||||||
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
playerdata.setFrozen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Player p;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
p = getPlayer(args[0]);
|
||||||
|
}
|
||||||
|
catch (CantFindPlayerException ex)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
playerdata.setFrozen(!playerdata.isFrozen());
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -9,6 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_gadmin extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -21,101 +21,90 @@ public class Command_gadmin extends TFM_Command
|
|||||||
|
|
||||||
String mode = args[0].toLowerCase();
|
String mode = args[0].toLowerCase();
|
||||||
|
|
||||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
if (mode.equals("list"))
|
||||||
{
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
String hash = p.getUniqueId().toString().substring(0, 4);
|
||||||
if (mode.equals("list"))
|
if (mode.equals("list"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
|
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
|
||||||
|
p.getName(),
|
||||||
|
ChatColor.stripColor(p.getDisplayName()),
|
||||||
|
hash));
|
||||||
}
|
}
|
||||||
|
else if (hash.equalsIgnoreCase(args[1]))
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
{
|
||||||
String hash = p.getUniqueId().toString().substring(0, 4);
|
if (mode.equals("kick"))
|
||||||
if (mode.equals("list"))
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
|
p.kickPlayer("Kicked by Administrator");
|
||||||
p.getName(),
|
|
||||||
ChatColor.stripColor(p.getDisplayName()),
|
|
||||||
hash));
|
|
||||||
}
|
}
|
||||||
else if (hash.equalsIgnoreCase(args[1]))
|
else if (mode.equals("nameban"))
|
||||||
{
|
{
|
||||||
if (mode.equals("kick"))
|
TFM_Util.banUsername(p.getName(), null, null, null);
|
||||||
{
|
TFM_Util.bcastMsg(String.format("Banning Name: %s.", p.getName()), ChatColor.RED);
|
||||||
p.kickPlayer("Kicked by Administrator");
|
p.kickPlayer("Username banned by Administrator.");
|
||||||
}
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
else if (mode.equals("ipban"))
|
|
||||||
{
|
|
||||||
String user_ip = p.getAddress().getAddress().getHostAddress();
|
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
|
||||||
if (ip_parts.length == 4)
|
|
||||||
{
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
else if (mode.equals("ban"))
|
|
||||||
{
|
|
||||||
String user_ip = p.getAddress().getAddress().getHostAddress();
|
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
|
||||||
if (ip_parts.length == 4)
|
|
||||||
{
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
else if (mode.equals("op"))
|
|
||||||
{
|
|
||||||
TFM_Util.bcastMsg(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
|
||||||
p.setOp(false);
|
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
|
||||||
}
|
|
||||||
else if (mode.equals("deop"))
|
|
||||||
{
|
|
||||||
TFM_Util.bcastMsg(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
|
||||||
p.setOp(false);
|
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
|
||||||
}
|
|
||||||
else if (mode.equals("ci"))
|
|
||||||
{
|
|
||||||
p.getInventory().clear();
|
|
||||||
}
|
|
||||||
else if (mode.equals("fr"))
|
|
||||||
{
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
|
||||||
playerdata.setFrozen(!playerdata.isFrozen());
|
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
||||||
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
else if (mode.equals("ipban"))
|
||||||
|
{
|
||||||
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
|
if (ip_parts.length == 4)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
TFM_Util.banIP(user_ip, null, null, null);
|
||||||
|
p.kickPlayer("IP address banned by Administrator.");
|
||||||
|
}
|
||||||
|
else if (mode.equals("ban"))
|
||||||
|
{
|
||||||
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
|
if (ip_parts.length == 4)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
TFM_Util.banIP(user_ip, null, null, null);
|
||||||
|
TFM_Util.banUsername(p.getName(), null, null, null);
|
||||||
|
p.kickPlayer("IP and username banned by Administrator.");
|
||||||
|
}
|
||||||
|
else if (mode.equals("op"))
|
||||||
|
{
|
||||||
|
TFM_Util.bcastMsg(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
|
p.setOp(false);
|
||||||
|
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||||
|
}
|
||||||
|
else if (mode.equals("deop"))
|
||||||
|
{
|
||||||
|
TFM_Util.bcastMsg(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
|
p.setOp(false);
|
||||||
|
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||||
|
}
|
||||||
|
else if (mode.equals("ci"))
|
||||||
|
{
|
||||||
|
p.getInventory().clear();
|
||||||
|
}
|
||||||
|
else if (mode.equals("fr"))
|
||||||
|
{
|
||||||
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
playerdata.setFrozen(!playerdata.isFrozen());
|
||||||
|
|
||||||
if (!mode.equals("list"))
|
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||||
{
|
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid hash.");
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!mode.equals("list"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(ChatColor.RED + "Invalid hash.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,71 +1,63 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_gcmd extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p = getPlayer(args[0]);
|
p = getPlayer(args[0]);
|
||||||
}
|
}
|
||||||
catch (CantFindPlayerException ex)
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ex.getMessage());
|
sender.sendMessage(ex.getMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String outcommand = "";
|
String outcommand = "";
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
StringBuilder outcommand_bldr = new StringBuilder();
|
||||||
|
for (int i = 1; i < args.length; i++)
|
||||||
{
|
{
|
||||||
StringBuilder outcommand_bldr = new StringBuilder();
|
outcommand_bldr.append(args[i]).append(" ");
|
||||||
for (int i = 1; i < args.length; i++)
|
|
||||||
{
|
|
||||||
outcommand_bldr.append(args[i]).append(" ");
|
|
||||||
}
|
|
||||||
outcommand = outcommand_bldr.toString().trim();
|
|
||||||
}
|
|
||||||
catch (Throwable ex)
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
outcommand = outcommand_bldr.toString().trim();
|
||||||
|
}
|
||||||
|
catch (Throwable ex)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Error building command: " + ex.getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
|
||||||
|
if (server.dispatchCommand(p, outcommand))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
|
sender.sendMessage(ChatColor.GRAY + "Command sent.");
|
||||||
if (server.dispatchCommand(p, outcommand))
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Command sent.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + ex.getMessage());
|
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,15 +2,15 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_glist extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -21,97 +21,90 @@ public class Command_glist extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
if (args.length == 1)
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("purge"))
|
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
|
||||||
{
|
TFM_UserList.getInstance(plugin).purge();
|
||||||
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
|
return true;
|
||||||
TFM_UserList.getInstance(plugin).purge();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (args.length != 2)
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (args.length != 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String username;
|
String username;
|
||||||
List<String> ip_addresses = new ArrayList<String>();
|
List<String> ip_addresses = new ArrayList<String>();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
Player p = getPlayer(args[1]);
|
||||||
|
|
||||||
|
username = p.getName();
|
||||||
|
ip_addresses.add(p.getAddress().getAddress().getHostAddress());
|
||||||
|
}
|
||||||
|
catch (CantFindPlayerException ex)
|
||||||
|
{
|
||||||
|
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
|
||||||
|
|
||||||
|
if (entry == null)
|
||||||
{
|
{
|
||||||
Player p = getPlayer(args[1]);
|
sender.sendMessage("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||||
|
return true;
|
||||||
username = p.getName();
|
|
||||||
ip_addresses.add(p.getAddress().getAddress().getHostAddress());
|
|
||||||
}
|
|
||||||
catch (CantFindPlayerException ex)
|
|
||||||
{
|
|
||||||
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
|
|
||||||
|
|
||||||
if (entry == null)
|
|
||||||
{
|
|
||||||
sender.sendMessage("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
username = entry.getUsername();
|
|
||||||
ip_addresses = entry.getIpAddresses();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String mode = args[0].toLowerCase();
|
username = entry.getUsername();
|
||||||
if (mode.equalsIgnoreCase("ban"))
|
ip_addresses = entry.getIpAddresses();
|
||||||
|
}
|
||||||
|
|
||||||
|
String mode = args[0].toLowerCase();
|
||||||
|
if (mode.equalsIgnoreCase("ban"))
|
||||||
|
{
|
||||||
|
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
|
||||||
|
|
||||||
|
Player p = server.getPlayerExact(username);
|
||||||
|
if (p != null)
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
|
//p.setBanned(true);
|
||||||
|
TFM_Util.banUsername(p.getName(), null, null, null);
|
||||||
Player p = server.getPlayerExact(username);
|
p.kickPlayer("IP and username banned by Administrator.");
|
||||||
if (p != null)
|
|
||||||
{
|
|
||||||
//p.setBanned(true);
|
|
||||||
TFM_Util.banUsername(p.getName(), null, null, null);
|
|
||||||
p.kickPlayer("IP and username banned by Administrator.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//server.getOfflinePlayer(username).setBanned(true);
|
|
||||||
TFM_Util.banUsername(username, null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String ip_address : ip_addresses)
|
|
||||||
{
|
|
||||||
//server.banIP(ip_address);
|
|
||||||
TFM_Util.banIP(ip_address, null, null, null);
|
|
||||||
String[] ip_address_parts = ip_address.split("\\.");
|
|
||||||
//server.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
|
||||||
TFM_Util.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", null, null, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (mode.equalsIgnoreCase("unban"))
|
else
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
|
//server.getOfflinePlayer(username).setBanned(true);
|
||||||
|
TFM_Util.banUsername(username, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
//server.getOfflinePlayer(username).setBanned(false);
|
for (String ip_address : ip_addresses)
|
||||||
TFM_Util.unbanUsername(username);
|
{
|
||||||
|
//server.banIP(ip_address);
|
||||||
for (String ip_address : ip_addresses)
|
TFM_Util.banIP(ip_address, null, null, null);
|
||||||
{
|
String[] ip_address_parts = ip_address.split("\\.");
|
||||||
//server.unbanIP(ip_address);
|
//server.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||||
TFM_Util.unbanIP(ip_address);
|
TFM_Util.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*", null, null, null);
|
||||||
String[] ip_address_parts = ip_address.split("\\.");
|
|
||||||
//server.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
|
||||||
TFM_Util.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (mode.equalsIgnoreCase("unban"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ip_addresses, ","), true);
|
||||||
|
|
||||||
|
//server.getOfflinePlayer(username).setBanned(false);
|
||||||
|
TFM_Util.unbanUsername(username);
|
||||||
|
|
||||||
|
for (String ip_address : ip_addresses)
|
||||||
|
{
|
||||||
|
//server.unbanIP(ip_address);
|
||||||
|
TFM_Util.unbanIP(ip_address);
|
||||||
|
String[] ip_address_parts = ip_address.split("\\.");
|
||||||
|
//server.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||||
|
TFM_Util.unbanIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -10,6 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_gtfo extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -20,74 +19,66 @@ public class Command_gtfo extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
Player p;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Player p;
|
p = getPlayer(args[0]);
|
||||||
try
|
}
|
||||||
{
|
catch (CantFindPlayerException ex)
|
||||||
p = getPlayer(args[0]);
|
{
|
||||||
}
|
sender.sendMessage(ex.getMessage());
|
||||||
catch (CantFindPlayerException ex)
|
return true;
|
||||||
{
|
}
|
||||||
sender.sendMessage(ex.getMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_Util.bcastMsg(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
TFM_Util.bcastMsg(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||||
|
|
||||||
//Undo WorldEdits:
|
//Undo WorldEdits:
|
||||||
if (senderIsConsole)
|
if (senderIsConsole)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// deop
|
|
||||||
p.setOp(false);
|
|
||||||
|
|
||||||
// set gamemode to survival:
|
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
|
||||||
|
|
||||||
// clear inventory:
|
|
||||||
p.getInventory().clear();
|
|
||||||
|
|
||||||
// strike with lightning effect:
|
|
||||||
final Location target_pos = p.getLocation();
|
|
||||||
for (int x = -1; x <= 1; x++)
|
|
||||||
{
|
|
||||||
for (int z = -1; z <= 1; z++)
|
|
||||||
{
|
|
||||||
final Location strike_pos = new Location(target_pos.getWorld(), target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
|
|
||||||
target_pos.getWorld().strikeLightning(strike_pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ban IP address:
|
|
||||||
String user_ip = p.getAddress().getAddress().getHostAddress();
|
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
|
||||||
if (ip_parts.length == 4)
|
|
||||||
{
|
|
||||||
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
|
||||||
}
|
|
||||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
|
||||||
//server.banIP(user_ip);
|
|
||||||
TFM_Util.banIP(user_ip, null, null, null);
|
|
||||||
|
|
||||||
// ban username:
|
|
||||||
// server.getOfflinePlayer(p.getName()).setBanned(true);
|
|
||||||
TFM_Util.banUsername(p.getName(), null, null, null);
|
|
||||||
|
|
||||||
// kick Player:
|
|
||||||
p.kickPlayer("GTFO");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// deop
|
||||||
|
p.setOp(false);
|
||||||
|
|
||||||
|
// set gamemode to survival:
|
||||||
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
|
// clear inventory:
|
||||||
|
p.getInventory().clear();
|
||||||
|
|
||||||
|
// strike with lightning effect:
|
||||||
|
final Location target_pos = p.getLocation();
|
||||||
|
for (int x = -1; x <= 1; x++)
|
||||||
|
{
|
||||||
|
for (int z = -1; z <= 1; z++)
|
||||||
|
{
|
||||||
|
final Location strike_pos = new Location(target_pos.getWorld(), target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
|
||||||
|
target_pos.getWorld().strikeLightning(strike_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ban IP address:
|
||||||
|
String user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
|
if (ip_parts.length == 4)
|
||||||
|
{
|
||||||
|
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
|
||||||
|
}
|
||||||
|
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||||
|
//server.banIP(user_ip);
|
||||||
|
TFM_Util.banIP(user_ip, null, null, null);
|
||||||
|
|
||||||
|
// ban username:
|
||||||
|
// server.getOfflinePlayer(p.getName()).setBanned(true);
|
||||||
|
TFM_Util.banUsername(p.getName(), null, null, null);
|
||||||
|
|
||||||
|
// kick Player:
|
||||||
|
p.kickPlayer("GTFO");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,17 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_halt extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
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);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
|
||||||
|
@ -2,24 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_kicknoob extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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);
|
TFM_Util.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
@ -27,7 +21,7 @@ public class Command_kicknoob extends TFM_Command
|
|||||||
p.kickPlayer("Disconnected by admin.");
|
p.kickPlayer("Disconnected by admin.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,13 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_landmine extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (senderIsConsole)
|
if (!TotalFreedomMod.landminesEnabled)
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
|
||||||
}
|
|
||||||
else if (!TotalFreedomMod.landminesEnabled)
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GREEN + "The landmine is currently disabled.");
|
sender.sendMessage(ChatColor.GREEN + "The landmine is currently disabled.");
|
||||||
}
|
}
|
||||||
@ -40,17 +37,13 @@ public class Command_landmine extends TFM_Command
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Block landmine = sender_p.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
Block landmine = sender_p.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||||
landmine.setType(Material.TNT);
|
landmine.setType(Material.TNT);
|
||||||
TFM_LandmineData.landmines.add(new TFM_LandmineData(landmine.getLocation(), sender_p, radius));
|
TFM_LandmineData.landmines.add(new TFM_LandmineData(landmine.getLocation(), sender_p, radius));
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Landmine planted. Radius: " + radius + " blocks.");
|
sender.sendMessage(ChatColor.GREEN + "Landmine planted. Radius: " + radius + " blocks.");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_lavadmg extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowLavaDamage = true;
|
TotalFreedomMod.allowLavaDamage = true;
|
||||||
sender.sendMessage("Lava damage is now enabled.");
|
sender.sendMessage("Lava damage is now enabled.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowLavaDamage = false;
|
|
||||||
sender.sendMessage("Lava damage is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowLavaDamage = false;
|
||||||
|
sender.sendMessage("Lava damage is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_lavaplace extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowLavaPlace = true;
|
TotalFreedomMod.allowLavaPlace = true;
|
||||||
sender.sendMessage("Lava placement is now enabled.");
|
sender.sendMessage("Lava placement is now enabled.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.allowLavaPlace = false;
|
|
||||||
sender.sendMessage("Lava placement is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowLavaPlace = false;
|
||||||
|
sender.sendMessage("Lava placement is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_list extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,27 +1,20 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
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
|
public class Command_lockup extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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.length == 1)
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("all"))
|
if (args[0].equalsIgnoreCase("all"))
|
||||||
|
@ -1,23 +1,16 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_moblimiter extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,40 +1,33 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
|
@CommandPermissions(level = ADMIN_LEVEL.OP, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
|
||||||
public class Command_mp extends TFM_Command
|
public class Command_mp extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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...");
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
|
|
||||||
|
|
||||||
int removed = 0;
|
int removed = 0;
|
||||||
for (World world : server.getWorlds())
|
for (World world : server.getWorlds())
|
||||||
|
{
|
||||||
|
for (Entity ent : world.getLivingEntities())
|
||||||
{
|
{
|
||||||
for (Entity ent : world.getLivingEntities())
|
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient)
|
||||||
{
|
{
|
||||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime || ent instanceof EnderDragon || ent instanceof Ambient)
|
ent.remove();
|
||||||
{
|
removed++;
|
||||||
ent.remove();
|
|
||||||
removed++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
|
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -9,47 +9,39 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
public class Command_mp44 extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (senderIsConsole)
|
if (!TotalFreedomMod.mp44Enabled)
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
|
||||||
}
|
|
||||||
else if (!TotalFreedomMod.mp44Enabled)
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GREEN + "The mp44 is currently disabled.");
|
sender.sendMessage(ChatColor.GREEN + "The mp44 is currently disabled.");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (sender.isOp())
|
|
||||||
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(sender_p);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(sender_p);
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("draw"))
|
if (args[0].equalsIgnoreCase("draw"))
|
||||||
{
|
{
|
||||||
playerdata.armMP44();
|
playerdata.armMP44();
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.");
|
sender.sendMessage(ChatColor.GREEN + "mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.");
|
||||||
sender.sendMessage(ChatColor.GREEN + "Type /mp44 sling to disable. -by Madgeek1450");
|
sender.sendMessage(ChatColor.GREEN + "Type /mp44 sling to disable. -by Madgeek1450");
|
||||||
|
|
||||||
sender_p.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
sender_p.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
playerdata.disarmMP44();
|
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
playerdata.disarmMP44();
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_nether extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,23 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_nonuke extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -57,7 +51,7 @@ public class Command_nonuke extends TFM_Command
|
|||||||
TotalFreedomMod.nukeMonitor = false;
|
TotalFreedomMod.nukeMonitor = false;
|
||||||
sender.sendMessage("Nuke monitor is disabled.");
|
sender.sendMessage("Nuke monitor is disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.PropertyManager;
|
import net.minecraft.server.PropertyManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_onlinemode extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
sender.sendMessage("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
||||||
|
@ -2,26 +2,18 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_op extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
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, "That player is not online.");
|
||||||
TFM_Util.playerMsg(sender, "You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
TFM_Util.playerMsg(sender, "You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -8,45 +7,39 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_opall extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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);
|
||||||
|
|
||||||
|
boolean doSetGamemode = false;
|
||||||
|
GameMode targetGamemode = GameMode.CREATIVE;
|
||||||
|
if (args.length != 0)
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
|
if (args[0].equals("-c"))
|
||||||
|
|
||||||
boolean doSetGamemode = false;
|
|
||||||
GameMode targetGamemode = GameMode.CREATIVE;
|
|
||||||
if (args.length != 0)
|
|
||||||
{
|
{
|
||||||
if (args[0].equals("-c"))
|
doSetGamemode = true;
|
||||||
{
|
targetGamemode = GameMode.CREATIVE;
|
||||||
doSetGamemode = true;
|
|
||||||
targetGamemode = GameMode.CREATIVE;
|
|
||||||
}
|
|
||||||
else if (args[0].equals("-s"))
|
|
||||||
{
|
|
||||||
doSetGamemode = true;
|
|
||||||
targetGamemode = GameMode.SURVIVAL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (args[0].equals("-s"))
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
{
|
||||||
p.setOp(true);
|
doSetGamemode = true;
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
targetGamemode = GameMode.SURVIVAL;
|
||||||
|
|
||||||
if (doSetGamemode)
|
|
||||||
{
|
|
||||||
p.setGameMode(targetGamemode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
p.setOp(true);
|
||||||
|
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||||
|
|
||||||
|
if (doSetGamemode)
|
||||||
|
{
|
||||||
|
p.setGameMode(targetGamemode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,32 +1,21 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_opme extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (senderIsConsole)
|
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||||
{
|
sender.setOp(true);
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||||
}
|
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,12 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_ops extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length < 1 || args.length > 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -11,63 +9,57 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
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
|
public class Command_orbit extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
p = getPlayer(args[0]);
|
||||||
|
}
|
||||||
|
catch (CantFindPlayerException ex)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ex.getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
|
|
||||||
|
double strength = 10.0;
|
||||||
|
|
||||||
|
if (args.length >= 2)
|
||||||
|
{
|
||||||
|
if (TFM_Util.isStopCommand(args[1]))
|
||||||
{
|
{
|
||||||
p = getPlayer(args[0]);
|
sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName());
|
||||||
}
|
playerdata.stopOrbiting();
|
||||||
catch (CantFindPlayerException ex)
|
|
||||||
{
|
|
||||||
sender.sendMessage(ex.getMessage());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
try
|
||||||
|
{
|
||||||
double strength = 10.0;
|
strength = Math.max(1.0, Math.min(150.0, Double.parseDouble(args[1])));
|
||||||
|
}
|
||||||
if (args.length >= 2)
|
catch (NumberFormatException nfex)
|
||||||
{
|
{
|
||||||
if (TFM_Util.isStopCommand(args[1]))
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName());
|
|
||||||
playerdata.stopOrbiting();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
strength = Math.max(1.0, Math.min(150.0, Double.parseDouble(args[1])));
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
|
||||||
playerdata.startOrbiting(strength);
|
|
||||||
|
|
||||||
p.setVelocity(new Vector(0, strength, 0));
|
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Orbiting " + p.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
playerdata.startOrbiting(strength);
|
||||||
|
|
||||||
|
p.setVelocity(new Vector(0, strength, 0));
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Orbiting " + p.getName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,17 +7,12 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_permban extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -26,24 +21,19 @@ public class Command_permban extends TFM_Command
|
|||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
dumplist(sender);
|
dumplist(sender);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else if (args[0].equalsIgnoreCase("reload"))
|
||||||
if (!senderIsConsole)
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("reload"))
|
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(sender, "Reloading permban list...", ChatColor.RED);
|
TFM_Util.playerMsg(sender, "Reloading permban list...", ChatColor.RED);
|
||||||
plugin.loadPermbanConfig();
|
plugin.loadPermbanConfig();
|
||||||
dumplist(sender);
|
dumplist(sender);
|
||||||
return true;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dumplist(CommandSender sender)
|
private void dumplist(CommandSender sender)
|
||||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -12,17 +11,12 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
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
|
public class Command_potion extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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.length == 1 || args.length == 2)
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
|
@ -1,37 +1,30 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_prelog extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.preprocessLogEnabled = true;
|
TotalFreedomMod.preprocessLogEnabled = true;
|
||||||
sender.sendMessage("Command preprocess logging is now enabled. This will be spammy in the log.");
|
sender.sendMessage("Command preprocess logging is now enabled. This will be spammy in the log.");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TotalFreedomMod.preprocessLogEnabled = false;
|
|
||||||
sender.sendMessage("Command preprocess logging is now disabled.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.preprocessLogEnabled = false;
|
||||||
|
sender.sendMessage("Command preprocess logging is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,24 +1,18 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_protectarea extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (!TotalFreedomMod.protectedAreasEnabled)
|
||||||
{
|
{
|
||||||
sender.sendMessage("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
sender.sendMessage("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
||||||
@ -34,7 +28,7 @@ public class Command_protectarea extends TFM_Command
|
|||||||
else if (args[0].equalsIgnoreCase("clear"))
|
else if (args[0].equalsIgnoreCase("clear"))
|
||||||
{
|
{
|
||||||
TFM_ProtectedArea.clearProtectedAreas();
|
TFM_ProtectedArea.clearProtectedAreas();
|
||||||
|
|
||||||
sender.sendMessage("Protected Areas Cleared.");
|
sender.sendMessage("Protected Areas Cleared.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -97,7 +91,9 @@ public class Command_protectarea extends TFM_Command
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
return false;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_qdeop extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -17,12 +17,6 @@ public class Command_qdeop extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean silent = false;
|
boolean silent = false;
|
||||||
if (args.length == 2)
|
if (args.length == 2)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_qop extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -17,12 +17,6 @@ public class Command_qop extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean silent = false;
|
boolean silent = false;
|
||||||
if (args.length == 2)
|
if (args.length == 2)
|
||||||
{
|
{
|
||||||
|
@ -4,24 +4,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_radar extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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();
|
Location sender_pos = sender_p.getLocation();
|
||||||
|
|
||||||
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_rank extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,30 +1,22 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_rawsay extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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.");
|
TFM_Util.bcastMsg(StringUtils.join(args, " "));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TFM_Util.bcastMsg(TFM_Util.implodeStringList(" ", Arrays.asList(args)));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_rd extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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
|
//This terminology is wrong, this doesn't remove *all* entities, by far. - Madgeek
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing all server entities.", false);
|
TFM_Util.adminAction(sender.getName(), "Removing all server entities.", false);
|
||||||
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed.");
|
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed.");
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_saconfig extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
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.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_say extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -18,12 +17,12 @@ public class Command_say extends TFM_Command
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
|
||||||
|
|
||||||
if (senderIsConsole && sender.getName().equals("Rcon"))
|
String message = StringUtils.join(args, " ");
|
||||||
|
|
||||||
|
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);
|
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);
|
||||||
{
|
|
||||||
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,27 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_setlevel extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int new_level;
|
int new_level;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new_level = Integer.parseInt(args[0]);
|
new_level = Integer.parseInt(args[0]);
|
||||||
|
|
||||||
if (new_level < 0)
|
if (new_level < 0)
|
||||||
{
|
{
|
||||||
new_level = 0;
|
new_level = 0;
|
||||||
@ -50,9 +38,9 @@ public class Command_setlevel extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender_p.setLevel(new_level);
|
sender_p.setLevel(new_level);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "You have been set to level " + Integer.toString(new_level));
|
sender.sendMessage(ChatColor.AQUA + "You have been set to level " + Integer.toString(new_level));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -10,33 +9,22 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_setspawnworld extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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();
|
Location pos = sender_p.getLocation();
|
||||||
sender_p.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
sender_p.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
sender.sendMessage(ChatColor.GRAY + "Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
||||||
|
|
||||||
if (TotalFreedomMod.protectedAreasEnabled && TotalFreedomMod.autoProtectSpawnpoints)
|
if (TotalFreedomMod.protectedAreasEnabled && TotalFreedomMod.autoProtectSpawnpoints)
|
||||||
{
|
{
|
||||||
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TotalFreedomMod.autoProtectRadius);
|
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TotalFreedomMod.autoProtectRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -11,7 +9,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_smite extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -22,12 +20,6 @@ public class Command_smite extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_status extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,12 +3,11 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_stfu extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -19,12 +18,6 @@ public class Command_stfu extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(sender, "Muted players:");
|
TFM_Util.playerMsg(sender, "Muted players:");
|
||||||
|
@ -1,34 +1,26 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_stop extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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);
|
||||||
{
|
|
||||||
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
|
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
|
||||||
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
|
||||||
}
|
|
||||||
|
|
||||||
server.shutdown();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.shutdown();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_survival extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@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;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -2,15 +2,14 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_tempban extends TFM_Command
|
||||||
{
|
{
|
||||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,23 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
|
import me.StevenLawson.TotalFreedomMod.TFM_RunSystemCommand;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_terminal extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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;
|
String command;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_tfbanlist extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_tfipbanlist extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
public class Command_tossmob extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -23,74 +24,63 @@ public class Command_tossmob extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole)
|
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p);
|
||||||
|
|
||||||
|
EntityType creature = EntityType.PIG;
|
||||||
|
if (args.length >= 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
if (TFM_Util.isStopCommand(args[0]))
|
||||||
|
{
|
||||||
|
playerData.disableMobThrower();
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "MobThrower is disabled.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Supported mobs: " + StringUtils.join(TFM_Util.mobtypes.keySet(), ", "));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
creature = TFM_Util.getEntityType(args[0]);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + args[0] + " is not a supported mob type. Using a pig instead.");
|
||||||
|
sender.sendMessage(ChatColor.RED + "By the way, you can type /tossmob list to see all possible mobs.");
|
||||||
|
creature = EntityType.PIG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (sender.isOp())
|
|
||||||
|
double speed = 1.0;
|
||||||
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p);
|
try
|
||||||
|
|
||||||
EntityType creature = EntityType.PIG;
|
|
||||||
if (args.length >= 1)
|
|
||||||
{
|
{
|
||||||
if (TFM_Util.isStopCommand(args[0]))
|
speed = Double.parseDouble(args[1]);
|
||||||
{
|
|
||||||
playerData.disableMobThrower();
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "MobThrower is disabled.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Supported mobs: " + StringUtils.join(TFM_Util.mobtypes.keySet(), ", "));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
creature = TFM_Util.getEntityType(args[0]);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.RED + args[0] + " is not a supported mob type. Using a pig instead.");
|
|
||||||
sender.sendMessage(ChatColor.RED + "By the way, you can type /tossmob list to see all possible mobs.");
|
|
||||||
creature = EntityType.PIG;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException nfex)
|
||||||
double speed = 1.0;
|
|
||||||
if (args.length >= 2)
|
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
speed = Double.parseDouble(args[1]);
|
|
||||||
}
|
|
||||||
catch (NumberFormatException nfex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speed < 1.0)
|
|
||||||
{
|
|
||||||
speed = 1.0;
|
|
||||||
}
|
|
||||||
else if (speed > 5.0)
|
|
||||||
{
|
|
||||||
speed = 5.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerData.enableMobThrower(creature, speed);
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Left click while holding a stick to throw mobs!");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Type '/tossmob off' to disable. -By Madgeek1450");
|
|
||||||
|
|
||||||
sender_p.setItemInHand(new ItemStack(Material.STICK, 1));
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (speed < 1.0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
speed = 1.0;
|
||||||
}
|
}
|
||||||
|
else if (speed > 5.0)
|
||||||
|
{
|
||||||
|
speed = 5.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerData.enableMobThrower(creature, speed);
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".");
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Left click while holding a stick to throw mobs!");
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Type '/tossmob off' to disable. -By Madgeek1450");
|
||||||
|
|
||||||
|
sender_p.setItemInHand(new ItemStack(Material.STICK, 1));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,29 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_uall extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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);
|
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");
|
server.dispatchCommand(p, "u");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + e.getMessage());
|
server.dispatchCommand(sender, "u *");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,32 +6,27 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_waterplace extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowWaterPlace = true;
|
return false;
|
||||||
sender.sendMessage("Water placement is now enabled.");
|
}
|
||||||
}
|
|
||||||
else
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TotalFreedomMod.allowWaterPlace = false;
|
TotalFreedomMod.allowWaterPlace = true;
|
||||||
sender.sendMessage("Water placement is now disabled.");
|
sender.sendMessage("Water placement is now enabled.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
TotalFreedomMod.allowWaterPlace = false;
|
||||||
|
sender.sendMessage("Water placement is now disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_whitelist extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -21,12 +22,6 @@ public class Command_whitelist extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sender.isOp())
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// list
|
// list
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
|
@ -1,38 +1,29 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import org.apache.commons.lang.StringUtils;
|
||||||
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.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_wildcard extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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"))
|
||||||
{
|
{
|
||||||
if (args[0].equals("wildcard"))
|
sender.sendMessage("What the hell are you trying to do, you stupid idiot...");
|
||||||
{
|
return true;
|
||||||
sender.sendMessage("What the hell are you trying to do, you stupid idiot...");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String base_command = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
|
||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
|
||||||
sender.sendMessage("Running Command: " + out_command);
|
|
||||||
server.dispatchCommand(sender, out_command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
String base_command = StringUtils.join(args, " ");
|
||||||
|
|
||||||
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
||||||
|
sender.sendMessage("Running Command: " + out_command);
|
||||||
|
server.dispatchCommand(sender, out_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_wipeflatlands extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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.setSavedFlag("do_wipe_flatlands", true);
|
||||||
|
|
||||||
TFM_Util.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
TFM_Util.bcastMsg("Server is going offline for flatlands wipe.", ChatColor.GRAY);
|
||||||
|
@ -4,80 +4,74 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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
|
public class Command_ziptool extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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 <= 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
if (args[0].equalsIgnoreCase("zip"))
|
||||||
if (args.length <= 1)
|
{
|
||||||
{
|
File directory = new File("./" + args[1]);
|
||||||
return false;
|
|
||||||
}
|
if (!directory.isDirectory())
|
||||||
|
{
|
||||||
if (args[0].equalsIgnoreCase("zip"))
|
sender.sendMessage(directory.getPath() + " is not a directory.");
|
||||||
{
|
return true;
|
||||||
File directory = new File("./" + args[1]);
|
}
|
||||||
|
|
||||||
if (!directory.isDirectory())
|
File output = new File(directory.getParent() + "/" + directory.getName() + ".zip");
|
||||||
{
|
|
||||||
sender.sendMessage(directory.getPath() + " is not a directory.");
|
sender.sendMessage("Zipping '" + directory.getPath() + "' to '" + output.getPath() + "'.");
|
||||||
return true;
|
|
||||||
}
|
try
|
||||||
|
{
|
||||||
File output = new File(directory.getParent() + "/" + directory.getName() + ".zip");
|
TFM_Util.zip(directory, output, true, sender);
|
||||||
|
}
|
||||||
sender.sendMessage("Zipping '" + directory.getPath() + "' to '" + output.getPath() + "'.");
|
catch (IOException ex)
|
||||||
|
{
|
||||||
try
|
TFM_Log.severe(ex);
|
||||||
{
|
}
|
||||||
TFM_Util.zip(directory, output, true, sender);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Zip finished.");
|
sender.sendMessage("Zip finished.");
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("unzip"))
|
else if (args[0].equalsIgnoreCase("unzip"))
|
||||||
{
|
{
|
||||||
File output = new File(args[1]);
|
File output = new File(args[1]);
|
||||||
|
|
||||||
if (!output.exists() || !output.isFile())
|
if (!output.exists() || !output.isFile())
|
||||||
{
|
{
|
||||||
sender.sendMessage(output.getPath() + " is not a file.");
|
sender.sendMessage(output.getPath() + " is not a file.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Unzipping '" + output.getPath() + "'.");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TFM_Util.unzip(output, output.getParentFile());
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Unzip finished.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
sender.sendMessage("Unzipping '" + output.getPath() + "'.");
|
||||||
}
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TFM_Util.unzip(output, output.getParentFile());
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage("Unzip finished.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ public class TFM_Util
|
|||||||
TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
|
TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static String implodeStringList(String glue, List<String> pieces)
|
public static String implodeStringList(String glue, List<String> pieces)
|
||||||
{
|
{
|
||||||
return StringUtils.join(pieces, glue);
|
return StringUtils.join(pieces, glue);
|
||||||
|
@ -8,6 +8,7 @@ import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
|||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -122,7 +123,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
sender_p.getName(),
|
sender_p.getName(),
|
||||||
ChatColor.stripColor(sender_p.getDisplayName()),
|
ChatColor.stripColor(sender_p.getDisplayName()),
|
||||||
commandLabel,
|
commandLabel,
|
||||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
|
StringUtils.join(args, " ")), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -130,7 +131,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||||
sender.getName(),
|
sender.getName(),
|
||||||
commandLabel,
|
commandLabel,
|
||||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
|
StringUtils.join(args, " ")), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Command dispatcher;
|
TFM_Command dispatcher;
|
||||||
|
Loading…
Reference in New Issue
Block a user