mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
feat: use HibiscusHooksAllActiveEvent for reloading plugins that active their items later
This commit is contained in:
@@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.listener;
|
|||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import me.lojosho.hibiscuscommons.api.events.HibiscusHookReload;
|
import me.lojosho.hibiscuscommons.api.events.HibiscusHookReload;
|
||||||
|
import me.lojosho.hibiscuscommons.api.events.HibiscusHooksAllActiveEvent;
|
||||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||||
import me.lojosho.hibiscuscommons.hooks.items.HookItemAdder;
|
import me.lojosho.hibiscuscommons.hooks.items.HookItemAdder;
|
||||||
import me.lojosho.hibiscuscommons.hooks.items.HookNexo;
|
import me.lojosho.hibiscuscommons.hooks.items.HookNexo;
|
||||||
@@ -15,27 +16,23 @@ public class ServerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onHookReload(HibiscusHookReload event) {
|
public void onHookReload(HibiscusHookReload event) {
|
||||||
Hook hook = event.getHook();
|
Hook hook = event.getHook();
|
||||||
|
HibiscusHookReload.ReloadType reloadType = event.getReloadType();
|
||||||
if (hook instanceof HookItemAdder) {
|
if (hook instanceof HookItemAdder) {
|
||||||
switch (event.getReloadType()) {
|
if (reloadType == HibiscusHookReload.ReloadType.RELOAD) {
|
||||||
case INITIAL -> {
|
if (!Settings.isItemsAdderChangeReload()) return;
|
||||||
HMCCosmeticsPlugin.setup();
|
HMCCosmeticsPlugin.setup();
|
||||||
}
|
|
||||||
case RELOAD -> {
|
|
||||||
if (!Settings.isItemsAdderChangeReload()) return;
|
|
||||||
HMCCosmeticsPlugin.setup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hook instanceof HookNexo) {
|
if (hook instanceof HookNexo) {
|
||||||
switch (event.getReloadType()) {
|
if (reloadType == HibiscusHookReload.ReloadType.RELOAD) {
|
||||||
case INITIAL -> {
|
if (!Settings.isNexoChangeReload()) return;
|
||||||
HMCCosmeticsPlugin.setup();
|
HMCCosmeticsPlugin.setup();
|
||||||
}
|
|
||||||
case RELOAD -> {
|
|
||||||
if (!Settings.isNexoChangeReload()) return;
|
|
||||||
HMCCosmeticsPlugin.setup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onAllHooksReady(HibiscusHooksAllActiveEvent event) {
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user