@@ -429,19 +429,26 @@ private void runPlaySound(ScriptActionData scriptActionData) {
429429 }
430430
431431 private void runPush (ScriptActionData scriptActionData ) {
432- getTargets (scriptActionData ).forEach (targetEntity -> {
433- if (blueprint .getScriptRelativeVectorBlueprint () != null ) {
434- if (blueprint .getBValue () != null && blueprint .getBValue ())
435- targetEntity .setVelocity (targetEntity .getVelocity ().add (new ScriptRelativeVector (blueprint .getScriptRelativeVectorBlueprint (), eliteScript , targetEntity .getLocation ()).getVector (scriptActionData )));
436- else
437- targetEntity .setVelocity (new ScriptRelativeVector (blueprint .getScriptRelativeVectorBlueprint (), eliteScript , targetEntity .getLocation ()).getVector (scriptActionData ));
438- } else if (blueprint .getVValue () != null ) {
439- if (blueprint .getBValue () != null && blueprint .getBValue ())
440- targetEntity .setVelocity (targetEntity .getVelocity ().add (blueprint .getVValue ()));
441- else
442- targetEntity .setVelocity (blueprint .getVValue ());
432+ //When players get hit that resets their velocity (by Minecraft) and since this runs before the damage is applied
433+ //any velocity set here would be cancelled if used in a damage event. To bypass it we just run it a tick later.
434+ new BukkitRunnable () {
435+ @ Override
436+ public void run () {
437+ getTargets (scriptActionData ).forEach (targetEntity -> {
438+ if (blueprint .getScriptRelativeVectorBlueprint () != null ) {
439+ if (blueprint .getBValue () != null && blueprint .getBValue ())
440+ targetEntity .setVelocity (targetEntity .getVelocity ().add (new ScriptRelativeVector (blueprint .getScriptRelativeVectorBlueprint (), eliteScript , targetEntity .getLocation ()).getVector (scriptActionData )));
441+ else
442+ targetEntity .setVelocity (new ScriptRelativeVector (blueprint .getScriptRelativeVectorBlueprint (), eliteScript , targetEntity .getLocation ()).getVector (scriptActionData ));
443+ } else if (blueprint .getVValue () != null ) {
444+ if (blueprint .getBValue () != null && blueprint .getBValue ())
445+ targetEntity .setVelocity (targetEntity .getVelocity ().add (blueprint .getVValue ()));
446+ else
447+ targetEntity .setVelocity (blueprint .getVValue ());
448+ }
449+ });
443450 }
444- });
451+ }. runTaskLater ( MetadataHandler . PLUGIN , 1 );
445452 }
446453
447454 private void runSummonReinforcement (ScriptActionData scriptActionData ) {
0 commit comments