diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index ec584c081..ff0b94dba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -337,7 +337,7 @@ public class CoreClientManager extends MiniPlugin } } - public void SaveRank(final String name, Rank rank, boolean perm) + public void SaveRank(final String name, final UUID uuid, Rank rank, boolean perm) { _repository.saveRank(new Callback() { @@ -350,7 +350,7 @@ public class CoreClientManager extends MiniPlugin client.SetRank(newRank); } } - }, name, rank, perm); + }, name, uuid, rank, perm); } public void checkPlayerNameExact(final Callback callback, final String playerName) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 860cd124a..7a7dbf3f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -2,6 +2,7 @@ package mineplex.core.account.command; import java.util.Iterator; import java.util.List; +import java.util.UUID; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -11,6 +12,7 @@ import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; +import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilPlayer; public class UpdateRank extends CommandBase @@ -86,13 +88,18 @@ public class UpdateRank extends CommandBase return; } + UUID uuid = Plugin.loadUUIDFromDB(playerName); + + if (uuid == null) + uuid = UUIDFetcher.getUUIDOf(playerName); + Plugin.getRepository().saveRank(new Callback() { public void run(Rank rank) { caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!")); } - }, target, rank, true); + }, target, uuid, rank, true); } }, caller, playerName, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index 602e2fd62..fd1aa01e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -166,7 +166,7 @@ public class AccountRepository extends RepositoryBase return uuids.size() == 1 ? uuids.get(0) : null; } - public void saveRank(final Callback callback, final String name, final Rank rank, final boolean perm) + public void saveRank(final Callback callback, final String name, final UUID uuid, final Rank rank, final boolean perm) { final RankUpdateToken token = new RankUpdateToken(); token.Name = name; @@ -180,16 +180,16 @@ public class AccountRepository extends RepositoryBase if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND) { if (perm) - executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString())); + executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); else - executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString())); + executeUpdate(UPDATE_ACCOUNT_RANK_DONOR, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); } else { if (perm) - executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString())); + executeUpdate(UPDATE_ACCOUNT_RANK_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); else - executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, UUIDFetcher.getUUIDOf(name).toString())); + executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString())); } Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index 92e8c8bdc..815edb705 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -1,11 +1,14 @@ package mineplex.core.reward.rewards; +import java.util.UUID; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.util.UUIDFetcher; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; @@ -21,7 +24,6 @@ public class RankReward extends Reward _clientManager = clientManager; } - @Override public RewardData giveRewardCustom(Player player) { @@ -34,7 +36,7 @@ public class RankReward extends Reward return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER)); _clientManager.Get(player).SetRank(rank); - _clientManager.getRepository().saveRank(null, player.getName(), rank, true); + _clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true); return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR)); } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/DedicatedServer.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/DedicatedServer.java deleted file mode 100644 index c0ae10014..000000000 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/DedicatedServer.java +++ /dev/null @@ -1,109 +0,0 @@ -package mineplex.serverdata; - -import java.util.HashMap; -import java.util.Map; - -public class DedicatedServer -{ - - // The default amount of available CPU usage. - public static final int DEFAULT_CPU = 32; - - // The default amount of available ram usage. - public static final int DEFAULT_RAM = 14000; - - // The unique name representing this server - private String _name; - public String getName() { return _name; } - - // The public I.P address used to connect to this server - private String _publicAddress; - public String getPublicAddress() { return _publicAddress; } - - // The private I.P address of this server - private String _privateAddress; - public String getPrivateAddress() { return _privateAddress; } - - // The geographical region that this dedicated server is located in - private Region _region; - public Region getRegion() { return _region; } - public boolean isUsRegion() { return _region == Region.US; } - - // The amount of available CPU usage on this server box. - private int _availableCpu; - public int getAvailableCpu() { return _availableCpu; } - - // The amount of available ram usage on this server box. - private int _availableRam; - public int getAvailableRam() { return _availableRam; } - - // The amount of available CPU usage on this server box. - private int _maxCpu; - public int getMaxCpu() { return _maxCpu; } - - // The amount of available ram usage on this server box. - private int _maxRam; - public int getMaxRam() { return _maxRam; } - - // A mapping of server group names (Key) to the number of server instances (Value) - private Map _serverCounts; - - /** - * Class constructor - * @param data - the set of serialized data values representing - * the internal state of this DedicatedServer. - */ - public DedicatedServer(Map data) - { - _name = data.get("name"); - _publicAddress = data.get("publicAddress"); - _privateAddress = data.get("privateAddress"); - _region = Region.valueOf(data.get("region").toUpperCase()); - _availableCpu = Integer.valueOf(data.get("cpu")); - _availableRam = Integer.valueOf(data.get("ram")); - _maxCpu = Integer.valueOf(data.get("cpu")); - _maxRam = Integer.valueOf(data.get("ram")); - _serverCounts = new HashMap(); - } - - /** - * Set the number of {@link MinecraftServer} instances on this server - * for a specific {@link ServerGroup} type. - * @param serverGroup - the {@link ServerGroup} whose server instance count is being set. - * @param serverCount - the number of {@link MinecraftServer} instances active on this server. - */ - public void setServerCount(ServerGroup serverGroup, int serverCount) - { - if (_serverCounts.containsKey(serverGroup.getName())) - { - int currentAmount = _serverCounts.get(serverGroup.getName()); - _availableCpu += serverGroup.getRequiredCpu() * currentAmount; - _availableRam += serverGroup.getRequiredRam() * currentAmount; - } - - _serverCounts.put(serverGroup.getName(), serverCount); - _availableCpu -= serverGroup.getRequiredCpu() * serverCount; - _availableRam -= serverGroup.getRequiredRam() * serverCount; - } - - /** - * @param serverGroup - the server group whose server count on this dedicated server is being fetched. - * @return the number of active {@link MinecraftServer}s on this dedicated server - * that belong to {@code serverGroup}. - */ - public int getServerCount(ServerGroup serverGroup) - { - String groupName = serverGroup.getName(); - return _serverCounts.containsKey(groupName) ? _serverCounts.get(groupName) : 0; - } - - /** - * Increment the number of {@link MinecraftServer} instances on this server - * for a specific {@link ServerGroup} type by 1. - * @param serverGroup - the {@link ServerGroup} whose server instance count is being incremented - */ - public void incrementServerCount(ServerGroup serverGroup) - { - setServerCount(serverGroup, getServerCount(serverGroup) + 1); - } -} diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java deleted file mode 100644 index bee342916..000000000 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/ServerGroup.java +++ /dev/null @@ -1,351 +0,0 @@ -package mineplex.serverdata; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class ServerGroup -{ - private HashMap _dataMap = null; - - private String _name; - private String _host; - private String _prefix; - - private int _minPlayers; - private int _maxPlayers; - - private int _requiredRam; - private int _requiredCpu; - private int _requiredTotalServers; - private int _requiredJoinableServers; - - private boolean _arcadeGroup; - private String _worldZip; - private String _plugin; - private String _configPath; - private int _portSection; - - private boolean _pvp; - private boolean _tournament; - private boolean _tournamentPoints; - private boolean _teamRejoin; - private boolean _teamAutoJoin; - private boolean _teamForceBalance; - - private boolean _gameAutoStart; - private boolean _gameTimeout; - private boolean _rewardGems; - private boolean _rewardItems; - - private boolean _rewardStats; - private boolean _rewardAchievements; - private boolean _hotbarInventory; - private boolean _hotbarHubClock; - private boolean _playerKickIdle; - private boolean _generateFreeVersions; - - private String _games; - private String _serverType; - private boolean _addNoCheat; - private boolean _whitelist; - private boolean _staffOnly; - private String _resourcePack = ""; - - private Region _region; - - private Set _servers; - - public ServerGroup(Map data, Collection serverStatuses) - { - _name = data.get("name"); - _prefix = data.get("prefix"); - _requiredRam = Integer.valueOf(data.get("ram")); - _requiredCpu = Integer.valueOf(data.get("cpu")); - _requiredTotalServers = Integer.valueOf(data.get("totalServers")); - _requiredJoinableServers = Integer.valueOf(data.get("joinableServers")); - _portSection = Integer.valueOf(data.get("portSection")); - _arcadeGroup = Boolean.valueOf(data.get("arcadeGroup")); - _worldZip = data.get("worldZip"); - _plugin = data.get("plugin"); - _configPath = data.get("configPath"); - _minPlayers = Integer.valueOf(data.get("minPlayers")); - _maxPlayers = Integer.valueOf(data.get("maxPlayers")); - _pvp = Boolean.valueOf(data.get("pvp")); - _tournament = Boolean.valueOf(data.get("tournament")); - _tournamentPoints = Boolean.valueOf(data.get("tournamentPoints")); - _generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); - _games = data.get("games"); - _serverType = data.get("serverType"); - _addNoCheat = Boolean.valueOf(data.get("addNoCheat")); - _teamRejoin = Boolean.valueOf(data.get("teamRejoin")); - _teamAutoJoin = Boolean.valueOf(data.get("teamAutoJoin")); - _teamForceBalance = Boolean.valueOf(data.get("teamForceBalance")); - _gameAutoStart = Boolean.valueOf(data.get("gameAutoStart")); - _gameTimeout = Boolean.valueOf(data.get("gameTimeout")); - _rewardGems = Boolean.valueOf(data.get("rewardGems")); - _rewardItems = Boolean.valueOf(data.get("rewardItems")); - _rewardStats = Boolean.valueOf(data.get("rewardStats")); - _rewardAchievements = Boolean.valueOf(data.get("rewardAchievements")); - _hotbarInventory = Boolean.valueOf(data.get("hotbarInventory")); - _hotbarHubClock = Boolean.valueOf(data.get("hotbarHubClock")); - _playerKickIdle = Boolean.valueOf(data.get("playerKickIdle")); - _staffOnly = Boolean.valueOf(data.get("staffOnly")); - _whitelist = Boolean.valueOf(data.get("whitelist")); - _resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : ""; - _host = data.get("host"); - _region = data.containsKey("region") ? Region.valueOf(data.get("region")) : Region.ALL; - - if (serverStatuses != null) - parseServers(serverStatuses); - } - - public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath - , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String serverType, boolean noCheat, boolean teamRejoin - , boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats - , boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region) - { - _name = name; - _prefix = prefix; - _host = host; - _requiredRam = ram; - _requiredCpu = cpu; - _requiredTotalServers = totalServers; - _requiredJoinableServers = joinable; - _portSection = portSection; - _arcadeGroup = arcade; - _worldZip = worldZip; - _plugin = plugin; - _configPath = configPath; - _minPlayers = minPlayers; - _maxPlayers = maxPlayers; - _pvp = pvp; - _tournament = tournament; - _tournamentPoints = tournamentPoints; - _games = games; - _serverType = serverType; - _addNoCheat = noCheat; - _teamRejoin = teamRejoin; - _teamAutoJoin = teamAutoJoin; - _teamForceBalance = teamForceBalance; - _gameAutoStart = gameAutoStart; - _gameTimeout = gameTimeout; - _rewardGems = rewardGems; - _rewardItems = rewardItems; - _rewardStats = rewardStats; - _rewardAchievements = rewardAchievements; - _hotbarInventory = hotbarInventory; - _hotbarHubClock = hotbarHubClock; - _playerKickIdle = playerKickIdle; - _staffOnly = staffOnly; - _whitelist = whitelist; - _resourcePack = resourcePack; - _region = region; - } - - public String getName() { return _name; } - public String getHost() { return _host; } - public String getPrefix() { return _prefix; } - - public int getMinPlayers() { return _minPlayers; } - public int getMaxPlayers() { return _maxPlayers; } - - public int getRequiredRam() { return _requiredRam; } - public int getRequiredCpu() { return _requiredCpu; } - public int getRequiredTotalServers() { return _requiredTotalServers; } - public int getRequiredJoinableServers() { return _requiredJoinableServers; } - public int getPortSection() { return _portSection; } - - public boolean getArcadeGroup() { return _arcadeGroup; } - public String getWorldZip() { return _worldZip; } - public String getPlugin() { return _plugin; } - public String getConfigPath() { return _configPath; } - - public boolean getPvp() { return _pvp; } - public boolean getTournament() { return _tournament; } - public boolean getTournamentPoints() { return _tournamentPoints; } - public boolean getTeamRejoin() { return _teamRejoin; } - public boolean getTeamAutoJoin() { return _teamAutoJoin; } - - public boolean getTeamForceBalance() { return _teamForceBalance; } - public boolean getGameAutoStart() { return _gameAutoStart; } - public boolean getGameTimeout() { return _gameTimeout; } - public boolean getRewardGems() { return _rewardGems; } - public boolean getRewardItems() { return _rewardItems; } - - public boolean getRewardStats() { return _rewardStats; } - public boolean getRewardAchievements() { return _rewardAchievements; } - public boolean getHotbarInventory() { return _hotbarInventory; } - public boolean getHotbarHubClock() { return _hotbarHubClock; } - public boolean getPlayerKickIdle() { return _playerKickIdle; } - public boolean getGenerateFreeVersions() { return _generateFreeVersions; } - - public String getGames() { return _games; } - public String getServerType() { return _serverType; } - public boolean getAddNoCheat() { return _addNoCheat; } - public boolean getWhitelist() { return _whitelist; } - public boolean getStaffOnly() { return _staffOnly; } - public String getResourcePack() { return _resourcePack; } - public Region getRegion() { return _region; } - - public Set getServers() { return _servers; } - - public int getServerCount() - { - return _servers.size(); - } - - public int getJoinableCount() - { - int joinable = 0; - - for (MinecraftServer server : _servers) - { - if (server.isJoinable()) - { - joinable++; - } - } - - return joinable; - } - - public int getPlayerCount() - { - int playerCount = 0; - - for (MinecraftServer server : _servers) - { - playerCount += server.getPlayerCount(); - } - - return playerCount; - } - - public int getMaxPlayerCount() - { - int maxPlayerCount = 0; - - for (MinecraftServer server : _servers) - { - maxPlayerCount += server.getMaxPlayerCount(); - } - - return maxPlayerCount; - } - - public Collection getEmptyServers() - { - Collection emptyServers = new HashSet(); - - for (MinecraftServer server : _servers) - { - if (server.isEmpty() && server.getUptime() >= 150) // Only return empty servers that have been online for >150 seconds - { - emptyServers.add(server); - } - } - - return emptyServers; - } - - private void parseServers(Collection servers) - { - _servers = new HashSet(); - - for (MinecraftServer server : servers) - { - if (_name.equalsIgnoreCase(server.getGroup())) - { - _servers.add(server); - } - } - } - - public int generateUniqueId(int startId) - { - int id = startId; - - while (true) - { - boolean uniqueId = true; - - for (MinecraftServer server : _servers) - { - String serverName = server.getName(); - try - { - int serverNum = Integer.parseInt(serverName.split("-")[1]); - - if (serverNum == id) - { - uniqueId = false; - break; - } - } - catch (Exception exception) - { - exception.printStackTrace(); - } - } - - if (uniqueId) - { - return id; - } - else - { - id++; - } - } - } - - public HashMap getDataMap() - { - if (_dataMap == null) - { - _dataMap = new HashMap(); - - _dataMap.put("name", _name); - _dataMap.put("prefix", _prefix); - _dataMap.put("ram", _requiredRam + ""); - _dataMap.put("cpu", _requiredCpu + ""); - _dataMap.put("totalServers", _requiredTotalServers + ""); - _dataMap.put("joinableServers", _requiredJoinableServers + ""); - _dataMap.put("portSection", _portSection + ""); - _dataMap.put("arcadeGroup", _arcadeGroup + ""); - _dataMap.put("worldZip", _worldZip); - _dataMap.put("plugin", _plugin); - _dataMap.put("configPath", _configPath); - _dataMap.put("minPlayers", _minPlayers + ""); - _dataMap.put("maxPlayers", _maxPlayers + ""); - _dataMap.put("pvp", _pvp + ""); - _dataMap.put("tournament", _tournament + ""); - _dataMap.put("tournamentPoints", _tournamentPoints + ""); - _dataMap.put("games", _games); - _dataMap.put("serverType", _serverType); - _dataMap.put("addNoCheat", _addNoCheat + ""); - _dataMap.put("teamRejoin", _teamRejoin + ""); - _dataMap.put("teamAutoJoin", _teamAutoJoin + ""); - _dataMap.put("teamForceBalance", _teamForceBalance + ""); - _dataMap.put("gameAutoStart", _gameAutoStart + ""); - _dataMap.put("gameTimeout", _gameTimeout + ""); - _dataMap.put("rewardGems", _rewardGems + ""); - _dataMap.put("rewardItems", _rewardItems + ""); - _dataMap.put("rewardStats", _rewardStats + ""); - _dataMap.put("rewardAchievements", _rewardAchievements + ""); - _dataMap.put("hotbarInventory", _hotbarInventory + ""); - _dataMap.put("hotbarHubClock", _hotbarHubClock + ""); - _dataMap.put("playerKickIdle", _playerKickIdle + ""); - _dataMap.put("staffOnly", _staffOnly + ""); - _dataMap.put("whitelist", _whitelist + ""); - _dataMap.put("resourcePack", _resourcePack); - _dataMap.put("host", _host); - _dataMap.put("region", _region.name()); - } - - return _dataMap; - } -} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java index fa59c5699..ff97c0786 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java @@ -37,11 +37,12 @@ public class ItemCommand extends CommandBase } final String itemName = tempName; - final UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName); + UUID uuidLookup = Plugin.getClientManager().loadUUIDFromDB(playerName); - if (uuid == null) - UUIDFetcher.getUUIDOf(playerName); + if (uuidLookup == null) + uuidLookup = UUIDFetcher.getUUIDOf(playerName); + final UUID uuid = uuidLookup; final int amount = amountSpecified; if (!Plugin.getInventoryManager().validCategory(category)) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java index cad386c51..ae576601c 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/RankCommand.java @@ -1,10 +1,13 @@ package mineplex.staffServer.salespackage.command; +import java.util.UUID; + import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; +import mineplex.core.common.util.UUIDFetcher; import mineplex.staffServer.salespackage.SalesPackageManager; public class RankCommand extends CommandBase @@ -24,11 +27,16 @@ public class RankCommand extends CommandBase String rank = args[1]; boolean perm = Boolean.parseBoolean(args[2]); + UUID uuid = Plugin.getClientManager().loadUUIDFromDB(playerName); + + if (uuid == null) + uuid = UUIDFetcher.getUUIDOf(playerName); + final Rank rankEnum = Rank.valueOf(rank); if (rankEnum == Rank.HERO || rankEnum == Rank.ULTRA || rankEnum == Rank.LEGEND || rankEnum == Rank.ALL) { - Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm); + Plugin.getClientManager().SaveRank(playerName, uuid, mineplex.core.common.Rank.valueOf(rank), perm); caller.sendMessage(F.main(Plugin.getName(), playerName + "'s rank has been updated to " + rank + "!")); } }