mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
More improvements. (#15)
* This is rediculous * Forgot some final and this * Fixed and improved skull caging * Windows wanted this yeah
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -30,7 +29,7 @@ public class Command_blockredstone extends FreedomCommand
|
||||
ConfigEntry.ALLOW_REDSTONE.setBoolean(true);
|
||||
}
|
||||
}
|
||||
}.runTaskLater((Plugin) this.plugin, 6000L);
|
||||
}.runTaskLater(plugin, 6000L);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
@ -16,49 +15,64 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Place a cage around someone.", usage = "/<command> <purge | off | <partialname> [skull | block] [blockname | skullname]")
|
||||
public class Command_cage extends FreedomCommand
|
||||
{
|
||||
public static String playerSkullName;
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("off".equals(args[0]) && sender instanceof Player) {
|
||||
String skullName = null;
|
||||
if ("off".equals(args[0]) && sender instanceof Player)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
final FPlayer playerdata = ((TotalFreedomMod)this.plugin).pl.getPlayer(playerSender);
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
if ("purge".equals(args[0])) {
|
||||
if ("purge".equals(args[0]))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging all players", true);
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
final FPlayer playerdata2 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player);
|
||||
playerdata2.getCageData().setCaged(false);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
fPlayer.getCageData().setCaged(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
final Player player2 = this.getPlayer(args[0]);
|
||||
if (player2 == null) {
|
||||
Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
final FPlayer playerdata3 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player2);
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
Material outerMaterial = Material.GLASS;
|
||||
Material innerMaterial = Material.AIR;
|
||||
if (args.length >= 2 && null != args[1]) {
|
||||
if (args.length >= 2 && args[1] != null)
|
||||
{
|
||||
final String s = args[1];
|
||||
switch (s) {
|
||||
case "off": {
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + player2.getName(), true);
|
||||
playerdata3.getCageData().setCaged(false);
|
||||
switch (s)
|
||||
{
|
||||
case "off":
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
fPlayer.getCageData().setCaged(false);
|
||||
return true;
|
||||
}
|
||||
case "skull": {
|
||||
case "skull":
|
||||
{
|
||||
outerMaterial = Material.SKULL;
|
||||
Command_cage.playerSkullName = args[2];
|
||||
if (args.length >= 3)
|
||||
{
|
||||
skullName = args[2];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "block": {
|
||||
if (Material.matchMaterial(args[2]) != null) {
|
||||
case "block":
|
||||
{
|
||||
if (Material.matchMaterial(args[2]) != null)
|
||||
{
|
||||
outerMaterial = Material.matchMaterial(args[2]);
|
||||
break;
|
||||
}
|
||||
@ -67,22 +81,34 @@ public class Command_cage extends FreedomCommand
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.length >= 3) {
|
||||
if (args[2].equalsIgnoreCase("water")) {
|
||||
if (args.length >= 3)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("water"))
|
||||
{
|
||||
innerMaterial = Material.STATIONARY_WATER;
|
||||
}
|
||||
else if (args[2].equalsIgnoreCase("lava")) {
|
||||
else if (args[2].equalsIgnoreCase("lava"))
|
||||
{
|
||||
innerMaterial = Material.STATIONARY_LAVA;
|
||||
}
|
||||
}
|
||||
final Location targetPos = player2.getLocation().clone().add(0.0, 1.0, 0.0);
|
||||
playerdata3.getCageData().cage(targetPos, outerMaterial, innerMaterial);
|
||||
player2.setGameMode(GameMode.SURVIVAL);
|
||||
if (outerMaterial != Material.SKULL) {
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player2.getName(), true);
|
||||
Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
|
||||
if (skullName != null)
|
||||
{
|
||||
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial, skullName);
|
||||
}
|
||||
else {
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player2.getName() + " in " + Command_cage.playerSkullName, true);
|
||||
else
|
||||
{
|
||||
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
|
||||
}
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
if (outerMaterial == Material.SKULL && skullName != null)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
|
||||
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
@ -21,90 +18,110 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
if (args.length > 1) {
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (FUtil.isFromHostConsole(sender.getName())) {
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
if (FUtil.isFromHostConsole(sender.getName()))
|
||||
{
|
||||
List<String> names = new ArrayList<String>();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
names.add(player.getName());
|
||||
}
|
||||
this.msg("There are " + names.size() + "/" + this.server.getMaxPlayers() + " players online:\n" + StringUtils.join((Iterable)names, ", "), ChatColor.WHITE);
|
||||
msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join((Iterable)names, ", "), ChatColor.WHITE);
|
||||
return true;
|
||||
}
|
||||
ListFilter listFilter = null;
|
||||
if (args.length == 1) {
|
||||
final String s = args[0];
|
||||
switch (s) {
|
||||
case "-a": {
|
||||
if (args.length == 1)
|
||||
{
|
||||
String s = args[0];
|
||||
switch (s)
|
||||
{
|
||||
case "-a":
|
||||
{
|
||||
listFilter = ListFilter.ADMINS;
|
||||
break;
|
||||
}
|
||||
case "-v": {
|
||||
case "-v":
|
||||
{
|
||||
listFilter = ListFilter.VANISHED_ADMINS;
|
||||
break;
|
||||
}
|
||||
case "-i": {
|
||||
case "-i":
|
||||
{
|
||||
listFilter = ListFilter.IMPOSTORS;
|
||||
break;
|
||||
}
|
||||
case "-f": {
|
||||
case "-f":
|
||||
{
|
||||
listFilter = ListFilter.FAMOUS_PLAYERS;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
listFilter = ListFilter.PLAYERS;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)playerSender)) {
|
||||
this.msg("/list [-a | -i | -f ]", ChatColor.WHITE);
|
||||
return true;
|
||||
StringBuilder onlineStats = new StringBuilder();
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - Command_vanish.VANISHED.size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
.append(server.getMaxPlayers())
|
||||
.append(" players online.");
|
||||
List<String> n = new ArrayList<String>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.isAdmin(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && Command_vanish.VANISHED.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !Command_vanish.VANISHED.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.IMPOSTORS && !((TotalFreedomMod)this.plugin).al.isAdminImpostor(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && Command_vanish.VANISHED.contains(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final Displayable display = plugin.rm.getDisplay(p);
|
||||
n.add(display.getColoredTag() + p.getName());
|
||||
}
|
||||
final StringBuilder onlineStats = new StringBuilder();
|
||||
final StringBuilder onlineUsers = new StringBuilder();
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(this.server.getOnlinePlayers().size() - Command_vanish.vanished.size());
|
||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(this.server.getMaxPlayers());
|
||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||
final List<String> names2 = new ArrayList<String>();
|
||||
for (final Player player2 : this.server.getOnlinePlayers()) {
|
||||
if (listFilter == ListFilter.ADMINS && !((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player2)) {
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && Command_vanish.vanished.contains(player2)) {
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !Command_vanish.vanished.contains(player2)) {
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.IMPOSTORS && !((TotalFreedomMod)this.plugin).al.isAdminImpostor(player2)) {
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(player2.getName().toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && Command_vanish.vanished.contains(player2)) {
|
||||
continue;
|
||||
}
|
||||
final Displayable display = ((TotalFreedomMod)this.plugin).rm.getDisplay((CommandSender)player2);
|
||||
names2.add(display.getColoredTag() + player2.getName());
|
||||
}
|
||||
final String playerType = (listFilter == null) ? "players" : listFilter.toString().toLowerCase().replace('_', ' ');
|
||||
onlineUsers.append("Connected ");
|
||||
onlineUsers.append(playerType + ": ");
|
||||
onlineUsers.append(StringUtils.join((Iterable)names2, ChatColor.WHITE + ", "));
|
||||
if (senderIsConsole) {
|
||||
String playerType = (listFilter == null) ? "players" : listFilter.toString().toLowerCase().replace('_', ' ');
|
||||
onlineUsers.append("Connected ")
|
||||
.append(playerType + ": ")
|
||||
.append(playerType + ": ")
|
||||
.append(StringUtils.join((Iterable)n, ChatColor.WHITE + ", "));
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
sender.sendMessage(onlineStats.toString());
|
||||
sender.sendMessage(onlineUsers.toString());
|
||||
}
|
||||
names2.clear();
|
||||
n.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class Command_opall extends FreedomCommand
|
||||
player.setOp(true);
|
||||
player.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
if (doSetGamemode)
|
||||
if (doSetGamemode && !plugin.al.isAdmin(player))
|
||||
{
|
||||
player.setGameMode(targetGamemode);
|
||||
}
|
||||
|
@ -1,38 +1,44 @@
|
||||
|
||||
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator.", usage = "/<command>", aliases = "gmsp")
|
||||
@CommandParameters(description = "Quickly change your own gamemode to spectator, or define someone's username to change theirs.", usage = "/<command> <[partialname]>", aliases = "gmsp")
|
||||
public class Command_spectator extends FreedomCommand
|
||||
{
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
if (args.length == 0) {
|
||||
if (this.isConsole()) {
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (isConsole())
|
||||
{
|
||||
sender.sendMessage("When used from the console, you must define a target player.");
|
||||
return true;
|
||||
}
|
||||
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
this.msg("Gamemode set to spectator.");
|
||||
msg("Gamemode set to spectator.");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
this.checkRank(Rank.SUPER_ADMIN);
|
||||
final Player player = this.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
this.msg("Setting " + player.getName() + " to game mode spectator");
|
||||
this.msg((CommandSender)player, sender.getName() + " set your game mode to spectator");
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Setting " + player.getName() + " to game mode spectator");
|
||||
msg(player, sender.getName() + " set your game mode to spectator");
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler;
|
||||
import me.totalfreedom.totalfreedommod.GameRuleHandler.GameRule;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
@ -38,103 +37,129 @@ public class Command_toggle extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("waterplace")) {
|
||||
this.toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
if (args[0].equals("waterplace"))
|
||||
{
|
||||
toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("frostwalk")) {
|
||||
this.toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
else if (args[0].equals("frostwalk"))
|
||||
{
|
||||
toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("fireplace")) {
|
||||
this.toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
else if (args[0].equals("fireplace"))
|
||||
{
|
||||
toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lavaplace")) {
|
||||
this.toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
else if (args[0].equals("lavaplace"))
|
||||
{
|
||||
toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE);
|
||||
return true;
|
||||
}
|
||||
/*if (args[0].equals("explosivearrows"))
|
||||
else if (args[0].equals("fluidspread"))
|
||||
{
|
||||
toggle("Explosive arrows are now", ConfigEntry.MAKE_ARROW_EXPLOSIVE);
|
||||
return true;
|
||||
}*/
|
||||
if (args[0].equals("fluidspread")) {
|
||||
this.toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lavadmg")) {
|
||||
this.toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
else if (args[0].equals("lavadmg"))
|
||||
{
|
||||
toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("firespread")) {
|
||||
this.toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
else if (args[0].equals("firespread"))
|
||||
{
|
||||
toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD);
|
||||
((TotalFreedomMod)this.plugin).gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean());
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("prelog")) {
|
||||
this.toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
else if (args[0].equals("prelog"))
|
||||
{
|
||||
toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("lockdown")) {
|
||||
final boolean active = !((TotalFreedomMod)this.plugin).lp.isLockdownEnabled();
|
||||
((TotalFreedomMod)this.plugin).lp.setLockdownEnabled(active);
|
||||
else if (args[0].equals("lockdown"))
|
||||
{
|
||||
boolean active = !plugin.lp.isLockdownEnabled();
|
||||
plugin.lp.setLockdownEnabled(active);
|
||||
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("petprotect")) {
|
||||
this.toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
else if (args[0].equals("petprotect"))
|
||||
{
|
||||
toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("entitywipe")) {
|
||||
this.toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
else if (args[0].equals("entitywipe"))
|
||||
{
|
||||
toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("firework")) {
|
||||
this.toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
else if (args[0].equals("firework"))
|
||||
{
|
||||
toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION);
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("nonuke")) {
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
else if (args[0].equals("nonuke"))
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex2) {}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (args.length >= 3) {
|
||||
try {
|
||||
if (args.length >= 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
|
||||
}
|
||||
catch (NumberFormatException ex3) {}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
this.toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) {
|
||||
this.msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
this.msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
toggle("Nuke monitor is", ConfigEntry.NUKE_MONITOR_ENABLED);
|
||||
if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
|
||||
{
|
||||
msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
|
||||
msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("explosives")) {
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
else if (args[0].equals("explosives"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigEntry.EXPLOSIVE_RADIUS.setDouble(Math.max(1.0, Math.min(30.0, Double.parseDouble(args[1]))));
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
this.msg(ex.getMessage());
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("The input provided is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) {
|
||||
this.msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
toggle("Explosions are", ConfigEntry.ALLOW_EXPLOSIONS);
|
||||
if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void toggle(final String name, final ConfigEntry entry) {
|
||||
this.msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
private void toggle(final String name, final ConfigEntry entry)
|
||||
{
|
||||
msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Iterator;
|
||||
@ -18,51 +16,50 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command>", aliases = "v")
|
||||
public class Command_vanish extends FreedomCommand
|
||||
{
|
||||
public static ArrayList<Player> vanished;
|
||||
public static ArrayList<Player> VANISHED = new ArrayList<Player>();
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
|
||||
final Displayable display = ((TotalFreedomMod)this.plugin).rm.getDisplay((CommandSender)playerSender);
|
||||
Displayable display = plugin.rm.getDisplay(playerSender);
|
||||
String loginMsg = display.getColoredLoginMessage();
|
||||
final String displayName = display.getColor() + playerSender.getName();
|
||||
final Admin admin = ((TotalFreedomMod)this.plugin).al.getAdmin(playerSender);
|
||||
if (Command_vanish.vanished.contains(playerSender)) {
|
||||
this.msg(ChatColor.GOLD + "You have been unvanished.");
|
||||
if (admin.hasLoginMessage()) {
|
||||
String displayName = display.getColor() + playerSender.getName();
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (VANISHED.contains(playerSender))
|
||||
{
|
||||
msg(ChatColor.GOLD + "You have been unvanished.");
|
||||
if (admin.hasLoginMessage())
|
||||
{
|
||||
loginMsg = FUtil.colorize(admin.getLoginMessage());
|
||||
}
|
||||
FUtil.bcastMsg(ChatColor.AQUA + playerSender.getName() + " is " + loginMsg);
|
||||
FUtil.bcastMsg(playerSender.getName() + " joined the game", ChatColor.YELLOW);
|
||||
((TotalFreedomMod)this.plugin).pl.getPlayer(playerSender).setTag(display.getColoredTag());
|
||||
plugin.pl.getPlayer(playerSender).setTag(display.getColoredTag());
|
||||
FLog.info(playerSender.getName() + " is no longer vanished.");
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.showPlayer(playerSender);
|
||||
}
|
||||
((TotalFreedomMod)this.plugin).esb.setVanished(playerSender.getName(), false);
|
||||
plugin.esb.setVanished(playerSender.getName(), false);
|
||||
playerSender.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||
Command_vanish.vanished.remove(playerSender);
|
||||
return true;
|
||||
VANISHED.remove(playerSender);
|
||||
}
|
||||
if (!Command_vanish.vanished.contains(playerSender)) {
|
||||
this.msg(ChatColor.GOLD + "You have been vanished.");
|
||||
else
|
||||
{
|
||||
msg("You have been vanished.", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(playerSender.getName() + " left the game", ChatColor.YELLOW);
|
||||
FLog.info(playerSender.getName() + " is now vanished.");
|
||||
for (final Player player : this.server.getOnlinePlayers()) {
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.hidePlayer(playerSender);
|
||||
}
|
||||
((TotalFreedomMod)this.plugin).esb.setVanished(playerSender.getName(), true);
|
||||
plugin.esb.setVanished(playerSender.getName(), true);
|
||||
playerSender.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000, 1000000, true, false));
|
||||
Command_vanish.vanished.add(playerSender);
|
||||
return true;
|
||||
VANISHED.add(playerSender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static {
|
||||
Command_vanish.vanished = new ArrayList<Player>();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import com.earth2me.essentials.Essentials;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Removes essentials warps", usage = "/<command>")
|
||||
@ -22,11 +22,12 @@ public class Command_wipewarps extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
Plugin essentials = server.getPluginManager().getPlugin("Essentials");
|
||||
FUtil.adminAction(sender.getName(), "Wiping Essentials Warps", true);
|
||||
server.getPluginManager().disablePlugin(essentials);
|
||||
FUtil.deleteFolder(new File(essentials.getDataFolder(), "warps"));
|
||||
server.getPluginManager().enablePlugin(essentials);
|
||||
Essentials essentials = plugin.esb.getEssentialsPlugin();
|
||||
File warps = new File(essentials.getDataFolder(), "warps");
|
||||
FUtil.adminAction(sender.getName(), "Wiping Essentials warps", true);
|
||||
FUtil.deleteFolder(warps);
|
||||
warps.mkdir();
|
||||
essentials.reload();
|
||||
msg("All warps deleted.");
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user