mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Alert player about shrunken backpack (Fixes #284)
This commit is contained in:
parent
f759a4b799
commit
0b9ec74747
@ -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.\"}]"
|
||||
|
@ -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 @@
|
||||
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 void checkResize()
|
||||
int size = Minepacks.getInstance().getBackpackPermSize(owner);
|
||||
if(size != bp.getSize())
|
||||
{
|
||||
boolean dropped = false;
|
||||
List<ItemStack> items = setSize(size);
|
||||
for(ItemStack i : items)
|
||||
{
|
||||
if(i != null)
|
||||
{
|
||||
owner.getWorld().dropItemNaturally(owner.getLocation(), i);
|
||||
dropped = true;
|
||||
}
|
||||
}
|
||||
if (dropped)
|
||||
{
|
||||
messageBackpackShrunk.send(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ private void load()
|
||||
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");
|
||||
|
4
pom.xml
4
pom.xml
@ -7,12 +7,12 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<revision>2.4.27-SNAPSHOT</revision>
|
||||
<revision>2.4.27</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<configFileVersion>34</configFileVersion>
|
||||
<languageFileVersion>20</languageFileVersion>
|
||||
<languageFileVersion>21</languageFileVersion>
|
||||
<pcgfPluginLibVersion>1.0.39.3-SNAPSHOT</pcgfPluginLibVersion>
|
||||
|
||||
<bukkitVersion>1.15.2-R0.1-SNAPSHOT</bukkitVersion>
|
||||
|
Loading…
Reference in New Issue
Block a user