mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-26 07:54:41 +02:00
Adding permissions for overwriting exisitng warps
essentials.warp.overwrite.[warpname] will allow overwrting of exsiting warps Adding WarpNotFoundException class For ticket #
This commit is contained in:
@@ -5,6 +5,7 @@ import com.earth2me.essentials.api.IEssentials;
|
|||||||
import com.earth2me.essentials.api.IWarp;
|
import com.earth2me.essentials.api.IWarp;
|
||||||
import com.earth2me.essentials.api.IWarps;
|
import com.earth2me.essentials.api.IWarps;
|
||||||
import com.earth2me.essentials.api.InvalidNameException;
|
import com.earth2me.essentials.api.InvalidNameException;
|
||||||
|
import com.earth2me.essentials.commands.WarpNotFoundException;
|
||||||
import com.earth2me.essentials.settings.WarpHolder;
|
import com.earth2me.essentials.settings.WarpHolder;
|
||||||
import com.earth2me.essentials.storage.StorageObjectMap;
|
import com.earth2me.essentials.storage.StorageObjectMap;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -60,7 +61,7 @@ public class Warps extends StorageObjectMap<IWarp> implements IWarps
|
|||||||
IWarp warp = getObject(name);
|
IWarp warp = getObject(name);
|
||||||
if (warp == null)
|
if (warp == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("warpNotExist"));
|
throw new WarpNotFoundException(_("warpNotExist"));
|
||||||
}
|
}
|
||||||
warp.acquireReadLock();
|
warp.acquireReadLock();
|
||||||
try
|
try
|
||||||
|
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.api.IUser;
|
import com.earth2me.essentials.api.IUser;
|
||||||
|
import com.earth2me.essentials.api.IWarps;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +22,27 @@ public class Commandsetwarp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Location loc = user.getLocation();
|
final Location loc = user.getLocation();
|
||||||
ess.getWarps().setWarp(args[0], loc);
|
final IWarps 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
|
||||||
|
{
|
||||||
|
user.sendMessage(_("warpOverwrite"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
user.sendMessage(_("warpSet", args[0]));
|
user.sendMessage(_("warpSet", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
|
||||||
|
public class WarpNotFoundException extends Exception
|
||||||
|
{
|
||||||
|
public WarpNotFoundException()
|
||||||
|
{
|
||||||
|
super("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarpNotFoundException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cYou do not have Permission to use that warp.
|
|||||||
warpingTo=\u00a77Warping to {0}.
|
warpingTo=\u00a77Warping to {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77You set the weather to storm in {0}
|
weatherStorm=\u00a77You set the weather to storm in {0}
|
||||||
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
|
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
|
||||||
weatherSun=\u00a77You set the weather to sun in {0}
|
weatherSun=\u00a77You set the weather to sun in {0}
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp.
|
|||||||
warpingTo=\u00a77Warper til {0}.
|
warpingTo=\u00a77Warper til {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77Der er {0} warps. Viser side {1} af {2}.
|
warpsCount=\u00a77Der er {0} warps. Viser side {1} af {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77Du har sat vejret til ''storm'' i {0}
|
weatherStorm=\u00a77Du har sat vejret til ''storm'' i {0}
|
||||||
weatherStormFor=\u00a77Du har sat vejret til ''storm'' i {0} i {1} sekunder
|
weatherStormFor=\u00a77Du har sat vejret til ''storm'' i {0} i {1} sekunder
|
||||||
weatherSun=\u00a77Du har sat vejret til ''sol'' i {0}
|
weatherSun=\u00a77Du har sat vejret til ''sol'' i {0}
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt.
|
|||||||
warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}.
|
warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}.
|
warpsCount=\u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77In {0} st\u00fcrmt es nun.
|
weatherStorm=\u00a77In {0} st\u00fcrmt es nun.
|
||||||
weatherStormFor=\u00a77In {0} st\u00fcrmt es nun f\u00fcr {1} Sekunden.
|
weatherStormFor=\u00a77In {0} st\u00fcrmt es nun f\u00fcr {1} Sekunden.
|
||||||
weatherSun=\u00a77In {0} scheint nun die Sonne.
|
weatherSun=\u00a77In {0} scheint nun die Sonne.
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cYou do not have Permission to use that warp.
|
|||||||
warpingTo=\u00a77Warping to {0}.
|
warpingTo=\u00a77Warping to {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77You set the weather to storm in {0}
|
weatherStorm=\u00a77You set the weather to storm in {0}
|
||||||
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
|
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
|
||||||
weatherSun=\u00a77You set the weather to sun in {0}
|
weatherSun=\u00a77You set the weather to sun in {0}
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cNo tienes permisos para usar ese teletransporte.
|
|||||||
warpingTo=\u00a77Teletransportandote a {0}.
|
warpingTo=\u00a77Teletransportandote a {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77Hay {0} teletransportes. Mostrando pagina {1} de {2}.
|
warpsCount=\u00a77Hay {0} teletransportes. Mostrando pagina {1} de {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77Has establecido el tiempo a tormenta en este mundo.
|
weatherStorm=\u00a77Has establecido el tiempo a tormenta en este mundo.
|
||||||
weatherStormFor=\u00a77Has establecido el tiempo a tormenta en este {1} durante {0} segundos.
|
weatherStormFor=\u00a77Has establecido el tiempo a tormenta en este {1} durante {0} segundos.
|
||||||
weatherSun=\u00a77Has establecido el tiempo a sol en este mundo.
|
weatherSun=\u00a77Has establecido el tiempo a sol en este mundo.
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cVous n''avez pas la permission d''utiliser ce warp.
|
|||||||
warpingTo=\u00a77T\u00e9l\u00e9portation au warp {0}.
|
warpingTo=\u00a77T\u00e9l\u00e9portation au warp {0}.
|
||||||
warps=Raccourcis : {0}
|
warps=Raccourcis : {0}
|
||||||
warpsCount=\u00a77Il y a {0} raccourcis. Page {1} sur {2}.
|
warpsCount=\u00a77Il y a {0} raccourcis. Page {1} sur {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77Vous avez programm\u00e9 l''orage dans {0}
|
weatherStorm=\u00a77Vous avez programm\u00e9 l''orage dans {0}
|
||||||
weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes.
|
weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes.
|
||||||
weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0}
|
weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0}
|
||||||
|
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cOnbevoegd om die warp te gebruiken.
|
|||||||
warpingTo=\u00a77Aan het warpen naar {0}.
|
warpingTo=\u00a77Aan het warpen naar {0}.
|
||||||
warps=Warps: {0}
|
warps=Warps: {0}
|
||||||
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}.
|
||||||
|
warpOverwrite=\u00a7cYou cannot overwrite that warp.
|
||||||
weatherStorm=\u00a77Je hebt het weer naar storm gezet in de {0}
|
weatherStorm=\u00a77Je hebt het weer naar storm gezet in de {0}
|
||||||
weatherStormFor=\u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seconde
|
weatherStormFor=\u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seconde
|
||||||
weatherSun=\u00a77Je hebt het weer naar zon gezet in de {0}
|
weatherSun=\u00a77Je hebt het weer naar zon gezet in de {0}
|
||||||
|
Reference in New Issue
Block a user