Adding permissions for overwriting exisitng warps

essentials.warp.overwrite.[warpname] will allow overwrting of exsiting warps
essentials.warp.overwrite.* for all warps
Adding WarpNotFoundException class
This commit is contained in:
ementalo 2012-03-14 21:16:22 +00:00
parent 267495a406
commit 6cf2bb5cd9
9 changed files with 42 additions and 1 deletions

View File

@ -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]));
}
}

View File

@ -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);
}
}

View File

@ -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}.

View File

@ -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}.

View File

@ -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}.

View File

@ -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}.

View File

@ -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}.

View File

@ -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}.

View File

@ -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}.