From f62777bc1a8265fe261ace077c2695f028a08b9e Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 12 Jan 2019 18:05:20 +0000 Subject: [PATCH] Minor: Fix BukkitLegacyMappings method map usage Move obtaining legacy block to default clause Task should be async --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 4 ++-- .../plotsquared/bukkit/util/BukkitLegacyMappings.java | 4 ++-- .../intellectualsites/plotsquared/plot/util/TaskManager.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index d1b132528..9612b562b 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1723,8 +1723,6 @@ import java.util.regex.Pattern; Block block = event.getClickedBlock(); location = BukkitUtil.getLocation(block.getLocation()); Material blockType = block.getType(); - int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() - .fromStringToLegacy(blockType.name())).id; switch (blockType) { case ANVIL: case ACACIA_DOOR: @@ -1849,6 +1847,8 @@ import java.util.regex.Pattern; eventType = PlayerBlockEventType.TELEPORT_OBJECT; break; default: + int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() + .fromStringToLegacy(blockType.name())).id; if (blockId > 197) { eventType = PlayerBlockEventType.INTERACT_BLOCK; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java index e37fde4fb..e9ec7742f 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitLegacyMappings.java @@ -776,11 +776,11 @@ public final class BukkitLegacyMappings extends LegacyMappings { } public PlotBlock fromLegacyToString(final String id) { - return NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(id); + return OLD_STRING_TO_STRING_PLOT_BLOCK.get(id); } public PlotBlock fromStringToLegacy(final String id) { - return OLD_STRING_TO_STRING_PLOT_BLOCK.get(id.toLowerCase(Locale.ENGLISH)); + return NEW_STRING_TO_LEGACY_PLOT_BLOCK.get(id.toLowerCase(Locale.ENGLISH)); } @Getter @EqualsAndHashCode @ToString @RequiredArgsConstructor diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java index 0dd717825..f6e86cd92 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/TaskManager.java @@ -32,7 +32,7 @@ public abstract class TaskManager { if (IMP == null) { throw new IllegalArgumentException("disabled"); } - return IMP.taskRepeat(runnable, interval); + return IMP.taskRepeatAsync(runnable, interval); } return -1; }