Skip to content

Commit

Permalink
move getEntityModifier to globalRegionScheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
D3it7i committed Jun 5, 2024
1 parent 1f6108e commit 1cb9c2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
}

group = "net.playl.scccpdebris"
version = "1.7.4-folia-SNAPSHOT"
version = "1.7.5-folia-SNAPSHOT"
description = "scccpdebris-folia"

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CompletableFuture;

import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.attribute.Attribute;
Expand Down Expand Up @@ -74,7 +76,12 @@ public void onPacketSending(PacketEvent event) {
private void entityMetaData(PacketEvent e) {
PacketContainer packet = e.getPacket();
Player p = e.getPlayer();
Entity entity = packet.getEntityModifier(e).read(0);
CompletableFuture<Entity> completableFuture = new CompletableFuture<>();
Bukkit.getGlobalRegionScheduler().execute(plugin, () -> {
completableFuture.complete(packet.getEntityModifier(p.getWorld()).read(0));
});

Entity entity = completableFuture.join();
List<WrappedDataValue> modifier = packet.getDataValueCollectionModifier().read(0);
if (!(entity instanceof LivingEntity) || e.isPlayerTemporary()) {
return;
Expand Down

0 comments on commit 1cb9c2b

Please sign in to comment.