Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private void animationEnd(Player player) {
PlayerAnimationInfo info = playingAnimations.remove(player);
if (info == null) return;

player.setInvulnerable(false);

sendCamera(player, player);
if (info.getArmorStand() != null)
info.getArmorStand().remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,16 +21,26 @@ 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() {
player.playSound(player, "omc_sounds:ambient.join_rift", 1.0f, 1.0f);
CustomPlayer.playEmote(player, Animation.JOIN_RIFT.getNameAnimation());
if (!player.isOnline()) return;

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading