mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-28 19:39:14 +00:00
Fixes for IA
This commit is contained in:
@@ -9,11 +9,7 @@ import io.github.fisher2911.hmccosmetics.database.Database;
|
||||
import io.github.fisher2911.hmccosmetics.database.DatabaseFactory;
|
||||
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
|
||||
import io.github.fisher2911.hmccosmetics.gui.CosmeticsMenu;
|
||||
import io.github.fisher2911.hmccosmetics.listener.ClickListener;
|
||||
import io.github.fisher2911.hmccosmetics.listener.HatRemoveFixListener;
|
||||
import io.github.fisher2911.hmccosmetics.listener.JoinListener;
|
||||
import io.github.fisher2911.hmccosmetics.listener.RespawnListener;
|
||||
import io.github.fisher2911.hmccosmetics.listener.TeleportListener;
|
||||
import io.github.fisher2911.hmccosmetics.listener.*;
|
||||
import io.github.fisher2911.hmccosmetics.message.MessageHandler;
|
||||
import io.github.fisher2911.hmccosmetics.message.Messages;
|
||||
import io.github.fisher2911.hmccosmetics.user.UserManager;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class HookManager {
|
||||
|
||||
final Map<String, ItemHook> itemHookMap = new HashMap<>();
|
||||
final OraxenHook oraxenHook = new OraxenHook();
|
||||
final ItemAdderHook = new ItemAdderHook();
|
||||
final ItemAdderHook itemAdderHook = new ItemAdderHook();
|
||||
if (pluginManager.getPlugin("Oraxen") != null) itemHookMap.put(oraxenHook.getIdentifier(), oraxenHook);
|
||||
if (pluginManager.getPlugin("ItemAdder") != null) itemHookMap.put(itemAdderHook.getIdentifier(), itemAdderHook);
|
||||
this.itemHooks = new ItemHooks(itemHookMap);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package io.github.fisher2911.hmccosmetics.hook.item;
|
||||
|
||||
import dev.lone.itemsadder.api.CustomStack;
|
||||
import io.github.fisher2911.hmccosmetics.hook.Hook;
|
||||
import io.th0rgal.oraxen.items.ItemBuilder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import dev.lone.itemsadder.api.CustomItem;
|
||||
|
||||
public class ItemAdderHook implements ItemHook {
|
||||
|
||||
@@ -22,8 +21,8 @@ public class ItemAdderHook implements ItemHook {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(final String id) {
|
||||
final CustomItem customItem = CustomItem.getInstance("id);
|
||||
if (customItem == null) return null;
|
||||
return customItem.getItemStack();
|
||||
final CustomStack stack = CustomStack.getInstance(id);
|
||||
if ( stack == null ) return null;
|
||||
return stack.getItemStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.github.fisher2911.hmccosmetics.listener;
|
||||
|
||||
import dev.lone.itemsadder.api.Events.ItemsAdderLoadDataEvent;
|
||||
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
|
||||
import io.github.fisher2911.hmccosmetics.database.Database;
|
||||
import io.github.fisher2911.hmccosmetics.hook.HookManager;
|
||||
import io.github.fisher2911.hmccosmetics.hook.item.ItemAdderHook;
|
||||
import io.github.fisher2911.hmccosmetics.user.User;
|
||||
import io.github.fisher2911.hmccosmetics.user.UserManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -18,24 +21,25 @@ public class ItemsAdderListener implements Listener {
|
||||
private boolean enabled;
|
||||
private boolean loaded;
|
||||
|
||||
public JoinListener(final HMCCosmetics plugin) {
|
||||
public ItemsAdderListener(final HMCCosmetics plugin) {
|
||||
this.plugin = plugin;
|
||||
enabled = HookManager.getInstance().isEnabled(ItemAdderHook.class);
|
||||
if (!this.enabled) {
|
||||
this.plugin.load();
|
||||
this.loaded = true;
|
||||
return;
|
||||
}
|
||||
this.plugin.load();
|
||||
this.loaded = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(final ItemsAdderLoadDataEvent event) {
|
||||
this.load();
|
||||
}
|
||||
|
||||
|
||||
private void load() {
|
||||
if (this.enabled) {
|
||||
this.plugin.load();
|
||||
this.loaded = true;
|
||||
if (this.enabled) {
|
||||
this.plugin.load();
|
||||
this.loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user