summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-01-17 17:41:16 +0000
committerKHobbits <rob@khobbits.co.uk>2012-01-17 17:41:16 +0000
commitee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab (patch)
tree56925eca39821ec4d4ae012e6b7f01c39a9c2ca1
parenta1cf08d6ab7a810ad77b9cccf9075b3b674c2479 (diff)
parent42e9e105cbfd5c0b48ded64c666201dce3015b4c (diff)
downloadEssentials-ee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab.tar
Essentials-ee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab.tar.gz
Essentials-ee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab.tar.lz
Essentials-ee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab.tar.xz
Essentials-ee88abafcf810a9d51ca11d3e6cc7ff7b8c768ab.zip
Merge branch '3.0' of github.com:essentials/Essentials into 3.0
-rw-r--r--Essentials/src/com/earth2me/essentials/Warps.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java17
-rw-r--r--Essentials/src/messages.properties1
-rw-r--r--Essentials/src/messages_da.properties1
-rw-r--r--Essentials/src/messages_de.properties1
-rw-r--r--Essentials/src/messages_en.properties1
-rw-r--r--Essentials/src/messages_es.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
10 files changed, 48 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java
index f710d2722..97db07cbc 100644
--- a/Essentials/src/com/earth2me/essentials/Warps.java
+++ b/Essentials/src/com/earth2me/essentials/Warps.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IWarp;
import com.earth2me.essentials.api.IWarps;
import com.earth2me.essentials.api.InvalidNameException;
+import com.earth2me.essentials.commands.WarpNotFoundException;
import com.earth2me.essentials.settings.WarpHolder;
import com.earth2me.essentials.storage.StorageObjectMap;
import java.io.File;
@@ -60,7 +61,7 @@ public class Warps extends StorageObjectMap<IWarp> implements IWarps
IWarp warp = getObject(name);
if (warp == null)
{
- throw new Exception(_("warpNotExist"));
+ throw new WarpNotFoundException(_("warpNotExist"));
}
warp.acquireReadLock();
try
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java
index 38f18db2b..b1e2dffde 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.api.IUser;
+import com.earth2me.essentials.api.IWarps;
import org.bukkit.Location;
@@ -21,7 +22,27 @@ public class Commandsetwarp extends EssentialsCommand
}
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]));
}
}
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..6caea6dd2
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/commands/WarpNotFoundException.java
@@ -0,0 +1,17 @@
+package com.earth2me.essentials.commands;
+
+
+public class WarpNotFoundException extends Exception
+{
+ public WarpNotFoundException()
+ {
+ super("");
+ }
+
+ public WarpNotFoundException(String message)
+ {
+ super(message);
+ }
+}
+
+
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 822cccc40..289e69fe6 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cYou do not have Permission to use that warp.
warpingTo=\u00a77Warping to {0}.
warps=Warps: {0}
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}
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
weatherSun=\u00a77You set the weather to sun in {0}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index eedb3c670..a78db7a37 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp.
warpingTo=\u00a77Warper til {0}.
warps=Warps: {0}
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}
weatherStormFor=\u00a77Du har sat vejret til ''storm'' i {0} i {1} sekunder
weatherSun=\u00a77Du har sat vejret til ''sol'' i {0}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 3b4441273..3825e8b9c 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt.
warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}.
warps=Warps: {0}
warpsCount=\u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}.
+warpOverwrite=\u00a7cYou cannot overwrite that warp.
weatherStorm=\u00a77In {0} st\u00fcrmt es nun.
weatherStormFor=\u00a77In {0} st\u00fcrmt es nun f\u00fcr {1} Sekunden.
weatherSun=\u00a77In {0} scheint nun die Sonne.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 822cccc40..289e69fe6 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cYou do not have Permission to use that warp.
warpingTo=\u00a77Warping to {0}.
warps=Warps: {0}
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}
weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds
weatherSun=\u00a77You set the weather to sun in {0}
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index ca9c3c1e9..a118d000e 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cNo tienes permisos para usar ese teletransporte.
warpingTo=\u00a77Teletransportandote a {0}.
warps=Warps: {0}
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.
weatherStormFor=\u00a77Has establecido el tiempo a tormenta en este {1} durante {0} segundos.
weatherSun=\u00a77Has establecido el tiempo a sol en este mundo.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 39bd578da..22903b279 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cVous n''avez pas la permission d''utiliser ce warp.
warpingTo=\u00a77T\u00e9l\u00e9portation au warp {0}.
warps=Raccourcis : {0}
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}
weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes.
weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 19dd347d1..185c400b3 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -383,6 +383,7 @@ warpUsePermission=\u00a7cOnbevoegd om die warp te gebruiken.
warpingTo=\u00a77Aan het warpen naar {0}.
warps=Warps: {0}
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}
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}