diff --git a/Minepacks/resources/lang/en.yml b/Minepacks/resources/lang/en.yml index f1b0ea2..b20c228 100644 --- a/Minepacks/resources/lang/en.yml +++ b/Minepacks/resources/lang/en.yml @@ -16,6 +16,7 @@ Language: NotAllowedInBackpack_SendMethod: "action_bar" DontRemoveShortcut: "&cYou must not remove the backpack shortcut from your inventory!" DontRemoveShortcut_SendMethod: "action_bar" + BackpackShrunk: "&cYour backpack shrunk! Some items fell to the ground!" Open: #Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened Cooldown: "[{\"text\":\"Please wait \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" till you reopen your backpack.\"}]" diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java index 491315b..b842836 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java @@ -18,6 +18,7 @@ package at.pcgamingfreaks.Minepacks.Bukkit; import at.pcgamingfreaks.Bukkit.MCVersion; +import at.pcgamingfreaks.Bukkit.Message.Message; import at.pcgamingfreaks.Bukkit.Util.InventoryUtils; import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.InventoryCompressor; import at.pcgamingfreaks.Util.StringUtils; @@ -44,6 +45,7 @@ import java.util.concurrent.ConcurrentHashMap; public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack { @Setter(AccessLevel.PACKAGE) private static ShrinkApproach shrinkApproach = ShrinkApproach.COMPRESS; + @Setter(AccessLevel.PACKAGE) private static Message messageBackpackShrunk = new Message("Backpack shrunk!"); private static Object titleOwnGlobal; private static String titleFormat, titleOtherFormat; private final Object titleOwn; @@ -142,14 +144,20 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack int size = Minepacks.getInstance().getBackpackPermSize(owner); if(size != bp.getSize()) { + boolean dropped = false; List items = setSize(size); for(ItemStack i : items) { if(i != null) { owner.getWorld().dropItemNaturally(owner.getLocation(), i); + dropped = true; } } + if (dropped) + { + messageBackpackShrunk.send(owner); + } } } } diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index 078410a..8b61349 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -193,6 +193,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin maxSize = config.getBackpackMaxSize(); at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setShrinkApproach(config.getShrinkApproach()); at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setTitle(config.getBPTitle(), config.getBPTitleOther()); + at.pcgamingfreaks.Minepacks.Bukkit.Backpack.setMessageBackpackShrunk(lang.getMessage("Ingame.BackpackShrunk")); messageNotFromConsole = lang.getMessage("NotFromConsole"); messageNoPermission = lang.getMessage("Ingame.NoPermission"); messageInvalidBackpack = lang.getMessage("Ingame.InvalidBackpack"); diff --git a/pom.xml b/pom.xml index 15f96c0..b7daacd 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,12 @@ pom - 2.4.27-SNAPSHOT + 2.4.27 UTF-8 UTF-8 34 - 20 + 21 1.0.39.3-SNAPSHOT 1.15.2-R0.1-SNAPSHOT