mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
Fixes MMOItem Stations saying the "m" filter is not registered on startup and /mmoitems reload stations
to fix.
This commit is contained in:
parent
426aee3100
commit
ae8d4b3d43
2
pom.xml
2
pom.xml
@ -141,7 +141,7 @@
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicLib-dist</artifactId>
|
||||
<version>1.3-R27-SNAPSHOT</version>
|
||||
<version>1.3-R28-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -151,6 +151,7 @@ public class MMOItems extends LuminePlugin {
|
||||
public void enable() {
|
||||
new SpigotPlugin(39267, this).checkForUpdate();
|
||||
new MMOItemsMetrics();
|
||||
MMOItemUIFilter.register();
|
||||
|
||||
RecipeBrowserGUI.registerNativeRecipes();
|
||||
skillManager.initialize(false);
|
||||
@ -215,7 +216,6 @@ public class MMOItems extends LuminePlugin {
|
||||
if (Bukkit.getPluginManager().getPlugin("PhatLoots") != null) {
|
||||
Bukkit.getPluginManager().registerEvents(new PhatLootsHook(), this);
|
||||
}
|
||||
MMOItemUIFilter.register();
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(this, () -> Bukkit.getOnlinePlayers().forEach(player -> PlayerData.get(player).updateStats()), 100, 20);
|
||||
|
||||
|
@ -17,6 +17,7 @@ import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.NameData;
|
||||
import net.Indyuce.mmoitems.stat.type.StatHistory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -41,12 +42,12 @@ public class MMOItemBuilder {
|
||||
* have. If no tier is given, item uses the default capacity
|
||||
* formula given in the main config file
|
||||
*/
|
||||
public MMOItemBuilder(MMOItemTemplate template, int level, ItemTier tier) {
|
||||
public MMOItemBuilder(MMOItemTemplate template, int level, @Nullable ItemTier tier) {
|
||||
this.level = level;
|
||||
this.tier = tier;
|
||||
|
||||
// Either use provided tier or look into the template base data
|
||||
tier = tier != null ? tier : template.getBaseItemData().containsKey(ItemStats.TIER) ? MMOItems.plugin.getTiers().getOrThrow(template.getBaseItemData().get(ItemStats.TIER).toString()) : null;
|
||||
tier = tier != null ? tier : template.getBaseItemData().containsKey(ItemStats.TIER) ? MMOItems.plugin.getTiers().get(template.getBaseItemData().get(ItemStats.TIER).toString()) : null;
|
||||
|
||||
// Capacity is not final as it keeps lowering as modifiers are selected
|
||||
double capacity = (tier != null && tier.hasCapacity() ? tier.getModifierCapacity() : MMOItems.plugin.getLanguage().defaultItemCapacity).calculate(level);
|
||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.api.item.util.identify;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.io.BukkitObjectInputStream;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
@ -28,9 +29,25 @@ public class IdentifiedItem {
|
||||
try {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
|
||||
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
|
||||
ItemStack item = (ItemStack) dataInput.readObject();
|
||||
ItemStack stack = (ItemStack) dataInput.readObject();
|
||||
dataInput.close();
|
||||
return item;
|
||||
|
||||
/*
|
||||
* For some reason, unidentified items keep having slightly different NBT tags
|
||||
* than items generated from mob drops or the GUI, I suppose it has to do with
|
||||
* the serialization-deserialization, It seems to get fixed when rebuilding
|
||||
* the item stack though.
|
||||
*
|
||||
* Its annoying because it prevents stacking.
|
||||
*/
|
||||
NBTItem toRebuild = NBTItem.get(stack);
|
||||
if (toRebuild.hasType()) {
|
||||
|
||||
// Rebuild
|
||||
LiveMMOItem rebuilt = new LiveMMOItem(stack);
|
||||
return rebuilt.newBuilder().build(); }
|
||||
|
||||
return stack;
|
||||
} catch (ClassNotFoundException | IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
@ -45,7 +45,9 @@ public class ItemSetStat extends StringStat {
|
||||
|
||||
// Display in lore
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
item.getLore().insert("set", set.getLoreTag());
|
||||
|
||||
// Apply lore
|
||||
if (set != null) { item.getLore().insert("set", set.getLoreTag()); }
|
||||
|
||||
// Add NBT
|
||||
item.addItemTag(getAppliedNBT(data));
|
||||
|
Loading…
Reference in New Issue
Block a user