Inconsistency and Ridiculous Bug Corrections (#189)

This commit is contained in:
Video 2020-03-16 18:58:44 -06:00 committed by GitHub
parent c94ce6b276
commit 48ee7b0e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 42 additions and 28 deletions

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>", aliases = "gms") @CommandParameters(description = "Quickly change your own gamemode to adventure, or define someone's username to change theirs.", usage = "/<command> <[partialname] | -a>", aliases = "gma")
public class Command_adventure extends FreedomCommand public class Command_adventure extends FreedomCommand
{ {

View File

@ -21,7 +21,7 @@ public class Command_cartsit extends FreedomCommand
targetPlayer = getPlayer(args[0]); targetPlayer = getPlayer(args[0]);
if (targetPlayer == null) if (targetPlayer == null || Command_vanish.VANISHED.contains(targetPlayer) && !plugin.al.isAdmin(sender))
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true; return true;

View File

@ -1,8 +1,11 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -22,6 +25,12 @@ public class Command_consolesay extends FreedomCommand
String message = StringUtils.join(args, " "); String message = StringUtils.join(args, " ");
FUtil.bcastMsg(String.format("§7[CONSOLE] §f<§c%s§f> %s", sender.getName(), StringUtils.join(args, " "))); FUtil.bcastMsg(String.format("§7[CONSOLE] §f<§c%s§f> %s", sender.getName(), StringUtils.join(args, " ")));
// Send the message to Discord
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist())
{
plugin.dc.messageChatChannel("[CONSOLE] " + sender.getName() + " \u00BB " + ChatColor.stripColor(message));
}
return true; return true;
} }
} }

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the ender / \"The End\".", usage = "/<command>") @CommandParameters(description = "Go to \"The End\".", usage = "/<command>")
public class Command_ender extends FreedomCommand public class Command_ender extends FreedomCommand
{ {

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the flatlands.", usage = "/<command>") @CommandParameters(description = "Go to the Flatlands.", usage = "/<command>")
public class Command_flatlands extends FreedomCommand public class Command_flatlands extends FreedomCommand
{ {

View File

@ -168,9 +168,6 @@ public class Command_gtfo extends FreedomCommand
// Broadcast // Broadcast
final StringBuilder bcast = new StringBuilder() final StringBuilder bcast = new StringBuilder()
.append(ChatColor.RED)
.append(sender.getName())
.append(" - ")
.append("Banning: ") .append("Banning: ")
.append(username); .append(username);
if (reason != null) if (reason != null)
@ -178,7 +175,7 @@ public class Command_gtfo extends FreedomCommand
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason); bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
} }
playerMsg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", ")); playerMsg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", "));
FUtil.bcastMsg(bcast.toString()); FUtil.adminAction(sender.getName(), String.format(bcast.toString()), true);
// Kick player and handle others on IP // Kick player and handle others on IP
if (player != null) if (player != null)

View File

@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Go to the MasterBuilderWorld.", @CommandParameters(description = "Go to the HubWorld.",
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]", usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
aliases = "hw,hworld") aliases = "hw,hworld")
public class Command_hubworld extends FreedomCommand public class Command_hubworld extends FreedomCommand

View File

@ -23,7 +23,7 @@ public class Command_invsee extends FreedomCommand
Player player = getPlayer(args[0]); Player player = getPlayer(args[0]);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
msg("This player is not online."); msg("This player is not online.");
return false; return false;

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Check name history of username.", usage = "/<command> <username>", aliases = "nh") @CommandParameters(description = "Check the name history of a username.", usage = "/<command> <username>", aliases = "nh")
public class Command_namehistory extends FreedomCommand public class Command_namehistory extends FreedomCommand
{ {
@Override @Override

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the nether.", usage = "/<command>") @CommandParameters(description = "Go to the Nether.", usage = "/<command>")
public class Command_nether extends FreedomCommand public class Command_nether extends FreedomCommand
{ {

View File

@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand
player = getPlayerByDisplayName(displayName); player = getPlayerByDisplayName(displayName);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
player = getPlayerByDisplayNameAlt(displayName); player = getPlayerByDisplayNameAlt(displayName);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName); sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
return true; return true;

View File

@ -37,8 +37,8 @@ public class Command_op extends FreedomCommand
} }
} }
// if the player is not online // if the player is not online or is vanished
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
if (plugin.al.isAdmin(sender) || senderIsConsole) if (plugin.al.isAdmin(sender) || senderIsConsole)
{ {

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>") @CommandParameters(description = "Manage operators", usage = "/<command> <count | purge>")
public class Command_ops extends FreedomCommand public class Command_ops extends FreedomCommand
{ {

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Goto the plot world", usage = "/<command>", aliases = "pw") @CommandParameters(description = "Go to the PlotWorld.", usage = "/<command>", aliases = "pw")
public class Command_plotworld extends FreedomCommand public class Command_plotworld extends FreedomCommand
{ {

View File

@ -62,7 +62,7 @@ public class Command_potion extends FreedomCommand
{ {
target = getPlayer(args[1]); target = getPlayer(args[1]);
if (target == null) if (target == null || Command_vanish.VANISHED.contains(target) && !plugin.al.isAdmin(sender))
{ {
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true; return true;
@ -103,10 +103,9 @@ public class Command_potion extends FreedomCommand
if (args.length == 5) if (args.length == 5)
{ {
target = getPlayer(args[4]); target = getPlayer(args[4]);
if (target == null) if (target == null || Command_vanish.VANISHED.contains(target) && !plugin.al.isAdmin(sender))
{ {
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true; return true;

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Toggles potion spy.", usage = "/<command>", aliases = "potspy") @CommandParameters(description = "Toggles PotionSpy.", usage = "/<command>", aliases = "potspy")
public class Command_potionspy extends FreedomCommand public class Command_potionspy extends FreedomCommand
{ {

View File

@ -35,7 +35,7 @@ public class Command_qdeop extends FreedomCommand
{ {
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
{ {
if (player.isOp()) if (player.isOp() && !Command_vanish.VANISHED.contains(player))
{ {
matchedPlayerNames.add(player.getName()); matchedPlayerNames.add(player.getName());
player.setOp(false); player.setOp(false);

View File

@ -35,7 +35,7 @@ public class Command_qop extends FreedomCommand
{ {
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
{ {
if (!player.isOp()) if (!player.isOp() && !Command_vanish.VANISHED.contains(player))
{ {
matchedPlayerNames.add(player.getName()); matchedPlayerNames.add(player.getName());
player.setOp(true); player.setOp(true);

View File

@ -37,7 +37,7 @@ public class Command_rank extends FreedomCommand
final Player player = getPlayer(args[0]); final Player player = getPlayer(args[0]);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true; return true;

View File

@ -23,7 +23,7 @@ public class Command_report extends FreedomCommand
Player player = getPlayer(args[0]); Player player = getPlayer(args[0]);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
msg(PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;

View File

@ -84,7 +84,7 @@ public class Command_ride extends FreedomCommand
} }
final Player player = getPlayer(args[0]); final Player player = getPlayer(args[0]);
if (player == null) if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{ {
msg(PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND);
return true; return true;

View File

@ -53,6 +53,10 @@ public class Command_tag extends FreedomCommand
for (final Player player : server.getOnlinePlayers()) for (final Player player : server.getOnlinePlayers())
{ {
if (Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
{
continue;
}
final FPlayer playerdata = plugin.pl.getPlayer(player); final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.getTag() != null) if (playerdata.getTag() != null)
{ {

View File

@ -40,6 +40,10 @@ public class Command_whohas extends FreedomCommand
for (final Player player : server.getOnlinePlayers()) for (final Player player : server.getOnlinePlayers())
{ {
if (!plugin.al.isAdmin(sender) && Command_vanish.VANISHED.contains(player))
{
continue;
}
if (player.getInventory().contains(material)) if (player.getInventory().contains(material))
{ {
players.add(player.getName()); players.add(player.getName());

View File

@ -18,7 +18,8 @@ public class Command_wildcard extends FreedomCommand
"wildcard", "wildcard",
"gtfo", "gtfo",
"doom", "doom",
"saconfig" "saconfig",
"smite"
); );
@Override @Override