Fix BukkitLegacyMappings method map usage
Move obtaining legacy block to default clause
Task should be async
This commit is contained in:
dordsor21 2019-01-12 18:05:20 +00:00
parent 8ba661aa35
commit f62777bc1a
3 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}