From 88ca2ec7b57f6a588e393af1cd5ed3fd2257dcbb Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 16 Aug 2023 22:56:25 +0200 Subject: [PATCH] Introduce Properties! --- src/TowerRun.properties | 27 +++++++++++++++ src/TowerRun_de.properties | 25 ++++++++++++++ src/config.yml | 7 ++++ .../towerrun/countdowns/EndCountdown.java | 4 ++- .../towerrun/countdowns/LobbyCountdown.java | 6 ++-- .../steamwar/towerrun/game/TowerRunGame.java | 5 +-- .../towerrun/listener/IngameListener.java | 3 +- src/world.yml | 33 +++++++++++++++++++ 8 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 src/TowerRun.properties create mode 100644 src/TowerRun_de.properties create mode 100644 src/config.yml create mode 100644 src/world.yml diff --git a/src/TowerRun.properties b/src/TowerRun.properties new file mode 100644 index 0000000..ab702e2 --- /dev/null +++ b/src/TowerRun.properties @@ -0,0 +1,27 @@ +# +# This file is a part of the SteamWar software. +# +# Copyright (C) 2023 SteamWar.de-Serverteam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +PREFIX=§eTowerRun§8» §r + +PLAYER_DIED=§c{0} §7died§8! +GAME_START=§aThe game has started§8! +GAME_WIN=§a{0} §7has won the game§8! +GAME_STARTING=§7Starting: §e{0}s§8! +GAME_WAITING=§7Waiting for players§8! +SERVER_STOPPING=§cThe server stops in §e{0}s§8! \ No newline at end of file diff --git a/src/TowerRun_de.properties b/src/TowerRun_de.properties new file mode 100644 index 0000000..31726bc --- /dev/null +++ b/src/TowerRun_de.properties @@ -0,0 +1,25 @@ +# +# This file is a part of the SteamWar software. +# +# Copyright (C) 2023 SteamWar.de-Serverteam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +PLAYER_DIED=§c{0} §7ist gestorben§8! +GAME_START=§aDas Spiel beginnt§8! +GAME_WIN=§a{0} §7hat das Spiel gewonnen§8! +GAME_STARTING=§7Das Spiel startet in §e{0}s§8! +GAME_WAITING=§7Warte auf weitere Spieler§8... +SERVER_STOPPING=§cDer Server stoppt in §e{0}s§8! \ No newline at end of file diff --git a/src/config.yml b/src/config.yml new file mode 100644 index 0000000..8b739e9 --- /dev/null +++ b/src/config.yml @@ -0,0 +1,7 @@ + +minPlayers: 2 +lobbyTimer: 30 + +destroyable: + - WHITE_WOOL + - FIRE \ No newline at end of file diff --git a/src/de/steamwar/towerrun/countdowns/EndCountdown.java b/src/de/steamwar/towerrun/countdowns/EndCountdown.java index 166e8ea..334f6b3 100644 --- a/src/de/steamwar/towerrun/countdowns/EndCountdown.java +++ b/src/de/steamwar/towerrun/countdowns/EndCountdown.java @@ -25,6 +25,7 @@ import de.steamwar.towerrun.state.GameStates; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; +import org.bukkit.Sound; import org.bukkit.scheduler.BukkitTask; import java.util.EnumSet; @@ -41,6 +42,7 @@ public class EndCountdown extends Countdown { @Override void timerEnd() { + Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1)); Bukkit.shutdown(); } @@ -51,6 +53,6 @@ public class EndCountdown extends Countdown { @Override void run() { - Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cServer wird in " + time + " Sekunden heruntergefahren..."))); + TowerRun.getMessage().broadcastActionbar("SERVER_STOPPING", time); } } diff --git a/src/de/steamwar/towerrun/countdowns/LobbyCountdown.java b/src/de/steamwar/towerrun/countdowns/LobbyCountdown.java index def1df5..f576bac 100644 --- a/src/de/steamwar/towerrun/countdowns/LobbyCountdown.java +++ b/src/de/steamwar/towerrun/countdowns/LobbyCountdown.java @@ -27,6 +27,7 @@ import de.steamwar.towerrun.state.GameStates; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; +import org.bukkit.Sound; import org.bukkit.scheduler.BukkitTask; import java.util.EnumSet; @@ -54,14 +55,15 @@ public class LobbyCountdown extends Countdown { @Override void run() { - Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§aStartet: " + time))); + TowerRun.getMessage().broadcastActionbar("GAME_STARTING", time); if (time < 10) { - Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), "note.pling", 1, 1)); + Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1)); } } @Override void timerReset() { Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§cEs wird noch auf Spieler gewartet..."))); + TowerRun.getMessage().broadcastActionbar("GAME_WAITING"); } } diff --git a/src/de/steamwar/towerrun/game/TowerRunGame.java b/src/de/steamwar/towerrun/game/TowerRunGame.java index 572c168..2b07d0c 100644 --- a/src/de/steamwar/towerrun/game/TowerRunGame.java +++ b/src/de/steamwar/towerrun/game/TowerRunGame.java @@ -19,6 +19,7 @@ package de.steamwar.towerrun.game; +import de.steamwar.towerrun.TowerRun; import de.steamwar.towerrun.config.WorldConfig; import de.steamwar.towerrun.state.GameState; import de.steamwar.towerrun.state.GameStates; @@ -46,7 +47,7 @@ public class TowerRunGame { PLAYERS_ALIVE.forEach(TowerRunPlayer::reset); GameState.nextState(); generateLava(); - Bukkit.broadcastMessage("§aDas Spiel beginnt!"); + TowerRun.getMessage().broadcast("GAME_START"); for (Location door : WorldConfig.DOORS) { door.getBlock().setType(Material.AIR); @@ -79,7 +80,7 @@ public class TowerRunGame { PLAYERS_ALIVE.clear(); tPlayer.player().teleport(WorldConfig.SPAWN); tPlayer.player().setGameMode(GameMode.SPECTATOR); - Bukkit.broadcastMessage("§a" + tPlayer.player().getName() + " hat das Spiel gewonnen!"); + TowerRun.getMessage().broadcast("GAME_WIN", tPlayer.player().getName()); GameState.nextState(); } } diff --git a/src/de/steamwar/towerrun/listener/IngameListener.java b/src/de/steamwar/towerrun/listener/IngameListener.java index 94a4d5e..48d2667 100644 --- a/src/de/steamwar/towerrun/listener/IngameListener.java +++ b/src/de/steamwar/towerrun/listener/IngameListener.java @@ -19,6 +19,7 @@ package de.steamwar.towerrun.listener; +import de.steamwar.towerrun.TowerRun; import de.steamwar.towerrun.config.Config; import de.steamwar.towerrun.state.GameStateBukkitListener; import de.steamwar.towerrun.state.GameStates; @@ -44,7 +45,7 @@ public class IngameListener extends GameStateBukkitListener { public void onPlayerDeath(PlayerDeathEvent event) { event.setDeathMessage(null); Bukkit.getOnlinePlayers().forEach(player -> { - player.sendTitle("§c" + event.getEntity().getName() + " ist gestorben!", "", 10, 70, 20); + player.sendTitle("", TowerRun.getMessage().parse("PLAYER_DIED", player, event.getEntity().getPlayer()), 10, 70, 20); player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 1); }); } diff --git a/src/world.yml b/src/world.yml new file mode 100644 index 0000000..54be90d --- /dev/null +++ b/src/world.yml @@ -0,0 +1,33 @@ +tower: + regions: + 1: + minX: 61 + maxX: 128 + minZ: 308 + maxZ: 340 + 2: + minX: 97 + maxX: 128 + minZ: 273 + maxZ: 340 + escapeHeight: 12 + spawn: + x: 116 + y: 167 + z: 297 + yaw: 0.0 + pitch: 0.0 + doors: + 1: + x: 117 + y: 167 + z: 309 + 2: + x: 116 + y: 167 + z: 309 + lavaY: 220 + +winconditions: + - LAST_REMAINING + - LAST_OUTSIDE \ No newline at end of file