Merge branch 'revert-a0ec9542' into 'master'

Revert "Merge branch 'custom-sound-case-sensitivity-fix' into 'master'"

See merge request phoenix-dvpmt/mmocore!29
This commit is contained in:
Guillaume 2023-06-25 08:05:00 +00:00
commit 6cd8c50ffa
7 changed files with 6 additions and 114 deletions

View File

@ -36,7 +36,7 @@ public class SoundObject {
} }
this.sound = sound; this.sound = sound;
this.key = key.toLowerCase(); this.key = key;
volume = split.length > 1 ? Float.parseFloat(split[1]) : 1; volume = split.length > 1 ? Float.parseFloat(split[1]) : 1;
pitch = split.length > 2 ? Float.parseFloat(split[2]) : 1; pitch = split.length > 2 ? Float.parseFloat(split[2]) : 1;
@ -54,7 +54,7 @@ public class SoundObject {
} }
this.sound = sound; this.sound = sound;
this.key = key.toLowerCase(); this.key = key;
volume = (float) config.getDouble("volume", 1); volume = (float) config.getDouble("volume", 1);
pitch = (float) config.getDouble("pitch", 1); pitch = (float) config.getDouble("pitch", 1);

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -9,7 +9,9 @@ import io.lumine.mythic.lib.player.cooldown.CooldownMap;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.ConfigMessage;
import net.Indyuce.mmocore.api.SoundEvent; 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.ItemLockedEvent;
import net.Indyuce.mmocore.api.event.unlocking.ItemUnlockedEvent; import net.Indyuce.mmocore.api.event.unlocking.ItemUnlockedEvent;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; 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) { public void setSkillCasting(@NotNull SkillCastingInstance skillCasting) {
Validate.isTrue(!isCasting(), "Player already in casting mode"); 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; this.skillCasting = skillCasting;
} }
@ -1028,26 +1023,8 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
return Objects.requireNonNull(skillCasting, "Player not in casting mode"); return Objects.requireNonNull(skillCasting, "Player not in casting mode");
} }
/** public void leaveSkillCasting() {
* 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) {
Validate.isTrue(isCasting(), "Player not in casting mode"); 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(); skillCasting.close();
this.skillCasting = null; this.skillCasting = null;
setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar

View File

@ -96,9 +96,6 @@ 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,9 +57,6 @@ 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,9 +78,6 @@ 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);
} }