refactor: Remove redundant V1_21_8PacketFactory class

The setupPacketFactory function automatically selects the highest compatible
version using fallback logic, making the empty V1_21_8PacketFactory unnecessary.
Minecraft 1.21.8 will now use V1_21_3PacketFactory automatically.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
3328429240 2025-07-22 20:26:57 +08:00
parent fbadeac502
commit 365d0e7ca5
4 changed files with 45 additions and 25 deletions

28
.promptx/pouch.json Normal file
View file

@ -0,0 +1,28 @@
{
"currentState": "initialized",
"stateHistory": [
{
"from": "initial",
"command": "init",
"timestamp": "2025-07-10T13:21:04.186Z",
"args": [
{
"workingDirectory": "/home/wangmeng123/znpcsplus",
"ideType": "cursor"
}
]
},
{
"from": "initialized",
"command": "init",
"timestamp": "2025-07-10T13:21:38.336Z",
"args": [
{
"workingDirectory": "/home/wangmeng123/ZNPCsPlus-2.X",
"ideType": "cursor"
}
]
}
],
"lastUpdated": "2025-07-10T13:21:38.393Z"
}

View file

@ -0,0 +1,17 @@
{
"version": "2.0.0",
"source": "project",
"metadata": {
"version": "2.0.0",
"description": "project 级资源注册表",
"createdAt": "2025-07-10T13:21:38.381Z",
"updatedAt": "2025-07-10T13:21:38.383Z",
"resourceCount": 0
},
"resources": [],
"stats": {
"totalResources": 0,
"byProtocol": {},
"bySource": {}
}
}

View file

@ -234,7 +234,6 @@ public class ZNpcsPlus {
versions.put(ServerVersion.V_1_19_3, LazyLoader.of(() -> new V1_19_3PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager))); versions.put(ServerVersion.V_1_19_3, LazyLoader.of(() -> new V1_19_3PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager)));
versions.put(ServerVersion.V_1_20_2, LazyLoader.of(() -> new V1_20_2PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager))); versions.put(ServerVersion.V_1_20_2, LazyLoader.of(() -> new V1_20_2PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager)));
versions.put(ServerVersion.V_1_21_3, LazyLoader.of(() -> new V1_21_3PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager))); versions.put(ServerVersion.V_1_21_3, LazyLoader.of(() -> new V1_21_3PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager)));
versions.put(ServerVersion.V_1_21_8, LazyLoader.of(() -> new V1_21_8PacketFactory(scheduler, packetEvents, propertyRegistry, textSerializer, configManager)));
ServerVersion version = packetEvents.getServerManager().getVersion(); ServerVersion version = packetEvents.getServerManager().getVersion();
if (versions.containsKey(version)) return versions.get(version).get(); if (versions.containsKey(version)) return versions.get(version).get();

View file

@ -1,24 +0,0 @@
package lol.pyr.znpcsplus.packets;
import com.github.retrooper.packetevents.PacketEventsAPI;
import lol.pyr.znpcsplus.config.ConfigManager;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.plugin.Plugin;
/**
* PacketFactory implementation for Minecraft 1.21.8.
*
* Since 1.21.8 is a hotfix release focusing on graphical and stability improvements
* without major protocol changes, this factory inherits all functionality from
* V1_21_3PacketFactory. Future version-specific optimizations can be added here
* if needed.
*/
public class V1_21_8PacketFactory extends V1_21_3PacketFactory {
public V1_21_8PacketFactory(TaskScheduler scheduler, PacketEventsAPI<Plugin> packetEvents,
EntityPropertyRegistryImpl propertyRegistry, LegacyComponentSerializer textSerializer,
ConfigManager configManager) {
super(scheduler, packetEvents, propertyRegistry, textSerializer, configManager);
}
}