From 5d79863cfc5cb72aa387a381cf8069cbd20a1c49 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 15 Mar 2012 02:12:43 +0000 Subject: [PATCH] Fixing setwarp command. --- Essentials/src/com/earth2me/essentials/Warps.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandsetwarp.java | 5 +++-- .../earth2me/essentials/commands/WarpNotFoundException.java | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index 57326b54a..ece987aba 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.commands.WarpNotFoundException; import java.io.File; import java.util.*; import java.util.logging.Level; @@ -48,7 +49,7 @@ public class Warps implements IConf EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp)); if (conf == null) { - throw new Exception(_("warpNotExist")); + throw new WarpNotFoundException(); } return conf.getLocation(null, server); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index b39a7efcf..42da62b85 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import com.earth2me.essentials.Warps; import org.bukkit.Location; import org.bukkit.Server; @@ -34,11 +35,11 @@ public class Commandsetwarp extends EssentialsCommand { warpLoc = warps.getWarp(args[0]); } - catch (WarpNotFoundException ex) + catch (Exception ex) { } - if (warpLoc == null || user.hasPermission("essentials.warp.overwrite." + args[0])) + if (warpLoc == null || user.isAuthorized("essentials.warp.overwrite." + Util.sanitizeFileName(args[0]))) { warps.setWarp(args[0], loc); } diff --git a/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java index 9258bf926..bfba73818 100644 --- a/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java +++ b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java @@ -1,11 +1,12 @@ package com.earth2me.essentials.commands; +import static com.earth2me.essentials.I18n._; public class WarpNotFoundException extends Exception { public WarpNotFoundException() { - super("Warp not found"); + super(_("warpNotExist")); } public WarpNotFoundException(String message)