mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Moved all commands into separate classes.
This commit is contained in:
parent
36e7de0a08
commit
7ea371e59d
@ -61,7 +61,7 @@ public class TFM_BlockListener extends BlockListener
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
p.getInventory().clear();
|
||||
|
||||
plugin.tfBroadcastMessage(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
|
||||
plugin.tfm_broadcastMessage(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -74,7 +74,7 @@ public class TFM_BlockListener extends BlockListener
|
||||
|
||||
if (playerdata.getBlockDestroyCount() > plugin.nukeMonitorCount)
|
||||
{
|
||||
plugin.tfBroadcastMessage(p.getName() + " is breaking blocks too fast!", ChatColor.RED);
|
||||
plugin.tfm_broadcastMessage(p.getName() + " is breaking blocks too fast!", ChatColor.RED);
|
||||
|
||||
p.setOp(false);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
|
418
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_Admin.java
Normal file
418
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_Admin.java
Normal file
@ -0,0 +1,418 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
//TFM_Cmds_Admin:
|
||||
//fr
|
||||
//gtfo
|
||||
//gadmin
|
||||
//wildcard
|
||||
//nonuke
|
||||
//prelog
|
||||
//cake
|
||||
|
||||
public class TFM_Cmds_Admin implements CommandExecutor
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Cmds_Admin(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Player sender_p = null;
|
||||
boolean senderIsConsole = false;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
sender_p = (Player) sender;
|
||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("fr"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
plugin.allPlayersFrozen = !plugin.allPlayersFrozen;
|
||||
|
||||
if (plugin.allPlayersFrozen)
|
||||
{
|
||||
plugin.allPlayersFrozen = true;
|
||||
sender.sendMessage("Players are now frozen.");
|
||||
plugin.tfm_broadcastMessage(sender.getName() + " has temporarily frozen everyone on the server.", ChatColor.AQUA);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allPlayersFrozen = false;
|
||||
sender.sendMessage("Players are now free to move.");
|
||||
plugin.tfm_broadcastMessage(sender.getName() + " has unfrozen everyone.", ChatColor.AQUA);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = (TFM_UserInfo) plugin.userinfo.get(p);
|
||||
if (playerdata != null)
|
||||
{
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata = new TFM_UserInfo();
|
||||
playerdata.setFrozen(true);
|
||||
plugin.userinfo.put(p, playerdata);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("gtfo"))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
plugin.tfm_broadcastMessage(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
//Attempt to kill:
|
||||
p.setHealth(0);
|
||||
|
||||
//Ban IP Address:
|
||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||
plugin.tfm_broadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
|
||||
//Ban Username:
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
|
||||
//Kick Player:
|
||||
p.kickPlayer("GTFO");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("gadmin"))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String mode = args[0].toLowerCase();
|
||||
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (mode.equals("list"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
|
||||
}
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String hash = p.getUniqueId().toString().substring(0, 4);
|
||||
if (mode.equals("list"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
|
||||
p.getName(),
|
||||
ChatColor.stripColor(p.getDisplayName()),
|
||||
hash));
|
||||
}
|
||||
else if (hash.equalsIgnoreCase(args[1]))
|
||||
{
|
||||
if (mode.equals("kick"))
|
||||
{
|
||||
p.kickPlayer("Kicked by Administrator");
|
||||
}
|
||||
else if (mode.equals("nameban"))
|
||||
{
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
plugin.tfm_broadcastMessage(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().toString().replaceAll("/", "").trim();
|
||||
plugin.tfm_broadcastMessage(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
p.kickPlayer("IP address banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("ban"))
|
||||
{
|
||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||
plugin.tfm_broadcastMessage(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||
Bukkit.banIP(user_ip);
|
||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
p.kickPlayer("IP and username banned by Administrator.");
|
||||
}
|
||||
else if (mode.equals("op"))
|
||||
{
|
||||
plugin.tfm_broadcastMessage(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"))
|
||||
{
|
||||
plugin.tfm_broadcastMessage(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) plugin.userinfo.get(p);
|
||||
if (playerdata != null)
|
||||
{
|
||||
playerdata.setFrozen(!playerdata.isFrozen());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata = new TFM_UserInfo();
|
||||
playerdata.setFrozen(true);
|
||||
plugin.userinfo.put(p, playerdata);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mode.equals("list"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Invalid hash.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("wildcard"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args[0].equals("wildcard"))
|
||||
{
|
||||
sender.sendMessage("What the hell are you trying to do, you stupid idiot...");
|
||||
return true;
|
||||
}
|
||||
|
||||
String base_command = plugin.implodeStringList(" ", Arrays.asList(args));
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
||||
sender.sendMessage("Running Command: " + out_command);
|
||||
Bukkit.getServer().dispatchCommand(sender, out_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("nonuke"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
plugin.nukeMonitorRange = Double.parseDouble(args[1]);
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
plugin.nukeMonitorCount = Integer.parseInt(args[2]);
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.nukeMonitor = true;
|
||||
sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled.");
|
||||
sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + plugin.nukeMonitorRange + " blocks.");
|
||||
sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + plugin.nukeMonitorCount + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.nukeMonitor = false;
|
||||
sender.sendMessage("Nuke monitor is disabled.");
|
||||
}
|
||||
|
||||
TotalFreedomMod.CONFIG.load();
|
||||
TotalFreedomMod.CONFIG.setProperty("nuke_monitor", plugin.nukeMonitor);
|
||||
TotalFreedomMod.CONFIG.setProperty("nuke_monitor_range", plugin.nukeMonitorRange);
|
||||
TotalFreedomMod.CONFIG.setProperty("nuke_monitor_count", plugin.nukeMonitorCount);
|
||||
TotalFreedomMod.CONFIG.save();
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("prelog"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.preprocessLogEnabled = true;
|
||||
sender.sendMessage("Command preprocess logging is now enabled. This will be spammy in the log.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.preprocessLogEnabled = false;
|
||||
sender.sendMessage("Command preprocess logging is now disabled.");
|
||||
}
|
||||
|
||||
TotalFreedomMod.CONFIG.load();
|
||||
TotalFreedomMod.CONFIG.setProperty("preprocess_log", plugin.preprocessLogEnabled);
|
||||
TotalFreedomMod.CONFIG.save();
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("cake"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
StringBuilder output = new StringBuilder();
|
||||
Random randomGenerator = new Random();
|
||||
|
||||
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 : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
||||
}
|
||||
|
||||
plugin.tfm_broadcastMessage(output.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_Admin.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
223
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_AntiBlock.java
Normal file
223
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_AntiBlock.java
Normal file
@ -0,0 +1,223 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//TFM_Cmds_AntiBlock:
|
||||
//explosives
|
||||
//lavadmg
|
||||
//firespread
|
||||
//lavaplace
|
||||
//waterplace
|
||||
//fireplace
|
||||
|
||||
public class TFM_Cmds_AntiBlock implements CommandExecutor
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Cmds_AntiBlock(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Player sender_p = null;
|
||||
boolean senderIsConsole = false;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
sender_p = (Player) sender;
|
||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("explosives"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
plugin.explosiveRadius = Double.parseDouble(args[1]);
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowExplosions = true;
|
||||
sender.sendMessage("Explosives are now enabled, radius set to " + plugin.explosiveRadius + " blocks.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowExplosions = false;
|
||||
sender.sendMessage("Explosives are now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("firespread"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowFireSpread = true;
|
||||
sender.sendMessage("Fire spread is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowFireSpread = false;
|
||||
sender.sendMessage("Fire spread is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("fireplace"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowFirePlace = true;
|
||||
sender.sendMessage("Fire placement is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowFirePlace = false;
|
||||
sender.sendMessage("Fire placement is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("lavadmg"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowLavaDamage = true;
|
||||
sender.sendMessage("Lava damage is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowLavaDamage = false;
|
||||
sender.sendMessage("Lava damage is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("lavaplace"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowLavaPlace = true;
|
||||
sender.sendMessage("Lava placement is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowLavaPlace = false;
|
||||
sender.sendMessage("Lava placement is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("waterplace"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
plugin.allowWaterPlace = true;
|
||||
sender.sendMessage("Water placement is now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.allowWaterPlace = false;
|
||||
sender.sendMessage("Water placement is now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_AntiBlock.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
244
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_General.java
Normal file
244
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_General.java
Normal file
@ -0,0 +1,244 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
//TFM_Cmds_General:
|
||||
//creative
|
||||
//survival
|
||||
//status
|
||||
//radar
|
||||
//mp
|
||||
//rd
|
||||
|
||||
public class TFM_Cmds_General implements CommandExecutor
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Cmds_General(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Player sender_p = null;
|
||||
boolean senderIsConsole = false;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
sender_p = (Player) sender;
|
||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("creative"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sender.isOp())
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Player p;
|
||||
if (args.length == 0)
|
||||
{
|
||||
p = Bukkit.getPlayerExact(sender.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage("Setting " + p.getName() + " to game mode 'Creative'.");
|
||||
p.sendMessage(sender.getName() + " set your game mode to 'Creative'.");
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("survival"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target user to change gamemode on.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sender.isOp())
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Player p;
|
||||
if (args.length == 0)
|
||||
{
|
||||
p = Bukkit.getPlayerExact(sender.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage("Setting " + p.getName() + " to game mode 'Survival'.");
|
||||
p.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("status"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("radar"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("This command can only be used in-game.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player sender_player = Bukkit.getPlayerExact(sender.getName());
|
||||
Location sender_pos = sender_player.getLocation();
|
||||
String sender_world = sender_player.getWorld().getName();
|
||||
|
||||
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (sender_world.equals(p.getWorld().getName()) && !p.getName().equals(sender.getName()))
|
||||
{
|
||||
radar_data.add(new TFM_RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(radar_data, new TFM_RadarData());
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + "People nearby in " + sender_world + ":");
|
||||
|
||||
int countmax = 5;
|
||||
if (args.length == 1)
|
||||
{
|
||||
countmax = Integer.parseInt(args[0]);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (TFM_RadarData i : radar_data)
|
||||
{
|
||||
if (count++ > countmax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d blocks away @ %s.", i.player.getName(), Math.round(i.distance), plugin.formatLocation(i.location)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("rd"))
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Removing all dropped items, arrows, exp. orbs and TNT...");
|
||||
sender.sendMessage(ChatColor.GRAY + String.valueOf(plugin.wipeDropEntities()) + " dropped enties removed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("mp"))
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
|
||||
|
||||
int removed = 0;
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
for (Entity ent : world.getEntities())
|
||||
{
|
||||
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime)
|
||||
{
|
||||
ent.remove();
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_General.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
201
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java
Normal file
201
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java
Normal file
@ -0,0 +1,201 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//TFM_Cmds_OP:
|
||||
//opme
|
||||
//opall
|
||||
//deopall
|
||||
//qop
|
||||
//qdeop
|
||||
|
||||
public class TFM_Cmds_OP implements CommandExecutor
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Cmds_OP(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Player sender_p = null;
|
||||
boolean senderIsConsole = false;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
sender_p = (Player) sender;
|
||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("opme"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("This command only works in-game.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
plugin.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY);
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("opall"))
|
||||
{
|
||||
if (plugin.isUserSuperadmin(sender) || senderIsConsole)
|
||||
{
|
||||
plugin.tfm_broadcastMessage(String.format("(%s: Opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||
|
||||
boolean doSetGamemode = false;
|
||||
GameMode targetGamemode = GameMode.CREATIVE;
|
||||
if (args.length != 0)
|
||||
{
|
||||
if (args[0].equals("-c"))
|
||||
{
|
||||
doSetGamemode = true;
|
||||
targetGamemode = GameMode.CREATIVE;
|
||||
}
|
||||
else if (args[0].equals("-s"))
|
||||
{
|
||||
doSetGamemode = true;
|
||||
targetGamemode = GameMode.SURVIVAL;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(true);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
|
||||
if (doSetGamemode)
|
||||
{
|
||||
p.setGameMode(targetGamemode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("deopall"))
|
||||
{
|
||||
if (plugin.isUserSuperadmin(sender) || senderIsConsole)
|
||||
{
|
||||
plugin.tfm_broadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.isUserSuperadmin(p) && !p.getName().equals(sender.getName()))
|
||||
{
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
plugin.tfm_broadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
p.setOp(true);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
sender.sendMessage("No targets matched.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
plugin.tfm_broadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
sender.sendMessage("No targets matched.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_OP.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
169
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_Override.java
Normal file
169
src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_Override.java
Normal file
@ -0,0 +1,169 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//TFM_Cmds_Override:
|
||||
//say
|
||||
//stop
|
||||
//list/listreal
|
||||
|
||||
public class TFM_Cmds_Override implements CommandExecutor
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Cmds_Override(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Player sender_p = null;
|
||||
boolean senderIsConsole = false;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
sender_p = (Player) sender;
|
||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s", sender_p.getName(), ChatColor.stripColor(sender_p.getDisplayName()), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, plugin.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("say"))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
String message = plugin.implodeStringList(" ", Arrays.asList(args));
|
||||
plugin.tfm_broadcastMessage(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("stop"))
|
||||
{
|
||||
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||
{
|
||||
plugin.tfm_broadcastMessage("Server is going offline.", ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||
}
|
||||
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("listreal") || cmd.getName().equalsIgnoreCase("list"))
|
||||
{
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
|
||||
if (senderIsConsole)
|
||||
{
|
||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers()));
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append("[OP]").append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
|
||||
onlineUsers.append(ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(onlineStats.toString());
|
||||
sender.sendMessage(onlineUsers.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_Override.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -116,7 +116,7 @@ class TFM_PlayerListener extends PlayerListener
|
||||
{
|
||||
p.setOp(false);
|
||||
p.kickPlayer("No Spamming");
|
||||
plugin.tfBroadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
||||
plugin.tfm_broadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
name: TotalFreedomMod
|
||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||
version: 1.4
|
||||
version: 1.5
|
||||
description: Plugin for the Total Freedom server
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user