Skip to content

Commit

Permalink
warn on loading npc/player by name instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 23, 2018
1 parent 308a8a7 commit 5a9562c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dNPC.java
Expand Up @@ -96,6 +96,9 @@ public static dNPC valueOf(String string, TagContext context) {
else {
for (NPC test : CitizensAPI.getNPCRegistry()) {
if (test.getName().equalsIgnoreCase(string)) {
if (context == null || context.debug) {
dB.echoError("Warning: loading NPC by name - use the ID instead! NPC named '" + test.getName() + "' has ID: " + test.getId());
}
return new dNPC(test);
}
}
Expand Down
Expand Up @@ -139,6 +139,9 @@ static dPlayer valueOfInternal(String string, boolean announce) {
// Match as a player name
if (playerNames.containsKey(CoreUtilities.toLowerCase(string))) {
OfflinePlayer player = Bukkit.getOfflinePlayer(playerNames.get(CoreUtilities.toLowerCase(string)));
if (announce) {
dB.echoError("Warning: loading player by name - use the UUID instead (or use tag server.match_player)! Player named '" + player.getName() + "' has UUID: " + player.getUniqueId());
}
return new dPlayer(player);
}

Expand Down
Expand Up @@ -394,10 +394,6 @@ public void adjust(Mechanism mechanism) {
dB.echoError("Invalid potion effect type '" + data[0] + "'");
return;
}
if (type == null) {
dB.echoError("Invalid potion effect type '" + data[0] + "'");
return;
}
if (!data1.isInt()) {
dB.echoError("Cannot apply effect '" + data[0] + "': '" + data[1] + "' is not a valid integer!");
return;
Expand Down

0 comments on commit 5a9562c

Please sign in to comment.