diff --git a/KotlinCore/src/de/steamwar/kotlin/message/ComponentMessage.kt b/KotlinCore/src/de/steamwar/kotlin/message/ComponentMessage.kt
index 85d41b3b..e1e1023b 100644
--- a/KotlinCore/src/de/steamwar/kotlin/message/ComponentMessage.kt
+++ b/KotlinCore/src/de/steamwar/kotlin/message/ComponentMessage.kt
@@ -32,5 +32,13 @@ class ComponentMessage(private val resourceBundleName: String, private val class
override fun name(): Key = Key.key("steamwar", resourceBundleName)
- override fun translate(key: String, locale: Locale): MessageFormat = MessageFormat(ResourceBundle.getBundle(resourceBundleName, locale, classLoader).getString(key), locale)
+ override fun translate(key: String, locale: Locale): MessageFormat? {
+ val rb = ResourceBundle.getBundle(resourceBundleName, locale, classLoader)
+
+ return if (rb.containsKey(key)) {
+ MessageFormat(rb.getString(key), locale)
+ } else {
+ null
+ }
+ }
}
diff --git a/TNTLeague/build.gradle.kts b/TNTLeague/build.gradle.kts
index 0d7fc472..e8b8253a 100644
--- a/TNTLeague/build.gradle.kts
+++ b/TNTLeague/build.gradle.kts
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
plugins {
steamwar.kotlin
}
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt
index cf4de2e3..9532fb7e 100644
--- a/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague
import de.steamwar.kotlin.message.ComponentMessage
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague.properties b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.properties
index 9ab3eb16..46d8dd35 100644
--- a/TNTLeague/src/de/steamwar/tntleague/TNTLeague.properties
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague.properties
@@ -1,3 +1,22 @@
+#
+# This file is a part of the SteamWar software.
+#
+# Copyright (C) 2024 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 .
+#
+
join={0} joined the game!
joinTeam={0} joined the {1} team!
quit={0} left the game!
@@ -18,11 +37,11 @@ timeRemaining={0} minutes remaining!
gameEnded=The game has ended!
draw=The game ended in a draw!
dealer=Shopkeeper
-dealerPrice=Price: {0} Coins
+dealerItem={0} {1}
-scoreboardTarget=Target: {0}
scoreboardTime=Time: {0}:{1}
scoreboardCoins=Coins: {0}
+scoreboardTeam=Team {0}: {1}
ready=Ready
notReady=Not ready
diff --git a/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de.properties b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de.properties
index 4765cba2..21e48240 100644
--- a/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de.properties
+++ b/TNTLeague/src/de/steamwar/tntleague/TNTLeague_de.properties
@@ -1,3 +1,22 @@
+#
+# This file is a part of the SteamWar software.
+#
+# Copyright (C) 2024 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 .
+#
+
join={0} ist dem Spiel beigetreten!
joinTeam={0} ist dem {1} team begetreten!
quit={0} hat das Spiel verlassen!
@@ -13,14 +32,11 @@ gameStarted=Das Spiel beginnt!
timeRemaining=noch {0} Minuten!
gameEnded=Das Spiel ist vorbei!
draw=Keiner hat gewonnen!
-chat={0}» {1}
dealer=Händler
-dealerItem={0} {1}
dealerPrice=Kosten: {0} Coins
scoreboardTarget=Ziel: {0}
scoreboardTime=Zeit: {0}:{1}
-scoreboardTeam=Team {0}: {1}
ready=Bereit
notReady=Nicht bereit
isReady=Team {0} ist bereit!
diff --git a/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt b/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt
index aeb96492..196f4312 100644
--- a/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/command/LeaveCommand.kt
@@ -26,5 +26,5 @@ import org.bukkit.entity.Player
object LeaveCommand: SWCommand("leave", "l") {
@Register
- fun leave(player: Player) = TNTLeagueGame.getTeam(player)?.remove(player)
+ fun leave(player: Player) = TNTLeagueGame.getTeam(player)?.remove(player) ?: Unit
}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt
index 30fb8353..cf48afe7 100644
--- a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueConfig.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.config
import de.steamwar.tntleague.plugin
diff --git a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt
index faaf73aa..acfb3ac4 100644
--- a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.config
import de.steamwar.tntleague.plugin
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt
index f9f616de..917ba5be 100644
--- a/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/events/DummyListener.kt
@@ -21,5 +21,4 @@ package de.steamwar.tntleague.events
import org.bukkit.event.Listener
-object DummyListener: Listener {
-}
\ No newline at end of file
+object DummyListener: Listener
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt
index a2a8fc9f..31f2e7e2 100644
--- a/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/events/GlobalListener.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.events
import de.steamwar.tntleague.config.TNTLeagueWorldConfig
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt
index 13e8e1b0..4d6f6704 100644
--- a/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/events/IngameListener.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.events
import de.steamwar.scoreboard.SWScoreboard
@@ -13,15 +32,11 @@ import org.bukkit.entity.EntityType
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.entity.EntityExplodeEvent
-import org.bukkit.event.entity.EntityPickupItemEvent
-import org.bukkit.event.entity.PlayerDeathEvent
import org.bukkit.event.player.PlayerAttemptPickupItemEvent
import org.bukkit.event.player.PlayerDropItemEvent
import org.bukkit.event.player.PlayerInteractEntityEvent
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.event.player.PlayerMoveEvent
-import org.bukkit.event.player.PlayerPickupItemEvent
-import org.bukkit.event.player.PlayerQuitEvent
object IngameListener: Listener {
@@ -29,7 +44,7 @@ object IngameListener: Listener {
fun onEntityInteract(e: PlayerInteractEntityEvent) {
if (e.player.gameMode == GameMode.SPECTATOR) return
- if(e.rightClicked.type == EntityType.VILLAGER) {
+ if(e.rightClicked.type == EntityType.WANDERING_TRADER) {
e.isCancelled = true
e.player.openInventory(DealerInventory(e.player).getInventory())
}
@@ -68,8 +83,8 @@ object IngameListener: Listener {
@EventHandler
fun onPickupCoins(e: PlayerAttemptPickupItemEvent) {
- if (e.item.itemStack == DealerInventory.coins) {
- TNTLeagueGame.getTeam(e.player)?.coins?.plus(e.item.itemStack.amount)
+ if (e.item.itemStack.isSimilar(DealerInventory.coins)) {
+ TNTLeagueGame.getTeam(e.player)?.coins = e.item.itemStack.amount + (TNTLeagueGame.getTeam(e.player)?.coins ?: 0)
e.item.itemStack.amount = 0
e.isCancelled = true
diff --git a/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt b/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt
index e88cfbaa..7074e73c 100644
--- a/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/events/LobbyListener.kt
@@ -1,22 +1,33 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.events
import de.steamwar.tntleague.game.TNTLeagueGame
-import de.steamwar.tntleague.plugin
-import de.steamwar.tntleague.util.basic
-import de.steamwar.tntleague.util.colorByTeam
-import de.steamwar.tntleague.util.translate
-import de.steamwar.tntleague.util.yellow
-import io.papermc.paper.util.Tick
+import org.bukkit.GameMode
+import org.bukkit.entity.EntityType
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
-import org.bukkit.event.block.Action
import org.bukkit.event.entity.EntityDamageEvent
import org.bukkit.event.inventory.InventoryClickEvent
-import org.bukkit.event.player.PlayerDropItemEvent
-import org.bukkit.event.player.PlayerInteractEvent
-import org.bukkit.event.player.PlayerJoinEvent
-import org.bukkit.event.player.PlayerQuitEvent
+import org.bukkit.event.player.*
object LobbyListener: Listener {
@@ -58,4 +69,13 @@ object LobbyListener: Listener {
e.isCancelled = true
}
}
+
+ @EventHandler
+ fun onEntityInteract(e: PlayerInteractEntityEvent) {
+ if (e.player.gameMode == GameMode.SPECTATOR) return
+
+ if(e.rightClicked.type == EntityType.WANDERING_TRADER) {
+ e.isCancelled = true
+ }
+ }
}
\ No newline at end of file
diff --git a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt
index 59d4e65c..28d6e26a 100644
--- a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueGame.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.game
import de.steamwar.scoreboard.SWScoreboard
diff --git a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt
index 2de35e2e..93e1f208 100644
--- a/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/game/TNTLeagueTeam.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.game
import de.steamwar.tntleague.config.TNTLeagueWorldConfig
diff --git a/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt b/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt
index 04c1c288..cdffa7a8 100644
--- a/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/inventory/DealerInventory.kt
@@ -1,6 +1,26 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.inventory
import de.steamwar.tntleague.config.TNTLeagueConfig
+import de.steamwar.tntleague.game.TNTLeagueGame
import de.steamwar.tntleague.plugin
import de.steamwar.tntleague.util.*
import net.kyori.adventure.sound.Sound
@@ -24,13 +44,15 @@ class DealerInventory(player: Player): SWInventoryHolder() {
val price = item.second.price * if (it.isShiftClick) 5 else 1
val amount = item.second.amount * if (it.isShiftClick) 5 else 1
- if (!player.inventory.containsAtLeast(coins, price)) {
+ val team = TNTLeagueGame.getTeam(player) ?: return@to
+
+ if (team.coins < price) {
player.sendMessage(translate("notEnoughCoins").error())
player.playSound(Sound.sound(org.bukkit.Sound.ENTITY_VILLAGER_HURT.key, net.kyori.adventure.sound.Sound.Source.MASTER, 1f, 1f))
return@to
}
- player.inventory.removeItem(coins.asQuantity(price))
+ team.coins -= price
player.inventory.addItem(ItemStack.of(item.first.type, amount))
}
}
diff --git a/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt b/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt
index 5d89e541..4a0619d2 100644
--- a/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/inventory/SWInventoryHolder.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.inventory
import org.bukkit.event.inventory.InventoryClickEvent
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/Area.kt b/TNTLeague/src/de/steamwar/tntleague/util/Area.kt
index 0b27d227..8808b628 100644
--- a/TNTLeague/src/de/steamwar/tntleague/util/Area.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/util/Area.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.util
import org.bukkit.Location
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/Style.kt b/TNTLeague/src/de/steamwar/tntleague/util/Style.kt
index 3ef28b9a..fab87935 100644
--- a/TNTLeague/src/de/steamwar/tntleague/util/Style.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/util/Style.kt
@@ -1,3 +1,22 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 .
+ */
+
package de.steamwar.tntleague.util
import de.steamwar.tntleague.game.TNTLeagueTeam
diff --git a/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt b/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt
index 20151e84..c7a68885 100644
--- a/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt
+++ b/TNTLeague/src/de/steamwar/tntleague/util/TNTLeagueScoreboard.kt
@@ -22,6 +22,7 @@ package de.steamwar.tntleague.util
import de.steamwar.scoreboard.ScoreboardCallback
import de.steamwar.tntleague.config.targetedBlocks
import de.steamwar.tntleague.game.TNTLeagueGame
+import de.steamwar.tntleague.game.TNTLeagueTeam
import net.kyori.adventure.text.Component
import org.bukkit.entity.Player
import kotlin.collections.HashMap
@@ -40,14 +41,23 @@ data class TNTLeagueScoreboard(val p: Player): ScoreboardCallback {
lines.add(Component.space().yellow())
- with(TNTLeagueGame.blueTeam) {
- lines.add(translate("scoreboardTeam", translate(name).colorByTeam(this), (targetedBlocks - damagedBlocks).toString().yellow()).gray())
+ when (val team = TNTLeagueGame.getTeam(p)) {
+ is TNTLeagueTeam -> lines.add(translate("scoreboardCoins", team.coins.toString().yellow()).gray())
+ else -> lines.add(translate("scoreboardCoins",
+ Component.text(TNTLeagueGame.blueTeam.coins.toString()).colorByTeam(TNTLeagueGame.blueTeam)
+ .append(Component.text("/").darkGray())
+ .append(Component.text(TNTLeagueGame.redTeam.coins.toString()).colorByTeam(TNTLeagueGame.redTeam))
+ ).gray())
}
+
+ lines.add(Component.space().red())
+
with(TNTLeagueGame.redTeam) {
lines.add(translate("scoreboardTeam", translate(name).colorByTeam(this), (targetedBlocks - damagedBlocks).toString().yellow()).gray())
}
-
- TNTLeagueGame.getTeam(p)?.coins?.let { lines.add(translate("scoreboardCoins", it.toString().yellow()).gray()) }
+ with(TNTLeagueGame.blueTeam) {
+ lines.add(translate("scoreboardTeam", translate(name).colorByTeam(this), (targetedBlocks - damagedBlocks).toString().yellow()).gray())
+ }
lines.add(Component.space().gray())