diff --git a/Minepacks/pom.xml b/Minepacks/pom.xml
index 5e5067d..3dc5495 100644
--- a/Minepacks/pom.xml
+++ b/Minepacks/pom.xml
@@ -38,7 +38,7 @@
at.pcgamingfreaks
PluginLib
- 1.0.27-SNAPSHOT
+ 1.0.28-SNAPSHOT
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java
index 7a8f520..6f2732c 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Backpack.java
@@ -19,6 +19,7 @@
import at.pcgamingfreaks.Bukkit.MCVersion;
import at.pcgamingfreaks.Bukkit.NMSReflection;
+import at.pcgamingfreaks.Bukkit.Utils;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.InventoryCompressor;
import at.pcgamingfreaks.StringUtils;
@@ -48,7 +49,7 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
private final static Field FIELD_TITLE = NMSReflection.getOBCField("inventory.CraftInventoryCustom$MinecraftInventory", "title");
@Setter(AccessLevel.PACKAGE) private static ShrinkApproach shrinkApproach = ShrinkApproach.COMPRESS;
private static Object titleOwn;
- private static String titleOtherFormat, titleOther;
+ private static String titleOtherFormat, titleOther, titleOwnString;
private final OfflinePlayer owner;
private final Object titleOtherOBC;
private final Map opened = new ConcurrentHashMap<>(); //Thanks Minecraft 1.14
@@ -58,6 +59,7 @@ public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
public static void setTitle(final @NotNull String title, final @NotNull String titleOther)
{
+ titleOwnString = title;
titleOwn = prepareTitle(title);
titleOtherFormat = titleOther;
}
@@ -194,25 +196,33 @@ public void open(@NotNull Player player, boolean editable, final @Nullable Strin
opened.put(player, editable);
//region Set backpack title
- // It's not perfect, but it is the only way of doing this.
- // This sets the title of the inventory based on the person who is opening it.
- // The owner will see an other title, then everyone else.
- // This way we can add owner name to the tile for everyone else.
- final Object usedTitle = (title == null) ? (player.equals(owner) ? titleOwn : titleOtherOBC) : prepareTitle(title);
- if(usedTitle != null && FIELD_TITLE != null && METHOD_GET_INVENTORY != null)
+ if(MCVersion.isOlderThan(MCVersion.MC_1_14))
{
- try
+ // It's not perfect, but it is the only way of doing this.
+ // This sets the title of the inventory based on the person who is opening it.
+ // The owner will see an other title, then everyone else.
+ // This way we can add owner name to the tile for everyone else.
+ final Object usedTitle = (title == null) ? (player.equals(owner) ? titleOwn : titleOtherOBC) : prepareTitle(title);
+ if(usedTitle != null && FIELD_TITLE != null && METHOD_GET_INVENTORY != null)
{
- FIELD_TITLE.set(METHOD_GET_INVENTORY.invoke(bp), usedTitle);
- }
- catch(Exception e)
- {
- e.printStackTrace();
+ try
+ {
+ FIELD_TITLE.set(METHOD_GET_INVENTORY.invoke(bp), usedTitle);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
//endregion
player.openInventory(bp);
+ if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_14))
+ {
+ final String usedTitle = (title == null) ? (player.equals(owner) ? titleOwnString : titleOther) : title;
+ Bukkit.getScheduler().runTaskLater(Minepacks.getInstance(), () -> Utils.updateInventoryTitle(player, usedTitle), 2);
+ }
}
public void close(Player p)
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java
index 069f56c..a5d25b8 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java
@@ -19,5 +19,5 @@
public class MagicValues
{
- public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.27-SNAPSHOT";
+ public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.28-SNAPSHOT";
}
\ No newline at end of file
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
index d32a891..9ce8d55 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
@@ -105,6 +105,7 @@ public void onEnable()
updater = new ManagedUpdater(this);
instance = this;
config = new Config(this);
+ updater.setChannel(config.getUpdateChannel());
if(config.useUpdater()) updater.update();
if(!checkMcVersion()) return;
diff --git a/pom.xml b/pom.xml
index 61503ee..8e29023 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
pom
- 2.3.10
+ 2.3.11
UTF-8
UTF-8