9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 04:19:27 +00:00

重构调试

This commit is contained in:
XiaoMoMi
2025-07-08 20:39:12 +08:00
parent a740917e28
commit c029cf6a1d
16 changed files with 70 additions and 60 deletions

View File

@@ -13,7 +13,6 @@ import net.momirealms.craftengine.core.entity.furniture.Furniture;
import net.momirealms.craftengine.core.entity.furniture.FurnitureElement;
import net.momirealms.craftengine.core.item.Item;
import net.momirealms.craftengine.core.item.data.FireworkExplosion;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.util.Key;
import net.momirealms.craftengine.core.world.WorldPosition;
import org.bukkit.Material;
@@ -70,7 +69,6 @@ public class BukkitFurnitureElement extends AbstractFurnitureElement {
List<Object> cachedValues = new ArrayList<>(this.commonValues);
Item<ItemStack> item = BukkitItemManager.instance().createWrappedItem(item(), null);
if (item == null) {
CraftEngine.instance().debug(() -> "Failed to create furniture element because item " + item() + " not found");
item = BukkitItemManager.instance().wrap(new ItemStack(Material.BARRIER));
} else {
if (color != null) {

View File

@@ -24,6 +24,7 @@ import net.momirealms.craftengine.core.pack.AbstractPackManager;
import net.momirealms.craftengine.core.plugin.config.Config;
import net.momirealms.craftengine.core.plugin.context.ContextHolder;
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
import net.momirealms.craftengine.core.plugin.logger.Debugger;
import net.momirealms.craftengine.core.registry.BuiltInRegistries;
import net.momirealms.craftengine.core.registry.Holder;
import net.momirealms.craftengine.core.registry.WritableRegistry;
@@ -97,9 +98,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
if (wrapped == null) return Optional.empty();
return this.networkItemHandler.s2c(wrapped, player).map(Item::getItem);
} catch (Throwable e) {
if (Config.debug()) {
this.plugin.logger().warn("Failed to handle s2c items.", e);
}
Debugger.ITEM.warn(() -> "Failed to handle s2c items.", e);
return Optional.empty();
}
}
@@ -110,9 +109,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
if (wrapped == null) return Optional.empty();
return this.networkItemHandler.c2s(wrapped).map(Item::getItem);
} catch (Throwable e) {
if (Config.debug()) {
this.plugin.logger().warn("Failed to handle c2s items.", e);
}
Debugger.COMMON.warn(() -> "Failed to handle c2s items.", e);
return Optional.empty();
}
}

View File

@@ -4,7 +4,6 @@ import com.google.gson.JsonElement;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MRegistryOps;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.Platform;
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
import net.momirealms.sparrow.nbt.CompoundTag;
@@ -28,7 +27,6 @@ public class BukkitPlatform implements Platform {
Map<String, Object> map = (Map<String, Object>) MRegistryOps.NBT.convertTo(MRegistryOps.JAVA, tag);
return map.get("root");
} catch (CommandSyntaxException e) {
CraftEngine.instance().debug(e::getMessage);
throw new LocalizedResourceConfigException("warning.config.type.snbt.invalid_syntax", e, nbt);
}
}
@@ -45,7 +43,6 @@ public class BukkitPlatform implements Platform {
CompoundTag map = (CompoundTag) MRegistryOps.NBT.convertTo(MRegistryOps.SPARROW_NBT, tag);
return map.get("root");
} catch (CommandSyntaxException e) {
CraftEngine.instance().debug(e::getMessage);
throw new LocalizedResourceConfigException("warning.config.type.snbt.invalid_syntax", e, nbt);
}
}

View File

@@ -200,7 +200,7 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
this.resetUserArray();
if (VersionHelper.isFolia()) {
player.getScheduler().runAtFixedRate(plugin.javaPlugin(), (t) -> user.tick(),
() -> plugin.debug(() -> "Player " + player.getName() + "'s entity scheduler is retired"), 1, 1);
() -> {}, 1, 1);
}
}
}

View File

@@ -1,13 +1,8 @@
package net.momirealms.craftengine.bukkit.util;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.CoreReflections;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.NetworkReflections;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.config.Config;
import org.jetbrains.annotations.Nullable;
import java.util.Queue;
import java.util.UUID;
public final class ResourcePackUtils {

View File

@@ -277,7 +277,6 @@ public class BukkitWorldManager implements WorldManager, Listener {
if (ceChunk != null) {
if (ceChunk.dirty()) {
try {
this.plugin.debug(() -> "[Dirty Chunk]" + pos + " unloaded");
world.worldDataStorage().writeChunkAt(pos, ceChunk);
ceChunk.setDirty(false);
} catch (IOException e) {