diff --git a/pom.xml b/pom.xml
index 7553a9a..be4cb77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.smartcraft.notifier
SmartCraftNotifier
- 1.0.1
+ 1.1.0
SmartCraftNotifier
diff --git a/src/main/java/com/smartcraft/notifier/AdvancementListener.java b/src/main/java/com/smartcraft/notifier/AdvancementListener.java
deleted file mode 100644
index c05e383..0000000
--- a/src/main/java/com/smartcraft/notifier/AdvancementListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.smartcraft.notifier;
-
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerAdvancementDoneEvent;
-
-public class AdvancementListener implements Listener {
-
- @EventHandler
- public void onAdvancement(PlayerAdvancementDoneEvent event) {
- String advancementKey = event.getAdvancement().getKey().getKey();
- String playerName = event.getPlayer().getName();
-
- // Filter out root advancements or hidden criteria
- if (advancementKey.contains("root") || advancementKey.contains("recipes")) return;
-
- SmartCraftNotifier.instance.getGotifyClient().sendMessage(
- "๐ Advancement Unlocked!",
- playerName + " has earned: " + advancementKey,
- 5
- );
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/GotifyClient.java b/src/main/java/com/smartcraft/notifier/GotifyClient.java
deleted file mode 100644
index 6b92b79..0000000
--- a/src/main/java/com/smartcraft/notifier/GotifyClient.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.smartcraft.notifier;
-
-import okhttp3.*;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.file.FileConfiguration;
-
-import java.io.IOException;
-
-public class GotifyClient {
-
- private final String serverUrl;
- private final String appToken;
- private final boolean enabled;
- private final OkHttpClient http;
-
- public GotifyClient(FileConfiguration config) {
- this.enabled = config.getBoolean("gotify.enabled", false);
- this.serverUrl = config.getString("gotify.serverUrl", "").trim();
- this.appToken = config.getString("gotify.appToken", "").trim();
- this.http = new OkHttpClient();
- }
-
- public boolean isReady() {
- return enabled && !serverUrl.isEmpty() && !appToken.isEmpty();
- }
-
- public void sendMessage(String title, String message, int priority) {
- if (!isReady()) return;
-
- HttpUrl url = HttpUrl.parse(serverUrl + "/message");
- if (url == null) return;
-
- RequestBody body = new FormBody.Builder()
- .add("title", title)
- .add("message", message)
- .add("priority", String.valueOf(priority))
- .build();
-
- Request request = new Request.Builder()
- .url(url)
- .addHeader("X-Gotify-Key", appToken)
- .post(body)
- .build();
-
- http.newCall(request).enqueue(new Callback() {
- @Override
- public void onFailure(Call call, IOException e) {
- Bukkit.getLogger().warning("[SmartCraftNotifier] Failed to send Gotify message: " + e.getMessage());
- }
-
- @Override
- public void onResponse(Call call, Response response) {
- response.close();
- }
- });
- }
-
- public boolean pingServer() {
- if (!isReady()) return false;
-
- HttpUrl url = HttpUrl.parse(serverUrl + "/application");
- if (url == null) return false;
-
- Request request = new Request.Builder()
- .url(url)
- .addHeader("X-Gotify-Key", appToken)
- .build();
-
- try (Response response = http.newCall(request).execute()) {
- return response.isSuccessful();
- } catch (IOException e) {
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/SmartCraftNotifier.java b/src/main/java/com/smartcraft/notifier/SmartCraftNotifier.java
index 3ea0127..13b054f 100644
--- a/src/main/java/com/smartcraft/notifier/SmartCraftNotifier.java
+++ b/src/main/java/com/smartcraft/notifier/SmartCraftNotifier.java
@@ -1,13 +1,20 @@
package com.smartcraft.notifier;
+import com.smartcraft.notifier.commands.GotifyStatusCommand;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+import com.smartcraft.notifier.listeners.core.JoinQuitListener;
+import com.smartcraft.notifier.listeners.core.AdvancementListener;
+import com.smartcraft.notifier.listeners.litebans.PunishmentListener;
+import com.smartcraft.notifier.listeners.bungee.ServerSwitchListener;
+
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.plugin.messaging.Messenger;
public class SmartCraftNotifier extends JavaPlugin {
public static SmartCraftNotifier instance;
+ private ConfigManager configManager;
private GotifyClient gotifyClient;
@Override
@@ -15,45 +22,59 @@ public class SmartCraftNotifier extends JavaPlugin {
instance = this;
saveDefaultConfig();
- FileConfiguration config = getConfig();
+ this.configManager = new ConfigManager(this);
+ this.gotifyClient = new GotifyClient(configManager);
- this.gotifyClient = new GotifyClient(config);
+ if (configManager.isDebugMode()) {
+ getLogger().info("[Debug] Debug mode is enabled.");
+ }
- if (!gotifyClient.isReady()) {
- getLogger().warning("Gotify is not properly configured. Notifications will not be sent.");
- } else {
+ if (configManager.isGotifyEnabled()) {
getLogger().info("Gotify is ready to send messages.");
+ getLogger().info("Connected to Gotify server: " + configManager.getGotifyUrl());
+ } else {
+ getLogger().warning("Gotify is disabled in the config.");
}
- // Event listeners
- if (config.getBoolean("events.logAdvancements", true)) {
- getServer().getPluginManager().registerEvents(new AdvancementListener(), this);
+ getCommand("gotifystatus").setExecutor(new GotifyStatusCommand(this));
+
+ Bukkit.getPluginManager().registerEvents(new JoinQuitListener(this), this);
+ Bukkit.getPluginManager().registerEvents(new AdvancementListener(this), this);
+
+ if (configManager.isLiteBansEnabled()) {
+ try {
+ Bukkit.getPluginManager().registerEvents(new PunishmentListener(this), this);
+ getLogger().info("LiteBans integration enabled.");
+ } catch (Throwable t) {
+ getLogger().warning("LiteBans not found or failed to initialize.");
+ if (configManager.isDebugMode()) t.printStackTrace();
+ }
}
- // BungeeCord plugin messaging setup
- if (config.getBoolean("bungeecord", false)) {
- Messenger messenger = getServer().getMessenger();
- messenger.registerOutgoingPluginChannel(this, "BungeeCord");
- messenger.registerIncomingPluginChannel(this, "BungeeCord", new BungeeMessageListener());
- getLogger().info("BungeeCord messaging enabled.");
+ if (configManager.isBungeeCordEnabled()) {
+ try {
+ Bukkit.getPluginManager().registerEvents(new ServerSwitchListener(this), this);
+ getLogger().info("BungeeCord server switch tracking is enabled.");
+ } catch (Throwable t) {
+ getLogger().warning("Failed to register BungeeCord listener.");
+ if (configManager.isDebugMode()) t.printStackTrace();
+ }
+ } else {
+ getLogger().info("BungeeCord integration is disabled.");
}
- // Register command
- getCommand("gotifystatus").setExecutor((sender, command, label, args) -> {
- boolean result = gotifyClient.pingServer();
- sender.sendMessage("Gotify status: " + (result ? "โ
Online" : "โ Unreachable"));
- return true;
- });
-
getLogger().info("SmartCraft Notifier has been enabled.");
}
- @Override
- public void onDisable() {
- getLogger().info("SmartCraft Notifier has been disabled.");
+ public ConfigManager getConfigManager() {
+ return configManager;
}
public GotifyClient getGotifyClient() {
return gotifyClient;
}
+
+ public static SmartCraftNotifier getInstance() {
+ return instance;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/commands/GotifyStatusCommand.java b/src/main/java/com/smartcraft/notifier/commands/GotifyStatusCommand.java
new file mode 100644
index 0000000..f325671
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/commands/GotifyStatusCommand.java
@@ -0,0 +1,58 @@
+package com.smartcraft.notifier.commands;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+
+public class GotifyStatusCommand implements CommandExecutor {
+
+ private final SmartCraftNotifier plugin;
+ private final ConfigManager config;
+ private final GotifyClient gotify;
+
+ public GotifyStatusCommand(SmartCraftNotifier plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfigManager();
+ this.gotify = plugin.getGotifyClient();
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if (!sender.hasPermission("smartcraftnotifier.command.status")) {
+ sender.sendMessage("ยงcYou do not have permission to use this command.");
+ return true;
+ }
+
+ String subcommand = (args.length == 0) ? "ping" : args[0].toLowerCase();
+
+ switch (subcommand) {
+ case "ping":
+ if (!sender.hasPermission("smartcraftnotifier.command.status.ping")) {
+ sender.sendMessage("ยงcYou do not have permission to ping Gotify.");
+ return true;
+ }
+ boolean reachable = gotify.ping();
+ sender.sendMessage(reachable
+ ? "ยงaโ
Gotify is reachable."
+ : "ยงcโ Could not reach Gotify server.");
+ return true;
+
+ case "server":
+ if (!sender.hasPermission("smartcraftnotifier.command.status.server")) {
+ sender.sendMessage("ยงcYou do not have permission to view Gotify server info.");
+ return true;
+ }
+ String url = config.getGotifyUrl();
+ sender.sendMessage("ยง7๐ Gotify server: ยงe" + url);
+ return true;
+
+ default:
+ sender.sendMessage("ยง7Usage: ยงf/gotifystatus ยง8[ping|server]");
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/config/ConfigManager.java b/src/main/java/com/smartcraft/notifier/config/ConfigManager.java
new file mode 100644
index 0000000..4c1aae9
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/config/ConfigManager.java
@@ -0,0 +1,101 @@
+package com.smartcraft.notifier.config;
+
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.Plugin;
+
+import java.io.File;
+
+public class ConfigManager {
+
+ private final Plugin plugin;
+ private final FileConfiguration config;
+ private FileConfiguration messageConfig;
+
+ public ConfigManager(Plugin plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfig();
+ loadMessages();
+ }
+
+ private void loadMessages() {
+ File messageFile = new File(plugin.getDataFolder(), "messages.yml");
+ if (!messageFile.exists()) {
+ plugin.saveResource("messages.yml", false);
+ }
+ this.messageConfig = YamlConfiguration.loadConfiguration(messageFile);
+ }
+
+ // ๐ง Global settings
+ public boolean isDebugMode() {
+ return config.getBoolean("debug", false);
+ }
+
+ public boolean isBungeeCordEnabled() {
+ return config.getBoolean("bungeecord.enabled", false);
+ }
+
+ // โ
Gotify settings
+ public boolean isGotifyEnabled() {
+ return config.getBoolean("gotify.enabled", false);
+ }
+
+ public String getGotifyUrl() {
+ return config.getString("gotify.serverUrl", "NOT SET");
+ }
+
+ public String getGotifyToken() {
+ return config.getString("gotify.appToken", "");
+ }
+
+ public int getDefaultPriority() {
+ return config.getInt("gotify.defaultPriority", 1);
+ }
+
+ // ๐ข Core Event toggles
+ public boolean logJoins() {
+ return config.getBoolean("events.logJoins", true);
+ }
+
+ public boolean logLeaves() {
+ return config.getBoolean("events.logLeaves", true);
+ }
+
+ public boolean logAdvancements() {
+ return config.getBoolean("events.logAdvancements", true);
+ }
+
+ public boolean logServerSwitches() {
+ return config.getBoolean("events.logServerSwitch", false);
+ }
+
+ public String getEventMessage(String key) {
+ return messageConfig.getString("events." + key, "{player} triggered " + key);
+ }
+
+ // ๐จ LiteBans Integration
+ public boolean isLiteBansEnabled() {
+ return config.getBoolean("litebans.enabled", false);
+ }
+
+ public boolean logBans() {
+ return config.getBoolean("litebans.logBans", true);
+ }
+
+ public boolean logMutes() {
+ return config.getBoolean("litebans.logMutes", true);
+ }
+
+ public boolean logKicks() {
+ return config.getBoolean("litebans.logKicks", true);
+ }
+
+ public boolean logWarns() {
+ return config.getBoolean("litebans.logWarns", true);
+ }
+
+ public String getLiteBansMessage(String type) {
+ return messageConfig.getString("litebans." + type,
+ "๐ {player} received a " + type + ": {reason}");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/gotify/GotifyClient.java b/src/main/java/com/smartcraft/notifier/gotify/GotifyClient.java
new file mode 100644
index 0000000..adf2c58
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/gotify/GotifyClient.java
@@ -0,0 +1,82 @@
+package com.smartcraft.notifier.gotify;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import okhttp3.*;
+
+import java.io.IOException;
+
+public class GotifyClient {
+
+ private final OkHttpClient httpClient = new OkHttpClient();
+ private final ConfigManager config;
+
+ public GotifyClient(ConfigManager config) {
+ this.config = config;
+ }
+
+ public void sendMessage(String title, String message, int priority) {
+ if (!config.isGotifyEnabled()) return;
+
+ String serverUrl = config.getGotifyUrl();
+ String token = config.getGotifyToken();
+
+ if (serverUrl == null || token == null || serverUrl.isEmpty() || token.isEmpty()) {
+ log("โ Gotify server URL or App Token is missing.");
+ return;
+ }
+
+ String url = serverUrl + "/message?token=" + token;
+
+ RequestBody body = new FormBody.Builder()
+ .add("title", title)
+ .add("message", message)
+ .add("priority", String.valueOf(priority))
+ .build();
+
+ Request request = new Request.Builder()
+ .url(url)
+ .post(body)
+ .build();
+
+ httpClient.newCall(request).enqueue(new Callback() {
+ @Override public void onFailure(Call call, IOException e) {
+ log("โ Failed to send Gotify message: " + e.getMessage());
+ if (config.isDebugMode()) e.printStackTrace();
+ }
+
+ @Override public void onResponse(Call call, Response response) {
+ if (!response.isSuccessful() && config.isDebugMode()) {
+ log("โ ๏ธ Gotify responded with status code: " + response.code());
+ }
+ response.close();
+ }
+ });
+
+ if (config.isDebugMode()) {
+ log("[Debug] Gotify message sent: " + title + " | " + message + " (Priority " + priority + ")");
+ }
+ }
+
+ public boolean ping() {
+ if (!config.isGotifyEnabled()) return false;
+
+ String pingUrl = config.getGotifyUrl() + "/application";
+
+ Request request = new Request.Builder()
+ .url(pingUrl)
+ .header("X-Gotify-Key", config.getGotifyToken())
+ .build();
+
+ try (Response response = httpClient.newCall(request).execute()) {
+ return response.isSuccessful();
+ } catch (IOException e) {
+ if (config.isDebugMode()) e.printStackTrace();
+ return false;
+ }
+ }
+
+ private void log(String msg) {
+ SmartCraftNotifier.getInstance().getLogger().warning(msg);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/listeners/bungee/ServerSwitchListener.java b/src/main/java/com/smartcraft/notifier/listeners/bungee/ServerSwitchListener.java
new file mode 100644
index 0000000..3cce645
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/listeners/bungee/ServerSwitchListener.java
@@ -0,0 +1,42 @@
+package com.smartcraft.notifier.listeners.bungee;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
+import net.md_5.bungee.api.event.ServerSwitchEvent;
+import net.md_5.bungee.api.plugin.Listener;
+import net.md_5.bungee.event.EventHandler;
+
+public class ServerSwitchListener implements Listener {
+
+ private final SmartCraftNotifier plugin;
+ private final ConfigManager config;
+ private final GotifyClient gotify;
+
+ public ServerSwitchListener(SmartCraftNotifier plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfigManager();
+ this.gotify = plugin.getGotifyClient();
+ }
+
+ @EventHandler
+ public void onServerSwitch(ServerSwitchEvent event) {
+ if (!config.logServerSwitches()) return;
+
+ ProxiedPlayer player = event.getPlayer();
+ String serverName = (player.getServer() != null)
+ ? player.getServer().getInfo().getName()
+ : "Unknown";
+
+ String message = config.getEventMessage("serverSwitch")
+ .replace("{player}", player.getName())
+ .replace("{server}", serverName);
+
+ gotify.sendMessage("Server Switched", message, config.getDefaultPriority());
+
+ if (config.isDebugMode()) {
+ plugin.getLogger().info("[Debug] " + player.getName() + " switched to " + serverName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/listeners/core/AdvancementListener.java b/src/main/java/com/smartcraft/notifier/listeners/core/AdvancementListener.java
new file mode 100644
index 0000000..05558b3
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/listeners/core/AdvancementListener.java
@@ -0,0 +1,45 @@
+package com.smartcraft.notifier.listeners.core;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+import org.bukkit.Bukkit;
+import org.bukkit.advancement.Advancement;
+import org.bukkit.advancement.AdvancementDisplay;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerAdvancementDoneEvent;
+
+public class AdvancementListener implements Listener {
+
+ private final SmartCraftNotifier plugin;
+ private final ConfigManager config;
+ private final GotifyClient gotify;
+
+ public AdvancementListener(SmartCraftNotifier plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfigManager();
+ this.gotify = plugin.getGotifyClient();
+ }
+
+ @EventHandler
+ public void onAdvancement(PlayerAdvancementDoneEvent event) {
+ if (!config.logAdvancements()) return;
+
+ Advancement adv = event.getAdvancement();
+ AdvancementDisplay display = adv.getDisplay();
+ if (display == null || !display.shouldAnnounceToChat()) return;
+
+ String player = event.getPlayer().getName();
+ String title = display.getTitle();
+ String message = config.getEventMessage("advancement")
+ .replace("{player}", player)
+ .replace("{advancement}", title);
+
+ gotify.sendMessage("Advancement Unlocked", message, config.getDefaultPriority());
+
+ if (config.isDebugMode()) {
+ Bukkit.getLogger().info("[Debug] Advancement event triggered for " + player + ": " + title);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/listeners/core/JoinQuitListener.java b/src/main/java/com/smartcraft/notifier/listeners/core/JoinQuitListener.java
new file mode 100644
index 0000000..97c7bb8
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/listeners/core/JoinQuitListener.java
@@ -0,0 +1,51 @@
+package com.smartcraft.notifier.listeners.core;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class JoinQuitListener implements Listener {
+
+ private final SmartCraftNotifier plugin;
+ private final ConfigManager config;
+ private final GotifyClient gotify;
+
+ public JoinQuitListener(SmartCraftNotifier plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfigManager();
+ this.gotify = plugin.getGotifyClient();
+ }
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent event) {
+ if (!config.logJoins()) return;
+
+ String player = event.getPlayer().getName();
+ String message = config.getEventMessage("join").replace("{player}", player);
+
+ gotify.sendMessage("Player Joined", message, config.getDefaultPriority());
+
+ if (config.isDebugMode()) {
+ Bukkit.getLogger().info("[Debug] Join event triggered for " + player);
+ }
+ }
+
+ @EventHandler
+ public void onQuit(PlayerQuitEvent event) {
+ if (!config.logLeaves()) return;
+
+ String player = event.getPlayer().getName();
+ String message = config.getEventMessage("leave").replace("{player}", player);
+
+ gotify.sendMessage("Player Left", message, config.getDefaultPriority());
+
+ if (config.isDebugMode()) {
+ Bukkit.getLogger().info("[Debug] Quit event triggered for " + player);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/smartcraft/notifier/listeners/litebans/PunishmentListener.java b/src/main/java/com/smartcraft/notifier/listeners/litebans/PunishmentListener.java
new file mode 100644
index 0000000..40ab448
--- /dev/null
+++ b/src/main/java/com/smartcraft/notifier/listeners/litebans/PunishmentListener.java
@@ -0,0 +1,71 @@
+package com.smartcraft.notifier.listeners.litebans;
+
+import com.smartcraft.notifier.SmartCraftNotifier;
+import com.smartcraft.notifier.config.ConfigManager;
+import com.smartcraft.notifier.gotify.GotifyClient;
+import litebans.api.Punishment;
+import litebans.api.events.PunishmentExecuteEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+public class PunishmentListener implements Listener {
+
+ private final SmartCraftNotifier plugin;
+ private final ConfigManager config;
+ private final GotifyClient gotify;
+
+ public PunishmentListener(SmartCraftNotifier plugin) {
+ this.plugin = plugin;
+ this.config = plugin.getConfigManager();
+ this.gotify = plugin.getGotifyClient();
+ }
+
+ @EventHandler
+ public void onPunishment(PunishmentExecuteEvent event) {
+ if (!config.isLiteBansEnabled()) return;
+
+ Punishment punishment = event.getPunishment();
+ String type = punishment.getType(); // "ban", "mute", "kick", "warn"
+ String playerName = punishment.getName(); // not UUID
+ String reason = punishment.getReason();
+
+ // Check if this type is allowed in config
+ switch (type.toLowerCase()) {
+ case "ban":
+ if (!config.logBans()) return;
+ break;
+ case "mute":
+ if (!config.logMutes()) return;
+ break;
+ case "kick":
+ if (!config.logKicks()) return;
+ break;
+ case "warn":
+ if (!config.logWarns()) return;
+ break;
+ default:
+ return; // Unknown type
+ }
+
+ // Build message from template
+ String template = config.getLiteBansMessage(type.toLowerCase());
+ String message = template
+ .replace("{player}", playerName)
+ .replace("{reason}", (reason != null && !reason.isEmpty()) ? reason : "No reason provided");
+
+ String title = switch (type.toLowerCase()) {
+ case "ban" -> "๐จ Player Banned";
+ case "mute" -> "๐ Player Muted";
+ case "kick" -> "๐ข Player Kicked";
+ case "warn" -> "โ ๏ธ Player Warned";
+ default -> "โ๏ธ Punishment Issued";
+ };
+
+ gotify.sendMessage(title, message, config.getDefaultPriority());
+
+ if (config.isDebugMode()) {
+ Bukkit.getLogger().info("[Debug] LiteBans " + type + " issued to " + playerName + ": " + reason);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 03afc45..dc68e16 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,12 +1,31 @@
-bungeecord: false
+debug: false
gotify:
enabled: true
- serverUrl: "https://your.gotify.server"
- appToken: "YOUR_SECRET_TOKEN"
+ serverUrl: "https://your.gotify.instance" # Replace with your Gotify server
+ appToken: "your_app_token_here" # Replace with your Gotify app token
+ defaultPriority: 4 # Use -2 (silent) to 10 (urgent)
events:
logJoins: true
logLeaves: true
logServerSwitch: true
- logAdvancements: true
\ No newline at end of file
+ logAdvancements: true
+
+ messages:
+ join: "๐ค {player} has joined the server!"
+ leave: "๐ช {player} has left the server."
+ advancement: "๐ {player} unlocked: {advancement}"
+
+litebans:
+ enabled: true
+ logBans: true
+ logMutes: true
+ logKicks: true
+ logWarns: true
+
+ messages:
+ ban: "๐จ {player} was banned for: {reason}"
+ mute: "๐ {player} was muted for: {reason}"
+ kick: "๐ข {player} was kicked for: {reason}"
+ warn: "โ ๏ธ {player} was warned: {reason}"
\ No newline at end of file
diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml
new file mode 100644
index 0000000..6c3d458
--- /dev/null
+++ b/src/main/resources/messages.yml
@@ -0,0 +1,11 @@
+events:
+ join: "๐ค {player} has joined the server!"
+ leave: "๐ช {player} has left the server."
+ advancement: "๐ {player} unlocked: {advancement}"
+ serverSwitch: "๐ {player} switched to: {server}"
+
+litebans:
+ ban: "๐จ {player} was banned for: {reason}"
+ mute: "๐ {player} was muted for: {reason}"
+ kick: "๐ข {player} was kicked for: {reason}"
+ warn: "โ ๏ธ {player} was warned: {reason}"
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index d3a7a3b..15edc57 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,14 +1,15 @@
name: SmartCraftNotifier
-version: 1.0.1
+version: 1.1.0
main: com.smartcraft.notifier.SmartCraftNotifier
api-version: 1.20
-description: Sends player events to Gotify and supports optional BungeeCord messaging.
+description: Notifies your Gotify server on key in-game events: joins, advancements, bans, and more.
+authors: minster586
commands:
gotifystatus:
- description: Check if Gotify is reachable.
+ description: Ping the Gotify server to check connectivity.
usage: /gotifystatus
- permission: smartcraftnotifier.status
+ permission: smartcraftnotifier.command.status
permissions:
- smartcraftnotifier.status:
- description: Allows use of /gotifystatus command
- default: op
\ No newline at end of file
+ smartcraftnotifier.command.status:
+ description: Allows access to the /gotifystatus command
+ default: true
\ No newline at end of file