From ceff17c4f7c7c87df963ae0c33cd929ada628323 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sun, 5 May 2019 14:25:43 -0400 Subject: [PATCH] Misc fixes. Closes a few old youtrack issues which I don't remember because I had like 30 tabs open, and a few other issues which I found while testing some of those. --- .../com/sk89q/wepif/ConfigurationPermissionsResolver.java | 6 +++--- .../java/com/sk89q/worldedit/function/GroundFunction.java | 2 +- .../command/exception/WorldEditExceptionConverter.java | 2 +- .../java/com/sk89q/worldedit/session/SessionManager.java | 1 + .../util/formatting/component/SchematicPaginationBox.java | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java index bdf1ba0ba..763e4f88d 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java @@ -59,7 +59,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { Map> userGroupPermissions = new HashMap<>(); - List groupKeys = config.getStringList("permissions.groups", null); + List groupKeys = config.getKeys("permissions.groups"); if (groupKeys != null) { for (String key : groupKeys) { @@ -77,7 +77,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { } } - List userKeys = config.getStringList("permissions.users", null); + List userKeys = config.getKeys("permissions.users"); if (userKeys != null) { for (String key : userKeys) { @@ -150,7 +150,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { return new String[0]; } - return groups.toArray(new String[groups.size()]); + return groups.toArray(new String[0]); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java index d3162ff13..5e4c7c545 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java @@ -85,9 +85,9 @@ public class GroundFunction implements LayerFunction { if (depth == 0) { if (function.apply(position)) { affected++; + return true; } } - return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java index a0100fc4c..b200e11b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java @@ -61,7 +61,7 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper { } private CommandException newCommandException(String message, Throwable cause) { - return new CommandException(TextComponent.of(message), cause, ImmutableList.of()); + return new CommandException(TextComponent.of(String.valueOf(message)), cause, ImmutableList.of()); } @ExceptionMatch diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index e393fe115..ba2468bd0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -261,6 +261,7 @@ public class SessionManager { */ public synchronized void unload() { clear(); + timer.cancel(); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SchematicPaginationBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SchematicPaginationBox.java index eb9598a49..9617b31dd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SchematicPaginationBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SchematicPaginationBox.java @@ -46,7 +46,7 @@ public class SchematicPaginationBox extends PaginationBox { @Override public Component getComponent(int number) { - checkArgument(number < files.length - 1 && number >= 0); + checkArgument(number < files.length && number >= 0); File file = files[number]; Multimap exts = ClipboardFormats.getFileExtensionMap(); String format = exts.get(Files.getFileExtension(file.getName()))