mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 10:15:54 +01:00
fix: Replace incorrect player lookups using Bukkit#getPlayer with -Exact
#34
This commit is contained in:
parent
a1f63b5336
commit
2a2886e9ae
@ -50,7 +50,7 @@ public class AddUpgradeCommand extends SubCommand {
|
|||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class AdminBank extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
case "deposit":
|
case "deposit":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
@ -86,7 +86,7 @@ public class AdminBank extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
case "withdraw":
|
case "withdraw":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
@ -94,7 +94,7 @@ public class AdminBank extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
case "open":
|
case "open":
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[1]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[1]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
@ -146,7 +146,7 @@ public class AdminBank extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
case "deposit":
|
case "deposit":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
@ -154,7 +154,7 @@ public class AdminBank extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
case "withdraw":
|
case "withdraw":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
|
@ -54,7 +54,7 @@ public class DeleteCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID targetPlayerUUID;
|
UUID targetPlayerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class OwnerCommand extends SubCommand {
|
|||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID targetPlayerUUID, islandOwnerUUID;
|
UUID targetPlayerUUID, islandOwnerUUID;
|
||||||
String targetPlayerName, islandOwnerName;
|
String targetPlayerName, islandOwnerName;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class RemoveUpgradeCommand extends SubCommand {
|
|||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class SetAlwaysLoadedCommand extends SubCommand {
|
|||||||
SoundManager soundManager = this.plugin.getSoundManager();
|
SoundManager soundManager = this.plugin.getSoundManager();
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
|
@ -76,7 +76,7 @@ public class SetBiomeCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (biome != null) {
|
if (biome != null) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class SetMaxMembers extends SubCommand {
|
|||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (args[1].matches("[0-9]+")) {
|
if (args[1].matches("[0-9]+")) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class SetSizeCommand extends SubCommand {
|
|||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (args[1].matches("[0-9]+")) {
|
if (args[1].matches("[0-9]+")) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class BanCommand extends SubCommand {
|
|||||||
} else if (this.plugin.getConfiguration().getBoolean("Island.Visitor.Banning")) {
|
} else if (this.plugin.getConfiguration().getBoolean("Island.Visitor.Banning")) {
|
||||||
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
||||||
|| (island.hasRole(IslandRole.OPERATOR, player.getUniqueId()) && permissionManager.hasPermission(island, "Ban", IslandRole.OPERATOR))) {
|
|| (island.hasRole(IslandRole.OPERATOR, player.getUniqueId()) && permissionManager.hasPermission(island, "Ban", IslandRole.OPERATOR))) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
UUID targetPlayerUUID;
|
UUID targetPlayerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
@ -42,7 +42,7 @@ public class CancelCommand extends SubCommand {
|
|||||||
} else if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
} else if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
||||||
|| island.hasRole(IslandRole.OPERATOR, player.getUniqueId())) {
|
|| island.hasRole(IslandRole.OPERATOR, player.getUniqueId())) {
|
||||||
String playerName = args[0];
|
String playerName = args[0];
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
|
Player targetPlayer = Bukkit.getPlayerExact(playerName);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Offline.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Cancel.Offline.Message"));
|
||||||
|
@ -33,7 +33,7 @@ public class CurrentCommand extends SubCommand {
|
|||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (!args[0].equalsIgnoreCase(player.getName())) {
|
if (!args[0].equalsIgnoreCase(player.getName())) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
|
@ -40,7 +40,7 @@ public class DemoteCommand extends SubCommand {
|
|||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Demote.Owner.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Demote.Owner.Message"));
|
||||||
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
|
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
|
||||||
} else if (island.hasRole(IslandRole.OWNER, player.getUniqueId())) {
|
} else if (island.hasRole(IslandRole.OWNER, player.getUniqueId())) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
||||||
|
@ -38,7 +38,7 @@ public class InformationCommand extends SubCommand {
|
|||||||
UUID islandOwnerUUID = null;
|
UUID islandOwnerUUID = null;
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||||
|
@ -64,7 +64,7 @@ public class InviteCommand extends SubCommand {
|
|||||||
configLoad.getString("Command.Island.Invite.Yourself.Message"));
|
configLoad.getString("Command.Island.Invite.Yourself.Message"));
|
||||||
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
|
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
|
||||||
} else {
|
} else {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
|
Player targetPlayer = Bukkit.getPlayerExact(playerName);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
|
@ -59,7 +59,7 @@ public class KickCommand extends SubCommand {
|
|||||||
UUID targetPlayerUUID = null;
|
UUID targetPlayerUUID = null;
|
||||||
String targetPlayerName = null;
|
String targetPlayerName = null;
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
Set<UUID> islandMembers = island.getRole(IslandRole.MEMBER), islandOperators = island.getRole(IslandRole.OPERATOR),
|
Set<UUID> islandMembers = island.getRole(IslandRole.MEMBER), islandOperators = island.getRole(IslandRole.OPERATOR),
|
||||||
islandVisitors = islandManager.getVisitorsAtIsland(island);
|
islandVisitors = islandManager.getVisitorsAtIsland(island);
|
||||||
|
@ -47,7 +47,7 @@ public class LevelCommand extends SubCommand {
|
|||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class OwnerCommand extends SubCommand {
|
|||||||
UUID targetPlayerUUID;
|
UUID targetPlayerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
||||||
|
@ -53,7 +53,7 @@ public class PromoteCommand extends SubCommand {
|
|||||||
soundManager.playSound(player, XSound.ENTITY_VILLAGER_NO);
|
soundManager.playSound(player, XSound.ENTITY_VILLAGER_NO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
OfflinePlayer offlinePlayer = new OfflinePlayer(args[0]);
|
||||||
|
@ -45,7 +45,7 @@ public class UnbanCommand extends SubCommand {
|
|||||||
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())
|
||||||
|| (island.hasRole(IslandRole.OPERATOR, player.getUniqueId())
|
|| (island.hasRole(IslandRole.OPERATOR, player.getUniqueId())
|
||||||
&& this.plugin.getPermissionManager().hasPermission(island, "Unban", IslandRole.OPERATOR))) {
|
&& this.plugin.getPermissionManager().hasPermission(island, "Unban", IslandRole.OPERATOR))) {
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
|
|
||||||
UUID targetPlayerUUID;
|
UUID targetPlayerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
@ -51,7 +51,7 @@ public class VoteCommand extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
|
||||||
UUID islandOwnerUUID;
|
UUID islandOwnerUUID;
|
||||||
String targetPlayerName;
|
String targetPlayerName;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class Members {
|
|||||||
String playerName = ChatColor.stripColor(is.getItemMeta().getDisplayName());
|
String playerName = ChatColor.stripColor(is.getItemMeta().getDisplayName());
|
||||||
UUID playerUUID;
|
UUID playerUUID;
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(playerName);
|
Player targetPlayer = Bukkit.getPlayerExact(playerName);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
playerUUID = new OfflinePlayer(playerName).getUUID();
|
playerUUID = new OfflinePlayer(playerName).getUUID();
|
||||||
|
@ -135,7 +135,7 @@ public class Visit {
|
|||||||
String targetPlayerName = ChatColor.stripColor(is.getItemMeta().getDisplayName());
|
String targetPlayerName = ChatColor.stripColor(is.getItemMeta().getDisplayName());
|
||||||
UUID targetPlayerUUID;
|
UUID targetPlayerUUID;
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(targetPlayerName);
|
Player targetPlayer = Bukkit.getPlayerExact(targetPlayerName);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
targetPlayerUUID = new OfflinePlayer(targetPlayerName).getUniqueId();
|
targetPlayerUUID = new OfflinePlayer(targetPlayerName).getUniqueId();
|
||||||
|
Loading…
Reference in New Issue
Block a user