From fbe93ca3e4577627eb3d3dcafba5f4fde3a9dc2f Mon Sep 17 00:00:00 2001 From: md5sha256 <42793301+md5sha256@users.noreply.github.com> Date: Sat, 30 Dec 2023 10:31:14 +0100 Subject: [PATCH] Update effects and send the ability packet when reloading player data. --- .../hyperver/hyperverse/spigotnms/v1_17_R1/NMSImpl.java | 8 ++++---- .../hyperver/hyperverse/spigotnms/v1_18_R2/NMSImpl.java | 8 ++++---- .../hyperver/hyperverse/spigotnms/v1_19_R3/NMSImpl.java | 8 ++++---- .../hyperver/hyperverse/spigotnms/v1_20_R3/NMSImpl.java | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hyperverse-nms-1-17/src/main/java/se/hyperver/hyperverse/spigotnms/v1_17_R1/NMSImpl.java b/hyperverse-nms-1-17/src/main/java/se/hyperver/hyperverse/spigotnms/v1_17_R1/NMSImpl.java index 93f7da0b..e7c01b7d 100644 --- a/hyperverse-nms-1-17/src/main/java/se/hyperver/hyperverse/spigotnms/v1_17_R1/NMSImpl.java +++ b/hyperverse-nms-1-17/src/main/java/se/hyperver/hyperverse/spigotnms/v1_17_R1/NMSImpl.java @@ -114,10 +114,10 @@ public class NMSImpl implements NMS { final BlockPos blockPosition = new BlockPos(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()); Optional portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent") .findPortal(Objects.requireNonNull(blockPosition, "position"), 128); - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16); } - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { return null; } final BlockUtil.FoundRectangle rectangle = portalShape.get(); @@ -198,8 +198,8 @@ public class NMSImpl implements NMS { entityPlayer.reset(); entityPlayer.load(compound); - // entityPlayer.updateEffects = true; - // entityPlayer.updateAbilities(); + entityPlayer.effectsDirty = true; + entityPlayer.onUpdateAbilities(); player.teleport(originLocation); final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle(); diff --git a/hyperverse-nms-1-18/src/main/java/se/hyperver/hyperverse/spigotnms/v1_18_R2/NMSImpl.java b/hyperverse-nms-1-18/src/main/java/se/hyperver/hyperverse/spigotnms/v1_18_R2/NMSImpl.java index 967d98f6..fdedcc6a 100644 --- a/hyperverse-nms-1-18/src/main/java/se/hyperver/hyperverse/spigotnms/v1_18_R2/NMSImpl.java +++ b/hyperverse-nms-1-18/src/main/java/se/hyperver/hyperverse/spigotnms/v1_18_R2/NMSImpl.java @@ -96,10 +96,10 @@ public class NMSImpl implements NMS { final WorldBorder worldBorder = worldServer.getWorldBorder(); Optional portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent") .findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128); - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16); } - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { return null; } final BlockUtil.FoundRectangle rectangle = portalShape.get(); @@ -181,8 +181,8 @@ public class NMSImpl implements NMS { entityPlayer.reset(); entityPlayer.load(compound); - // entityPlayer.updateEffects = true; - // entityPlayer.updateAbilities(); + entityPlayer.effectsDirty = true; + entityPlayer.onUpdateAbilities(); player.teleport(originLocation); final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle(); diff --git a/hyperverse-nms-1-19/src/main/java/se/hyperver/hyperverse/spigotnms/v1_19_R3/NMSImpl.java b/hyperverse-nms-1-19/src/main/java/se/hyperver/hyperverse/spigotnms/v1_19_R3/NMSImpl.java index ccbfb444..be3c677d 100644 --- a/hyperverse-nms-1-19/src/main/java/se/hyperver/hyperverse/spigotnms/v1_19_R3/NMSImpl.java +++ b/hyperverse-nms-1-19/src/main/java/se/hyperver/hyperverse/spigotnms/v1_19_R3/NMSImpl.java @@ -97,10 +97,10 @@ public class NMSImpl implements NMS { final WorldBorder worldBorder = worldServer.getWorldBorder(); Optional portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent") .findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128); - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16); } - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { return null; } final BlockUtil.FoundRectangle rectangle = portalShape.get(); @@ -182,8 +182,8 @@ public class NMSImpl implements NMS { entityPlayer.reset(); entityPlayer.load(compound); - // entityPlayer.updateEffects = true; - // entityPlayer.updateAbilities(); + entityPlayer.effectsDirty = true; + entityPlayer.onUpdateAbilities(); player.teleport(originLocation); final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle(); diff --git a/hyperverse-nms-1-20/src/main/java/se/hyperver/hyperverse/spigotnms/v1_20_R3/NMSImpl.java b/hyperverse-nms-1-20/src/main/java/se/hyperver/hyperverse/spigotnms/v1_20_R3/NMSImpl.java index 98ab78c3..ea8d1ff4 100644 --- a/hyperverse-nms-1-20/src/main/java/se/hyperver/hyperverse/spigotnms/v1_20_R3/NMSImpl.java +++ b/hyperverse-nms-1-20/src/main/java/se/hyperver/hyperverse/spigotnms/v1_20_R3/NMSImpl.java @@ -98,10 +98,10 @@ public class NMSImpl implements NMS { final WorldBorder worldBorder = worldServer.getWorldBorder(); Optional portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent") .findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128); - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16); } - if (!portalShape.isPresent()) { + if (portalShape.isEmpty()) { return null; } final BlockUtil.FoundRectangle rectangle = portalShape.get(); @@ -183,8 +183,8 @@ public class NMSImpl implements NMS { entityPlayer.reset(); entityPlayer.load(compound); - // entityPlayer.updateEffects = true; - // entityPlayer.updateAbilities(); + entityPlayer.effectsDirty = true; + entityPlayer.onUpdateAbilities(); player.teleport(originLocation); final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle();