Initial commit: setup GamingCore plugin skeleton with Gradle, Paper API, Kyori Adventure and XSeries

This commit is contained in:
2026-08-18 21:44:53 +02:00
commit 9be2e2dccf
10 changed files with 548 additions and 0 deletions
@@ -0,0 +1,87 @@
package fr.luc.gamingcore;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.logging.Level;
public final class GamingCore extends JavaPlugin {
private static GamingCore instance;
private BukkitAudiences adventure;
private final MiniMessage miniMessage = MiniMessage.miniMessage();
@Override
public void onEnable() {
instance = this;
// Initialize Adventure audience platform
this.adventure = BukkitAudiences.create(this);
// Save default config if not exists
saveDefaultConfig();
getLogger().log(Level.INFO, "========================================");
getLogger().log(Level.INFO, " GamingCore v" + getDescription().getVersion() + " active avec succes !");
getLogger().log(Level.INFO, " Compatibilite: 1.16.5 - 1.20+");
getLogger().log(Level.INFO, "========================================");
}
@Override
public void onDisable() {
if (this.adventure != null) {
this.adventure.close();
this.adventure = null;
}
getLogger().info("GamingCore désactivé.");
}
public static GamingCore getInstance() {
return instance;
}
public BukkitAudiences getAdventure() {
if (this.adventure == null) {
throw new IllegalStateException("Adventure audience platform is not initialized!");
}
return this.adventure;
}
public MiniMessage getMiniMessage() {
return miniMessage;
}
/**
* Send a MiniMessage formatted message with the prefix to any CommandSender
*/
public void sendMessage(CommandSender sender, String message) {
String prefix = getConfig().getString("prefix", "");
Component component = miniMessage.deserialize(prefix + message);
adventure.sender(sender).sendMessage(component);
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (command.getName().equalsIgnoreCase("gamingcore")) {
if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
if (!sender.hasPermission("gamingcore.admin")) {
sendMessage(sender, getConfig().getString("messages.no-permission", "<red>Permission refusée.</red>"));
return true;
}
reloadConfig();
sendMessage(sender, getConfig().getString("messages.reload-success", "<green>Configuration rechargée !</green>"));
return true;
}
sendMessage(sender, "<yellow>GamingCore</yellow> <gray>version " + getDescription().getVersion() + "</gray>");
sendMessage(sender, "<gray>Utilise <white>/gcore reload</white> pour recharger la configuration.</gray>");
return true;
}
return false;
}
}
+14
View File
@@ -0,0 +1,14 @@
# ══════════════════════════════════════════════════════════════════════════════
# GamingCore - Configuration
# ══════════════════════════════════════════════════════════════════════════════
prefix: "<gradient:#00C9FF:#92FE9D>[GamingCore]</gradient> <dark_gray>»</dark_gray> <gray>"
settings:
debug: false
language: "fr"
messages:
no-permission: "<red>Tu n'as pas la permission d'exécuter cette commande.</red>"
reload-success: "<green>Configuration rechargée avec succès !</green>"
unknown-command: "<red>Commande inconnue. Tape /gamingcore help pour de l'aide.</red>"
+20
View File
@@ -0,0 +1,20 @@
name: ${name}
version: ${version}
main: fr.luc.gamingcore.GamingCore
api-version: '1.16'
author: Luc
description: ${description}
commands:
gamingcore:
description: Main command for GamingCore
aliases: [gcore, core]
permission: gamingcore.use
permissions:
gamingcore.use:
description: Allows use of basic gamingcore commands
default: op
gamingcore.admin:
description: Allows administrative access to gamingcore
default: op