added sound effects
This commit is contained in:
		| @@ -4,6 +4,7 @@ import eu.mhsl.craftattack.teamLobby.data.Team; | ||||
| import eu.mhsl.craftattack.teamLobby.util.CommonHandler; | ||||
| import eu.mhsl.craftattack.teamLobby.util.PluginMessageUtil; | ||||
| import eu.mhsl.craftattack.teamLobby.util.PosSerializer; | ||||
| import net.kyori.adventure.sound.Sound; | ||||
| import net.kyori.adventure.text.Component; | ||||
| import net.kyori.adventure.text.format.NamedTextColor; | ||||
| import net.kyori.adventure.util.Ticks; | ||||
| @@ -23,6 +24,7 @@ import net.minestom.server.particle.Particle; | ||||
| import net.minestom.server.potion.Potion; | ||||
| import net.minestom.server.potion.PotionEffect; | ||||
| import net.minestom.server.registry.DynamicRegistry; | ||||
| import net.minestom.server.sound.SoundEvent; | ||||
| import net.minestom.server.timer.TaskSchedule; | ||||
| import net.minestom.server.utils.NamespaceID; | ||||
| import net.minestom.server.world.DimensionType; | ||||
| @@ -92,11 +94,26 @@ public class Lobby extends InstanceContainer { | ||||
|     private <TEvent> void onPlayerChange(TEvent event) { | ||||
|         MinecraftServer.getSchedulerManager().scheduleNextTick(() -> { | ||||
|             this.isJoining = false; | ||||
|             boolean wasComplete = this.isComplete; | ||||
|             this.isComplete = this.getPlayers().stream() | ||||
|                 .map(Entity::getUuid) | ||||
|                 .collect(Collectors.toSet()) | ||||
|                 .containsAll(this.team.players()); | ||||
|  | ||||
|             if(this.isComplete) { | ||||
|                 this.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP, Sound.Source.PLAYER, 1f, 1f)); | ||||
|                 this.everyMember(p -> p.sendMessage(Component.text( | ||||
|                     "Das Team ist vollständig. Der Server kann jederzeit über den Knopf betreten werden!", | ||||
|                     NamedTextColor.GREEN | ||||
|                 ))); | ||||
|             } else if(wasComplete) { | ||||
|                 this.playSound(Sound.sound(SoundEvent.ENTITY_EXPERIENCE_ORB_PICKUP, Sound.Source.PLAYER, 1f, 0.1f)); | ||||
|                 this.everyMember(p -> p.sendMessage(Component.text( | ||||
|                     "Das Team ist nicht mehr vollständig.", | ||||
|                     NamedTextColor.RED | ||||
|                 ))); | ||||
|             } | ||||
|  | ||||
|             this.update(); | ||||
|         }); | ||||
|     } | ||||
| @@ -105,6 +122,7 @@ public class Lobby extends InstanceContainer { | ||||
|         if(!event.getBlockPosition().sameBlock(this.buttonLocation)) return; | ||||
|         if(this.isJoining) return; | ||||
|         if(!this.isComplete) { | ||||
|             event.getPlayer().playSound(Sound.sound(SoundEvent.UI_BUTTON_CLICK, Sound.Source.PLAYER, 1f, 1f)); | ||||
|             this.everyMember(p -> p.sendActionBar(Component.text("Dein Team ist nicht vollständig!", NamedTextColor.RED))); | ||||
|             return; | ||||
|         } | ||||
| @@ -123,6 +141,7 @@ public class Lobby extends InstanceContainer { | ||||
|  | ||||
|     private void connect() { | ||||
|         if(!this.isJoining) return; | ||||
|         this.playSound(Sound.sound(SoundEvent.ENTITY_PLAYER_LEVELUP, Sound.Source.PLAYER, 1f, 1f)); | ||||
|         this.everyMember(p -> { | ||||
|             p.addEffect(new Potion(PotionEffect.DARKNESS, 0, 5 * Ticks.TICKS_PER_SECOND)); | ||||
|             p.sendActionBar(Component.text("Verbinde...", NamedTextColor.GREEN)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user