added interaction sounds to settings
This commit is contained in:
@ -6,6 +6,7 @@ import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.datatypes.Setting;
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.listeners.OpenSettingsShortcutListener;
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.listeners.SettingsInventoryListener;
|
||||
import eu.mhsl.craftattack.spawn.core.util.world.InteractSounds;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -136,6 +137,7 @@ public class Settings extends Appliance {
|
||||
}
|
||||
|
||||
player.openInventory(inventory);
|
||||
InteractSounds.of(player).open();
|
||||
this.openSettingsInventories.put(player, new OpenSettingsInventory(inventory, settings));
|
||||
}
|
||||
|
||||
@ -166,6 +168,7 @@ public class Settings extends Appliance {
|
||||
if(!this.openSettingsInventories.containsKey(player)) return;
|
||||
this.openSettingsInventories.remove(player);
|
||||
player.updateInventory();
|
||||
InteractSounds.of(player).close();
|
||||
}
|
||||
|
||||
public boolean hasSettingsNotOpen(Player player) {
|
||||
|
@ -3,6 +3,7 @@ package eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.dataty
|
||||
import eu.mhsl.craftattack.spawn.core.Main;
|
||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.settings.Settings;
|
||||
import eu.mhsl.craftattack.spawn.core.util.text.ComponentUtil;
|
||||
import eu.mhsl.craftattack.spawn.core.util.world.InteractSounds;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@ -37,7 +38,9 @@ public abstract class Setting<TDataType> {
|
||||
}
|
||||
|
||||
public void triggerChange(Player p, ClickType clickType) {
|
||||
if(clickType.equals(ClickType.DOUBLE_CLICK)) return;
|
||||
this.change(p, clickType);
|
||||
InteractSounds.of(p).click();
|
||||
this.toStorage(p.getPersistentDataContainer(), this.state());
|
||||
}
|
||||
|
||||
|
@ -34,4 +34,12 @@ public class InteractSounds {
|
||||
public void delete() {
|
||||
this.playSound(SoundEventKeys.ENTITY_SILVERFISH_DEATH);
|
||||
}
|
||||
|
||||
public void open() {
|
||||
this.playSound(SoundEventKeys.BLOCK_BARREL_OPEN);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.playSound(SoundEventKeys.BLOCK_BARREL_CLOSE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user