summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/MetaItemStack.java38
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgive.java7
-rw-r--r--Essentials/src/items.csv1
-rw-r--r--Essentials/src/messages.properties1
-rw-r--r--Essentials/src/messages_cs.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_et.properties1
-rw-r--r--Essentials/src/messages_fi.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_hu.properties1
-rw-r--r--Essentials/src/messages_it.properties1
-rw-r--r--Essentials/src/messages_ko.properties1
-rw-r--r--Essentials/src/messages_lt.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
-rw-r--r--Essentials/src/messages_pl.properties1
-rw-r--r--Essentials/src/messages_pt.properties1
-rw-r--r--Essentials/src/messages_ro.properties1
-rw-r--r--Essentials/src/messages_ru.properties1
-rw-r--r--Essentials/src/messages_sv.properties1
-rw-r--r--Essentials/src/messages_tr.properties1
-rw-r--r--Essentials/src/messages_zh.properties1
-rw-r--r--Essentials/src/messages_zh_HK.properties1
-rw-r--r--Essentials/src/messages_zh_TW.properties1
26 files changed, 68 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java
index 164624319..4618159dc 100644
--- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java
+++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java
@@ -10,6 +10,7 @@ import java.util.*;
import java.util.regex.Pattern;
import com.google.common.base.Joiner;
+import java.util.logging.Level;
import net.ess3.api.IEssentials;
import org.bukkit.Color;
import org.bukkit.DyeColor;
@@ -26,6 +27,7 @@ public class MetaItemStack
{
private static final Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>();
private static final Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>();
+
static
{
for (DyeColor color : DyeColor.values())
@@ -95,6 +97,35 @@ public class MetaItemStack
completePotion = true;
}
+ public boolean canSpawn(final IEssentials ess)
+ {
+ try
+ {
+ ess.getServer().getUnsafe().modifyItemStack(stack, "{}");
+ return true;
+ }
+ catch (NullPointerException npe)
+ {
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "Itemstack is invalid", npe);
+ }
+ return false;
+ }
+ catch (NoSuchMethodError nsme)
+ {
+ return true;
+ }
+ catch (Throwable throwable)
+ {
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "Itemstack is invalid", throwable);
+ }
+ return false;
+ }
+ }
+
public void parseStringMeta(final CommandSource sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception
{
if (string[fromArg].startsWith("{"))
@@ -103,6 +134,13 @@ public class MetaItemStack
{
stack = ess.getServer().getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(string).subList(fromArg, string.length)));
}
+ catch (NullPointerException npe)
+ {
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "Itemstack is invalid", npe);
+ }
+ }
catch (NoSuchMethodError nsme)
{
throw new Exception(tl("noMetaJson"), nsme);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
index 982054bbb..8e8a6dfc4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
@@ -69,9 +69,14 @@ public class Commandgive extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
+ MetaItemStack metaStack = new MetaItemStack(stack);
+ if (!metaStack.canSpawn(ess))
+ {
+ throw new Exception(tl("unableToSpawnItem", itemname));
+ }
+
if (args.length > 3)
{
- MetaItemStack metaStack = new MetaItemStack(stack);
boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
if (allowUnsafe && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.enchantments.allowunsafe"))
{
diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv
index d1acf6404..6fa5b1ece 100644
--- a/Essentials/src/items.csv
+++ b/Essentials/src/items.csv
@@ -6661,6 +6661,7 @@ goldencarrot,396,0
goldcarrot,396,0
gcarrot,396,0
head,397,0
+skull,397,0
skeletonhead,397,0
headskeleton,397,0
skeletonskull,397,0
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 5abc17c15..084f0eff7 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index ed3a79825..21df9a42b 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index d33b004f2..5a222ac2c 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 197240ec1..92a8a4c51 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 5abc17c15..084f0eff7 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index e19c297ea..1ea437a24 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_et.properties b/Essentials/src/messages_et.properties
index 49b65fd58..2d371745e 100644
--- a/Essentials/src/messages_et.properties
+++ b/Essentials/src/messages_et.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index fa01cc3ea..da28a7cb6 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 8df87422c..ee685b3c0 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_hu.properties b/Essentials/src/messages_hu.properties
index 7fb296deb..d5c9d7829 100644
--- a/Essentials/src/messages_hu.properties
+++ b/Essentials/src/messages_hu.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index d62baa616..ce539cbb2 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_ko.properties b/Essentials/src/messages_ko.properties
index 3d5fbee08..104f1911d 100644
--- a/Essentials/src/messages_ko.properties
+++ b/Essentials/src/messages_ko.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_lt.properties b/Essentials/src/messages_lt.properties
index 68ad18671..d06f03dda 100644
--- a/Essentials/src/messages_lt.properties
+++ b/Essentials/src/messages_lt.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index b4efc24f4..11f42cd70 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 2f3f26c4f..1e705fc94 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index 72e6d98ea..36b663bf4 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_ro.properties b/Essentials/src/messages_ro.properties
index 5c36f98cb..73b792f6c 100644
--- a/Essentials/src/messages_ro.properties
+++ b/Essentials/src/messages_ro.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_ru.properties b/Essentials/src/messages_ru.properties
index dbeace14f..21968a15d 100644
--- a/Essentials/src/messages_ru.properties
+++ b/Essentials/src/messages_ru.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_sv.properties b/Essentials/src/messages_sv.properties
index 3ec26213a..875f586db 100644
--- a/Essentials/src/messages_sv.properties
+++ b/Essentials/src/messages_sv.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_tr.properties b/Essentials/src/messages_tr.properties
index 8d80e596f..b47eadc3c 100644
--- a/Essentials/src/messages_tr.properties
+++ b/Essentials/src/messages_tr.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_zh.properties b/Essentials/src/messages_zh.properties
index 2f0947661..7f24d48a9 100644
--- a/Essentials/src/messages_zh.properties
+++ b/Essentials/src/messages_zh.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_zh_HK.properties b/Essentials/src/messages_zh_HK.properties
index 82c97bf70..e928f3a21 100644
--- a/Essentials/src/messages_zh_HK.properties
+++ b/Essentials/src/messages_zh_HK.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
diff --git a/Essentials/src/messages_zh_TW.properties b/Essentials/src/messages_zh_TW.properties
index d1f61c169..2c774a53c 100644
--- a/Essentials/src/messages_zh_TW.properties
+++ b/Essentials/src/messages_zh_TW.properties
@@ -546,3 +546,4 @@ gameModeInvalid=\u00a74You need to specify a valid player/mode.
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
+unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.