diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java index 4b57f5d36..e794397ec 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java @@ -1,6 +1,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.CmdInstance; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.CmdConfirm; @@ -22,8 +23,8 @@ public class Confirm extends SubCommand { return false; } CmdConfirm.removePending(player); - if ((System.currentTimeMillis() - command.timestamp) > 20000) { - MainUtil.sendMessage(player, C.FAILED_CONFIRM); + if ((System.currentTimeMillis() - command.timestamp) > Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) { + MainUtil.sendMessage(player, C.EXPIRED_CONFIRM); return false; } TaskManager.runTask(command.command); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index ecb26e7a3..8af004599 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -167,6 +167,7 @@ public enum C { /* * Confirm */ + EXPIRED_CONFIRM("$2Confirmation has expired, please run the command again!", "Confirm"), FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), REQUIRES_CONFIRM("$2Are you sure you wish to execute: $1%s$2?&-$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), /* diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 9dfd7ae8f..a5269c7f5 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -251,6 +251,11 @@ public class Settings extends Config { public static boolean CACHE_UUDS = false; } + public static final class Confirmation { + @Comment("Teleport to your plot on death") + public static int CONFIRMATION_TIMEOUT_SECONDS = 20; + } + public static final class Teleport { @Comment("Teleport to your plot on death") public static boolean ON_DEATH = false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java b/Core/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java index 5b359a473..b5f4d7d11 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java @@ -16,7 +16,7 @@ public class CmdConfirm { public static void addPending(final PlotPlayer player, String commandStr, final Runnable runnable) { removePending(player); - MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr); + if (commandStr != null) MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr); TaskManager.runTaskLater(new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java index 20a92eba9..5fe863620 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java @@ -8,7 +8,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper; - import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -131,7 +130,11 @@ public class UUIDHandler { return null; } if (nameOrUUIDString.length() > 16) { - return UUID.fromString(nameOrUUIDString); + try { + return UUID.fromString(nameOrUUIDString); + } catch (IllegalArgumentException e) { + return null; + } } return UUIDHandler.getUUID(nameOrUUIDString, null); }