diff options
author | cexikitin <king@hiberniagaming.net> | 2013-06-04 17:12:15 -0400 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-06-09 03:05:40 +0100 |
commit | a6b5902929836f2adc1f47ab2ea5f156327c5874 (patch) | |
tree | bc495bfdc29ff3d12135208ed9ad7818712a950c | |
parent | 7470ee685467e9dd7b1d6c0abf6e8ff174ed6e77 (diff) | |
download | Essentials-a6b5902929836f2adc1f47ab2ea5f156327c5874.tar Essentials-a6b5902929836f2adc1f47ab2ea5f156327c5874.tar.gz Essentials-a6b5902929836f2adc1f47ab2ea5f156327c5874.tar.lz Essentials-a6b5902929836f2adc1f47ab2ea5f156327c5874.tar.xz Essentials-a6b5902929836f2adc1f47ab2ea5f156327c5874.zip |
Alert give sender that the user was unable to receive all the items.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandgive.java | 21 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_cs.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_es.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fi.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_it.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pt.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_ro.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_se.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_zh.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_zh_HK.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_zh_TW.properties | 1 |
18 files changed, 32 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 1d668d2b5..ce0258108 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -3,10 +3,10 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.utils.NumberUtil; import java.util.Locale; +import java.util.Map; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -73,14 +73,14 @@ public class Commandgive extends EssentialsCommand if (args.length > 3) { MetaItemStack metaStack = new MetaItemStack(stack); - boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); + boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); if (allowUnsafe && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.enchantments.allowunsafe")) { allowUnsafe = false; } - + metaStack.parseStringMeta(sender, allowUnsafe, args, NumberUtil.isInt(args[3]) ? 4 : 3, ess); - + stack = metaStack.getItemStack(); } @@ -91,14 +91,23 @@ public class Commandgive extends EssentialsCommand final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(_("giveSpawn", stack.getAmount(), itemName, giveTo.getDisplayName())); + + Map<Integer, ItemStack> leftovers; + if (giveTo.isAuthorized("essentials.oversizedstacks")) { - InventoryWorkaround.addOversizedItems(giveTo.getInventory(), ess.getSettings().getOversizedStackSize(), stack); + leftovers = InventoryWorkaround.addOversizedItems(giveTo.getInventory(), ess.getSettings().getOversizedStackSize(), stack); } else { - InventoryWorkaround.addItems(giveTo.getInventory(), stack); + leftovers = InventoryWorkaround.addItems(giveTo.getInventory(), stack); } + + for (ItemStack item : leftovers.values()) + { + sender.sendMessage(_("giveSpawnFailure", item.getAmount(), itemName, giveTo.getDisplayName())); + } + giveTo.updateInventory(); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index ab42d0d10..2abfcd66e 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -134,6 +134,7 @@ geoIpUrlEmpty=GeoIP download url is empty. geoIpUrlInvalid=GeoIP download url is invalid. geoipJoinFormat=\u00a76Player \u00a7c{0} \u00a76comes from \u00a7c{1}\u00a76. giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76. +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. godDisabledFor=\u00a74disabled\u00a76 for\u00a7c {0} godEnabledFor=\u00a7aenabled\u00a76 for\u00a7c {0} godMode=\u00a76God mode\u00a7c {0}\u00a76. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index cd772c90f..bba5c40b4 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -545,3 +545,4 @@ youAreHealed=\u00a77Byl jsi uzdraven. youHaveNewMail=\u00a7cMas {0} zprav!\u00a7f Napis \u00a77/mail read\u00a7f aby jsi si precetl sve zpravy. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index cebc5729b..dd8f43e33 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Du er blevet healed. Halleluja! youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 84e2ec1d1..fe1557dd7 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Du wurdest geheilt. youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index ab42d0d10..fbcb40552 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a76You have been healed. youHaveNewMail=\u00a76You have\u00a7c {0} \u00a76messages! Type \u00a7c/mail read\u00a76 to view your mail. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index b5970a078..a5752d2f8 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Has sido curado. youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index cbe17df53..c0ae60764 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Sinut on parannettu. youHaveNewMail=\u00a7cSinulla on {0} viesti(\u00e4)!\u00a7f Kirjoita \u00a77/mail read\u00a7f lukeaksesi viestit. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 398a729aa..521ff15f3 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. youHaveNewMail=\u00a7cVous avez {0} message(s) ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index b20ce9b54..871aef845 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Sei stato curato. youHaveNewMail=\u00a7cHai {0} messaggi!\u00a7f digita \u00a77/mail read\u00a7f per consultare la tua mail. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 453691ae4..4c8f2f9cd 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Je bent genezen. youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 80bb0e6d8..b39e71edb 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Zostales uleczony. youHaveNewMail=\u00a77Masz\u00a7c {0} \u00a77wiadomosci! Wpisz \u00a7c/mail read\u00a77 aby je przeczytac. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index a9642f884..10b9bb9b0 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a76Voc\u00c3\u00aa foi curado. youHaveNewMail=\u00a76Voc\u00c3\u00aa tem\u00a7c {0} \u00a76mensagens! Digite \u00a7c/mail read\u00a76 para v\u00c3\u00aa-las. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_ro.properties b/Essentials/src/messages_ro.properties index f7cefc67f..51bf0e748 100644 --- a/Essentials/src/messages_ro.properties +++ b/Essentials/src/messages_ro.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a76Ai fost vindecat. youHaveNewMail=\u00a76Ai\u00a7c {0} \u00a76mesaje! scrie \u00a7c/mail read\u00a76 pentru a-ti vedea mesajele. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index e8d989fcc..788a1e08a 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -541,3 +541,4 @@ youAreHealed=\u00a77Du har blivit l\u00e4kt. youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f f\u00f6r att l\u00e4sa dina meddelanden. whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_zh.properties b/Essentials/src/messages_zh.properties index 548cd522f..9ff9160c7 100644 --- a/Essentials/src/messages_zh.properties +++ b/Essentials/src/messages_zh.properties @@ -542,3 +542,4 @@ youAreHealed=\u00a76\u4f60\u5df2\u88ab\u6cbb\u7597 youHaveNewMail=\u00a76\u4f60\u62e5\u6709 \u00a7c{0}\u00a76 \u6761\u6d88\u606f\uff01\u00a7r\u8f93\u5165 \u00a7c/mail read\u00a76 \u6765\u67e5\u770b whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_zh_HK.properties b/Essentials/src/messages_zh_HK.properties index 85d4a79ed..ada10ae31 100644 --- a/Essentials/src/messages_zh_HK.properties +++ b/Essentials/src/messages_zh_HK.properties @@ -543,3 +543,4 @@ youAreHealed=\u00a76\u4f60\u5df2\u88ab\u6cbb\u7642 youHaveNewMail=\u00a76\u4f60\u64c1\u6709 \u00a7c{0}\u00a76 \u689d\u6d88\u606f\uff01\u00a7r\u8f38\u5165 \u00a7c/mail read\u00a76 \u4f86\u67e5\u770b whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. diff --git a/Essentials/src/messages_zh_TW.properties b/Essentials/src/messages_zh_TW.properties index c6a9115d2..06a4f3621 100644 --- a/Essentials/src/messages_zh_TW.properties +++ b/Essentials/src/messages_zh_TW.properties @@ -543,3 +543,4 @@ youAreHealed=\u00a76\u4f60\u5df2\u88ab\u6cbb\u7642 youHaveNewMail=\u00a76\u4f60\u64c1\u6709 \u00a7c{0}\u00a76 \u689d\u6d88\u606f\uff01\u00a7r\u8f38\u5165 \u00a7c/mail read\u00a76 \u4f86\u67e5\u770b whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation) kitDelay=\u00a7m{0}\u00a7r +giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost. |