diff --git a/build.gradle b/build.gradle index a2b6500..11cab29 100644 --- a/build.gradle +++ b/build.gradle @@ -143,8 +143,6 @@ dependencies { implementation project(path: ':multiver:mc-1-19-3', configuration: 'reobf') implementation project(path: ':multiver:mc-1-19-4', configuration: 'reobf') implementation project(path: ':multiver:mc-1-20', configuration: 'reobf') - implementation project(path: ':folia:folia-1-19-4') - implementation project(path: ':folia:folia-1-20') } shadowJar { diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 978aa52..d29599a 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -13,8 +13,6 @@ dependencies { compileOnly project(path: ':multiver:mc-1-19-3', configuration: 'reobf') compileOnly project(path: ':multiver:mc-1-19-4', configuration: 'reobf') compileOnly project(path: ':multiver:mc-1-20', configuration: 'reobf') - compileOnly project(path: ':folia:folia-1-19-4') - compileOnly project(path: ':folia:folia-1-20') implementation "net.kyori:adventure-platform-bukkit:4.3.0" } diff --git a/bukkit/src/main/java/com/georgev22/skinoverlay/SkinOverlayBukkit.java b/bukkit/src/main/java/com/georgev22/skinoverlay/SkinOverlayBukkit.java index d050f14..ca6f94f 100644 --- a/bukkit/src/main/java/com/georgev22/skinoverlay/SkinOverlayBukkit.java +++ b/bukkit/src/main/java/com/georgev22/skinoverlay/SkinOverlayBukkit.java @@ -89,20 +89,8 @@ public void onEnable() { case V1_18_R2 -> skinOverlay.setSkinHandler(new SkinHandler_1_18_R2()); case V1_19_R1 -> skinOverlay.setSkinHandler(new SkinHandler_1_19()); case V1_19_R2 -> skinOverlay.setSkinHandler(new SkinHandler_1_19_R2()); - case V1_19_R3 -> { - if (isFolia()) { - skinOverlay.setSkinHandler(new SkinHandler_Folia_1_19_R3()); - } else { - skinOverlay.setSkinHandler(new SkinHandler_1_19_R3()); - } - } - case V1_20_R1 -> { - if (isFolia()) { - skinOverlay.setSkinHandler(new SkinHandler_Folia_1_20_R1()); - } else { - skinOverlay.setSkinHandler(new SkinHandler_1_20()); - } - } + case V1_19_R3 -> skinOverlay.setSkinHandler(new SkinHandler_1_19_R3()); + case V1_20_R1 -> skinOverlay.setSkinHandler(new SkinHandler_1_20()); case UNKNOWN -> skinOverlay.setSkinHandler(new SkinHandler_Unsupported()); default -> skinOverlay.setSkinHandler(new SkinHandler_Legacy()); } diff --git a/folia/build.gradle b/folia/build.gradle deleted file mode 100644 index e69de29..0000000 diff --git a/folia/folia-1-19-4/build.gradle b/folia/folia-1-19-4/build.gradle deleted file mode 100644 index 9462aa0..0000000 --- a/folia/folia-1-19-4/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "io.papermc.paperweight.userdev" version "1.5.5" -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - paperweight.foliaDevBundle("1.19.4-R0.1-SNAPSHOT") - - implementation project(path: ':core') - - compileOnly "io.papermc:paperlib:1.0.8" -} \ No newline at end of file diff --git a/folia/folia-1-19-4/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_19_R3.java b/folia/folia-1-19-4/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_19_R3.java deleted file mode 100644 index 964ddaa..0000000 --- a/folia/folia-1-19-4/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_19_R3.java +++ /dev/null @@ -1,134 +0,0 @@ - -package com.georgev22.skinoverlay.handler.handlers; - -import com.georgev22.library.scheduler.SchedulerManager; -import com.georgev22.skinoverlay.handler.SGameProfile; -import com.georgev22.skinoverlay.handler.Skin; -import com.georgev22.skinoverlay.handler.SkinHandler; -import com.georgev22.skinoverlay.utilities.player.PlayerObject; -import com.mojang.authlib.GameProfile; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.*; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.ServerPlayerGameMode; -import net.minecraft.world.level.biome.BiomeManager; -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import static com.georgev22.skinoverlay.handler.handlers.SkinHandler_Unsupported.wrapper; - -public final class SkinHandler_Folia_1_19_R3 extends SkinHandler { - - @Override - public CompletableFuture updateSkin(@NotNull PlayerObject playerObject, @NotNull Skin skin) { - return CompletableFuture.supplyAsync(() -> { - try { - Player player = (Player) playerObject.player(); - final CraftPlayer craftPlayer = (CraftPlayer) player; - final ServerPlayer entityPlayer = craftPlayer.getHandle(); - - ClientboundPlayerInfoRemovePacket removePlayer = new ClientboundPlayerInfoRemovePacket(List.of(entityPlayer.getUUID())); - ClientboundPlayerInfoUpdatePacket addPlayer = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityPlayer)); - ServerLevel world = entityPlayer.getLevel(); - ServerPlayerGameMode gamemode = entityPlayer.gameMode; - - ClientboundRespawnPacket respawn = new ClientboundRespawnPacket( - world.dimensionTypeId(), - world.dimension(), - BiomeManager.obfuscateSeed(world.getSeed()), - gamemode.getGameModeForPlayer(), - gamemode.getPreviousGameModeForPlayer(), - world.isDebug(), - world.isFlat(), - (byte) 3, - entityPlayer.getLastDeathLocation() - ); - - Location l = player.getLocation(); - ClientboundPlayerPositionPacket pos = new ClientboundPlayerPositionPacket(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch(), new HashSet<>(), 0); - ClientboundSetCarriedItemPacket slot = new ClientboundSetCarriedItemPacket(player.getInventory().getHeldItemSlot()); - - sendPacket(entityPlayer, removePlayer); - sendPacket(entityPlayer, addPlayer); - - sendPacket(entityPlayer, respawn); - - SynchedEntityData synchedEntityData = entityPlayer.getEntityData(); - - EntityDataAccessor entityDataAccessor; - - synchedEntityData.set(entityDataAccessor = new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), skin.skinOptions().getFlags()); - - synchedEntityData.markDirty(entityDataAccessor); - - synchedEntityData.refresh(entityPlayer); - - entityPlayer.onUpdateAbilities(); - - sendPacket(entityPlayer, pos); - sendPacket(entityPlayer, slot); - craftPlayer.updateScaledHealth(); - player.updateInventory(); - entityPlayer.resetSentInfo(); - return true; - } catch (Exception exception) { - throw new RuntimeException(exception); - } - }); - } - - @Override - public void applySkin(@NotNull PlayerObject playerObject, @NotNull Skin skin) { - SchedulerManager.getScheduler().runTaskLater(skinOverlay.getClass(), () -> { - Player player = (Player) playerObject.player(); - player.hidePlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - player.showPlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - skinOverlay.getSkinHandler().updateSkin(playerObject, skin).handleAsync((aBoolean, throwable) -> { - if (throwable != null) { - throwable.printStackTrace(); - return false; - } - return aBoolean; - }).thenAccept(aBoolean -> SchedulerManager.getScheduler().runTask(skinOverlay.getClass(), () -> { - if (aBoolean) - skinOverlay.onlinePlayers().stream().filter(playerObjects -> playerObjects != playerObject).forEach(playerObjects -> { - Player p = (Player) playerObjects.player(); - p.hidePlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - p.showPlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - }); - })); - }, 20L); - } - - @Override - public GameProfile getInternalGameProfile(@NotNull PlayerObject playerObject) { - Player player = (Player) playerObject.player(); - final CraftPlayer craftPlayer = (CraftPlayer) player; - final ServerPlayer entityPlayer = craftPlayer.getHandle(); - return entityPlayer.getGameProfile(); - } - - @Override - public SGameProfile getGameProfile(@NotNull PlayerObject playerObject) { - if (sGameProfiles.containsKey(playerObject)) { - return sGameProfiles.get(playerObject); - } - return sGameProfiles.append(playerObject, wrapper(this.getInternalGameProfile(playerObject))).get(playerObject); - } - - private void sendPacket(@NotNull ServerPlayer player, Packet packet) { - player.connection.send(packet); - } -} - diff --git a/folia/folia-1-20/build.gradle b/folia/folia-1-20/build.gradle deleted file mode 100644 index 858d91f..0000000 --- a/folia/folia-1-20/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "io.papermc.paperweight.userdev" version "1.5.5" -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - paperweight.foliaDevBundle("1.20.1-R0.1-SNAPSHOT") - - implementation project(path: ':core') - - compileOnly "io.papermc:paperlib:1.0.8" -} \ No newline at end of file diff --git a/folia/folia-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_20_R1.java b/folia/folia-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_20_R1.java deleted file mode 100644 index 3382bfe..0000000 --- a/folia/folia-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_Folia_1_20_R1.java +++ /dev/null @@ -1,135 +0,0 @@ - -package com.georgev22.skinoverlay.handler.handlers; - -import com.georgev22.library.scheduler.SchedulerManager; -import com.georgev22.skinoverlay.handler.SGameProfile; -import com.georgev22.skinoverlay.handler.Skin; -import com.georgev22.skinoverlay.handler.SkinHandler; -import com.georgev22.skinoverlay.utilities.player.PlayerObject; -import com.mojang.authlib.GameProfile; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.*; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.ServerPlayerGameMode; -import net.minecraft.world.level.biome.BiomeManager; -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -import static com.georgev22.skinoverlay.handler.handlers.SkinHandler_Unsupported.wrapper; - -public final class SkinHandler_Folia_1_20_R1 extends SkinHandler { - - @Override - public CompletableFuture updateSkin(@NotNull PlayerObject playerObject, @NotNull Skin skin) { - return CompletableFuture.supplyAsync(() -> { - try { - Player player = (Player) playerObject.player(); - final CraftPlayer craftPlayer = (CraftPlayer) player; - final ServerPlayer entityPlayer = craftPlayer.getHandle(); - - ClientboundPlayerInfoRemovePacket removePlayer = new ClientboundPlayerInfoRemovePacket(List.of(entityPlayer.getUUID())); - ClientboundPlayerInfoUpdatePacket addPlayer = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityPlayer)); - ServerLevel world = entityPlayer.serverLevel(); - ServerPlayerGameMode gamemode = entityPlayer.gameMode; - - ClientboundRespawnPacket respawn = new ClientboundRespawnPacket( - world.dimensionTypeId(), - world.dimension(), - BiomeManager.obfuscateSeed(world.getSeed()), - gamemode.getGameModeForPlayer(), - gamemode.getPreviousGameModeForPlayer(), - world.isDebug(), - world.isFlat(), - (byte) 3, - entityPlayer.getLastDeathLocation(), - entityPlayer.getPortalCooldown() - ); - - Location l = player.getLocation(); - ClientboundPlayerPositionPacket pos = new ClientboundPlayerPositionPacket(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch(), new HashSet<>(), 0); - ClientboundSetCarriedItemPacket slot = new ClientboundSetCarriedItemPacket(player.getInventory().getHeldItemSlot()); - - sendPacket(entityPlayer, removePlayer); - sendPacket(entityPlayer, addPlayer); - - sendPacket(entityPlayer, respawn); - - SynchedEntityData synchedEntityData = entityPlayer.getEntityData(); - - EntityDataAccessor entityDataAccessor; - - synchedEntityData.set(entityDataAccessor = new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), skin.skinOptions().getFlags()); - - synchedEntityData.markDirty(entityDataAccessor); - - synchedEntityData.refresh(entityPlayer); - - entityPlayer.onUpdateAbilities(); - - sendPacket(entityPlayer, pos); - sendPacket(entityPlayer, slot); - craftPlayer.updateScaledHealth(); - player.updateInventory(); - entityPlayer.resetSentInfo(); - return true; - } catch (Exception exception) { - throw new RuntimeException(exception); - } - }); - } - - @Override - public void applySkin(@NotNull PlayerObject playerObject, @NotNull Skin skin) { - SchedulerManager.getScheduler().runTaskLater(skinOverlay.getClass(), () -> { - Player player = (Player) playerObject.player(); - player.hidePlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - player.showPlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - skinOverlay.getSkinHandler().updateSkin(playerObject, skin).handleAsync((aBoolean, throwable) -> { - if (throwable != null) { - throwable.printStackTrace(); - return false; - } - return aBoolean; - }).thenAccept(aBoolean -> SchedulerManager.getScheduler().runTask(skinOverlay.getClass(), () -> { - if (aBoolean) - skinOverlay.onlinePlayers().stream().filter(playerObjects -> playerObjects != playerObject).forEach(playerObjects -> { - Player p = (Player) playerObjects.player(); - p.hidePlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - p.showPlayer((Plugin) skinOverlay.getSkinOverlay().plugin(), player); - }); - })); - }, 20L); - } - - @Override - public GameProfile getInternalGameProfile(@NotNull PlayerObject playerObject) { - Player player = (Player) playerObject.player(); - final CraftPlayer craftPlayer = (CraftPlayer) player; - final ServerPlayer entityPlayer = craftPlayer.getHandle(); - return entityPlayer.getGameProfile(); - } - - @Override - public SGameProfile getGameProfile(@NotNull PlayerObject playerObject) { - if (sGameProfiles.containsKey(playerObject)) { - return sGameProfiles.get(playerObject); - } - return sGameProfiles.append(playerObject, wrapper(this.getInternalGameProfile(playerObject))).get(playerObject); - } - - private void sendPacket(@NotNull ServerPlayer player, Packet packet) { - player.connection.send(packet); - } -} - diff --git a/multiver/mc-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_1_20.java b/multiver/mc-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_1_20.java index ee6a8df..07ea758 100644 --- a/multiver/mc-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_1_20.java +++ b/multiver/mc-1-20/src/main/java/com/georgev22/skinoverlay/handler/handlers/SkinHandler_1_20.java @@ -38,7 +38,6 @@ public CompletableFuture updateSkin(@NotNull PlayerObject playerObject, final CraftPlayer craftPlayer = (CraftPlayer) player; final ServerPlayer entityPlayer = craftPlayer.getHandle(); - ClientboundPlayerInfoRemovePacket removePlayer = new ClientboundPlayerInfoRemovePacket(List.of(entityPlayer.getUUID())); ClientboundPlayerInfoUpdatePacket addPlayer = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityPlayer)); ServerLevel world = entityPlayer.serverLevel(); diff --git a/settings.gradle b/settings.gradle index feaf5c5..748311d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,9 +21,6 @@ include ':multiver:mc-1-19' include ':multiver:mc-1-19-3' include ':multiver:mc-1-19-4' include 'multiver:mc-1-20' -include 'folia' -include 'folia:folia-1-19-4' -include 'folia:folia-1-20' findProject(':multiver:mc-1-17')?.name = 'mc-1-17' findProject(':multiver:mc-1-18')?.name = 'mc-1-18' findProject(':multiver:mc-1-18-2')?.name = 'mc-1-18-2' @@ -31,6 +28,4 @@ findProject(':multiver:mc-1-19')?.name = 'mc-1-19' findProject(':multiver:mc-1-19-3')?.name = 'mc-1-19-3' findProject(':multiver:mc-1-19-4')?.name = 'mc-1-19-4' findProject(':multiver:mc-1-20')?.name = 'mc-1-20' -findProject(':folia:folia-1-19-4')?.name = 'folia-1-19-4' -findProject(':folia:folia-1-20')?.name = 'folia-1-20'