mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fixes #1661
This commit is contained in:
parent
1918000668
commit
248751378b
@ -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);
|
||||
|
@ -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"),
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user