diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 1a7d27b4b..b39a7efcf 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.Warps; import org.bukkit.Location; import org.bukkit.Server; @@ -26,7 +27,25 @@ public class Commandsetwarp extends EssentialsCommand } final Location loc = user.getLocation(); - ess.getWarps().setWarp(args[0], loc); + final Warps warps = ess.getWarps(); + Location warpLoc = null; + + try + { + warpLoc = warps.getWarp(args[0]); + } + catch (WarpNotFoundException ex) + { + } + + if (warpLoc == null || user.hasPermission("essentials.warp.overwrite." + args[0])) + { + warps.setWarp(args[0], loc); + } + else + { + throw new Exception(_("warpOverwrite")); + } user.sendMessage(_("warpSet", args[0])); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java new file mode 100644 index 000000000..9258bf926 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java @@ -0,0 +1,15 @@ +package com.earth2me.essentials.commands; + + +public class WarpNotFoundException extends Exception +{ + public WarpNotFoundException() + { + super("Warp not found"); + } + + public WarpNotFoundException(String message) + { + super(message); + } +} diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 146ab7736..0db1ab1b3 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Your voice has been silenced warpDeleteError=Problem deleting the warp file. warpListPermission=\u00a7cYou do not have Permission to list warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 4a46b1302..6168b7bdb 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Din stemme er blevet gjort stille. warpDeleteError=Ah, shit; kunne sgu ikke fjerne warp-filen. Jeg giver en \u00c3\u00b8l i lufthavnen. warpListPermission=\u00a7cDu har ikke tilladelse til at vise listen over warps. warpNotExist=Den warp eksisterer ikke. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} sat. warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp. warpingTo=\u00a77Warper til {0}. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index aaeec37a4..1ebac92ae 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Du bist stumm warpDeleteError=Fehler beim L\u00f6schen der Warp-Datei. warpListPermission=\u00a7cDu hast keine Berechtigung, die Warp-Punkte anzuzeigen. warpNotExist=Warp-Punkt existiert nicht. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp-Punkt {0} wurde erstellt. warpUsePermission=\u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt. warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index ef3855714..e7433b943 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Your voice has been silenced warpDeleteError=Problem deleting the warp file. warpListPermission=\u00a7cYou do not have Permission to list that warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index ecee52869..9ffe1fa6c 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Tu voz ha sido silenciada warpDeleteError=Problema al borrar el archivo de teletransporte. warpListPermission=\u00a7cNo tienes permiso para listar esos teletransportes. warpNotExist=Ese teletransporte no existe. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Teletransporte {0} establecido. warpUsePermission=\u00a7cNo tienes permisos para usar ese teletransporte. warpingTo=\u00a77Teletransportandote a {0}. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index c7898356d..a65e79c52 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duit au silence. warpDeleteError=Probl\u00c3\u00a8me concernant la suppression du fichier warp. warpListPermission=\u00a7cVous n'avez pas la permission d'afficher la liste des points de t\u00e9l\u00e9portation. warpNotExist=Ce point de t\u00e9l\u00e9portation n'existe pas. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Le point de t\u00e9l\u00e9portation {0} a \u00e9t\u00e9 cr\u00e9\u00e9. warpUsePermission=\u00a7cVous n'avez pas la permission d'utiliser ce point de t\u00e9l\u00e9portation. warpingTo=\u00a77T\u00e9l\u00e9portation vers {0}. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 7a56a4e8d..b21185784 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -386,6 +386,7 @@ voiceSilenced=\u00a77Je kan niet meer praten warpDeleteError=Fout bij het verwijderen van het warp bestand. warpListPermission=\u00a7cJe hebt geen toegang om die warp te maken. warpNotExist=Die warp bestaat niet. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} ingesteld. warpUsePermission=\u00a7cOnbevoegd om die warp te gebruiken. warpingTo=\u00a77Aan het warpen naar {0}.