From f9c9ff8f07d89057304a075e1a57250bb38c83de Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 28 Sep 2020 14:49:55 -0500 Subject: [PATCH] Changed system used to detect if a player is real or not. --- .../com/songoda/ultimatemoderation/commands/CommandBan.java | 5 ----- .../songoda/ultimatemoderation/commands/CommandKick.java | 5 ----- .../songoda/ultimatemoderation/commands/CommandMute.java | 5 ----- .../ultimatemoderation/commands/CommandRunTemplate.java | 5 ----- .../songoda/ultimatemoderation/commands/CommandUnBan.java | 5 ----- .../songoda/ultimatemoderation/commands/CommandUnMute.java | 5 ----- .../songoda/ultimatemoderation/commands/CommandWarn.java | 5 ----- .../moderate/moderations/SpyModeration.java | 6 ++---- 8 files changed, 2 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandBan.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandBan.java index fed62b4..6715d90 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandBan.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandBan.java @@ -49,11 +49,6 @@ public class CommandBan extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendMessage(sender); - return ReturnType.FAILURE; - } - if (plugin.getPunishmentManager().getPlayer(player).getActivePunishments() .stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) { plugin.getLocale().newMessage("That player is already banned.").sendPrefixedMessage(sender); diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandKick.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandKick.java index dea19a3..6d7faa2 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandKick.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandKick.java @@ -39,11 +39,6 @@ public class CommandKick extends AbstractCommand { OfflinePlayer player = Bukkit.getPlayer(args[0]); - if (player == null) { - plugin.getLocale().newMessage("That player does not exist or is not online.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - if (sender instanceof Player && player.getPlayer().hasPermission("um.kick.exempt")) { plugin.getLocale().newMessage("You cannot kick this player.").sendPrefixedMessage(sender); return ReturnType.FAILURE; diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandMute.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandMute.java index 6682e7c..18d2b9f 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandMute.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandMute.java @@ -49,11 +49,6 @@ public class CommandMute extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - if (sender instanceof Player && VaultPermissions.hasPermission(player, "um.mute.exempt")) { plugin.getLocale().newMessage("You cannot mute that player.").sendPrefixedMessage(sender); return ReturnType.FAILURE; diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandRunTemplate.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandRunTemplate.java index 72ebf25..bb7f16e 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandRunTemplate.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandRunTemplate.java @@ -27,11 +27,6 @@ public class CommandRunTemplate extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - StringBuilder templateBuilder = new StringBuilder(); for (int i = 1; i < args.length; i++) { String line = args[i]; diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnBan.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnBan.java index 97338b7..edf9ca9 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnBan.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnBan.java @@ -28,11 +28,6 @@ public class CommandUnBan extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - if (!plugin.getPunishmentManager().getPlayer(player).getActivePunishments() .stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) { plugin.getLocale().newMessage("That player isn't banned.").sendPrefixedMessage(sender); diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnMute.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnMute.java index ee3bb21..061477f 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnMute.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandUnMute.java @@ -28,11 +28,6 @@ public class CommandUnMute extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - if (!plugin.getPunishmentManager().getPlayer(player).getActivePunishments() .stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) { plugin.getLocale().newMessage("That player isn't muted.").sendPrefixedMessage(sender); diff --git a/src/main/java/com/songoda/ultimatemoderation/commands/CommandWarn.java b/src/main/java/com/songoda/ultimatemoderation/commands/CommandWarn.java index c8c8ef7..771a19a 100644 --- a/src/main/java/com/songoda/ultimatemoderation/commands/CommandWarn.java +++ b/src/main/java/com/songoda/ultimatemoderation/commands/CommandWarn.java @@ -49,11 +49,6 @@ public class CommandWarn extends AbstractCommand { OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - if (!player.hasPlayedBefore()) { - plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender); - return ReturnType.FAILURE; - } - if (sender instanceof Player && VaultPermissions.hasPermission(player, "um.warning.exempt")) { plugin.getLocale().newMessage("You cannot warn that player.").sendPrefixedMessage(sender); return ReturnType.FAILURE; diff --git a/src/main/java/com/songoda/ultimatemoderation/moderate/moderations/SpyModeration.java b/src/main/java/com/songoda/ultimatemoderation/moderate/moderations/SpyModeration.java index ce0e9d6..5fe9ef6 100644 --- a/src/main/java/com/songoda/ultimatemoderation/moderate/moderations/SpyModeration.java +++ b/src/main/java/com/songoda/ultimatemoderation/moderate/moderations/SpyModeration.java @@ -86,13 +86,11 @@ public class SpyModeration extends AbstractModeration { return; } - if (oPlayer == null) return; - Player player = oPlayer.getPlayer(); - - if (player == null) { + if (oPlayer == null || !oPlayer.isOnline()) { instance.getLocale().newMessage("That player does not exist or is not online.").sendPrefixedMessage(senderP); return; } + Player player = oPlayer.getPlayer(); if (player == senderP) { instance.getLocale().getMessage("command.spy.cant").sendPrefixedMessage(senderP);