fix double arrow formatting issue, add 1.19.4 support, fix entity destroy issue
This commit is contained in:
parent
4f6048c058
commit
b95c5ab3f3
5 changed files with 13 additions and 18 deletions
|
@ -495,6 +495,7 @@ public final class CacheRegistry {
|
|||
.withMethodName("getId")
|
||||
.withMethodName("ae")
|
||||
.withMethodName("ah")
|
||||
.withMethodName("af")
|
||||
.withExpectResult(int.class));
|
||||
|
||||
public static final TypeCache.BaseCache<Method> GET_HANDLE_PLAYER_METHOD = new TypeCache.BaseCache.MethodLoader((new TypeCache.CacheBuilder(CachePackage.CRAFT_BUKKIT))
|
||||
|
@ -567,6 +568,7 @@ public final class CacheRegistry {
|
|||
.withMethodName("getDataWatcher")
|
||||
.withMethodName("ai")
|
||||
.withMethodName("al")
|
||||
.withMethodName("aj")
|
||||
.withExpectResult(DATA_WATCHER_CLASS));
|
||||
|
||||
public static final TypeCache.BaseCache<Method> GET_BUKKIT_ENTITY_METHOD = new TypeCache.BaseCache.MethodLoader((new TypeCache.CacheBuilder(CachePackage.MINECRAFT_SERVER))
|
||||
|
|
|
@ -151,7 +151,10 @@ public interface TypeCache {
|
|||
if (eval == null) throw new NullPointerException();
|
||||
} catch (Throwable throwable) {
|
||||
if (!missAllowed) {
|
||||
log("Cache for class failed to load due to the following exception: " + this.cacheBuilder.className);
|
||||
log("Cache load failed!");
|
||||
log("Class Names: " + this.cacheBuilder.className.toString());
|
||||
log("Loader Type: " + getClass().getCanonicalName());
|
||||
log("Exception:");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CommandSender {
|
|||
}
|
||||
|
||||
public void sendMessage(CommandInformation subCommand) {
|
||||
sendMessage(" &7» &6/&eznpcs " + subCommand.name() + " " +
|
||||
sendMessage(" &7\u00BB &6/&eznpcs " + subCommand.name() + " " +
|
||||
Arrays.stream(subCommand.arguments())
|
||||
.map(s -> "<" + s + ">")
|
||||
.collect(Collectors.joining(" ")),
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DefaultCommand extends Command {
|
|||
@CommandInformation(arguments = {}, name = "", permission = "")
|
||||
public void defaultCommand(CommandSender sender, Map<String, String> args) {
|
||||
sender.sendMessage("&6&m------------------------------------------");
|
||||
sender.sendMessage("&b&lZNPCS &8» &7ZNetwork");
|
||||
sender.sendMessage("&b&lZNPCS &8\u00BB &7ZNetwork");
|
||||
sender.sendMessage("&6https://www.spigotmc.org/resources/znpcs.80940");
|
||||
Objects.requireNonNull(sender);
|
||||
getCommands().forEach(sender::sendMessage);
|
||||
|
@ -77,12 +77,8 @@ public class DefaultCommand extends Command {
|
|||
return;
|
||||
}
|
||||
NPCType npcType = NPCType.valueOf(args.get("type").toUpperCase());
|
||||
NPC npc = ZNPCsPlus.createNPC(id, npcType, sender.getPlayer().getLocation(), name);
|
||||
ZNPCsPlus.createNPC(id, npcType, sender.getPlayer().getLocation(), name);
|
||||
Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.SUCCESS);
|
||||
if (npcType == NPCType.PLAYER) {
|
||||
Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.FETCHING_SKIN, name);
|
||||
DO_APPLY_SKIN.apply(sender.getPlayer(), npc, name);
|
||||
}
|
||||
}
|
||||
|
||||
@CommandInformation(arguments = {"id"}, name = "delete", permission = "znpcs.cmd.delete", help = {" &f&l* &e/znpcs delete <npc_id>"})
|
||||
|
|
|
@ -35,8 +35,7 @@ public interface Packet {
|
|||
@SuppressWarnings("SuspiciousTernaryOperatorInVarargsCall")
|
||||
@PacketValue(keyName = "destroyPacket", valueType = ValueType.ARGUMENTS)
|
||||
default Object getDestroyPacket(int entityId) throws ReflectiveOperationException {
|
||||
(new int[1])[0] = entityId;
|
||||
return CacheRegistry.PACKET_PLAY_OUT_ENTITY_DESTROY_CONSTRUCTOR.load().newInstance(CacheRegistry.PACKET_PLAY_OUT_ENTITY_DESTROY_CONSTRUCTOR.load().getParameterTypes()[0].isArray() ? new int[1] : entityId);
|
||||
return CacheRegistry.PACKET_PLAY_OUT_ENTITY_DESTROY_CONSTRUCTOR.load().newInstance(CacheRegistry.PACKET_PLAY_OUT_ENTITY_DESTROY_CONSTRUCTOR.load().getParameterTypes()[0].isArray() ? new int[] {entityId} : entityId);
|
||||
}
|
||||
|
||||
@PacketValue(keyName = "enumSlot", valueType = ValueType.ARGUMENTS)
|
||||
|
@ -47,16 +46,11 @@ public interface Packet {
|
|||
@PacketValue(keyName = "removeTab")
|
||||
default Object getTabRemovePacket(Object nmsEntity) throws ReflectiveOperationException {
|
||||
try {
|
||||
return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_CONSTRUCTOR.load().newInstance(CacheRegistry.REMOVE_PLAYER_FIELD
|
||||
.load(),
|
||||
Collections.singletonList(nmsEntity));
|
||||
return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_CONSTRUCTOR.load().newInstance(CacheRegistry.REMOVE_PLAYER_FIELD.load(), Collections.singletonList(nmsEntity));
|
||||
} catch (Throwable throwable) {
|
||||
boolean useOldMethod = (CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_REMOVE_CLASS != null);
|
||||
if (useOldMethod)
|
||||
return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_REMOVE_CONSTRUCTOR.load()
|
||||
.newInstance(Collections.singletonList(CacheRegistry.GET_UNIQUE_ID_METHOD.load().invoke(nmsEntity)));
|
||||
return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_CONSTRUCTOR.load().newInstance(CacheRegistry.REMOVE_PLAYER_FIELD
|
||||
.load(), nmsEntity);
|
||||
if (useOldMethod) return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_REMOVE_CONSTRUCTOR.load().newInstance(Collections.singletonList(CacheRegistry.GET_UNIQUE_ID_METHOD.load().invoke(nmsEntity)));
|
||||
return CacheRegistry.PACKET_PLAY_OUT_PLAYER_INFO_CONSTRUCTOR.load().newInstance(CacheRegistry.REMOVE_PLAYER_FIELD.load(), nmsEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue