Skip to content

Commit

Permalink
use playertag.getuuid (rel 1725)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 27, 2021
1 parent 632ecc2 commit 36b6752
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void execute(ScriptEntry scriptEntry) {
RunCommandsPacketOut packetScript = new RunCommandsPacketOut(toSend.toString(),
defNames.toString() + "\r" + defValues.toString(), scriptEntry.shouldDebug(),
Utilities.entryHasPlayer(scriptEntry) ?
Utilities.getEntryPlayer(scriptEntry).getOfflinePlayer().getUniqueId()
Utilities.getEntryPlayer(scriptEntry).getUUID()
: new UUID(0, 0));
for (String server : servers) {
RedirectPacketOut packet = new RedirectPacketOut(server, packetScript);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void execute(ScriptEntry scriptEntry) {
}
RunScriptPacketOut packetScript = new RunScriptPacketOut();
packetScript.playerUUID = Utilities.entryHasPlayer(scriptEntry) ?
Utilities.getEntryPlayer(scriptEntry).getOfflinePlayer().getUniqueId()
Utilities.getEntryPlayer(scriptEntry).getUUID()
: new UUID(0, 0);
packetScript.scriptName = scriptName.asString();
packetScript.defs = def.asString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void execute(ScriptEntry scriptEntry) {
}
ReadTagPacketOut packetTag = new ReadTagPacketOut();
packetTag.playerUUID = Utilities.entryHasPlayer(scriptEntry) ?
Utilities.getEntryPlayer(scriptEntry).getOfflinePlayer().getUniqueId()
Utilities.getEntryPlayer(scriptEntry).getUUID()
: new UUID(0, 0);
packetTag.tag = tag.asString();
packetTag.id = newId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ else if (player != null && player.isOnline() && party != null && PartyManager.ge
}
}
else if (player != null) {
DatabaseManagerFactory.getDatabaseManager().removeUser(player.getName(), player.getOfflinePlayer().getUniqueId());
DatabaseManagerFactory.getDatabaseManager().removeUser(player.getName(), player.getUUID());
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ public void execute(ScriptEntry scriptEntry) {

PlayerPoints plugin = (PlayerPoints) PlayerPointsBridge.instance.plugin;
if (action.asString().equalsIgnoreCase("give")) {
plugin.getAPI().give(target.getOfflinePlayer().getUniqueId(), amount.asInt());
plugin.getAPI().give(target.getUUID(), amount.asInt());
}

else if (action.asString().equalsIgnoreCase("take")) {
plugin.getAPI().take(target.getOfflinePlayer().getUniqueId(), amount.asInt());
plugin.getAPI().take(target.getUUID(), amount.asInt());
}

else if (action.asString().equalsIgnoreCase("set")) {
plugin.getAPI().set(target.getOfflinePlayer().getUniqueId(), amount.asInt());
plugin.getAPI().set(target.getUUID(), amount.asInt());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public void adjust(Mechanism mechanism) {
try {
if (PlayerTag.matches(mechanism.getValue().asString())) {
PlayerTag player = mechanism.valueAsType(PlayerTag.class);
dataStore.changeClaimOwner(claim, player.getOfflinePlayer().getUniqueId());
dataStore.changeClaimOwner(claim, player.getUUID());
}
else if (CoreUtilities.equalsIgnoreCase(mechanism.getValue().asString(), "admin")) {
dataStore.changeClaimOwner(claim, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public String getAttribute(Attribute attribute) {
attribute.echoError("Invalid player input for 'group' tag.");
return null;
}
User user = LuckPermsBridge.luckPermsInstance.getUserManager().getUser(player.getOfflinePlayer().getUniqueId());
User user = LuckPermsBridge.luckPermsInstance.getUserManager().getUser(player.getUUID());
List<String> trackGroups = track.getGroups();
List<String> memberGroups = user.resolveInheritedNodes(QueryOptions.nonContextual()).stream()
.filter(NodeType.INHERITANCE::matches)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("owned")) {
ListTag list = new ListTag();
UUID uuid = player.getOfflinePlayer().getUniqueId();
UUID uuid = player.getUUID();
for (GeneralRegion region : AreaShop.getInstance().getFileManager().getRegions()) {
if (uuid.equals(region.getOwner())) {
list.addObject(new AreaShopTag(region));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static ASkyBlockPlayerProperties getFrom(ObjectTag object) {

public ASkyBlockPlayerProperties(PlayerTag player) {
this.player = player;
skyblock = api.getIslandOwnedBy(player.getOfflinePlayer().getUniqueId());
skyblock = api.getIslandOwnedBy(player.getUUID());
}

ASkyBlockAPI api = ASkyBlockAPI.getInstance();
Expand All @@ -76,7 +76,7 @@ public String getAttribute(Attribute attribute) {
// Returns whether the player has a skyblock.
// -->
if (attribute.startsWith("has_skyblock")) {
return new ElementTag(api.hasIsland(player.getOfflinePlayer().getUniqueId()))
return new ElementTag(api.hasIsland(player.getUUID()))
.getAttribute(attribute.fulfill(1));
}

Expand Down Expand Up @@ -126,7 +126,7 @@ else if (attribute.startsWith("members")) {
// Returns the level of the player's skyblock.
// -->
else if (attribute.startsWith("level")) {
return new ElementTag(api.getIslandLevel(player.getOfflinePlayer().getUniqueId()))
return new ElementTag(api.getIslandLevel(player.getUUID()))
.getAttribute(attribute.fulfill(1));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void registerTags() {
// -->
PropertyParser.<BigDoorsPlayerProperties>registerTag("bigdoors", (attribute, property) -> {
ListTag doors = new ListTag();
for (Door door : BigDoorsBridge.commander.getDoors(property.player.getOfflinePlayer().getUniqueId().toString(), null)) {
for (Door door : BigDoorsBridge.commander.getDoors(property.player.getUUID().toString(), null)) {
doors.addObject(new BigDoorsDoorTag(door));
}
return doors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private EssentialsPlayerProperties(PlayerTag player) {
}

public User getUser() {
return ((Essentials) EssentialsBridge.instance.plugin).getUser(player.getOfflinePlayer().getUniqueId());
return ((Essentials) EssentialsBridge.instance.plugin).getUser(player.getUUID());
}

PlayerTag player;
Expand Down Expand Up @@ -331,7 +331,7 @@ public void adjust(Mechanism mechanism) {
ListTag split = mechanism.valueAsType(ListTag.class);
PlayerTag otherPlayer = PlayerTag.valueOf(split.get(0), mechanism.context);
boolean shouldIgnore = split.size() < 2 || new ElementTag(split.get(1)).asBoolean();
getUser().setIgnoredPlayer(ess.getUser(otherPlayer.getOfflinePlayer().getUniqueId()), shouldIgnore);
getUser().setIgnoredPlayer(ess.getUser(otherPlayer.getUUID()), shouldIgnore);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private FactionsPlayerProperties(PlayerTag object) {
}

public MPlayer getMPlayer() {
return MPlayer.get(IdUtil.getId(player.getOfflinePlayer().getUniqueId()));
return MPlayer.get(IdUtil.getId(player.getUUID()));
}

PlayerTag player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static GriefPreventionPlayerProperties getFrom(ObjectTag object) {

private GriefPreventionPlayerProperties(PlayerTag player) {
this.player = player;
data = dataStore.getPlayerData(player.getOfflinePlayer().getUniqueId());
data = dataStore.getPlayerData(player.getUUID());
}

PlayerData data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("luckperms_tracks")) {
ListTag tracks = new ListTag();
User user = LuckPermsBridge.luckPermsInstance.getUserManager().getUser(player.getOfflinePlayer().getUniqueId());
User user = LuckPermsBridge.luckPermsInstance.getUserManager().getUser(player.getUUID());
for (Track track : LuckPermsBridge.luckPermsInstance.getTrackManager().getLoadedTracks()) {
for (String groupName : track.getGroups()) {
Group group = LuckPermsBridge.luckPermsInstance.getGroupManager().getGroup(groupName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String getAttribute(Attribute attribute) {
.getAttribute(attribute.fulfill(1));
}
else {
return new ElementTag(ExperienceAPI.getPowerLevelOffline(player.getOfflinePlayer().getUniqueId()))
return new ElementTag(ExperienceAPI.getPowerLevelOffline(player.getUUID()))
.getAttribute(attribute.fulfill(1));
}
}
Expand All @@ -86,7 +86,7 @@ public String getAttribute(Attribute attribute) {
.getAttribute(attribute.fulfill(1));
}
else {
return new ElementTag(ExperienceAPI.getLevelOffline(player.getOfflinePlayer().getUniqueId(), attribute.getContext(1)))
return new ElementTag(ExperienceAPI.getLevelOffline(player.getUUID(), attribute.getContext(1)))
.getAttribute(attribute.fulfill(1));
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ else if (attribute.startsWith("xp")) {
.getAttribute(attribute.fulfill(1));
}
else {
return new ElementTag(ExperienceAPI.getOfflineXPToNextLevel(player.getOfflinePlayer().getUniqueId(), skill))
return new ElementTag(ExperienceAPI.getOfflineXPToNextLevel(player.getUUID(), skill))
.getAttribute(attribute.fulfill(1));
}
}
Expand All @@ -142,7 +142,7 @@ else if (attribute.startsWith("level")) {
.getAttribute(attribute.fulfill(1));
}
else {
return new ElementTag(ExperienceAPI.getLevelOffline(player.getOfflinePlayer().getUniqueId(), skill))
return new ElementTag(ExperienceAPI.getLevelOffline(player.getUUID(), skill))
.getAttribute(attribute.fulfill(1));
}
}
Expand All @@ -159,7 +159,7 @@ else if (player.isOnline()) {
.getAttribute(attribute.fulfill(0));
}
else {
return new ElementTag(ExperienceAPI.getOfflineXP(player.getOfflinePlayer().getUniqueId(), skill))
return new ElementTag(ExperienceAPI.getOfflineXP(player.getUUID(), skill))
.getAttribute(attribute.fulfill(0));
}

Expand All @@ -180,7 +180,7 @@ else if (attribute.startsWith("rank")) {
}
else {
if (PrimarySkillType.getSkill(attribute.getContext(1)) != null) {
return new ElementTag(ExperienceAPI.getPlayerRankSkill(player.getOfflinePlayer().getUniqueId(), attribute.getContext(1)))
return new ElementTag(ExperienceAPI.getPlayerRankSkill(player.getUUID(), attribute.getContext(1)))
.getAttribute(attribute.fulfill(1));
}
else if (!attribute.hasAlternative()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("playerpoints_points")) {
return new ElementTag(((PlayerPoints) PlayerPointsBridge.instance.plugin).getAPI()
.look(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
.look(player.getUUID())).getAttribute(attribute.fulfill(1));
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public String getAttribute(Attribute attribute) {
// Returns the number of times the player has died.
// -->
if (attribute.startsWith("deaths")) {
return new ElementTag(PlayerStatisticsBuffer.getDeaths(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
return new ElementTag(PlayerStatisticsBuffer.getDeaths(player.getUUID())).getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand All @@ -75,7 +75,7 @@ public String getAttribute(Attribute attribute) {
// Returns the Elo rating of the player.
// -->
if (attribute.startsWith("elo")) {
return new ElementTag(PlayerStatisticsBuffer.getEloScore(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
return new ElementTag(PlayerStatisticsBuffer.getEloScore(player.getUUID())).getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand All @@ -86,7 +86,7 @@ public String getAttribute(Attribute attribute) {
// Returns the number of players the player has killed.
// -->
if (attribute.startsWith("kills")) {
return new ElementTag(PlayerStatisticsBuffer.getKills(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
return new ElementTag(PlayerStatisticsBuffer.getKills(player.getUUID())).getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand All @@ -97,7 +97,7 @@ public String getAttribute(Attribute attribute) {
// Returns the current kill streak of the player.
// -->
if (attribute.startsWith("streak")) {
return new ElementTag(PlayerStatisticsBuffer.getStreak(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
return new ElementTag(PlayerStatisticsBuffer.getStreak(player.getUUID())).getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand All @@ -108,7 +108,7 @@ public String getAttribute(Attribute attribute) {
// Returns the highest kill streak of the player.
// -->
if (attribute.startsWith("max_streak")) {
return new ElementTag(PlayerStatisticsBuffer.getMaxStreak(player.getOfflinePlayer().getUniqueId())).getAttribute(attribute.fulfill(1));
return new ElementTag(PlayerStatisticsBuffer.getMaxStreak(player.getUUID())).getAttribute(attribute.fulfill(1));
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private QuestsPlayerProperties(PlayerTag player) {
this.player = player;
Quests quests = (Quests) QuestsBridge.instance.plugin;
// This would be Quests.getInstance() but the developers of Quests did a stupid and broke that method.
this.quester = quests.getQuester(player.getOfflinePlayer().getUniqueId());
this.quester = quests.getQuester(player.getUUID());
}

PlayerTag player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("viaversion")) {
ViaAPI api = Via.getAPI();
return new ElementTag(api.getPlayerVersion(player.getOfflinePlayer().getUniqueId()))
return new ElementTag(api.getPlayerVersion(player.getUUID()))
.getAttribute(attribute.fulfill(1));
}

Expand Down

0 comments on commit 36b6752

Please sign in to comment.