set custom name datawatcher
corentingosselin opened this issue ยท 3 comments
- [ Y] You're using the latest build for your server version
- [ Y] This isn't an issue caused by another plugin
- [ Y] You've checked for duplicate issues
- [ Y] You didn't use
/reload
Description and relevant errors:
This code is perfectly working for 1.13.2, the same with 1.14.4/1.14.2 does not while anything has changed since 1.14.2:
https://wiki.vg/Pre-release_protocol#Mobs
Readable code here: https://hastebin.com/betigonuce.cpp
public void setCustomName(String name) { if(VersionChecker.isHigherOrEqualThan(VersionChecker.v1_14_R1)) { Optional<?> opt = Optional.of(WrappedChatComponent.fromChatMessage(name)[0].getHandle()); dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)), opt);
} else if(VersionChecker.isHigherOrEqualThan(VersionChecker.v1_13_R1)) { dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)) , Optional.ofNullable(WrappedChatComponent.fromChatMessage(name)[0].getHandle())); } else { setDataWatcherObject(String.class, 2, name); } }
fixed
https://github.com/coco5843/ProdigyGUI/blob/master/src/main/java/fr/cocoraid/prodigygui/nms/wrapper/living/WrappedEntityLiving.java#L161
probably caused by new armor index