Skip to content

Commit

Permalink
feat: game mode change logger listener
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Aug 2, 2023
1 parent 36c45cf commit 50b621b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.6.9"
version = "6.6.10"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/github/mori01231/lifecore/LifeCore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class LifeCore : JavaPlugin() {
pm.registerEvents(EscapeLobbyListener(this), this)
pm.registerEvents(PreventOpenMerchantMenuListener(), this)
pm.registerEvents(CancelMythicItemPlaceListener(), this)
pm.registerEvents(GameModeChangeLoggerListener(this), this)

// Items
pm.registerEvents(OreOnlyItemListener(), this)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.mori01231.lifecore.listener;

import com.github.mori01231.lifecore.LifeCore;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;

public class GameModeChangeLoggerListener implements Listener {
private final LifeCore plugin;

public GameModeChangeLoggerListener(LifeCore plugin) {
this.plugin = plugin;
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onGameModeChange(PlayerGameModeChangeEvent e) {
plugin.getLogger().info("Game mode of " + e.getPlayer().getName() + " changed from " + e.getPlayer().getGameMode().name() + " to " + e.getNewGameMode().name());
}
}

0 comments on commit 50b621b

Please sign in to comment.