9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 10:59:07 +00:00

加点检测

This commit is contained in:
XiaoMoMi
2025-05-23 21:33:39 +08:00
parent c34ec30212
commit d0e2429008
5 changed files with 63 additions and 3 deletions

View File

@@ -175,6 +175,13 @@ debug_is_section_injected:
- /craftengine debug is-section-injected
- /ce debug is-section-injected
debug_host_status:
enable: true
permission: ce.command.debug.host_status
usage:
- /craftengine debug host-status
- /ce debug host-status
debug_test:
enable: true
permission: ce.command.debug.test

View File

@@ -121,6 +121,7 @@ public class BukkitPackManager extends AbstractPackManager implements Listener {
return;
}
if (!Config.sendPackOnUpload()) return;
CraftEngine.instance().logger().info("Complete uploading resource pack");
for (BukkitServerPlayer player : this.plugin.networkManager().onlineUsers()) {
sendResourcePack(player);
}

View File

@@ -39,6 +39,7 @@ public class BukkitCommandManager extends AbstractCommandManager<CommandSender>
new SearchUsageAdminCommand(this, plugin),
new TestCommand(this, plugin),
new DebugGetBlockStateRegistryIdCommand(this, plugin),
new DebugHostStatusCommand(this, plugin),
new DebugGetBlockInternalIdCommand(this, plugin),
new DebugAppearanceStateUsageCommand(this, plugin),
new DebugRealStateUsageCommand(this, plugin),

View File

@@ -0,0 +1,39 @@
package net.momirealms.craftengine.bukkit.plugin.command.feature;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.md_5.bungee.chat.ComponentSerializer;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.command.BukkitCommandFeature;
import net.momirealms.craftengine.bukkit.plugin.injector.BukkitInjector;
import net.momirealms.craftengine.core.pack.host.impl.SelfHostHttpServer;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.command.CraftEngineCommandManager;
import net.momirealms.craftengine.core.plugin.command.sender.Sender;
import org.bukkit.Chunk;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.incendo.cloud.Command;
public class DebugHostStatusCommand extends BukkitCommandFeature<CommandSender> {
public DebugHostStatusCommand(CraftEngineCommandManager<CommandSender> commandManager, CraftEngine plugin) {
super(commandManager, plugin);
}
@Override
public Command.Builder<? extends CommandSender> assembleCommand(org.incendo.cloud.CommandManager<CommandSender> manager, Command.Builder<CommandSender> builder) {
return builder
.handler(context -> {
Sender sender = plugin().senderFactory().wrap(context.sender());
sender.sendMessage(Component.text("Self Host status: " + (SelfHostHttpServer.instance().isAlive() ? "on" : "off")));
byte[] pack = SelfHostHttpServer.instance().resourcePackBytes();
sender.sendMessage(Component.text("Resource Pack Bytes: " + (pack == null ? "null" : pack.length)));
});
}
@Override
public String getFeatureID() {
return "debug_host_status";
}
}