diff options
| author | Krakenied <Krakenied1@gmail.com> | 2024-03-04 13:26:11 +0100 |
|---|---|---|
| committer | Leonardo Bishop <13875753+LMBishop@users.noreply.github.com> | 2024-03-09 22:21:59 +0000 |
| commit | 10fc3ae291ebc632edd0543121286b1bc80fa947 (patch) | |
| tree | 00f932b2c15eaa2a24ef27d374ca26a17786fb2b /bukkit | |
| parent | 69ed205703015ce1915a68636a70f80ccd7499f7 (diff) | |
Delay Legacy Material Support initialization
Do not init it at all if not required
Diffstat (limited to 'bukkit')
| -rw-r--r-- | bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java index 5444b03c..d4caf566 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java @@ -302,7 +302,8 @@ public class TaskUtils { Object configData = task.getConfigValue("data"); Material blockMaterial = state.getType(); - byte blockData = state.getRawData(); + // do not set block data here as it will initialize Legacy Material Support + Byte blockData = null; Material material; int comparableData; @@ -321,11 +322,25 @@ public class TaskUtils { type.debug("Checking against block " + material + ":" + comparableData, pendingTask.quest.getId(), task.getId(), player); - if (material == blockMaterial && ((parts.length == 1 && configData == null) || blockData == comparableData)) { - type.debug("Block match", pendingTask.quest.getId(), task.getId(), player); - return true; + if (material == blockMaterial) { + if (parts.length == 1 && configData == null) { + type.debug("Block match (modern)", pendingTask.quest.getId(), task.getId(), player); + return true; + } + + // delay legacy material support initialization + if (blockData == null) { + blockData = state.getRawData(); + } + + if (blockData == comparableData) { + type.debug("Block match (legacy)", pendingTask.quest.getId(), task.getId(), player); + return true; + } + + type.debug("Block mismatch (legacy)", pendingTask.quest.getId(), task.getId(), player); } else { - type.debug("Block mismatch", pendingTask.quest.getId(), task.getId(), player); + type.debug("Block mismatch (modern)", pendingTask.quest.getId(), task.getId(), player); } } |
