|
43 | 43 | import com.ghostchu.quickshop.shop.controlpanel.SimpleShopControlPanel; |
44 | 44 | import com.ghostchu.quickshop.shop.controlpanel.SimpleShopControlPanelManager; |
45 | 45 | import com.ghostchu.quickshop.shop.display.AbstractDisplayItem; |
46 | | -import com.ghostchu.quickshop.shop.display.VirtualDisplayItem; |
| 46 | +import com.ghostchu.quickshop.shop.display.virtual.VirtualDisplayItemManager; |
47 | 47 | import com.ghostchu.quickshop.shop.inventory.BukkitInventoryWrapperManager; |
48 | 48 | import com.ghostchu.quickshop.shop.signhooker.SignHooker; |
49 | 49 | import com.ghostchu.quickshop.util.*; |
@@ -238,6 +238,9 @@ public class QuickShop implements QuickShopAPI, Reloadable { |
238 | 238 | @Getter |
239 | 239 | private BungeeListener bungeeListener; |
240 | 240 | private RankLimiter rankLimiter; |
| 241 | + @Nullable |
| 242 | + @Getter |
| 243 | + private VirtualDisplayItemManager virtualDisplayItemManager; |
241 | 244 |
|
242 | 245 | public QuickShop(QuickShopBukkit javaPlugin, Logger logger, Platform platform) { |
243 | 246 | this.javaPlugin = javaPlugin; |
@@ -626,7 +629,11 @@ public final void onEnable() { |
626 | 629 | registerCommunicationChannels(); |
627 | 630 | new QSConfigurationReloadEvent(javaPlugin).callEvent(); |
628 | 631 | load3rdParty(); |
| 632 | + try (PerfMonitor ignored = new PerfMonitor("Self Test")) { |
| 633 | + runtimeCheck(EnvCheckEntry.Stage.AFTER_ON_ENABLE); |
| 634 | + } |
629 | 635 | logger.info("QuickShop Loaded! " + enableTimer.stopAndGetTimePassed() + " ms."); |
| 636 | + |
630 | 637 | } |
631 | 638 |
|
632 | 639 | private void loadErrorReporter() { |
@@ -660,6 +667,7 @@ private void loadVirtualDisplayItem() { |
660 | 667 | Plugin protocolLibPlugin = Bukkit.getPluginManager().getPlugin("ProtocolLib"); |
661 | 668 | if (protocolLibPlugin != null && protocolLibPlugin.isEnabled()) { |
662 | 669 | logger.info("Successfully loaded ProtocolLib support!"); |
| 670 | + virtualDisplayItemManager = new VirtualDisplayItemManager(this); |
663 | 671 | if (getConfig().getBoolean("shop.per-player-shop-sign")) { |
664 | 672 | signHooker = new SignHooker(this); |
665 | 673 | logger.info("Successfully registered per-player shop sign!"); |
@@ -957,9 +965,9 @@ public final void onDisable() { |
957 | 965 | logger.info("Cleaning up shop manager..."); |
958 | 966 | shopManager.clear(); |
959 | 967 | } |
960 | | - if (AbstractDisplayItem.getNowUsing() == DisplayType.VIRTUALITEM) { |
| 968 | + if (AbstractDisplayItem.getNowUsing() == DisplayType.VIRTUALITEM && virtualDisplayItemManager != null) { |
961 | 969 | logger.info("Cleaning up display manager..."); |
962 | | - VirtualDisplayItem.VirtualDisplayItemManager.unload(); |
| 970 | + virtualDisplayItemManager.unload(); |
963 | 971 | } |
964 | 972 | if (logWatcher != null) { |
965 | 973 | logger.info("Stopping log watcher..."); |
|
0 commit comments