diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/SoundObject.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/SoundObject.java index ace91e51..d9e4eba4 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/SoundObject.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/SoundObject.java @@ -36,7 +36,7 @@ public class SoundObject { } this.sound = sound; - this.key = key.toLowerCase(); + this.key = key; volume = split.length > 1 ? Float.parseFloat(split[1]) : 1; pitch = split.length > 2 ? Float.parseFloat(split[2]) : 1; @@ -54,7 +54,7 @@ public class SoundObject { } this.sound = sound; - this.key = key.toLowerCase(); + this.key = key; volume = (float) config.getDouble("volume", 1); pitch = (float) config.getDouble("pitch", 1); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerEnterCastingModeEvent.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerEnterCastingModeEvent.java deleted file mode 100644 index 3656a398..00000000 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerEnterCastingModeEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.Indyuce.mmocore.api.event; - -import lombok.Getter; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.jetbrains.annotations.NotNull; - -@Getter -public class PlayerEnterCastingModeEvent extends PlayerDataEvent implements Cancellable { - private static final HandlerList handlerList = new HandlerList(); - private boolean cancelled = false; - - public PlayerEnterCastingModeEvent(@NotNull Player who) { - super(PlayerData.get(who.getUniqueId())); - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(boolean cancelled) { - this.cancelled = cancelled; - } - - @NotNull - @Override - public HandlerList getHandlers() { - return getHandlerList(); - } - - public static HandlerList getHandlerList(){ - return handlerList; - } -} diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerExitCastingModeEvent.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerExitCastingModeEvent.java deleted file mode 100644 index 4f065738..00000000 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/event/PlayerExitCastingModeEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.Indyuce.mmocore.api.event; - -import lombok.Getter; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.jetbrains.annotations.NotNull; - -@Getter -public class PlayerExitCastingModeEvent extends PlayerDataEvent implements Cancellable { - private static final HandlerList handlerList = new HandlerList(); - private boolean cancelled = false; - - public PlayerExitCastingModeEvent(@NotNull Player who) { - super(PlayerData.get(who.getUniqueId())); - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(boolean cancelled) { - this.cancelled = cancelled; - } - - @NotNull - @Override - public HandlerList getHandlers() { - return handlerList; - } - - public static HandlerList getHandlerList() { - return handlerList; - } -} diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index b9347df0..291b0c6f 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -9,7 +9,9 @@ import io.lumine.mythic.lib.player.cooldown.CooldownMap; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.SoundEvent; -import net.Indyuce.mmocore.api.event.*; +import net.Indyuce.mmocore.api.event.PlayerExperienceGainEvent; +import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; +import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; import net.Indyuce.mmocore.api.event.unlocking.ItemLockedEvent; import net.Indyuce.mmocore.api.event.unlocking.ItemUnlockedEvent; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; @@ -1005,13 +1007,6 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD public void setSkillCasting(@NotNull SkillCastingInstance skillCasting) { Validate.isTrue(!isCasting(), "Player already in casting mode"); - PlayerEnterCastingModeEvent event = new PlayerEnterCastingModeEvent(getPlayer()); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()){ - skillCasting.close(); - return; - } this.skillCasting = skillCasting; } @@ -1028,26 +1023,8 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD return Objects.requireNonNull(skillCasting, "Player not in casting mode"); } - /** - * API Method to leave casting mode and fire the PlayerExitCastingModeEvent - */ - public void leaveSkillCasting(){ - this.leaveSkillCasting(false); - } - - /** - * @param skipEvent Skip the PlayerExitCastingModeEvent - */ - public void leaveSkillCasting(boolean skipEvent) { + public void leaveSkillCasting() { Validate.isTrue(isCasting(), "Player not in casting mode"); - if (!skipEvent) { - PlayerExitCastingModeEvent event = new PlayerExitCastingModeEvent(getPlayer()); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - } skillCasting.close(); this.skillCasting = null; setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java index b6de6f7f..9fe2c397 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java @@ -96,9 +96,6 @@ public class KeyCombos implements SkillCastingListener { if (comboMap.isComboStart(event.getPressed())) { casting = new CustomSkillCastingInstance(playerData); playerData.setSkillCasting(casting); - if (!playerData.isCasting()){ - return; - } if (beginComboSound != null) beginComboSound.playTo(player); } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java index f4e5873a..ca459b64 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java @@ -57,9 +57,6 @@ public class SkillBar implements SkillCastingListener { final PlayerData playerData = event.getData(); if (player.getGameMode() != GameMode.SPECTATOR && (MMOCore.plugin.configManager.canCreativeCast || player.getGameMode() != GameMode.CREATIVE) && !playerData.isCasting() && !playerData.getBoundSkills().isEmpty()) { playerData.setSkillCasting(new CustomSkillCastingInstance(playerData)); - if (!playerData.isCasting()){ - return; - } MMOCore.plugin.soundManager.getSound(SoundEvent.SPELL_CAST_BEGIN).playTo(player); } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java index 72a2db96..92acb49e 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java @@ -78,9 +78,6 @@ public class SkillScroller implements SkillCastingListener { // Enter casting mode playerData.setSkillCasting(new CustomSkillCastingInstance(playerData)); - if (!playerData.isCasting()){ - return; - } if (enterSound != null) enterSound.playTo(player); }