mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
v2.0 Overhaul
This commit is contained in:
parent
e094c9c114
commit
d1df1c8398
@ -26,13 +26,12 @@ dist.jar=${dist.dir}/TotalFreedomMod.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
||||
file.reference.MobDisguise.jar=C:\\github\\MobDisguise\\dist\\MobDisguise.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.bukkit-0.0.1-SNAPSHOT.jar}:\
|
||||
${file.reference.MobDisguise.jar}
|
||||
${file.reference.MobDisguise.jar}:\
|
||||
${libs.Bukkit.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=-Xlint:unchecked
|
||||
javac.deprecation=false
|
||||
|
@ -0,0 +1,94 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_cage extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
Material cage_material_outer = Material.GLASS;
|
||||
Material cage_material_inner = Material.AIR;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("end") || args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("stop"))
|
||||
{
|
||||
playerdata.setCaged(false);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cage_material_outer = Material.matchMaterial(args[1]);
|
||||
if (cage_material_outer == null)
|
||||
{
|
||||
cage_material_outer = Material.GLASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("water"))
|
||||
{
|
||||
cage_material_inner = Material.STATIONARY_WATER;
|
||||
}
|
||||
else if (args[2].equalsIgnoreCase("lava"))
|
||||
{
|
||||
cage_material_inner = Material.STATIONARY_LAVA;
|
||||
}
|
||||
}
|
||||
|
||||
Location target_pos = p.getLocation().add(0, 1, 0);
|
||||
playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
TFM_Util.buildHistory(target_pos, 2, playerdata);
|
||||
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
|
||||
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
|
||||
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(sender.getName() + " caged " + p.getName() + "!", ChatColor.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Random;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Command_cake extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(output.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_creative extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_csay extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
String sender_name = sender.getName();
|
||||
|
||||
if (sender_name.equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
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.tfm_broadcastMessage(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender_name, outmessage_bldr.toString().trim()));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_deopall extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender, plugin) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.tfm_broadcastMessage(String.format("(%s: De-opping all players on server)", sender.getName()), ChatColor.YELLOW);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging ops.txt.");
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOperators())
|
||||
{
|
||||
p.setOp(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Command_expel extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
double radius = 50.0;
|
||||
double strength = 100.0;
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
radius = Double.parseDouble(args[0]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
strength = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!p.equals(sender_p))
|
||||
{
|
||||
Location target_pos = p.getLocation();
|
||||
if (target_pos.getWorld().equals(sender_pos.getWorld()))
|
||||
{
|
||||
if (target_pos.distance(sender_pos) < radius)
|
||||
{
|
||||
sender.sendMessage("Pushing " + p.getName());
|
||||
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
||||
p.setVelocity(expel_direction.multiply(strength));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_explosives extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.explosiveRadius = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_fireplace extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_firespread extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_flatlands extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "flatlands");
|
||||
return true;
|
||||
}
|
||||
}
|
65
src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java
Normal file
65
src/me/StevenLawson/TotalFreedomMod/Commands/Command_fr.java
Normal file
@ -0,0 +1,65 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_fr extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
plugin.allPlayersFrozen = !plugin.allPlayersFrozen;
|
||||
|
||||
if (plugin.allPlayersFrozen)
|
||||
{
|
||||
plugin.allPlayersFrozen = true;
|
||||
sender.sendMessage("Players are now frozen.");
|
||||
TFM_Util.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.");
|
||||
TFM_Util.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.getPlayerData(p, plugin);
|
||||
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
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
109
src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java
Normal file
109
src/me/StevenLawson/TotalFreedomMod/Commands/Command_gadmin.java
Normal file
@ -0,0 +1,109 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_gadmin extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String mode = args[0].toLowerCase();
|
||||
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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);
|
||||
TFM_Util.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();
|
||||
TFM_Util.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();
|
||||
TFM_Util.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"))
|
||||
{
|
||||
TFM_Util.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"))
|
||||
{
|
||||
TFM_Util.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.getPlayerData(p, plugin);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mode.equals("list"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Invalid hash.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_gcmd extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
String outcommand = "";
|
||||
try
|
||||
{
|
||||
StringBuilder outcommand_bldr = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++)
|
||||
{
|
||||
outcommand_bldr.append(args[i]).append(" ");
|
||||
}
|
||||
outcommand = outcommand_bldr.toString().trim();
|
||||
}
|
||||
catch (Exception cmdex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error building command: " + cmdex.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
|
||||
if (Bukkit.getServer().dispatchCommand(p, outcommand))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Command sent.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
||||
}
|
||||
}
|
||||
catch (Exception cmdex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + cmdex.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_gtfo extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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_Util.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
//Undo WorldEdits:
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), 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().toString().replaceAll("/", "").trim();
|
||||
TFM_Util.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;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_lavadmg extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_lavaplace extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_list extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
42
src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java
Normal file
42
src/me/StevenLawson/TotalFreedomMod/Commands/Command_mp.java
Normal file
@ -0,0 +1,42 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class Command_mp extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_mp44 extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(sender_p, plugin);
|
||||
|
||||
if (args[0].equalsIgnoreCase("draw"))
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
int schedule_id = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(sender_p), 1L, 1L);
|
||||
playerdata.startArrowShooter(schedule_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class ArrowShooter implements Runnable
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
public ArrowShooter(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot_arrow = _player.shootArrow();
|
||||
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_nether extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "nether");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_nonuke extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.nukeMonitorRange = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.nukeMonitorCountBreak = Integer.parseInt(args[2]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
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.nukeMonitorCountBreak + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.nukeMonitor = false;
|
||||
sender.sendMessage("Nuke monitor is disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_opall extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender, plugin) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.tfm_broadcastMessage(String.format("(%s: Opping all players on server)", sender.getName()), ChatColor.YELLOW);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_opme extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Command_orbit extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
double strength = 10.0;
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("end"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName());
|
||||
playerdata.stopOrbiting();
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
strength = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
strength = 10.0;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_prelog extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_qdeop extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_qjail extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
//Send to jail "mgjail":
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tjail %s mgjail 1y", p.getName().replace(" ", "").trim()));
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(p.getName() + " has been JAILED!", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_qop extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_radar extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
countmax = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (TFM_RadarData i : radar_data)
|
||||
{
|
||||
if (count++ > countmax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d, Disguised: %s",
|
||||
i.player.getName(),
|
||||
Math.round(i.distance),
|
||||
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
27
src/me/StevenLawson/TotalFreedomMod/Commands/Command_rd.java
Normal file
27
src/me/StevenLawson/TotalFreedomMod/Commands/Command_rd.java
Normal file
@ -0,0 +1,27 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_rd extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Removing all dropped items, arrows, exp. orbs and TNT...");
|
||||
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeDropEntities(true)) + " dropped enties removed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_say extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
||||
TFM_Util.tfm_broadcastMessage(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_skylands extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "skylands");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_status extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Server is currently running with 'online-mode=" + (Bukkit.getOnlineMode() ? "true" : "false") + "'.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
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.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_stop extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_survival extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_tfbanlist extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
{
|
||||
p.setBanned(false);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Ban list has been purged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to purge the ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder banned_players = new StringBuilder();
|
||||
banned_players.append("Banned Players: ");
|
||||
boolean first = true;
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_players.append(", ");
|
||||
}
|
||||
first = false;
|
||||
banned_players.append(p.getName().trim());
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + banned_players.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_tfipbanlist extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (String ip : Bukkit.getIPBans())
|
||||
{
|
||||
Bukkit.unbanIP(ip);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "IP Ban list has been purged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to purge the IP ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ip_bans = Arrays.asList(Bukkit.getIPBans().toArray(new String[0]));
|
||||
Collections.sort(ip_bans);
|
||||
|
||||
StringBuilder banned_ips = new StringBuilder();
|
||||
banned_ips.append("Banned IPs: ");
|
||||
boolean first = true;
|
||||
for (String ip : ip_bans)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_ips.append(", ");
|
||||
}
|
||||
if (ip.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"))
|
||||
{
|
||||
first = false;
|
||||
banned_ips.append(ip.trim());
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + banned_ips.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_tfsmite extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
List<Player> targets = new ArrayList<Player>();
|
||||
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
targets = Arrays.asList(Bukkit.getOnlinePlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
targets.add(matches.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : targets)
|
||||
{
|
||||
TFM_Util.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();
|
||||
|
||||
//Flag for insta-kill:
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
playerdata.setForcedDeath(true);
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_tossmob extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p, plugin);
|
||||
|
||||
CreatureType creature = CreatureType.PIG;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("end"))
|
||||
{
|
||||
playerData.disableMobThrower();
|
||||
sender.sendMessage(ChatColor.GREEN + "MobThrower is disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Map<String, CreatureType> mobtypes = new HashMap<String, CreatureType>();
|
||||
mobtypes.put("chicken", CreatureType.CHICKEN);
|
||||
mobtypes.put("cow", CreatureType.COW);
|
||||
mobtypes.put("creeper", CreatureType.CREEPER);
|
||||
mobtypes.put("pig", CreatureType.PIG);
|
||||
mobtypes.put("sheep", CreatureType.SHEEP);
|
||||
mobtypes.put("skeleton", CreatureType.SKELETON);
|
||||
mobtypes.put("spider", CreatureType.SPIDER);
|
||||
mobtypes.put("zombie", CreatureType.ZOMBIE);
|
||||
mobtypes.put("wolf", CreatureType.WOLF);
|
||||
|
||||
CreatureType creature_query = mobtypes.get(args[0].toLowerCase().trim());
|
||||
if (creature_query != null)
|
||||
{
|
||||
creature = creature_query;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(args[0] + " is not a supported mob type. Using a pig instead.");
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_umd extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (MobDisguiseAPI.isDisguised(p))
|
||||
{
|
||||
p.sendMessage(ChatColor.GRAY + "You have been undisguised by an administrator.");
|
||||
}
|
||||
|
||||
MobDisguiseAPI.undisguisePlayer(p);
|
||||
MobDisguiseAPI.undisguisePlayerAsPlayer(p, "");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "All players have been undisguised.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_waterplace extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_wildcard extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args[0].equals("wildcard"))
|
||||
{
|
||||
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 : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
||||
sender.sendMessage("Running Command: " + out_command);
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), out_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_Command
|
||||
{
|
||||
protected TotalFreedomMod plugin;
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Command()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
log.severe("Command Error: Command not implemented: " + cmd.getName());
|
||||
sender.sendMessage(ChatColor.RED + "Command Error: Command not implemented: " + cmd.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPlugin(TotalFreedomMod plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -14,7 +17,7 @@ public class TFM_BlockListener extends BlockListener
|
||||
private TotalFreedomMod plugin;
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
TFM_BlockListener(TotalFreedomMod instance)
|
||||
public TFM_BlockListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@ -8,7 +10,7 @@ public class TFM_EntityListener extends EntityListener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
||||
TFM_EntityListener(TotalFreedomMod instance)
|
||||
public TFM_EntityListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -12,12 +15,12 @@ import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
class TFM_PlayerListener extends PlayerListener
|
||||
public class TFM_PlayerListener extends PlayerListener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
TFM_PlayerListener(TotalFreedomMod instance)
|
||||
public TFM_PlayerListener(TotalFreedomMod instance)
|
||||
{
|
||||
this.plugin = instance;
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.event.weather.*;
|
||||
|
||||
class TFM_WeatherListener extends WeatherListener
|
||||
public class TFM_WeatherListener extends WeatherListener
|
||||
{
|
||||
private TotalFreedomMod plugin;
|
||||
|
@ -1,879 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
||||
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.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
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, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("fr"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
plugin.allPlayersFrozen = !plugin.allPlayersFrozen;
|
||||
|
||||
if (plugin.allPlayersFrozen)
|
||||
{
|
||||
plugin.allPlayersFrozen = true;
|
||||
sender.sendMessage("Players are now frozen.");
|
||||
TFM_Util.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.");
|
||||
TFM_Util.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.getPlayerData(p, plugin);
|
||||
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
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("gtfo"))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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_Util.tfm_broadcastMessage(p.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
||||
//Undo WorldEdits:
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), 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().toString().replaceAll("/", "").trim();
|
||||
TFM_Util.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("tfsmite"))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
List<Player> targets = new ArrayList<Player>();
|
||||
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
targets = Arrays.asList(Bukkit.getOnlinePlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage("Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
targets.add(matches.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : targets)
|
||||
{
|
||||
TFM_Util.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();
|
||||
|
||||
//Flag for insta-kill:
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
playerdata.setForcedDeath(true);
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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);
|
||||
TFM_Util.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();
|
||||
TFM_Util.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();
|
||||
TFM_Util.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"))
|
||||
{
|
||||
TFM_Util.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"))
|
||||
{
|
||||
TFM_Util.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.getPlayerData(p, plugin);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args[0].equals("wildcard"))
|
||||
{
|
||||
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 : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
String out_command = base_command.replaceAll("\\x3f", p.getName());
|
||||
sender.sendMessage("Running Command: " + out_command);
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), out_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("nonuke"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.nukeMonitorRange = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.nukeMonitorCountBreak = Integer.parseInt(args[2]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
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.nukeMonitorCountBreak + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.nukeMonitor = false;
|
||||
sender.sendMessage("Nuke monitor is disabled.");
|
||||
}
|
||||
|
||||
// FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), TotalFreedomMod.CONFIG_FILE));
|
||||
// config.set("nuke_monitor", plugin.nukeMonitor);
|
||||
// config.set("nuke_monitor_range", plugin.nukeMonitorRange);
|
||||
// config.set("nuke_monitor_count", plugin.nukeMonitorCountBreak);
|
||||
// config.save(new File(plugin.getDataFolder(), TotalFreedomMod.CONFIG_FILE));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("prelog"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
// FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), TotalFreedomMod.CONFIG_FILE));
|
||||
// config.set("preprocess_log", plugin.preprocessLogEnabled);
|
||||
// config.save(new File(plugin.getDataFolder(), TotalFreedomMod.CONFIG_FILE));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("cake"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(output.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("gcmd"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
String outcommand = "";
|
||||
try
|
||||
{
|
||||
StringBuilder outcommand_bldr = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++)
|
||||
{
|
||||
outcommand_bldr.append(args[i]).append(" ");
|
||||
}
|
||||
outcommand = outcommand_bldr.toString().trim();
|
||||
}
|
||||
catch (Exception cmdex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error building command: " + cmdex.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Sending command as " + p.getName() + ": " + outcommand);
|
||||
if (Bukkit.getServer().dispatchCommand(p, outcommand))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Command sent.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Unknown error sending command.");
|
||||
}
|
||||
}
|
||||
catch (Exception cmdex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + cmdex.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("qjail"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
//Send to jail "mgjail":
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tjail %s mgjail 1y", p.getName().replace(" ", "").trim()));
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(p.getName() + " has been JAILED!", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("umd"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (MobDisguiseAPI.isDisguised(p))
|
||||
{
|
||||
p.sendMessage(ChatColor.GRAY + "You have been undisguised by an administrator.");
|
||||
}
|
||||
|
||||
MobDisguiseAPI.undisguisePlayer(p);
|
||||
MobDisguiseAPI.undisguisePlayerAsPlayer(p, "");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "All players have been undisguised.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("csay"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
String sender_name = sender.getName();
|
||||
|
||||
if (sender_name.equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
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.tfm_broadcastMessage(String.format("§7[CONSOLE]§f<§c%s§f> %s", sender_name, outmessage_bldr.toString().trim()));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("cage"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
Material cage_material_outer = Material.GLASS;
|
||||
Material cage_material_inner = Material.AIR;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("end") || args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("stop"))
|
||||
{
|
||||
playerdata.setCaged(false);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cage_material_outer = Material.matchMaterial(args[1]);
|
||||
if (cage_material_outer == null)
|
||||
{
|
||||
cage_material_outer = Material.GLASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 3)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("water"))
|
||||
{
|
||||
cage_material_inner = Material.STATIONARY_WATER;
|
||||
}
|
||||
else if (args[2].equalsIgnoreCase("lava"))
|
||||
{
|
||||
cage_material_inner = Material.STATIONARY_LAVA;
|
||||
}
|
||||
}
|
||||
|
||||
Location target_pos = p.getLocation().add(0, 1, 0);
|
||||
playerdata.setCaged(true, target_pos, cage_material_outer, cage_material_inner);
|
||||
playerdata.regenerateHistory();
|
||||
playerdata.clearHistory();
|
||||
TFM_Util.buildHistory(target_pos, 2, playerdata);
|
||||
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
|
||||
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
|
||||
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
|
||||
TFM_Util.tfm_broadcastMessage(sender.getName() + " caged " + p.getName() + "!", ChatColor.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("orbit"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player p;
|
||||
List<Player> matches = Bukkit.matchPlayer(args[0]);
|
||||
if (matches.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = matches.get(0);
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
double strength = 10.0;
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("end"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName());
|
||||
playerdata.stopOrbiting();
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
strength = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
strength = 10.0;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("expel"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
double radius = 50.0;
|
||||
double strength = 100.0;
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
radius = Double.parseDouble(args[0]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
strength = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!p.equals(sender_p))
|
||||
{
|
||||
Location target_pos = p.getLocation();
|
||||
if (target_pos.distance(sender_pos) < radius)
|
||||
{
|
||||
sender.sendMessage("Pushing " + p.getName());
|
||||
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
||||
p.setVelocity(expel_direction.multiply(strength));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("mp44"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(sender_p, plugin);
|
||||
|
||||
if (args[0].equalsIgnoreCase("draw"))
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
int schedule_id = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(sender_p), 1L, 1L);
|
||||
playerdata.startArrowShooter(schedule_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_Admin.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
class ArrowShooter implements Runnable
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
public ArrowShooter(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot_arrow = _player.shootArrow();
|
||||
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,221 +0,0 @@
|
||||
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;
|
||||
|
||||
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, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("explosives"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.explosiveRadius = Double.parseDouble(args[1]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,428 +0,0 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
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, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TFM_Util.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(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
countmax = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch (NumberFormatException nfex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (TFM_RadarData i : radar_data)
|
||||
{
|
||||
if (count++ > countmax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d, Disguised: %s",
|
||||
i.player.getName(),
|
||||
Math.round(i.distance),
|
||||
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"));
|
||||
}
|
||||
|
||||
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(TFM_Util.wipeDropEntities(true)) + " 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;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("flatlands"))
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "flatlands");
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("skylands"))
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "skylands");
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("nether"))
|
||||
{
|
||||
TFM_Util.gotoWorld(sender, "nether");
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("tfbanlist"))
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
{
|
||||
p.setBanned(false);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Ban list has been purged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to purge the ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder banned_players = new StringBuilder();
|
||||
banned_players.append("Banned Players: ");
|
||||
boolean first = true;
|
||||
for (OfflinePlayer p : Bukkit.getBannedPlayers())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_players.append(", ");
|
||||
}
|
||||
first = false;
|
||||
banned_players.append(p.getName().trim());
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + banned_players.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("tfipbanlist"))
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
for (String ip : Bukkit.getIPBans())
|
||||
{
|
||||
Bukkit.unbanIP(ip);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "IP Ban list has been purged.");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to purge the IP ban list, you may only view it.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> ip_bans = Arrays.asList(Bukkit.getIPBans().toArray(new String[0]));
|
||||
Collections.sort(ip_bans);
|
||||
|
||||
StringBuilder banned_ips = new StringBuilder();
|
||||
banned_ips.append("Banned IPs: ");
|
||||
boolean first = true;
|
||||
for (String ip : ip_bans)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
banned_ips.append(", ");
|
||||
}
|
||||
if (ip.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"))
|
||||
{
|
||||
first = false;
|
||||
banned_ips.append(ip.trim());
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + banned_ips.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (cmd.getName().equalsIgnoreCase("tossmob"))
|
||||
{
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_UserInfo playerData = TFM_UserInfo.getPlayerData(sender_p, plugin);
|
||||
|
||||
CreatureType creature = CreatureType.PIG;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("end"))
|
||||
{
|
||||
playerData.disableMobThrower();
|
||||
sender.sendMessage(ChatColor.GREEN + "MobThrower is disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Map<String, CreatureType> mobtypes = new HashMap<String, CreatureType>();
|
||||
mobtypes.put("chicken", CreatureType.CHICKEN);
|
||||
mobtypes.put("cow", CreatureType.COW);
|
||||
mobtypes.put("creeper", CreatureType.CREEPER);
|
||||
mobtypes.put("pig", CreatureType.PIG);
|
||||
mobtypes.put("sheep", CreatureType.SHEEP);
|
||||
mobtypes.put("skeleton", CreatureType.SKELETON);
|
||||
mobtypes.put("spider", CreatureType.SPIDER);
|
||||
mobtypes.put("zombie", CreatureType.ZOMBIE);
|
||||
mobtypes.put("wolf", CreatureType.WOLF);
|
||||
|
||||
CreatureType creature_query = mobtypes.get(args[0].toLowerCase().trim());
|
||||
if (creature_query != null)
|
||||
{
|
||||
creature = creature_query;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(args[1] + " is not a supported mob type. Using a pig instead.");
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Exception in TFM_Cmds_General.onCommand(): " + ex.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,205 +0,0 @@
|
||||
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.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("opme"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("This command only works in-game.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
TFM_Util.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 (TFM_Util.isUserSuperadmin(sender, plugin) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.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 (TFM_Util.isUserSuperadmin(sender, plugin) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.tfm_broadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Purging ops.txt.");
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOperators())
|
||||
{
|
||||
p.setOp(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
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;
|
||||
|
||||
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, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("say"))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
String message = TFM_Util.implodeStringList(" ", Arrays.asList(args));
|
||||
TFM_Util.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 || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
{
|
||||
TFM_Util.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;
|
||||
}
|
||||
}
|
@ -143,7 +143,7 @@ public class TFM_UserInfo
|
||||
return this.forced_death;
|
||||
}
|
||||
|
||||
void setForcedDeath(boolean forced_death)
|
||||
public void setForcedDeath(boolean forced_death)
|
||||
{
|
||||
this.forced_death = forced_death;
|
||||
}
|
||||
@ -273,12 +273,12 @@ public class TFM_UserInfo
|
||||
}
|
||||
}
|
||||
|
||||
void startArrowShooter(int schedule_id)
|
||||
public void startArrowShooter(int schedule_id)
|
||||
{
|
||||
this.mp44_schedule_id = schedule_id;
|
||||
}
|
||||
|
||||
void stopArrowShooter()
|
||||
public void stopArrowShooter()
|
||||
{
|
||||
if (this.mp44_schedule_id != -1)
|
||||
{
|
||||
|
@ -2,13 +2,18 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
||||
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -22,6 +27,8 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
|
||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||
public static final String CONFIG_FILE = "config.yml";
|
||||
private static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
||||
private static final String COMMAND_PREFIX = "Command_";
|
||||
|
||||
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||
@ -37,7 +44,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
{
|
||||
loadTFMConfig();
|
||||
registerEventHandlers();
|
||||
registerCommands();
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
|
||||
@ -52,6 +58,63 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Disabled.");
|
||||
}
|
||||
|
||||
@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,
|
||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
else
|
||||
{
|
||||
senderIsConsole = true;
|
||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||
sender.getName(),
|
||||
commandLabel,
|
||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
||||
}
|
||||
|
||||
TFM_Command dispatcher;
|
||||
try
|
||||
{
|
||||
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
|
||||
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
|
||||
dispatcher.setPlugin(this);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "Command not loaded: " + cmd.getName(), ex);
|
||||
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return dispatcher.run(sender, sender_p, cmd, commandLabel, args, senderIsConsole);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Command Error: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "Command Error: " + commandLabel, ex);
|
||||
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowFirePlace = false;
|
||||
public Boolean allowFireSpread = false;
|
||||
@ -155,61 +218,4 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
pm.registerEvent(Event.Type.WEATHER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||
pm.registerEvent(Event.Type.THUNDER_CHANGE, weatherListener, Event.Priority.High, this);
|
||||
}
|
||||
|
||||
private TFM_Cmds_OP OPCommands = new TFM_Cmds_OP(this);
|
||||
private TFM_Cmds_Override OverrideCommands = new TFM_Cmds_Override(this);
|
||||
private TFM_Cmds_General GeneralCommands = new TFM_Cmds_General(this);
|
||||
private TFM_Cmds_AntiBlock AntiblockCommands = new TFM_Cmds_AntiBlock(this);
|
||||
private TFM_Cmds_Admin AdminCommands = new TFM_Cmds_Admin(this);
|
||||
|
||||
private void registerCommands()
|
||||
{
|
||||
this.getCommand("deopall").setExecutor(OPCommands);
|
||||
this.getCommand("opall").setExecutor(OPCommands);
|
||||
this.getCommand("opme").setExecutor(OPCommands);
|
||||
this.getCommand("qdeop").setExecutor(OPCommands);
|
||||
this.getCommand("qop").setExecutor(OPCommands);
|
||||
|
||||
this.getCommand("tfbanlist").setExecutor(GeneralCommands);
|
||||
this.getCommand("creative").setExecutor(GeneralCommands);
|
||||
this.getCommand("flatlands").setExecutor(GeneralCommands);
|
||||
this.getCommand("tfipbanlist").setExecutor(GeneralCommands);
|
||||
this.getCommand("mp").setExecutor(GeneralCommands);
|
||||
this.getCommand("nether").setExecutor(GeneralCommands);
|
||||
this.getCommand("radar").setExecutor(GeneralCommands);
|
||||
this.getCommand("rd").setExecutor(GeneralCommands);
|
||||
this.getCommand("skylands").setExecutor(GeneralCommands);
|
||||
this.getCommand("status").setExecutor(GeneralCommands);
|
||||
this.getCommand("survival").setExecutor(GeneralCommands);
|
||||
this.getCommand("tossmob").setExecutor(GeneralCommands);
|
||||
|
||||
this.getCommand("cage").setExecutor(AdminCommands);
|
||||
this.getCommand("cake").setExecutor(AdminCommands);
|
||||
this.getCommand("csay").setExecutor(AdminCommands);
|
||||
this.getCommand("expel").setExecutor(AdminCommands);
|
||||
this.getCommand("fr").setExecutor(AdminCommands);
|
||||
this.getCommand("gadmin").setExecutor(AdminCommands);
|
||||
this.getCommand("gcmd").setExecutor(AdminCommands);
|
||||
this.getCommand("gtfo").setExecutor(AdminCommands);
|
||||
this.getCommand("nonuke").setExecutor(AdminCommands);
|
||||
this.getCommand("orbit").setExecutor(AdminCommands);
|
||||
this.getCommand("prelog").setExecutor(AdminCommands);
|
||||
this.getCommand("qjail").setExecutor(AdminCommands);
|
||||
this.getCommand("tfsmite").setExecutor(AdminCommands);
|
||||
this.getCommand("umd").setExecutor(AdminCommands);
|
||||
this.getCommand("wildcard").setExecutor(AdminCommands);
|
||||
this.getCommand("mp44").setExecutor(AdminCommands);
|
||||
|
||||
this.getCommand("explosives").setExecutor(AntiblockCommands);
|
||||
this.getCommand("fireplace").setExecutor(AntiblockCommands);
|
||||
this.getCommand("firespread").setExecutor(AntiblockCommands);
|
||||
this.getCommand("lavadmg").setExecutor(AntiblockCommands);
|
||||
this.getCommand("lavaplace").setExecutor(AntiblockCommands);
|
||||
this.getCommand("waterplace").setExecutor(AntiblockCommands);
|
||||
|
||||
this.getCommand("list").setExecutor(OverrideCommands);
|
||||
this.getCommand("listreal").setExecutor(OverrideCommands);
|
||||
this.getCommand("say").setExecutor(OverrideCommands);
|
||||
this.getCommand("stop").setExecutor(OverrideCommands);
|
||||
}
|
||||
}
|
||||
|
258
src/plugin.yml
258
src/plugin.yml
@ -1,135 +1,133 @@
|
||||
name: TotalFreedomMod
|
||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||
version: 1.7
|
||||
version: 2.0
|
||||
description: Plugin for the Total Freedom server.
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
cage:
|
||||
description: Superadmin command - Place a cage around someone.
|
||||
usage: /<command> <partialname> [off|outermaterial] [water|lava]
|
||||
cake:
|
||||
description: Superadmin command - For the people that are still alive.
|
||||
usage: /<command>
|
||||
creative:
|
||||
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
|
||||
usage: /<command> [partialname]
|
||||
csay:
|
||||
description: Telnet command - Send a chat message with chat formatting over telnet.
|
||||
usage: /<command> [partialname]
|
||||
deopall:
|
||||
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
|
||||
usage: /<command> [purge]
|
||||
explosives:
|
||||
description: Superadmin command - Enable/disable explosives and set effect radius.
|
||||
usage: /<command> <on|off> [radius]
|
||||
expel:
|
||||
description: Superadmin command - Push people away from you.
|
||||
usage: /<command> [radius] [strength]
|
||||
fireplace:
|
||||
description: Superadmin command - Enable/disable fire placement.
|
||||
usage: /<command> <on|off>
|
||||
firespread:
|
||||
description: Superadmin command - Enable/disable fire spread.
|
||||
usage: /<command> <on|off>
|
||||
flatlands:
|
||||
description: Goto the flatlands.
|
||||
usage: /<command>
|
||||
fr:
|
||||
description: Superadmin command - Freeze all players (toggles on and off).
|
||||
usage: /<command>
|
||||
gadmin:
|
||||
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
|
||||
usage: /<command> [list | <kick|nameban|ipban|ban|op|deop|ci> <targethash>]
|
||||
gcmd:
|
||||
description: Superadmin command - Send a command as someone else.
|
||||
usage: /<command> <fromname> <outcommand>
|
||||
gtfo:
|
||||
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
||||
usage: /<command> <partialname>
|
||||
lavadmg:
|
||||
description: Superadmin command - Enable/disable lava damage.
|
||||
usage: /<command> <on|off>
|
||||
lavaplace:
|
||||
description: Superadmin command - Enable/disable lava placement.
|
||||
usage: /<command> <on|off>
|
||||
list:
|
||||
description: Lists the real names of all online players.
|
||||
usage: /<command>
|
||||
listreal:
|
||||
description: Lists the real names of all online players.
|
||||
usage: /<command>
|
||||
mp:
|
||||
description: Use moblimiter to purge all mobs.
|
||||
usage: /<command>
|
||||
mp44:
|
||||
description: Superadmin Command - Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.
|
||||
usage: /<command> [draw|sling]
|
||||
nether:
|
||||
description: Goto the nether.
|
||||
usage: /<command>
|
||||
nonuke:
|
||||
description: Attempt to detect "invisible griefers" and "nukers".
|
||||
usage: /<command> <on|off> [range] [blockrate]
|
||||
opall:
|
||||
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||
usage: /<command> [-c|-s]
|
||||
opme:
|
||||
description: Superadmin command - Automatically ops user.
|
||||
usage: /<command>
|
||||
orbit:
|
||||
description: Superadmin command - POW!!! Right in the kisser! One of these days Alice, straight to the Moon!
|
||||
usage: /<command> <target> [power]
|
||||
prelog:
|
||||
description: Superadmin command - Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.
|
||||
usage: /<command> <on|off>
|
||||
qjail:
|
||||
description: Quick Jail - Quickly jail someone (mgjail must be set as a jail!)
|
||||
usage: /<command> <partialname>
|
||||
qdeop:
|
||||
description: Quick De-Op - deop someone based on a partial name.
|
||||
usage: /<command> <partialname>
|
||||
qop:
|
||||
description: Quick Op - op someone based on a partial name.
|
||||
usage: /<command> <partialname>
|
||||
radar:
|
||||
description: Shows nearby people sorted by distance.
|
||||
usage: /<command>
|
||||
rd:
|
||||
description: Use WorldEdit to remove drops, arrows, and primed TNT.
|
||||
usage: /<command>
|
||||
say:
|
||||
description: Broadcasts the given message as the console, includes sender.
|
||||
usage: /<command> <message>
|
||||
skylands:
|
||||
description: Goto the skylands.
|
||||
usage: /<command>
|
||||
status:
|
||||
description: Show random server info.
|
||||
usage: /<command>
|
||||
stop:
|
||||
description: Superadmin command - Kicks everyone and stops the server.
|
||||
usage: /<command>
|
||||
survival:
|
||||
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
||||
usage: /<command> [partialname]
|
||||
tossmob:
|
||||
description: Throw a mob in the direction you are facing when you left click with a stick.
|
||||
usage: /<command> [mobtype | off] [speed]
|
||||
tfbanlist:
|
||||
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
|
||||
usage: /<command> [purge]
|
||||
tfipbanlist:
|
||||
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
|
||||
usage: /<command> [purge]
|
||||
tfsmite:
|
||||
description: De-op, inventory clear, de-godmode, lightning, and kill your target. For naughty people only (or the entire server).
|
||||
usage: /<command> [playername|all]
|
||||
umd:
|
||||
description: Superadmin command - Undisguse all players.
|
||||
usage: /<command>
|
||||
waterplace:
|
||||
description: Superadmin command - Enable/disable water placement.
|
||||
usage: /<command> <on|off>
|
||||
wildcard:
|
||||
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
||||
usage: /<command> [fluff] ? [fluff] ?
|
||||
cage:
|
||||
description: Superadmin command - Place a cage around someone.
|
||||
usage: /<command> <partialname> [off | outermaterial] [water | lava]
|
||||
cake:
|
||||
description: Superadmin command - For the people that are still alive.
|
||||
usage: /<command>
|
||||
creative:
|
||||
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
|
||||
usage: /<command> [partialname]
|
||||
csay:
|
||||
description: Telnet command - Send a chat message with chat formatting over telnet.
|
||||
usage: /<command> [partialname]
|
||||
deopall:
|
||||
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
|
||||
usage: /<command> [purge]
|
||||
expel:
|
||||
description: Superadmin command - Push people away from you.
|
||||
usage: /<command> [radius] [strength]
|
||||
explosives:
|
||||
description: Superadmin command - Enable/disable explosives and set effect radius.
|
||||
usage: /<command> <on | off> [radius]
|
||||
fireplace:
|
||||
description: Superadmin command - Enable/disable fire placement.
|
||||
usage: /<command> <on | off>
|
||||
firespread:
|
||||
description: Superadmin command - Enable/disable fire spread.
|
||||
usage: /<command> <on | off>
|
||||
flatlands:
|
||||
description: Goto the flatlands.
|
||||
usage: /<command>
|
||||
fr:
|
||||
description: Superadmin command - Freeze all players (toggles on and off).
|
||||
usage: /<command>
|
||||
gadmin:
|
||||
description: Superadmin command - Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci
|
||||
usage: /<command> [list | [<kick | nameban | ipban | ban | op | deop | ci> <targethash>] ]
|
||||
gcmd:
|
||||
description: Superadmin command - Send a command as someone else.
|
||||
usage: /<command> <fromname> <outcommand>
|
||||
gtfo:
|
||||
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
||||
usage: /<command> <partialname>
|
||||
lavadmg:
|
||||
description: Superadmin command - Enable/disable lava damage.
|
||||
usage: /<command> <on | off>
|
||||
lavaplace:
|
||||
description: Superadmin command - Enable/disable lava placement.
|
||||
usage: /<command> <on | off>
|
||||
list:
|
||||
description: Lists the real names of all online players.
|
||||
usage: /<command>
|
||||
aliases: [listreal]
|
||||
mp:
|
||||
description: Purge all mobs in all worlds.
|
||||
usage: /<command>
|
||||
mp44:
|
||||
description: Superadmin Command - Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.
|
||||
usage: /<command> <draw | sling>
|
||||
nether:
|
||||
description: Goto the nether.
|
||||
usage: /<command>
|
||||
nonuke:
|
||||
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
|
||||
usage: /<command> <on | off> [range] [blockrate]
|
||||
opall:
|
||||
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||
usage: /<command> [-c | -s]
|
||||
opme:
|
||||
description: Superadmin command - Automatically ops user.
|
||||
usage: /<command>
|
||||
orbit:
|
||||
description: Superadmin command - POW!!! Right in the kisser! One of these days Alice, straight to the Moon!
|
||||
usage: /<command> <target> [power]
|
||||
prelog:
|
||||
description: Superadmin command - Enable/disable the command prelogger. When this is on, logs will be filled with many duplicate messages.
|
||||
usage: /<command> <on | off>
|
||||
qdeop:
|
||||
description: Quick De-Op - deop someone based on a partial name.
|
||||
usage: /<command> <partialname>
|
||||
qjail:
|
||||
description: Quick Jail - Quickly jail someone (mgjail must be set as a jail!)
|
||||
usage: /<command> <partialname>
|
||||
qop:
|
||||
description: Quick Op - op someone based on a partial name.
|
||||
usage: /<command> <partialname>
|
||||
radar:
|
||||
description: Shows nearby people sorted by distance.
|
||||
usage: /<command> [range]
|
||||
rd:
|
||||
description: Remove drops, arrows, primed TNT, and expierence orbs in all worlds.
|
||||
usage: /<command>
|
||||
say:
|
||||
description: Broadcasts the given message as the console, includes sender name.
|
||||
usage: /<command> <message>
|
||||
skylands:
|
||||
description: Goto the skylands.
|
||||
usage: /<command>
|
||||
status:
|
||||
description: Show misc. server info.
|
||||
usage: /<command>
|
||||
stop:
|
||||
description: Superadmin command - Kicks everyone and stops the server.
|
||||
usage: /<command>
|
||||
survival:
|
||||
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
||||
usage: /<command> [partialname]
|
||||
tfbanlist:
|
||||
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
|
||||
usage: /<command> [purge]
|
||||
tfipbanlist:
|
||||
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
|
||||
usage: /<command> [purge]
|
||||
tfsmite:
|
||||
description: De-op, inventory clear, de-godmode, lightning, and kill your target. For naughty people only (or the entire server).
|
||||
usage: /<command> <playername | all>
|
||||
tossmob:
|
||||
description: Throw a mob in the direction you are facing when you left click with a stick.
|
||||
usage: /<command> [mobtype | off] [speed]
|
||||
umd:
|
||||
description: Superadmin command - Undisguse all players.
|
||||
usage: /<command>
|
||||
waterplace:
|
||||
description: Superadmin command - Enable/disable water placement.
|
||||
usage: /<command> <on | off>
|
||||
wildcard:
|
||||
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
||||
usage: /<command> [fluff] ? [fluff] ?
|
||||
|
Loading…
Reference in New Issue
Block a user