From 2648a246286b255194aff7f5ca24f13e271c7bc6 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Sat, 28 Mar 2026 18:58:45 +0100 Subject: [PATCH 1/3] try to fix the bug when playEmote add a error --- .../listeners/PlayerFinishJoiningListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java b/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java index dc40d728a..976e64beb 100644 --- a/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java +++ b/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java @@ -27,8 +27,15 @@ public void onPlayerJoin(PlayerJoinEvent event) { new BukkitRunnable() { @Override public void run() { + if (!player.isOnline()) return; + player.playSound(player, "omc_sounds:ambient.join_rift", 1.0f, 1.0f); - CustomPlayer.playEmote(player, Animation.JOIN_RIFT.getNameAnimation()); + try { + CustomPlayer.playEmote(player, Animation.JOIN_RIFT.getNameAnimation()); + } catch (Exception e) { + playingAnimations.remove(player); + EmoteListener.sendCamera(player, player); + } } }.runTaskLater(OMCPlugin.getInstance(), 11L); } From a489fd000bf9bd40cc0529f924d0108583ada6ae Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Sat, 28 Mar 2026 21:32:16 +0100 Subject: [PATCH 2/3] add settings for JOIN_ANIMATION + invulnerable while animation --- .../core/features/animations/listeners/EmoteListener.java | 2 ++ .../animations/listeners/PlayerFinishJoiningListener.java | 7 ++++++- .../java/fr/openmc/core/features/settings/SettingType.java | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java b/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java index acfc15fca..1b30a2e38 100644 --- a/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java +++ b/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java @@ -96,6 +96,8 @@ private void animationEnd(Player player) { PlayerAnimationInfo info = playingAnimations.remove(player); if (info == null) return; + player.setInvulnerable(true); + sendCamera(player, player); if (info.getArmorStand() != null) info.getArmorStand().remove(); diff --git a/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java b/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java index 976e64beb..78ad65def 100644 --- a/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java +++ b/src/main/java/fr/openmc/core/features/animations/listeners/PlayerFinishJoiningListener.java @@ -4,6 +4,8 @@ import fr.openmc.core.OMCPlugin; import fr.openmc.core.features.animations.Animation; import fr.openmc.core.features.animations.PlayerAnimationInfo; +import fr.openmc.core.features.settings.PlayerSettingsManager; +import fr.openmc.core.features.settings.SettingType; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,22 +21,25 @@ public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); boolean onGround = player.getLocation().subtract(0, 1, 0).getBlock().getType().isSolid(); + if (!(boolean) PlayerSettingsManager.getPlayerSettings(player.getUniqueId()).getSetting(SettingType.JOIN_ANIMATION)) return; if (player.isFlying() || !onGround || player.getGameMode().equals(GameMode.SPECTATOR)) return; playingAnimations.put(player, new PlayerAnimationInfo()); EmoteListener.setupHead(player); + player.setInvulnerable(true); new BukkitRunnable() { @Override public void run() { if (!player.isOnline()) return; - player.playSound(player, "omc_sounds:ambient.join_rift", 1.0f, 1.0f); + player.getWorld().playSound(player.getLocation(), "omc_sounds:ambient.join_rift", 1.0f, 1.0f); try { CustomPlayer.playEmote(player, Animation.JOIN_RIFT.getNameAnimation()); } catch (Exception e) { playingAnimations.remove(player); EmoteListener.sendCamera(player, player); + player.setInvulnerable(false); } } }.runTaskLater(OMCPlugin.getInstance(), 11L); diff --git a/src/main/java/fr/openmc/core/features/settings/SettingType.java b/src/main/java/fr/openmc/core/features/settings/SettingType.java index cc24a9530..fdad9ccc6 100644 --- a/src/main/java/fr/openmc/core/features/settings/SettingType.java +++ b/src/main/java/fr/openmc/core/features/settings/SettingType.java @@ -32,7 +32,9 @@ public enum SettingType { Material.NOTE_BLOCK, Material.GRAY_DYE, "Activer ou désactiver les sons des messages privés"), TELEPORT_TITLE_FADE(ValueType.BOOLEAN, true, "Fondu du titre lors des téléportations", Material.ENDER_PEARL, Material.GRAY_DYE, "Activer ou désactiver le fondu du titre lors des téléportations"), - + JOIN_ANIMATION(ValueType.BOOLEAN, true, "Animation de connexion", + Material.GLOW_INK_SAC, Material.INK_SAC, "Activer ou désactiver l'animation de connexion"), + ; private final ValueType valueType; From 8be9b576aa25e6e33c6e301f1e55d223f817ee65 Mon Sep 17 00:00:00 2001 From: iambibi_ <89582596+iambibi@users.noreply.github.com> Date: Sun, 29 Mar 2026 11:23:50 +0200 Subject: [PATCH 3/3] review iambibi invulnerable --- .../core/features/animations/listeners/EmoteListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java b/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java index 1b30a2e38..2fe3241c6 100644 --- a/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java +++ b/src/main/java/fr/openmc/core/features/animations/listeners/EmoteListener.java @@ -96,7 +96,7 @@ private void animationEnd(Player player) { PlayerAnimationInfo info = playingAnimations.remove(player); if (info == null) return; - player.setInvulnerable(true); + player.setInvulnerable(false); sendCamera(player, player); if (info.getArmorStand() != null)