mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
Lots of formatting fixes and removal of useless things (#10)
This commit is contained in:
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Blocks all block placing for player with brute force.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "editmute")
|
||||
@CommandParameters(description = "Restricts/unrestricts block modification abilities", usage = "/<command> [[-s] <player> [reason] | list | purge | all]")
|
||||
public class Command_blockedit extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -25,14 +25,14 @@ public class Command_blockedit extends FreedomCommand
|
||||
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
msg("Block edits blocked for players:");
|
||||
msg("The following have block modification abilities restricted:");
|
||||
int count = 0;
|
||||
for (Player mp : server.getOnlinePlayers())
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
final FPlayer info = plugin.pl.getPlayer(mp);
|
||||
final FPlayer info = plugin.pl.getPlayer(player);
|
||||
if (info.isEditBlocked())
|
||||
{
|
||||
msg("- " + mp.getName());
|
||||
msg("- " + player.getName());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@ -46,24 +46,24 @@ public class Command_blockedit extends FreedomCommand
|
||||
|
||||
if (args[0].equals("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unblocking block edits for all players.", true);
|
||||
FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for all players.", true);
|
||||
int count = 0;
|
||||
for (final Player mp : this.server.getOnlinePlayers())
|
||||
for (final Player player : this.server.getOnlinePlayers())
|
||||
{
|
||||
final FPlayer info = plugin.pl.getPlayer(mp);
|
||||
final FPlayer info = plugin.pl.getPlayer(player);
|
||||
if (info.isEditBlocked())
|
||||
{
|
||||
info.setEditBlocked(false);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
msg("Unblocked all block edit for " + count + " players.");
|
||||
msg("Unblocked all block modification abilities for " + count + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("all"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Blocking block edits for all non-admins.", true);
|
||||
FUtil.adminAction(sender.getName(), "Blocking block modification abilities for all non-admins.", true);
|
||||
int counter = 0;
|
||||
for (final Player player : this.server.getOnlinePlayers())
|
||||
{
|
||||
@ -75,7 +75,7 @@ public class Command_blockedit extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
msg("Blocked block edits for " + counter + " players.");
|
||||
msg("Blocked block modification abilities for " + counter + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -102,13 +102,13 @@ public class Command_blockedit extends FreedomCommand
|
||||
reason = StringUtils.join((Object[]) args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
final FPlayer playerdata2 = plugin.pl.getPlayer(player2);
|
||||
if (playerdata2.isEditBlocked())
|
||||
final FPlayer pd = plugin.pl.getPlayer(player2);
|
||||
if (pd.isEditBlocked())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unblocking block edits for " + player2.getName(), true);
|
||||
playerdata2.setEditBlocked(false);
|
||||
msg("Unblocking block edits for " + player2.getName());
|
||||
msg(player2, "Your block edits have been unblocked.", ChatColor.RED);
|
||||
FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for " + player2.getName(), true);
|
||||
pd.setEditBlocked(false);
|
||||
msg("Unblocking block modification abilities for " + player2.getName());
|
||||
msg(player2, "Your block modification abilities have been restored.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,16 +118,16 @@ public class Command_blockedit extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Blocking block edits for " + player2.getName(), true);
|
||||
playerdata2.setEditBlocked(true);
|
||||
FUtil.adminAction(sender.getName(), "Blocking block modification abilities for " + player2.getName(), true);
|
||||
pd.setEditBlocked(true);
|
||||
|
||||
if (smite)
|
||||
{
|
||||
Command_smite.smite(sender, player2, reason);
|
||||
}
|
||||
|
||||
msg(player2, "Your block edits have been blocked.", ChatColor.RED);
|
||||
msg("Blocked all block edits for " + player2.getName());
|
||||
msg(player2, "Your block modification abilities have been blocked.", ChatColor.RED);
|
||||
msg("Blocked all block modification abilities for " + player2.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Toggle PVP mode for players.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode,pvpman,pvman")
|
||||
@CommandParameters(description = "Toggle PVP mode for players.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode")
|
||||
public class Command_blockpvp extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -25,21 +25,21 @@ public class Command_blockpvp extends FreedomCommand
|
||||
|
||||
if (args[0].equals("list"))
|
||||
{
|
||||
this.msg("PVP is blocked for players:");
|
||||
msg("PVP is blocked for players:");
|
||||
int count = 0;
|
||||
for (Player mp : server.getOnlinePlayers())
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
final FPlayer info = plugin.pl.getPlayer(mp);
|
||||
final FPlayer info = plugin.pl.getPlayer(player);
|
||||
if (info.isPvpBlocked())
|
||||
{
|
||||
msg(" - " + mp.getName());
|
||||
msg(" - " + player.getName());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
this.msg(" - none");
|
||||
msg(" - none");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -48,9 +48,9 @@ public class Command_blockpvp extends FreedomCommand
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP for all players.", true);
|
||||
int count = 0;
|
||||
for (Player mp : this.server.getOnlinePlayers())
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
final FPlayer info = plugin.pl.getPlayer(mp);
|
||||
final FPlayer info = plugin.pl.getPlayer(player);
|
||||
if (info.isPvpBlocked())
|
||||
{
|
||||
info.setPvpBlocked(false);
|
||||
@ -90,8 +90,8 @@ public class Command_blockpvp extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
final Player player2 = getPlayer(args[0]);
|
||||
if (player2 == null)
|
||||
final Player p = getPlayer(args[0]);
|
||||
if (p == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
@ -103,31 +103,31 @@ public class Command_blockpvp extends FreedomCommand
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
}
|
||||
|
||||
final FPlayer playerdata2 = plugin.pl.getPlayer(player2);
|
||||
if (playerdata2.isPvpBlocked())
|
||||
final FPlayer pd = plugin.pl.getPlayer(p);
|
||||
if (pd.isPvpBlocked())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP for " + player2.getName(), true);
|
||||
playerdata2.setPvpBlocked(false);
|
||||
msg("Enabling PVP for " + player2.getName());
|
||||
msg((CommandSender) player2, "Your PVP have been enabled.", ChatColor.GREEN);
|
||||
FUtil.adminAction(sender.getName(), "Enabling PVP for " + p.getName(), true);
|
||||
pd.setPvpBlocked(false);
|
||||
msg("Enabling PVP for " + p.getName());
|
||||
msg((CommandSender) p, "Your PVP have been enabled.", ChatColor.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.al.isAdmin((CommandSender) player2))
|
||||
if (plugin.al.isAdmin((CommandSender) p))
|
||||
{
|
||||
this.msg(player2.getName() + " is an admin, and his PVP cannot be disabled.");
|
||||
msg(p.getName() + " is an admin, and cannot have their PVP disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP for " + player2.getName(), true);
|
||||
playerdata2.setPvpBlocked(true);
|
||||
FUtil.adminAction(sender.getName(), "Disabling PVP for " + p.getName(), true);
|
||||
pd.setPvpBlocked(true);
|
||||
if (smite)
|
||||
{
|
||||
Command_smite.smite(sender, player2, reason);
|
||||
Command_smite.smite(sender, p, reason);
|
||||
}
|
||||
|
||||
msg(player2, "Your PVP has been disabled.", ChatColor.RED);
|
||||
msg("Disabled PVP for " + player2.getName());
|
||||
msg(p, "Your PVP has been disabled.", ChatColor.RED);
|
||||
msg("Disabled PVP for " + p.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spy on Chest Movements", usage = "/<command>", aliases = "chspy")
|
||||
public class Command_chestspy extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.setChestMonitorEnabled(!playerdata.isChestMonitorEnabled());
|
||||
msg("ChestSpy " + (playerdata.isChestMonitorEnabled() ? "enabled." : "disabled."));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spy on Dropped Items", usage = "/<command>", aliases = "dropspy")
|
||||
public class Command_dropspy extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.setDropMonitorEnabled(!playerdata.isDropMonitorEnabled());
|
||||
msg("DropSpy " + (playerdata.isDropMonitorEnabled() ? "enabled." : "disabled."));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import me.totalfreedom.totalfreedommod.util.History;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import me.totalfreedom.totalfreedommod.util.History;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Check name history of username.", usage = "/<command> <username>")
|
||||
|
@ -1,23 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Spy on potions", usage = "/<command>", aliases = "potspy")
|
||||
public class Command_potionspy extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.setPotionMonitorEnabled(!playerdata.isPotionMonitorEnabled());
|
||||
msg("PotionSpy " + (playerdata.isPotionMonitorEnabled() ? "enabled." : "disabled."));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -10,16 +10,19 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unloads chunks not currently in use", usage = "/<command>", aliases = "rc")
|
||||
public class Command_unloadchunks extends FreedomCommand {
|
||||
@CommandParameters(description = "Unloads chunks not currently in use", usage = "/<command>", aliases = "uc")
|
||||
public class Command_unloadchunks extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unloading unused chunks", false);
|
||||
|
||||
int numChunks = 0;
|
||||
|
||||
for (World world : server.getWorlds()) {
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
numChunks += unloadUnusedChunks(world);
|
||||
}
|
||||
|
||||
@ -27,14 +30,15 @@ public class Command_unloadchunks extends FreedomCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private int unloadUnusedChunks(World world) {
|
||||
private int unloadUnusedChunks(World world)
|
||||
{
|
||||
int numChunks = 0;
|
||||
|
||||
for (Chunk loadedChunk : world.getLoadedChunks()) {
|
||||
if (!world.isChunkInUse(loadedChunk.getX(), loadedChunk.getZ())) {
|
||||
if (world.unloadChunk(loadedChunk)) {
|
||||
numChunks++;
|
||||
}
|
||||
for (Chunk loadedChunk : world.getLoadedChunks())
|
||||
{
|
||||
if (!world.isChunkInUse(loadedChunk.getX(), loadedChunk.getZ()) && world.unloadChunk(loadedChunk))
|
||||
{
|
||||
numChunks++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user