Skip to content

Commit

Permalink
Merge pull request #3 from ItsSyfe/1.21.4
Browse files Browse the repository at this point in the history
Folia support
  • Loading branch information
Mrbysco authored Feb 7, 2025
2 parents be444bc + b44159a commit 685d753
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/mrbysco/armorposer/ArmorPoserPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ private void setupConfig() {
public void onDisable() {
// Plugin shutdown logic
}

public static boolean isFolia() {
try {
Class.forName("io.papermc.paper.threadedregions.ThreadedRegionizer");
} catch (Exception e) {
return false;
}
return true;
}
}
13 changes: 10 additions & 3 deletions src/main/java/com/mrbysco/armorposer/handler/SyncHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mrbysco.armorposer.ArmorPoserPlugin;
import io.netty.buffer.Unpooled;
import io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
Expand Down Expand Up @@ -79,9 +80,15 @@ public void onPluginMessageReceived(@NotNull String channel, @NotNull Player pla
double y = tagList.getDouble(1);
double z = tagList.getDouble(2);
if (x != 0 || y != 0 || z != 0)
armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getX() + x,
armorStand.getY() + y,
armorStand.getZ() + z), PlayerTeleportEvent.TeleportCause.PLUGIN);
if (ArmorPoserPlugin.isFolia()) {
armorStand.teleportAsync(new Location(armorStand.getWorld(), armorStand.getX() + x,
armorStand.getY() + y,
armorStand.getZ() + z), PlayerTeleportEvent.TeleportCause.PLUGIN);
} else {
armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getX() + x,
armorStand.getY() + y,
armorStand.getZ() + z), PlayerTeleportEvent.TeleportCause.PLUGIN);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: ArmorPoser
version: '${version}'
main: com.mrbysco.armorposer.ArmorPoserPlugin
api-version: 1.21
folia-supported: true
author: "Mrbysco"
description: "A paper plugin that allows clients to use Armor Poser to pose armor stands"
website: "https://www.curseforge.com/minecraft/bukkit-plugins/armor-poser-plugin"

0 comments on commit 685d753

Please sign in to comment.