Skip to content

Commit 63c056c

Browse files
author
Shynixn
committed
#753 Added new logging settings.
1 parent b0425f3 commit 63c056c

16 files changed

Lines changed: 204 additions & 155 deletions

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## Release 7.42.0
4+
5+
### Changes
6+
7+
* #753 Added new logging settings to the config.yml. It is highly recommended to delete the config.yml to let it be recreated.
8+
* #753 You can now configure the log level of BlockBall for the main server console and BlockBall-only log file found in the /plugins/BlockBall/logs folder.
9+
* #753 Log levels can be switched without server shutdown and applied via the /blockball reload command. This is useful for cases where you want to actively investigate something using DEBUG mode.
10+
11+
### Bugs/Issues
12+
13+
* #752 Fixed html color codes did not work in standard chat messages.
14+
15+
---
16+
317
## Release 7.41.2
418

519
### Bugs/Issues

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "com.github.shynixn"
11-
version = "7.41.2"
11+
version = "7.42.0"
1212

1313
repositories {
1414
mavenCentral()
@@ -34,8 +34,8 @@ dependencies {
3434
implementation("com.github.shynixn.shyscoreboard:shyscoreboard:1.14.1")
3535
implementation("com.github.shynixn.shyparticles:shyparticles:1.4.1")
3636
implementation("com.github.shynixn.shyguild:shyguild:1.2.1")
37-
implementation("com.github.shynixn.mcutils:common:2026.13")
38-
implementation("com.github.shynixn.mcutils:packet:2026.24")
37+
implementation("com.github.shynixn.mcutils:common:2026.16")
38+
implementation("com.github.shynixn.mcutils:packet:2026.25")
3939
implementation("com.github.shynixn.mcutils:worldguard:2026.1")
4040
implementation("com.github.shynixn.mcutils:database:2026.3")
4141
implementation("com.github.shynixn.mcutils:http:2026.3")

src/main/java/com/github/shynixn/blockball/BlockBallPlugin.kt

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import com.github.shynixn.blockball.entity.SoccerBallMeta
88
import com.github.shynixn.blockball.enumeration.PlaceHolder
99
import com.github.shynixn.blockball.impl.commandexecutor.BlockBallCommandExecutor
1010
import com.github.shynixn.blockball.impl.exception.SoccerGameException
11-
import com.github.shynixn.blockball.impl.listener.*
11+
import com.github.shynixn.blockball.impl.listener.BallListener
12+
import com.github.shynixn.blockball.impl.listener.DoubleJumpListener
13+
import com.github.shynixn.blockball.impl.listener.ForceFieldListener
14+
import com.github.shynixn.blockball.impl.listener.GameListener
1215
import com.github.shynixn.mccoroutine.folia.*
1316
import com.github.shynixn.mcutils.common.*
1417
import com.github.shynixn.mcutils.common.di.DependencyInjectionModule
@@ -53,18 +56,13 @@ import com.github.shynixn.shyscoreboard.entity.ShyScoreboardSettings
5356
import com.github.shynixn.shyscoreboard.impl.commandexecutor.ShyScoreboardCommandExecutor
5457
import com.github.shynixn.shyscoreboard.impl.listener.ShyScoreboardListener
5558
import kotlinx.coroutines.Job
56-
import kotlinx.coroutines.delay
5759
import kotlinx.coroutines.runBlocking
5860
import org.bukkit.Bukkit
5961
import org.bukkit.Location
6062
import org.bukkit.entity.Entity
6163
import org.bukkit.plugin.ServicePriority
6264
import org.bukkit.plugin.java.JavaPlugin
63-
import org.bukkit.util.Vector
64-
import java.nio.file.Files
65-
import java.util.logging.Level
6665
import kotlin.coroutines.CoroutineContext
67-
import kotlin.io.path.absolutePathString
6866

6967
/**
7068
* Plugin Main.
@@ -136,36 +134,36 @@ class BlockBallPlugin : JavaPlugin(), CoroutineHandler {
136134

137135
if (!Version.serverVersion.isCompatible(*versions)) {
138136
immediateDisable = true
139-
logger.log(Level.SEVERE, "================================================")
140-
logger.log(Level.SEVERE, "BlockBall does not support your server version")
141-
logger.log(Level.SEVERE, "Install v" + versions[0].from + " - v" + versions[versions.size - 1].to)
142-
logger.log(Level.SEVERE, "Need support for a particular version? Go to https://www.patreon.com/Shynixn")
143-
logger.log(Level.SEVERE, "Plugin gets now disabled!")
144-
logger.log(Level.SEVERE, "================================================")
137+
log.error("================================================")
138+
log.error("BlockBall does not support your server version")
139+
log.error("Install v" + versions[0].from + " - v" + versions[versions.size - 1].to)
140+
log.error("Need support for a particular version? Go to https://www.patreon.com/Shynixn")
141+
log.error("Plugin gets now disabled!")
142+
log.error("================================================")
145143
Bukkit.getPluginManager().disablePlugin(this)
146144
return
147145
}
148146

149-
logger.log(Level.INFO, "Loaded NMS version ${Version.serverVersion}.")
147+
log.info("Loaded NMS version ${Version.serverVersion}.")
150148

151149
if (mcCoroutineConfiguration.isFoliaLoaded && !checkIfFoliaIsLoadable()) {
152-
logger.log(Level.SEVERE, "================================================")
153-
logger.log(Level.SEVERE, "BlockBall for Folia requires BlockBall-Premium-Folia.jar")
154-
logger.log(Level.SEVERE, "Go to https://www.patreon.com/Shynixn to download it.")
155-
logger.log(Level.SEVERE, "Plugin gets now disabled!")
156-
logger.log(Level.SEVERE, "================================================")
150+
log.error("================================================")
151+
log.error("BlockBall for Folia requires BlockBall-Premium-Folia.jar")
152+
log.error("Go to https://www.patreon.com/Shynixn to download it.")
153+
log.error("Plugin gets now disabled!")
154+
log.error("================================================")
157155
Bukkit.getPluginManager().disablePlugin(this)
158156
return
159157
}
160158

161159
if (isFoliaLoaded()) {
162-
logger.log(Level.INFO, "Loading Folia components.")
160+
log.info("Loading Folia components.")
163161
}
164162

165163
// Load BlockBallLanguage
166164
val language = BlockBallLanguageImpl()
167165
reloadTranslation(language)
168-
logger.log(Level.INFO, "Loaded language file.")
166+
log.info("Loaded language file.")
169167

170168
// Module
171169
val placeHolderService = PlaceHolderServiceImpl(this, Bukkit.getPluginManager())
@@ -230,7 +228,7 @@ class BlockBallPlugin : JavaPlugin(), CoroutineHandler {
230228
try {
231229
gameService.reloadAll()
232230
} catch (e: SoccerGameException) {
233-
plugin.logger.log(Level.WARNING, " Cannot start game of soccerArena ${e.arena.name}.", e)
231+
plugin.log.warning(" Cannot start game of soccerArena ${e.arena.name}.", e)
234232
}
235233

236234
// Enable stats
@@ -292,6 +290,7 @@ class BlockBallPlugin : JavaPlugin(), CoroutineHandler {
292290
bossBarModule?.close()
293291
signModule?.close()
294292
particlesModule?.close()
293+
log.close()
295294
}
296295

297296
private fun loadShyBossBarModule(

src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import com.github.shynixn.blockball.contract.*
44
import com.github.shynixn.blockball.entity.*
55
import com.github.shynixn.blockball.entity.cloud.CloudGame
66
import com.github.shynixn.blockball.entity.cloud.CloudPlayer
7-
import com.github.shynixn.blockball.enumeration.GameState
8-
import com.github.shynixn.blockball.enumeration.GameSubState
9-
import com.github.shynixn.blockball.enumeration.JoinResult
10-
import com.github.shynixn.blockball.enumeration.LeaveResult
11-
import com.github.shynixn.blockball.enumeration.Team
7+
import com.github.shynixn.blockball.enumeration.*
128
import com.github.shynixn.blockball.event.GameEndEvent
139
import com.github.shynixn.blockball.event.GameGoalEvent
1410
import com.github.shynixn.blockball.event.GameJoinEvent
@@ -17,15 +13,16 @@ import com.github.shynixn.mccoroutine.folia.launch
1713
import com.github.shynixn.mccoroutine.folia.ticks
1814
import com.github.shynixn.mcutils.common.ChatColor
1915
import com.github.shynixn.mcutils.common.CoroutineHandler
16+
import com.github.shynixn.mcutils.common.Vector3d
2017
import com.github.shynixn.mcutils.common.chat.ChatMessageService
2118
import com.github.shynixn.mcutils.common.command.CommandMeta
2219
import com.github.shynixn.mcutils.common.command.CommandService
2320
import com.github.shynixn.mcutils.common.item.ItemService
2421
import com.github.shynixn.mcutils.common.language.LanguageType
22+
import com.github.shynixn.mcutils.common.log
2523
import com.github.shynixn.mcutils.common.placeholder.PlaceHolderService
2624
import com.github.shynixn.mcutils.common.toLocation
2725
import com.github.shynixn.mcutils.common.toVector3d
28-
import com.github.shynixn.mcutils.common.Vector3d
2926
import com.github.shynixn.mcutils.database.api.PlayerDataRepository
3027
import com.github.shynixn.shyguild.entity.Guild
3128
import kotlinx.coroutines.delay
@@ -40,16 +37,14 @@ import java.time.format.DateTimeFormatter
4037
import java.time.temporal.ChronoUnit
4138
import java.util.*
4239
import java.util.concurrent.ConcurrentHashMap
43-
import java.util.logging.Level
44-
4540

4641
abstract class SoccerGameImpl(
4742
/**
4843
* Gets the soccerArena.
4944
*/
5045
override val arena: SoccerArena,
5146
val placeHolderService: PlaceHolderService,
52-
private val plugin: Plugin,
47+
val plugin: Plugin,
5348
val soccerBallService: SoccerBallService,
5449
private val commandService: CommandService,
5550
override val language: BlockBallLanguage,
@@ -146,7 +141,6 @@ abstract class SoccerGameImpl(
146141
override var ball: SoccerBall? = null
147142

148143

149-
150144
/**
151145
* Contains players which are in cooldown by doublejump.
152146
*/
@@ -241,10 +235,12 @@ abstract class SoccerGameImpl(
241235
* Does nothing if the player is already in a Game.
242236
*/
243237
override fun join(player: Player, team: Team?): JoinResult {
238+
plugin.log.debug("[BlockBall] Player '${player.name}' initiating entry sequence for Arena: '${arena.name}' (Game ID: $id). Requested Team: ${team ?: "AUTOMATIC"}")
244239
val event = GameJoinEvent(player, this)
245240
server.pluginManager.callEvent(event)
246241

247242
if (event.isCancelled()) {
243+
plugin.log.debug("[BlockBall] GameJoinEvent for '${player.name}' in Arena: '${arena.name}' was cancelled by an external listener.")
248244
return JoinResult.EVENT_CANCELLED
249245
}
250246

@@ -266,25 +262,32 @@ abstract class SoccerGameImpl(
266262
}
267263

268264
val result = if (joiningTeam == Team.RED && redTeam.size < arena.meta.redTeamMeta.maxAmount) {
265+
plugin.log.debug("[BlockBall] Allocating player '${player.name}' to Team RED in Arena: '${arena.name}'. Current capacity: ${redTeam.size}/${arena.meta.redTeamMeta.maxAmount}")
269266
setPlayerToArena(player, joiningTeam)
270267
storeTemporaryPlayerData(player, joiningTeam)
271268
executeCommandsWithPlaceHolder(setOf(player), arena.meta.redTeamMeta.joinCommands)
269+
plugin.log.debug("[BlockBall] Successfully processed registration for player '${player.name}' to Team RED in Arena: '${arena.name}'.")
272270
JoinResult.SUCCESS_RED
273271
} else if (joiningTeam == Team.BLUE && blueTeam.size < arena.meta.blueTeamMeta.maxAmount) {
272+
plugin.log.debug("[BlockBall] Allocating player '${player.name}' to Team BLUE in Arena: '${arena.name}'. Current capacity: ${blueTeam.size}/${arena.meta.blueTeamMeta.maxAmount}")
274273
setPlayerToArena(player, joiningTeam)
275274
storeTemporaryPlayerData(player, joiningTeam)
276275
executeCommandsWithPlaceHolder(setOf(player), arena.meta.blueTeamMeta.joinCommands)
276+
plugin.log.debug("[BlockBall] Successfully processed registration for player '${player.name}' to Team BLUE in Arena: '${arena.name}'.")
277277
JoinResult.SUCCESS_BLUE
278278
} else if (joiningTeam == Team.REFEREE && refereeTeam.size < arena.meta.refereeTeamMeta.maxAmount) {
279+
plugin.log.debug("[BlockBall] Allocating player '${player.name}' as REFEREE in Arena: '${arena.name}'. Current capacity: ${refereeTeam.size}/${arena.meta.refereeTeamMeta.maxAmount}")
279280
setPlayerToArena(player, joiningTeam)
280281
storeTemporaryPlayerData(player, joiningTeam)
281282
executeCommandsWithPlaceHolder(setOf(player), arena.meta.refereeTeamMeta.joinCommands)
283+
plugin.log.debug("[BlockBall] Successfully processed registration for player '${player.name}' as REFEREE in Arena: '${arena.name}'.")
282284
JoinResult.SUCCESS_REFEREE
283285
} else {
284286
JoinResult.TEAM_FULL
285287
}
286288

287289
if (result == JoinResult.TEAM_FULL) {
290+
plugin.log.debug("[BlockBall] Allocation rejected: Target group/team '$joiningTeam' is full or unavailable for player '${player.name}' in Arena: '${arena.name}'.")
288291
return result
289292
}
290293

@@ -298,6 +301,7 @@ abstract class SoccerGameImpl(
298301
if (playerData != null) {
299302
playerData.cachedStorage = ingamePlayersStorage[player]
300303
playerData.statsMeta.joinedGames++
304+
plugin.log.debug("[BlockBall] Performance stats adjusted for '${player.name}' in Arena: '${arena.name}'. Stats: Games Joined: ${playerData.statsMeta.joinedGames}, Cached Level: ${playerData.cachedStorage?.level}, Cached Exp: ${playerData.cachedStorage?.exp}")
301305
}
302306
}
303307

@@ -308,19 +312,23 @@ abstract class SoccerGameImpl(
308312
* Leaves the given player.
309313
*/
310314
override fun leave(player: Player): LeaveResult {
315+
plugin.log.debug("[BlockBall] Player '${player.name}' initiated exit sequence from Arena: '${arena.name}' (Game ID: $id).")
316+
311317
if (!ingamePlayersStorage.containsKey(player)) {
318+
plugin.log.debug("[BlockBall] Player '${player.name}' requested leave but was not registered active in Arena: '${arena.name}'.")
312319
return LeaveResult.NOT_IN_MATCH
313320
}
314321

315322
val event = GameLeaveEvent(player, this)
316323
server.pluginManager.callEvent(event)
317324

318325
if (event.isCancelled()) {
326+
plugin.log.debug("[BlockBall] GameLeaveEvent for '${player.name}' in Arena: '${arena.name}' was cancelled by an external listener.")
319327
return LeaveResult.EVENT_CANCELLED
320328
}
321329

322330
val playerData = ingamePlayersStorage[player]!!
323-
restoreFromTemporaryPlayerData(player)
331+
restoreFromTemporaryPlayerData(player, playerData)
324332

325333
if (playerData.team == Team.RED) {
326334
executeCommandsWithPlaceHolder(setOf(player), arena.meta.redTeamMeta.leaveCommands)
@@ -339,6 +347,7 @@ abstract class SoccerGameImpl(
339347
coroutineHandler.execute(coroutineHandler.fetchEntityDispatcher(player)) {
340348
if (player.isOnline) {
341349
playerData.cachedStorage = null
350+
plugin.log.debug("[BlockBall] Flushed session cached player storage data for '${player.name}' upon departure from Arena: '${arena.name}'.")
342351
}
343352
}
344353
}
@@ -349,9 +358,11 @@ abstract class SoccerGameImpl(
349358

350359
coroutineHandler.execute(coroutineHandler.fetchEntityDispatcher(player)) {
351360
player.teleportCompat(plugin, teleportTarget)
361+
plugin.log.debug("[BlockBall] Teleported departing player '${player.name}' to designated exit spawnpoint for Arena: '${arena.name}'.")
352362
}
353363
}
354364

365+
plugin.log.debug("[BlockBall] Clean up complete. Player '${player.name}' has successfully left Arena: '${arena.name}'.")
355366
return LeaveResult.SUCCESS
356367
}
357368

@@ -455,7 +466,7 @@ abstract class SoccerGameImpl(
455466
}
456467
}
457468
} catch (e: Exception) {
458-
plugin.logger.log(Level.WARNING, "Cannot publish game to BlockBall Hub.", e)
469+
plugin.log.error("Failed to publish structured game records to the cloud stats server network for Arena: '${arena.name}'.", e)
459470
}
460471
}
461472
}
@@ -489,6 +500,7 @@ abstract class SoccerGameImpl(
489500
* Lets the given [player] in the given [game] respawn at the specified spawnpoint.
490501
*/
491502
override fun respawn(player: Player, team: Team?) {
503+
plugin.log.debug("[BlockBall] Initializing respawn calculations for player '${player.name}' in Arena: '${arena.name}'.")
492504
val actualTeam = if (ingamePlayersStorage.containsKey(player)) {
493505
ingamePlayersStorage[player]!!.goalTeam
494506
} else {
@@ -515,8 +527,10 @@ abstract class SoccerGameImpl(
515527
teamMeta.spawnpoint!!.toLocation()
516528
}
517529

530+
plugin.log.debug("[BlockBall] Queuing sync entity dispatcher to teleport player '${player.name}' to respawn point ($spawnPoint) in Arena: '${arena.name}'.")
518531
coroutineHandler.execute(coroutineHandler.fetchEntityDispatcher(player)) {
519532
player.teleportCompat(plugin, spawnPoint)
533+
plugin.log.debug("[BlockBall] Respawn task finalized. Player '${player.name}' safely relocated inside Arena: '${arena.name}'.")
520534
}
521535
}
522536

@@ -1044,13 +1058,15 @@ abstract class SoccerGameImpl(
10441058
* TODO: Migrate to minigame essentials.
10451059
*/
10461060
private fun storeTemporaryPlayerData(player: Player, team: Team) {
1061+
plugin.log.debug("[BlockBall] Scheduling player profile capture task for '${player.name}' in Arena: '${arena.name}'.")
10471062
// Store
10481063
val stats = GameStorage()
10491064
ingamePlayersStorage[player] = stats
10501065
stats.team = team
10511066
stats.goalTeam = team
10521067

10531068
coroutineHandler.execute(coroutineHandler.fetchEntityDispatcher(player)) {
1069+
plugin.log.debug("[BlockBall] Persisting temporary profile states (Inventory, XP, Status) for player '${player.name}' inside Arena: '${arena.name}'.")
10541070
stats.gameMode = player.gameMode
10551071
stats.armorContents =
10561072
player.inventory.armorContents.map { itemService.serializeItemStack(it) }.toTypedArray()
@@ -1082,13 +1098,15 @@ abstract class SoccerGameImpl(
10821098
.toTypedArray())
10831099
player.updateInventory()
10841100
}
1101+
1102+
plugin.log.debug("[BlockBall] Temporary profile mapping succeeded for '${player.name}' in Arena: '${arena.name}'. Mapped initial tracking data - Stored Level: ${stats.level}, Stored Exp: ${stats.exp}.")
10851103
}
10861104
}
10871105

1088-
private fun restoreFromTemporaryPlayerData(player: Player) {
1089-
val stats = ingamePlayersStorage[player]!!
1090-
1106+
private fun restoreFromTemporaryPlayerData(player: Player, stats : GameStorage) {
1107+
plugin.log.debug("[BlockBall] Scheduling baseline profile data restoration task for '${player.name}' in Arena: '${arena.name}'.")
10911108
coroutineHandler.execute(coroutineHandler.fetchEntityDispatcher(player)) {
1109+
plugin.log.debug("[BlockBall] Processing raw structural rollbacks (XP, GameMode, Status) for player '${player.name}' returning from Arena: '${arena.name}'.")
10921110
player.gameMode = stats.gameMode
10931111
player.allowFlight = stats.gameMode == GameMode.CREATIVE || stats.gameMode == GameMode.SPECTATOR
10941112
player.isFlying = false
@@ -1112,6 +1130,8 @@ abstract class SoccerGameImpl(
11121130
.toTypedArray())
11131131
player.updateInventory()
11141132
}
1133+
1134+
plugin.log.debug("[BlockBall] Verification complete. Pre-match profile successfully re-applied to player '${player.name}' leaving Arena: '${arena.name}'. Rolled Back Level: ${stats.level}, Rolled Back Exp: ${stats.exp}.")
11151135
}
11161136
}
11171137

@@ -1273,4 +1293,4 @@ abstract class SoccerGameImpl(
12731293
subStateEndTimeStamp = System.currentTimeMillis() + timeFromNowMilliSeconds
12741294
subStateNext = subState
12751295
}
1276-
}
1296+
}

src/main/java/com/github/shynixn/blockball/impl/SoccerHubGameImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.github.shynixn.mcutils.common.chat.ClickEventType
1515
import com.github.shynixn.mcutils.common.chat.TextComponent
1616
import com.github.shynixn.mcutils.common.command.CommandService
1717
import com.github.shynixn.mcutils.common.item.ItemService
18+
import com.github.shynixn.mcutils.common.log
1819
import com.github.shynixn.mcutils.common.placeholder.PlaceHolderService
1920
import com.github.shynixn.mcutils.database.api.PlayerDataRepository
2021
import org.bukkit.Bukkit
@@ -136,6 +137,7 @@ class SoccerHubGameImpl(
136137
if (arena.meta.hubLobbyMeta.teleportOnJoin) {
137138
this.respawn(player, team)
138139
} else {
140+
plugin.log.debug("Player ${player.name} is moved towards the arena ${arena.name}.")
139141
val velocityIntoArena = player.location.direction.normalize().multiply(0.5)
140142
player.velocity = velocityIntoArena
141143
}

0 commit comments

Comments
 (0)