Fix of small bugs relate to the events!

This commit is contained in:
Rosenthalk0 2023-06-18 15:36:00 -05:00
parent 222fbfc833
commit 6088c8b343
4 changed files with 10 additions and 0 deletions

View File

@ -1009,6 +1009,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()){ if (event.isCancelled()){
skillCasting.close();
return; return;
} }
this.skillCasting = skillCasting; this.skillCasting = skillCasting;

View File

@ -96,6 +96,9 @@ public class KeyCombos implements SkillCastingListener {
if (comboMap.isComboStart(event.getPressed())) { if (comboMap.isComboStart(event.getPressed())) {
casting = new CustomSkillCastingInstance(playerData); casting = new CustomSkillCastingInstance(playerData);
playerData.setSkillCasting(casting); playerData.setSkillCasting(casting);
if (!playerData.isCasting()){
return;
}
if (beginComboSound != null) beginComboSound.playTo(player); if (beginComboSound != null) beginComboSound.playTo(player);
} }
} }

View File

@ -57,6 +57,9 @@ public class SkillBar implements SkillCastingListener {
final PlayerData playerData = event.getData(); final PlayerData playerData = event.getData();
if (player.getGameMode() != GameMode.SPECTATOR && (MMOCore.plugin.configManager.canCreativeCast || player.getGameMode() != GameMode.CREATIVE) && !playerData.isCasting() && !playerData.getBoundSkills().isEmpty()) { if (player.getGameMode() != GameMode.SPECTATOR && (MMOCore.plugin.configManager.canCreativeCast || player.getGameMode() != GameMode.CREATIVE) && !playerData.isCasting() && !playerData.getBoundSkills().isEmpty()) {
playerData.setSkillCasting(new CustomSkillCastingInstance(playerData)); playerData.setSkillCasting(new CustomSkillCastingInstance(playerData));
if (!playerData.isCasting()){
return;
}
MMOCore.plugin.soundManager.getSound(SoundEvent.SPELL_CAST_BEGIN).playTo(player); MMOCore.plugin.soundManager.getSound(SoundEvent.SPELL_CAST_BEGIN).playTo(player);
} }
} }

View File

@ -78,6 +78,9 @@ public class SkillScroller implements SkillCastingListener {
// Enter casting mode // Enter casting mode
playerData.setSkillCasting(new CustomSkillCastingInstance(playerData)); playerData.setSkillCasting(new CustomSkillCastingInstance(playerData));
if (!playerData.isCasting()){
return;
}
if (enterSound != null) enterSound.playTo(player); if (enterSound != null) enterSound.playTo(player);
} }