From f5b9583e0cab43f9f6a1adbabd82c6e4934b34a7 Mon Sep 17 00:00:00 2001 From: GuiguiShow Date: Mon, 17 Nov 2025 17:56:27 +0100 Subject: [PATCH 1/4] Migration archi (fonctionnel mais logiques KO) --- .../tesseract/core/cosmetics/TeleportationAnimation.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/onl/tesseract/core/cosmetics/TeleportationAnimation.java b/src/main/kotlin/onl/tesseract/core/cosmetics/TeleportationAnimation.java index 2ee526f..34a327f 100644 --- a/src/main/kotlin/onl/tesseract/core/cosmetics/TeleportationAnimation.java +++ b/src/main/kotlin/onl/tesseract/core/cosmetics/TeleportationAnimation.java @@ -260,4 +260,10 @@ public Material getIcon() public @NotNull Material getMaterial() { return icon; } + + public static TeleportationAnimation getTpAnimation() { + //ajouter plus tard les animations + return WATER; + } + } From e5f4364fe847f214c9bbda68ebdecd593da41cfc Mon Sep 17 00:00:00 2001 From: GuiguiShow Date: Tue, 18 Nov 2025 22:26:58 +0100 Subject: [PATCH 2/4] correction post migration --- .../tesseract/core/command/PWeatherCommand.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/onl/tesseract/core/command/PWeatherCommand.kt b/src/main/kotlin/onl/tesseract/core/command/PWeatherCommand.kt index 5a7668f..7da6996 100644 --- a/src/main/kotlin/onl/tesseract/core/command/PWeatherCommand.kt +++ b/src/main/kotlin/onl/tesseract/core/command/PWeatherCommand.kt @@ -18,26 +18,25 @@ import org.bukkit.entity.Player args = [Argument(value = "weather", clazz = WeatherNameArg::class)]) class PWeatherCommand : CommandContext() { @CommandBody - fun onCommand(@Env(key = "weather") weather: Weather, sender: Player): Boolean { + fun onCommand(@Env(key = "weather") weather: Weather, sender: Player) { if (weather == Weather.RESET) { sender.resetPlayerWeather() - sender.sendMessage(Component.text("Votre météo a été réinitialisé.", NamedTextColor.GREEN)); - return true + sender.sendMessage(Component.text("Votre météo a été réinitialisée.", NamedTextColor.GREEN)); + return } weather.weatherType?.let { sender.setPlayerWeather(it) } - sender.sendMessage(Component.text("Météo fixé à ${weather.weatherType}", NamedTextColor.GREEN)) - - return true + sender.sendMessage(Component.text("Météo fixée à ${weather.displayName}", NamedTextColor.GREEN)) } - - enum class Weather(val weatherType: WeatherType?) { - RESET(null), - CLEAR(WeatherType.CLEAR), - RAIN(WeatherType.DOWNFALL) + enum class Weather( + val weatherType: WeatherType?, + val displayName: String + ) { + RESET(null, "DEFAUT"), + CLEAR(WeatherType.CLEAR, "CLAIR"), + RAIN(WeatherType.DOWNFALL, "PLUVIEUX") } - } \ No newline at end of file From 4c07d3154b6d2a732971b5301bb945197459e6b6 Mon Sep 17 00:00:00 2001 From: GuiguiShow Date: Wed, 19 Nov 2025 18:48:31 +0100 Subject: [PATCH 3/4] Rename .java to .kt --- .../autochatmessage/{AutoChatMessage.java => AutoChatMessage.kt} | 0 .../{AutoChatMessages.java => AutoChatMessages.kt} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/main/kotlin/onl/tesseract/core/autochatmessage/{AutoChatMessage.java => AutoChatMessage.kt} (100%) rename src/main/kotlin/onl/tesseract/core/autochatmessage/{AutoChatMessages.java => AutoChatMessages.kt} (100%) diff --git a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.java b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt similarity index 100% rename from src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.java rename to src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt diff --git a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.java b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt similarity index 100% rename from src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.java rename to src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt From b594a34717e87a1c9d009fec2415dff168277e07 Mon Sep 17 00:00:00 2001 From: GuiguiShow Date: Wed, 19 Nov 2025 18:48:32 +0100 Subject: [PATCH 4/4] AutochatMessage : ajout GlobalAutoChat (instance commune aux servs) --- .../onl/tesseract/core/TesseractCorePlugin.kt | 11 +- .../core/autochatmessage/AutoChatMessage.kt | 52 ++-- .../core/autochatmessage/AutoChatMessages.kt | 263 ++++++++++++------ .../core/autochatmessage/GlobalAutoChat.kt | 15 + 4 files changed, 224 insertions(+), 117 deletions(-) create mode 100644 src/main/kotlin/onl/tesseract/core/autochatmessage/GlobalAutoChat.kt diff --git a/src/main/kotlin/onl/tesseract/core/TesseractCorePlugin.kt b/src/main/kotlin/onl/tesseract/core/TesseractCorePlugin.kt index 34fbe73..a77e2bb 100644 --- a/src/main/kotlin/onl/tesseract/core/TesseractCorePlugin.kt +++ b/src/main/kotlin/onl/tesseract/core/TesseractCorePlugin.kt @@ -2,8 +2,8 @@ package onl.tesseract.core import onl.tesseract.core.achievement.AchievementService import onl.tesseract.core.afk.AfkManager -import onl.tesseract.core.autochatmessage.AutoChatMessage import onl.tesseract.core.autochatmessage.AutoChatMessages +import onl.tesseract.core.autochatmessage.GlobalAutoChat import onl.tesseract.core.boutique.BoutiqueService import onl.tesseract.core.command.* import onl.tesseract.core.command.staff.* @@ -88,11 +88,10 @@ class TesseractCorePlugin : JavaPlugin() { registerCommands() VoteGoalManager.startLoops() - val autoChatMessage = AutoChatMessage() - autoChatMessage.start() - autoChatMessage.addMessage(AutoChatMessages.voteMessage()) - autoChatMessage.addMessage(AutoChatMessages.discordMessage()) - autoChatMessage.addMessage(AutoChatMessages.recrutementMessage()) + GlobalAutoChat.instance.addMessage(AutoChatMessages.voteMessage()) + GlobalAutoChat.instance.addMessage(AutoChatMessages.discordMessage()) + GlobalAutoChat.instance.addMessage(AutoChatMessages.recrutementMessage()) + GlobalAutoChat.startOnce() } fun registerCommands() { diff --git a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt index 6b13ec7..795c4a6 100644 --- a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt +++ b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessage.kt @@ -1,38 +1,34 @@ -package onl.tesseract.core.autochatmessage; +package onl.tesseract.core.autochatmessage -import net.kyori.adventure.text.Component; -import onl.tesseract.core.TesseractCorePlugin; -import org.bukkit.Bukkit; -import org.bukkit.scheduler.BukkitRunnable; +import net.kyori.adventure.text.Component +import onl.tesseract.core.TesseractCorePlugin +import org.bukkit.Bukkit +import org.bukkit.entity.Player +import org.bukkit.scheduler.BukkitRunnable -import java.util.ArrayList; -import java.util.List; +/** + * Période d'envoi de message 5*60*20 = 5min + */ +private const val PERIOD = (7.5 * 60 * 20).toInt() -public class AutoChatMessage { - /** - * Période d'envoi de message 5*60*20 = 5min - */ - private static final int PERIOD = (int) (7.5 * 60 * 20); - /** - * Instance - */ - private final List messages = new ArrayList<>(); - private int currentMessageIndex = 0; +open class AutoChatMessage { - public void addMessage(Component message) { - messages.add(message); + private val messages: MutableList = ArrayList() + private var currentMessageIndex = 0 + + fun addMessage(message: Component) { + messages.add(message) } - public void start() { - new BukkitRunnable() { - @Override - public void run() { - if (!messages.isEmpty()) { - Component message = messages.get(currentMessageIndex++); - Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(message)); - currentMessageIndex %= messages.size(); + fun start() { + object : BukkitRunnable() { + override fun run() { + if (messages.isNotEmpty()) { + val message = messages[currentMessageIndex++] + Bukkit.getOnlinePlayers().forEach { p: Player? -> p!!.sendMessage(message) } + currentMessageIndex %= messages.size } } - }.runTaskTimer(TesseractCorePlugin.instance, 0, PERIOD); + }.runTaskTimer(TesseractCorePlugin.instance, 0, PERIOD.toLong()) } } diff --git a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt index fa4157b..ed607f6 100644 --- a/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt +++ b/src/main/kotlin/onl/tesseract/core/autochatmessage/AutoChatMessages.kt @@ -1,92 +1,189 @@ -package onl.tesseract.core.autochatmessage; +package onl.tesseract.core.autochatmessage -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.format.TextDecoration; +import net.kyori.adventure.text.Component +import net.kyori.adventure.text.event.ClickEvent +import net.kyori.adventure.text.format.NamedTextColor +import net.kyori.adventure.text.format.TextDecoration -public class AutoChatMessages { +private val SPACE_MESSAGE = " " - public static Component voteMessage() { - return Component.text(" ", NamedTextColor.GREEN, TextDecoration.STRIKETHROUGH) - .append(Component.newline()) - .append(Component.text(" ") - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text(" GAGNEZ DES RÉCOMPENSES EN VOTANT ", NamedTextColor.GREEN, TextDecoration.BOLD)) - .append(Component.text(" ")) - .append(Component.newline())) - .append(Component.newline()) - .append(Component.text(" ") - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text("Votez dès maintenant pour soutenir le serveur et recevez des points boutique pour obtenir des récompenses uniques !", NamedTextColor.DARK_GREEN)) - .append(Component.newline()) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text("Exécutez la commande ou cliquez ci-dessous : ", NamedTextColor.DARK_GREEN)) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text(" → ", NamedTextColor.DARK_GREEN, TextDecoration.BOLD) - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text("/vote", NamedTextColor.GREEN, TextDecoration.BOLD)) - .append(Component.text(" ← ", NamedTextColor.DARK_GREEN, TextDecoration.BOLD)) - .clickEvent(net.kyori.adventure.text.event.ClickEvent.clickEvent(net.kyori.adventure.text.event.ClickEvent.Action.RUN_COMMAND, "/vote"))) - .append(Component.newline())) - .append(Component.text(" ", NamedTextColor.GREEN, TextDecoration.STRIKETHROUGH)); +object AutoChatMessages { + fun voteMessage(): Component { + return Component.text( + SPACE_MESSAGE, + NamedTextColor.GREEN, + TextDecoration.STRIKETHROUGH + ) + .append(Component.newline()) + .append( + Component.text(" ") + .decoration(TextDecoration.STRIKETHROUGH, false) + .append( + Component.text( + " GAGNEZ DES RÉCOMPENSES EN VOTANT ", + NamedTextColor.GREEN, + TextDecoration.BOLD + ) + ) + .append(Component.text(" ")) + .append(Component.newline()) + ) + .append(Component.newline()) + .append( + Component.text(" ") + .decoration(TextDecoration.STRIKETHROUGH, false) + .append( + Component.text( + "Votez dès maintenant pour soutenir le serveur et " + + "recevez des points boutique pour obtenir des récompenses uniques !", + NamedTextColor.DARK_GREEN + ) + ) + .append(Component.newline()) + .append(Component.newline()) + .append(Component.text(" ")) + .append(Component.text("Exécutez la commande ou cliquez ci-dessous : ", NamedTextColor.DARK_GREEN)) + .append(Component.newline()) + .append(Component.text(" ")) + .append( + Component.text(" → ", NamedTextColor.DARK_GREEN, TextDecoration.BOLD) + .decoration(TextDecoration.STRIKETHROUGH, false) + .append(Component.text("/vote", NamedTextColor.GREEN, TextDecoration.BOLD)) + .append(Component.text(" ← ", NamedTextColor.DARK_GREEN, TextDecoration.BOLD)) + .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/vote")) + ) + .append(Component.newline()) + ) + .append( + Component.text( + SPACE_MESSAGE, + NamedTextColor.GREEN, + TextDecoration.STRIKETHROUGH + ) + ) } - public static Component discordMessage() { - return Component.text(" ", NamedTextColor.BLUE, TextDecoration.STRIKETHROUGH) - .append(Component.newline()) - .append(Component.text(" ") - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text(" DÉCOUVREZ NOTRE COMMUNAUTÉ DISCORD ! ", NamedTextColor.AQUA, TextDecoration.BOLD)) - .append(Component.text(" ")) - .append(Component.newline())) - .append(Component.newline()) - .append(Component.text(" ") - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text("Rejoignez notre serveur Discord pour être informés des dernières nouvelles et interagir avec notre communauté !", NamedTextColor.DARK_AQUA)) - .append(Component.newline()) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text("Exécutez la commande ou cliquez ci-dessous : ", NamedTextColor.BLUE)) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text(" → ", NamedTextColor.BLUE, TextDecoration.BOLD) - .decoration(TextDecoration.BOLD, false) - .append(Component.text("/discord", NamedTextColor.AQUA, TextDecoration.BOLD)) - .clickEvent(net.kyori.adventure.text.event.ClickEvent.clickEvent(net.kyori.adventure.text.event.ClickEvent.Action.OPEN_URL, "https://discord.gg/4ajRytDJWK")) - .append(Component.text(" ← ", NamedTextColor.BLUE, TextDecoration.BOLD)))) - .append(Component.newline()) - .append(Component.text(" ", NamedTextColor.BLUE, TextDecoration.STRIKETHROUGH)); + fun discordMessage(): Component { + return Component.text( + SPACE_MESSAGE, + NamedTextColor.BLUE, + TextDecoration.STRIKETHROUGH + ) + .append(Component.newline()) + .append( + Component.text(" ") + .decoration(TextDecoration.STRIKETHROUGH, false) + .append( + Component.text( + " DÉCOUVREZ NOTRE COMMUNAUTÉ DISCORD ! ", + NamedTextColor.AQUA, + TextDecoration.BOLD + ) + ) + .append(Component.text(" ")) + .append(Component.newline()) + ) + .append(Component.newline()) + .append( + Component.text(" ") + .decoration(TextDecoration.STRIKETHROUGH, false) + .append( + Component.text( + "Rejoignez notre serveur Discord pour être informés " + + "des dernières nouvelles et interagir avec notre communauté !", + NamedTextColor.DARK_AQUA + ) + ) + .append(Component.newline()) + .append(Component.newline()) + .append(Component.text(" ")) + .append(Component.text("Exécutez la commande ou cliquez ci-dessous : ", NamedTextColor.BLUE)) + .append(Component.newline()) + .append(Component.text(" ")) + .append( + Component.text(" → ", NamedTextColor.BLUE, TextDecoration.BOLD) + .decoration(TextDecoration.BOLD, false) + .append(Component.text("/discord", NamedTextColor.AQUA, TextDecoration.BOLD)) + .clickEvent( + ClickEvent.clickEvent( + ClickEvent.Action.OPEN_URL, + "https://discord.gg/4ajRytDJWK" + ) + ) + .append(Component.text(" ← ", NamedTextColor.BLUE, TextDecoration.BOLD)) + ) + ) + .append(Component.newline()) + .append( + Component.text( + SPACE_MESSAGE, + NamedTextColor.BLUE, + TextDecoration.STRIKETHROUGH + ) + ) } - public static Component recrutementMessage() { - return Component.text(" ", NamedTextColor.YELLOW, TextDecoration.STRIKETHROUGH) - .append(Component.newline()) - .append(Component.text(" ") - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.text(" TESSERACT RECRUTE !", NamedTextColor.YELLOW, TextDecoration.BOLD) - .append(Component.text(" ", NamedTextColor.GOLD, TextDecoration.BOLD))) - .append(Component.newline()) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text("Nous recherchons de nouveaux membres pour contribuer au développement de nos projets ! ", NamedTextColor.GOLD)) - .append(Component.text("Développeur JAVA, Scénariste, Community Manager", NamedTextColor.RED)) - .append(Component.text(", et autres nombreux postes s'offrent à vous !", NamedTextColor.GOLD)) - .decoration(TextDecoration.STRIKETHROUGH, false) - .append(Component.newline()) - .append(Component.newline()) - .append(Component.text(" ") - .append(Component.text("Rejoignez-nous dès maintenant (cliquez ici) : ", NamedTextColor.GOLD)) - .append(Component.newline()) - .append(Component.text(" ")) - .append(Component.text(" → ", NamedTextColor.GOLD, TextDecoration.BOLD) - .decoration(TextDecoration.BOLD, false) - .append(Component.text("Candidater", NamedTextColor.YELLOW, TextDecoration.BOLD) - .clickEvent(net.kyori.adventure.text.event.ClickEvent.clickEvent(net.kyori.adventure.text.event.ClickEvent.Action.OPEN_URL, "https://www.tesseract.onl/candidature/"))) - .append(Component.text(" ← ", NamedTextColor.GOLD, TextDecoration.BOLD))) - .append(Component.newline()) - .append(Component.text(" ", NamedTextColor.YELLOW, TextDecoration.STRIKETHROUGH)))); + fun recrutementMessage(): Component { + return Component.text( + SPACE_MESSAGE, + NamedTextColor.YELLOW, + TextDecoration.STRIKETHROUGH + ) + .append(Component.newline()) + .append( + Component.text(" ") + .decoration(TextDecoration.STRIKETHROUGH, false) + .append( + Component.text(" TESSERACT RECRUTE !", NamedTextColor.YELLOW, TextDecoration.BOLD) + .append(Component.text(" ", NamedTextColor.GOLD, TextDecoration.BOLD)) + ) + .append(Component.newline()) + .append(Component.newline()) + .append(Component.text(" ")) + .append( + Component.text( + "Nous recherchons de nouveaux membres pour contribuer au développement de nos projets ! ", + NamedTextColor.GOLD + ) + ) + .append(Component.text("Développeur JAVA, Scénariste, Community Manager", NamedTextColor.RED)) + .append(Component.text(", et autres nombreux postes s'offrent à vous !", NamedTextColor.GOLD)) + .decoration(TextDecoration.STRIKETHROUGH, false) + .append(Component.newline()) + .append(Component.newline()) + .append( + Component.text(" ") + .append( + Component.text( + "Rejoignez-nous dès maintenant (cliquez ici) : ", + NamedTextColor.GOLD + ) + ) + .append(Component.newline()) + .append(Component.text(" ")) + .append( + Component.text(" → ", NamedTextColor.GOLD, TextDecoration.BOLD) + .decoration(TextDecoration.BOLD, false) + .append( + Component.text("Candidater", NamedTextColor.YELLOW, TextDecoration.BOLD) + .clickEvent( + ClickEvent.clickEvent( + ClickEvent.Action.OPEN_URL, + "https://www.tesseract.onl/candidature/" + ) + ) + ) + .append(Component.text(" ← ", NamedTextColor.GOLD, TextDecoration.BOLD)) + ) + .append(Component.newline()) + .append( + Component.text( + SPACE_MESSAGE, + NamedTextColor.YELLOW, + TextDecoration.STRIKETHROUGH + ) + ) + ) + ) } - } diff --git a/src/main/kotlin/onl/tesseract/core/autochatmessage/GlobalAutoChat.kt b/src/main/kotlin/onl/tesseract/core/autochatmessage/GlobalAutoChat.kt new file mode 100644 index 0000000..4152203 --- /dev/null +++ b/src/main/kotlin/onl/tesseract/core/autochatmessage/GlobalAutoChat.kt @@ -0,0 +1,15 @@ +package onl.tesseract.core.autochatmessage + +object GlobalAutoChat { + + val instance: AutoChatMessage = AutoChatMessage() + private var started: Boolean = false + + @Synchronized + fun startOnce() { + if (!started) { + instance.start() + started = true + } + } +}