From 6d8f2235919adc1758c9cd813a08f2744bd9c74b Mon Sep 17 00:00:00 2001 From: PiggyPiglet Date: Fri, 30 Jan 2026 20:02:19 +0800 Subject: [PATCH] actually fix windows loading issue maybe --- .../placeholderapi/PlaceholderAPIPlugin.java | 10 ++--- .../manager/LocalExpansionManager.java | 1 - .../listeners/ServerLoadEventListener.java | 44 ------------------- .../helpch/placeholderapi/util/Futures.java | 5 +-- 4 files changed, 7 insertions(+), 53 deletions(-) delete mode 100644 src/main/java/at/helpch/placeholderapi/listeners/ServerLoadEventListener.java diff --git a/src/main/java/at/helpch/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/at/helpch/placeholderapi/PlaceholderAPIPlugin.java index d80a136..a8372af 100644 --- a/src/main/java/at/helpch/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/at/helpch/placeholderapi/PlaceholderAPIPlugin.java @@ -4,8 +4,8 @@ import at.helpch.placeholderapi.commands.PlaceholderCommandRouter; import at.helpch.placeholderapi.configuration.ConfigManager; import at.helpch.placeholderapi.expansion.manager.CloudExpansionManager; import at.helpch.placeholderapi.expansion.manager.LocalExpansionManager; -import at.helpch.placeholderapi.listeners.ServerLoadEventListener; import com.hypixel.hytale.server.core.command.system.CommandSender; +import com.hypixel.hytale.server.core.console.ConsoleSender; import com.hypixel.hytale.server.core.event.events.player.PlayerDisconnectEvent; import com.hypixel.hytale.server.core.plugin.JavaPlugin; import com.hypixel.hytale.server.core.plugin.JavaPluginInit; @@ -33,16 +33,16 @@ public class PlaceholderAPIPlugin extends JavaPlugin { configManager.setup(); getEventRegistry().register(PlayerDisconnectEvent.class, localExpansionManager::onQuit); - new ServerLoadEventListener(this); + if (configManager.config().cloudEnabled()) { + cloudExpansionManager.load(); + } } @Override protected void start() { getCommandRegistry().registerCommand(new PlaceholderCommandRouter(this)); - if (configManager.config().cloudEnabled()) { - cloudExpansionManager.load(); - } + localExpansionManager().load(ConsoleSender.INSTANCE); super.start(); } diff --git a/src/main/java/at/helpch/placeholderapi/expansion/manager/LocalExpansionManager.java b/src/main/java/at/helpch/placeholderapi/expansion/manager/LocalExpansionManager.java index bf53ba8..9703e7d 100644 --- a/src/main/java/at/helpch/placeholderapi/expansion/manager/LocalExpansionManager.java +++ b/src/main/java/at/helpch/placeholderapi/expansion/manager/LocalExpansionManager.java @@ -386,7 +386,6 @@ public final class LocalExpansionManager /*implements Listener*/ { .filter(Objects::nonNull) .filter(CloudExpansion::shouldUpdate) .count(); - Message message = Message.raw(registered.size() + "").color(registered.isEmpty() ? Color.YELLOW : Color.GREEN) .insert(" placeholder hook(s) registered!"); diff --git a/src/main/java/at/helpch/placeholderapi/listeners/ServerLoadEventListener.java b/src/main/java/at/helpch/placeholderapi/listeners/ServerLoadEventListener.java deleted file mode 100644 index 1d4d20d..0000000 --- a/src/main/java/at/helpch/placeholderapi/listeners/ServerLoadEventListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of PlaceholderAPI - * - * PlaceholderAPI - * Copyright (c) 2015 - 2026 PlaceholderAPI Team - * - * PlaceholderAPI free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlaceholderAPI is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package at.helpch.placeholderapi.listeners; - -import at.helpch.placeholderapi.PlaceholderAPIPlugin; -import com.hypixel.hytale.server.core.console.ConsoleSender; -import com.hypixel.hytale.server.core.event.events.PrepareUniverseEvent; -import org.jetbrains.annotations.NotNull; - -public final class ServerLoadEventListener { - - @NotNull - private final PlaceholderAPIPlugin plugin; - - public ServerLoadEventListener(@NotNull final PlaceholderAPIPlugin plugin) { - this.plugin = plugin; - - plugin.getEventRegistry().register(PrepareUniverseEvent.class, this::onServerLoad); -// Bukkit.getPluginManager().registerEvents(this, plugin); - } - - public void onServerLoad(@NotNull final PrepareUniverseEvent event) { - plugin.localExpansionManager().load(ConsoleSender.INSTANCE); - } - -} diff --git a/src/main/java/at/helpch/placeholderapi/util/Futures.java b/src/main/java/at/helpch/placeholderapi/util/Futures.java index cdfe2ee..0354aca 100644 --- a/src/main/java/at/helpch/placeholderapi/util/Futures.java +++ b/src/main/java/at/helpch/placeholderapi/util/Futures.java @@ -29,6 +29,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import at.helpch.placeholderapi.PlaceholderAPIPlugin; +import com.hypixel.hytale.server.core.HytaleServer; import com.hypixel.hytale.server.core.universe.Universe; import org.jetbrains.annotations.NotNull; @@ -41,9 +42,7 @@ public final class Futures { @NotNull final CompletableFuture future, @NotNull final BiConsumer consumer) { future.whenComplete((value, exception) -> { - Universe.get().getDefaultWorld().execute(() -> consumer.accept(value, exception)); -// plugin.getTaskRegistry().registerTask(() -> consumer.accept(value, exception)); -// plugin.getScheduler().runTask(() -> consumer.accept(value, exception)); + HytaleServer.SCHEDULED_EXECUTOR.execute(() -> consumer.accept(value, exception)); }); }