Update quick-select and talk items to material names (#1710)

also add back-support for if the original IDs are used (there's no good generic legacy ID upverter, but recognizing the old default numbers should suffice for 99% of servers). Should be cross-compatible with all supported minecraft versions, but is *required* in particular for 1.13
This commit is contained in:
Alex "mcmonkey" Goodwin 2019-03-08 22:19:31 -08:00 committed by fullwall
parent 7d7bf356de
commit 7c348bff13
2 changed files with 13 additions and 4 deletions

View File

@ -114,7 +114,7 @@ public class Settings {
QUICK_SELECT("npc.selection.quick-select", false),
REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true),
SAVE_TASK_DELAY("storage.save-task.delay", 20 * 60 * 60),
SELECTION_ITEM("npc.selection.item", "280"),
SELECTION_ITEM("npc.selection.item", "stick"),
SELECTION_MESSAGE("npc.selection.message", "<b>You selected <a><npc><b>!"),
SERVER_OWNS_NPCS("npc.server-ownership", false),
STORAGE_FILE("storage.file", "saves.yml"),
@ -122,7 +122,7 @@ public class Settings {
SUBPLUGIN_FOLDER("subplugins.folder", "plugins"),
TALK_CLOSE_MAXIMUM_COOLDOWN("npc.text.max-talk-cooldown", 5),
TALK_CLOSE_MINIMUM_COOLDOWN("npc.text.min-talk-cooldown", 10),
TALK_ITEM("npc.text.talk-item", "340"),
TALK_ITEM("npc.text.talk-item", "book"),
TELEPORT_DELAY("npc.teleport-delay", -1),
USE_BOAT_CONTROLS("npc.controllable.use-boat-controls", true),
USE_NEW_PATHFINDER("npc.pathfinding.use-new-finder", false),

View File

@ -237,8 +237,17 @@ public class Util {
if (parts.contains("*"))
return true;
for (String part : Splitter.on(',').split(parts)) {
if ((SpigotUtil.isUsing1_13API() ? Material.matchMaterial(part, true)
: Material.matchMaterial(part)) == player.getInventory().getItemInHand().getType()) {
Material matchMaterial = SpigotUtil.isUsing1_13API() ? Material.matchMaterial(part, true)
: Material.matchMaterial(part);
if (matchMaterial == null) {
if (part.equals("280")) {
matchMaterial = Material.STICK;
}
else if (part.equals("340")) {
matchMaterial = Material.BOOK;
}
}
if (matchMaterial == player.getInventory().getItemInHand().getType()) {
return true;
}
}