Merge branch 'dev' into syntax-highlighter-unified

This commit is contained in:
Kam committed 2026-03-04 16:21:29 -05:00
commit c5cd2d7ce1
9 files changed
+160 -41

No files matched your search

@@ -14,6 +14,7 @@ import noppes.npcs.scripted.NpcAPI;
import javax.script.Bindings;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.Invocable;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import java.io.PrintWriter;
@@ -272,20 +273,18 @@ public class ScriptContainer implements IScriptUnit {
unknownFunctions.add(type);
}
} else {
if (!this.cachedFunctions.containsKey(type)) {
ScriptObjectMirror func;
if (instanceBindings != null) {
if (instanceBindings != null) {
if (!this.cachedFunctions.containsKey(type)) {
Object val = instanceBindings.get(type);
func = val instanceof ScriptObjectMirror ? (ScriptObjectMirror) val : null;
} else {
ScriptObjectMirror global = (ScriptObjectMirror) engine.getBindings(ScriptContext.ENGINE_SCOPE);
func = (ScriptObjectMirror) global.get(type);
ScriptObjectMirror func = val instanceof ScriptObjectMirror ? (ScriptObjectMirror) val : null;
this.cachedFunctions.put(type, func);
}
this.cachedFunctions.put(type, func);
}
ScriptObjectMirror func = this.cachedFunctions.get(type);
if (func != null) {
func.call(null, event);
ScriptObjectMirror func = this.cachedFunctions.get(type);
if (func != null) {
func.call(null, event);
}
} else {
((Invocable) engine).invokeFunction(type, event);
}
}
} catch (NoSuchMethodException e) {
@@ -8,6 +8,8 @@ import kamkeel.npcs.controllers.data.ability.data.ChainedAbility;
import kamkeel.npcs.controllers.data.ability.data.IAbilityAction;
import kamkeel.npcs.controllers.data.ability.data.entry.AbilityToggleEntry;
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.packets.data.UpdateAnimationsPacket;
import kamkeel.npcs.network.packets.data.ability.AbilityCooldownSyncPacket;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket;
@@ -177,6 +179,22 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
protected void clearAnimationData() {
playerData.animationData.setAnimation(null);
playerData.animationData.updateClient();
// Directly send animation clear to the owning player. updateClient() uses
// getEntitiesWithinAABB to find recipients, but during teleport the player
// entity hasn't migrated to the new chunk yet — so the AABB search centered
// on the new position won't find them, and the clear packet is never delivered.
// This guarantees the player's client always receives the clear.
EntityPlayer player = playerData.player;
if (player instanceof EntityPlayerMP) {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("AllowAnimation", playerData.animationData.enabled());
PacketHandler.Instance.sendToPlayer(
new UpdateAnimationsPacket(data, player.getCommandSenderName()),
(EntityPlayerMP) player
);
}
playingAbilityAnimation = false;
}