diff --git a/src/main/java/fr/communaywen/core/AywenCraftPlugin.java b/src/main/java/fr/communaywen/core/AywenCraftPlugin.java index a2854418..c7a0da21 100644 --- a/src/main/java/fr/communaywen/core/AywenCraftPlugin.java +++ b/src/main/java/fr/communaywen/core/AywenCraftPlugin.java @@ -160,6 +160,7 @@ public void onLoad() { this.registerFlags(new StateFlag("disable-builder-wand", false)); this.registerFlags(new StateFlag("disable-fly", false)); this.registerFlags(new StateFlag("disable-spawn-grave", false)); + this.registerFlags(new StateFlag("disable-wind-charge", false)); } @SneakyThrows diff --git a/src/main/java/fr/communaywen/core/EventsManager.java b/src/main/java/fr/communaywen/core/EventsManager.java index ceeaa3e9..7b1f4017 100644 --- a/src/main/java/fr/communaywen/core/EventsManager.java +++ b/src/main/java/fr/communaywen/core/EventsManager.java @@ -265,7 +265,7 @@ public boolean startMiraculousFishing() { System.out.println("\n\nEvent started\n\n"); Bukkit.broadcastMessage(ChatColor.GREEN + "Nouvel évènement en approche: " + ChatColor.BOLD + "Pêche Miraculeuse\n" + - ChatColor.RESET + ChatColor.GOLD + "Vous obtenez plus d'xp et de récompense en pêchat et en découvrant des coffres de structures"); + ChatColor.RESET + ChatColor.GOLD + "Vous obtenez plus d'xp et de récompenses en pêchant et en découvrant des coffres de structures"); lastMiraculousFishing = System.currentTimeMillis(); diff --git a/src/main/java/fr/communaywen/core/QuizManager.java b/src/main/java/fr/communaywen/core/QuizManager.java index 052f523a..2b24a36c 100644 --- a/src/main/java/fr/communaywen/core/QuizManager.java +++ b/src/main/java/fr/communaywen/core/QuizManager.java @@ -101,9 +101,9 @@ public void onPlayerChat(AsyncPlayerChatEvent event) { ); - contestManager.addPointPlayer(points + contestManager.getPlayerPoints(event.getPlayer()), event.getPlayer()); + contestManager.addPointPlayer(points + contestManager.getPlayerPoints(event.getPlayer()).join(), event.getPlayer()); String playerCamp = "points" + ContestCache.getPlayerCampsCache(event.getPlayer()); - contestManager.updateColumnInt("contest", playerCamp, points + contestManager.getInt("contest", playerCamp)); + contestManager.updateColumnInt("contest", playerCamp, points + contestManager.getInt("contest", playerCamp).join()); } else { Bukkit.broadcastMessage( diff --git a/src/main/java/fr/communaywen/core/adminshop/AdminShopCategory.java b/src/main/java/fr/communaywen/core/adminshop/AdminShopCategory.java index a6423c44..26575ba7 100644 --- a/src/main/java/fr/communaywen/core/adminshop/AdminShopCategory.java +++ b/src/main/java/fr/communaywen/core/adminshop/AdminShopCategory.java @@ -7,8 +7,6 @@ import fr.communaywen.core.adminshop.menu.category.defaults.OresItems; import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; import fr.communaywen.core.adminshop.shopinterfaces.BaseShop; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import lombok.Getter; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/AdminShopMenu.java b/src/main/java/fr/communaywen/core/adminshop/menu/AdminShopMenu.java index 64aec6c9..a0032e09 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/AdminShopMenu.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/AdminShopMenu.java @@ -4,8 +4,6 @@ import dev.xernas.menulib.utils.InventorySize; import dev.xernas.menulib.utils.ItemBuilder; import fr.communaywen.core.adminshop.AdminShopCategory; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/buy/AdminShopBuy.java b/src/main/java/fr/communaywen/core/adminshop/menu/buy/AdminShopBuy.java index 57d99ab3..0954a125 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/buy/AdminShopBuy.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/buy/AdminShopBuy.java @@ -5,7 +5,6 @@ import dev.xernas.menulib.utils.InventorySize; import dev.xernas.menulib.utils.ItemBuilder; import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; -import fr.communaywen.core.customitems.utils.CustomItemsUtils; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/category/colored/BlockType.java b/src/main/java/fr/communaywen/core/adminshop/menu/category/colored/BlockType.java index 2062cea5..021bbe31 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/category/colored/BlockType.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/category/colored/BlockType.java @@ -1,8 +1,5 @@ package fr.communaywen.core.adminshop.menu.category.colored; -import fr.communaywen.core.adminshop.shopinterfaces.ColoredShop; -import org.bukkit.entity.Player; - public enum BlockType { CONCRETE("Béton"), CONCRETE_POWDER("Béton poudreux"), diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/BlocksItems.java b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/BlocksItems.java index 8bb90918..5dd28236 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/BlocksItems.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/BlocksItems.java @@ -2,8 +2,6 @@ import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; import fr.communaywen.core.adminshop.menu.category.ShopType; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import org.bukkit.Material; public enum BlocksItems implements BaseItems { diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/MiscItems.java b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/MiscItems.java index d4d26099..0ef99c93 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/MiscItems.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/MiscItems.java @@ -2,8 +2,6 @@ import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; import fr.communaywen.core.adminshop.menu.category.ShopType; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import org.bukkit.Material; public enum MiscItems implements BaseItems { diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/OresItems.java b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/OresItems.java index dc8233d4..b9f7575a 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/OresItems.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/category/defaults/OresItems.java @@ -1,10 +1,7 @@ package fr.communaywen.core.adminshop.menu.category.defaults; -import fr.communaywen.core.AywenCraftPlugin; import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; import fr.communaywen.core.adminshop.menu.category.ShopType; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import org.bukkit.Material; public enum OresItems implements BaseItems { diff --git a/src/main/java/fr/communaywen/core/adminshop/menu/sell/AdminShopSell.java b/src/main/java/fr/communaywen/core/adminshop/menu/sell/AdminShopSell.java index 19304b77..a8071df8 100644 --- a/src/main/java/fr/communaywen/core/adminshop/menu/sell/AdminShopSell.java +++ b/src/main/java/fr/communaywen/core/adminshop/menu/sell/AdminShopSell.java @@ -6,8 +6,6 @@ import dev.xernas.menulib.utils.ItemBuilder; import fr.communaywen.core.adminshop.menu.category.ShopType; import fr.communaywen.core.adminshop.shopinterfaces.BaseItems; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/fr/communaywen/core/adminshop/shopinterfaces/BaseItems.java b/src/main/java/fr/communaywen/core/adminshop/shopinterfaces/BaseItems.java index 8034b42e..1b31e87c 100644 --- a/src/main/java/fr/communaywen/core/adminshop/shopinterfaces/BaseItems.java +++ b/src/main/java/fr/communaywen/core/adminshop/shopinterfaces/BaseItems.java @@ -1,8 +1,6 @@ package fr.communaywen.core.adminshop.shopinterfaces; import fr.communaywen.core.adminshop.menu.category.ShopType; -import fr.communaywen.core.credit.Credit; -import fr.communaywen.core.credit.Feature; public interface BaseItems { String named(); diff --git a/src/main/java/fr/communaywen/core/claim/ClaimConfigDataBase.java b/src/main/java/fr/communaywen/core/claim/ClaimConfigDataBase.java index f30c44cc..a9e86b6e 100644 --- a/src/main/java/fr/communaywen/core/claim/ClaimConfigDataBase.java +++ b/src/main/java/fr/communaywen/core/claim/ClaimConfigDataBase.java @@ -1,12 +1,10 @@ package fr.communaywen.core.claim; import fr.communaywen.core.AywenCraftPlugin; -import fr.communaywen.core.credit.Credit; import fr.communaywen.core.teams.Team; import fr.communaywen.core.utils.database.DatabaseConnector; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.entity.Player; import java.sql.PreparedStatement; import java.sql.ResultSet; diff --git a/src/main/java/fr/communaywen/core/claim/ClaimListener.java b/src/main/java/fr/communaywen/core/claim/ClaimListener.java index 80cfcfa4..8abacb85 100644 --- a/src/main/java/fr/communaywen/core/claim/ClaimListener.java +++ b/src/main/java/fr/communaywen/core/claim/ClaimListener.java @@ -1,24 +1,13 @@ package fr.communaywen.core.claim; -import java.sql.SQLException; import java.util.*; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldguard.WorldGuard; -import com.sk89q.worldguard.protection.ApplicableRegionSet; -import com.sk89q.worldguard.protection.flags.StateFlag; -import com.sk89q.worldguard.protection.regions.RegionContainer; -import com.sk89q.worldguard.protection.regions.RegionQuery; import dev.lone.itemsadder.api.CustomStack; import fr.communaywen.core.utils.constant.MessageManager; import fr.communaywen.core.utils.constant.MessageType; import fr.communaywen.core.utils.constant.Prefix; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.event.ClickEvent; import org.bukkit.*; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.block.Container; import org.bukkit.block.data.Openable; import org.bukkit.block.data.type.*; @@ -42,12 +31,8 @@ import fr.communaywen.core.AywenCraftPlugin; import fr.communaywen.core.teams.EconomieTeam; import fr.communaywen.core.teams.Team; -import org.bukkit.material.RedstoneTorch; import org.bukkit.scheduler.BukkitRunnable; -import static org.bukkit.event.EventPriority.HIGH; -import static org.bukkit.event.EventPriority.LOWEST; - public class ClaimListener implements Listener { public static final Map activeParticleTasks = new HashMap<>(); diff --git a/src/main/java/fr/communaywen/core/claim/ClaimMenu.java b/src/main/java/fr/communaywen/core/claim/ClaimMenu.java index d5de1418..e7bd5a21 100644 --- a/src/main/java/fr/communaywen/core/claim/ClaimMenu.java +++ b/src/main/java/fr/communaywen/core/claim/ClaimMenu.java @@ -4,8 +4,6 @@ import dev.xernas.menulib.utils.InventorySize; import dev.xernas.menulib.utils.ItemBuilder; import fr.communaywen.core.AywenCraftPlugin; -import fr.communaywen.core.claim.ClaimDeleteConfirmationMenu; -import fr.communaywen.core.claim.RegionManager; import fr.communaywen.core.teams.Team; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/src/main/java/fr/communaywen/core/claim/RegionManager.java b/src/main/java/fr/communaywen/core/claim/RegionManager.java index 18487b47..efe99112 100644 --- a/src/main/java/fr/communaywen/core/claim/RegionManager.java +++ b/src/main/java/fr/communaywen/core/claim/RegionManager.java @@ -4,8 +4,6 @@ import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/fr/communaywen/core/commands/contest/ContestCommand.java b/src/main/java/fr/communaywen/core/commands/contest/ContestCommand.java index 265e2bb3..0b019dcb 100644 --- a/src/main/java/fr/communaywen/core/commands/contest/ContestCommand.java +++ b/src/main/java/fr/communaywen/core/commands/contest/ContestCommand.java @@ -84,12 +84,12 @@ public void setcontest(Player player, String camp1, @Named("colorContest") Strin contestManager.deleteTableContest("camps"); contestManager.insertCustomContest(camp1, color1, camp2, color2); - player.sendMessage("§aLe Contest : " + camp1 + " VS " + camp2 + " a bien été sauvegarder\nMerci d'attendre que les données en cache s'actualise."); + MessageManager.sendMessageType(player, "§aLe Contest : " + camp1 + " VS " + camp2 + " a bien été sauvegarder\nMerci d'attendre que les données en cache s'actualise.", Prefix.STAFF, MessageType.SUCCESS, true); } else { - player.sendMessage("§c/contest setcontest et color doit comporter une couleur valide"); + MessageManager.sendMessageType(player, "§c/contest setcontest et color doit comporter une couleur valide", Prefix.STAFF, MessageType.ERROR, true); } } else { - player.sendMessage("§cVous pouvez pas définir un contest lorsqu'il a commencé"); + MessageManager.sendMessageType(player, "§cVous pouvez pas définir un contest lorsqu'il a commencé", Prefix.STAFF, MessageType.ERROR, true); } } @@ -97,9 +97,9 @@ public void setcontest(Player player, String camp1, @Named("colorContest") Strin @Description("Permet d'ajouter des points a un membre") @CommandPermission("ayw.command.contest.addpoints") public void addpoints(Player player, Player target, Integer points) { - contestManager.addPointPlayer(points + contestManager.getPlayerPoints(target), target); + contestManager.addPointPlayer(points + contestManager.getPlayerPoints(target).join(), target); - player.sendMessage("§aVous avez ajouté " + points + " §apoint(s) à " + target.getName()); + MessageManager.sendMessageType(player, "§aVous avez ajouté " + points + " §apoint(s) à " + target.getName(), Prefix.STAFF, MessageType.SUCCESS, true); } } diff --git a/src/main/java/fr/communaywen/core/commands/spawn/head/HeadCommand.java b/src/main/java/fr/communaywen/core/commands/spawn/head/HeadCommand.java index 40b0838b..0abfa02c 100644 --- a/src/main/java/fr/communaywen/core/commands/spawn/head/HeadCommand.java +++ b/src/main/java/fr/communaywen/core/commands/spawn/head/HeadCommand.java @@ -32,7 +32,7 @@ public HeadCommand(AywenCraftPlugin plugins) { @Cooldown(4) @DefaultFor("~") public void defaultCommand(Player player) { - MessageManager.sendMessageType(player, "§7Vous avez trouvé §d" + HeadManager.getNumberHeads(player) + "§8tête(s) sur §d" + HeadManager.getMaxHeads() + "§8têtes", Prefix.HEAD, MessageType.SUCCESS, true); + MessageManager.sendMessageType(player, "§7Vous avez trouvé §d" + HeadManager.getNumberHeads(player) + " §8tête(s) sur §d" + HeadManager.getMaxHeads() + " §8têtes", Prefix.HEAD, MessageType.SUCCESS, true); } @Subcommand("add") diff --git a/src/main/java/fr/communaywen/core/commands/spawn/jump/JumpCommand.java b/src/main/java/fr/communaywen/core/commands/spawn/jump/JumpCommand.java index c9e5ae77..21fea5fe 100644 --- a/src/main/java/fr/communaywen/core/commands/spawn/jump/JumpCommand.java +++ b/src/main/java/fr/communaywen/core/commands/spawn/jump/JumpCommand.java @@ -32,12 +32,6 @@ public JumpCommand(AywenCraftPlugin plugins, JumpManager manager) { jumpManager = manager; } - @Cooldown(4) - @DefaultFor("~") - public void defaultCommand(Player player) { - MessageManager.sendMessageType(player, "§7Vous avez trouvé §d" + HeadManager.getNumberHeads(player) + "§8tête(s) sur §d" + HeadManager.getMaxHeads() + "§8têtes", Prefix.HEAD, MessageType.SUCCESS, true); - } - @Subcommand("end") @Description("Arrete le jump que vous etes entrain de faire") public void end(Player player) { diff --git a/src/main/java/fr/communaywen/core/contest/cache/ContestCache.java b/src/main/java/fr/communaywen/core/contest/cache/ContestCache.java index 499e5b1a..530e7daf 100644 --- a/src/main/java/fr/communaywen/core/contest/cache/ContestCache.java +++ b/src/main/java/fr/communaywen/core/contest/cache/ContestCache.java @@ -149,7 +149,7 @@ public static void initPlayerDataCache(Player player) { if (result.next()) { int points = result.getInt("point_dep"); int camp = result.getInt("camps"); - String color = ContestManager.getString("contest","color" + camp); + String color = ContestManager.getString("contest","color" + camp).join(); ChatColor campColor = ChatColor.valueOf(color); Bukkit.getScheduler().runTask(plugin, () -> { diff --git a/src/main/java/fr/communaywen/core/contest/managers/ContestManager.java b/src/main/java/fr/communaywen/core/contest/managers/ContestManager.java index 69aae6b9..8b727965 100644 --- a/src/main/java/fr/communaywen/core/contest/managers/ContestManager.java +++ b/src/main/java/fr/communaywen/core/contest/managers/ContestManager.java @@ -45,6 +45,7 @@ import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import static fr.communaywen.core.mailboxes.utils.MailboxUtils.*; @@ -241,8 +242,8 @@ public void initPhase3(JavaPlugin plugin, FileConfiguration eventConfig) { int totalvote = vote1 + vote2; int vote1Taux = (int) (((double) vote1 / totalvote) * 100); int vote2Taux = (int) (((double) vote2 / totalvote) * 100); - int points1 = getInt("contest", "points1"); - int points2 = getInt("contest", "points2"); + int points1 = getInt("contest", "points1").join(); + int points2 = getInt("contest", "points2").join(); int multiplicateurPoint = Math.abs(vote1Taux - vote2Taux)/16; multiplicateurPoint=Integer.valueOf(df.format(multiplicateurPoint)); @@ -449,30 +450,34 @@ public void initPhase3(JavaPlugin plugin, FileConfiguration eventConfig) { System.out.println("[CONTEST] Fermeture du Contest"); } - public static String getString(String table, String column) { + public static CompletableFuture getString(String table, String column) { + return CompletableFuture.supplyAsync(() -> { try { PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table); ResultSet rs = statement.executeQuery(); if (rs.next()) { - return rs.getString(column); + return rs.getString(column); } } catch (SQLException e) { throw new RuntimeException(e); } - return ""; + return null; + }); } - public static int getInt(String table, String column) { - try { - PreparedStatement statement = connection.prepareStatement("SELECT * FROM "+table); - ResultSet rs = statement.executeQuery(); - if (rs.next()) { - return rs.getInt(column); + public static CompletableFuture getInt(String table, String column) { + return CompletableFuture.supplyAsync(() -> { + try { + PreparedStatement statement = connection.prepareStatement("SELECT * FROM "+table); + ResultSet rs = statement.executeQuery(); + if (rs.next()) { + return rs.getInt(column); + } + } catch (SQLException e) { + throw new RuntimeException(e); } - } catch (SQLException e) { - throw new RuntimeException(e); - } - return 999; + return -1; + }); } public static String getTimeUntilNextMonday() { @@ -489,33 +494,35 @@ public static String getTimeUntilNextMonday() { return String.format("%dd %dh %dm", days, hours, minutes); } - public int getPlayerPoints(Player player) { - UUID playerUUID = player.getUniqueId(); + public CompletableFuture getPlayerPoints(Player player) { + return CompletableFuture.supplyAsync(() -> { + UUID playerUUID = player.getUniqueId(); - String sql = "SELECT * FROM camps WHERE minecraft_uuid = ?"; - try (PreparedStatement states = connection.prepareStatement(sql)) { - states.setString(1, playerUUID.toString()); - ResultSet result = states.executeQuery(); - if (result.next()) { - int points = result.getInt("point_dep"); - - return points; + String sql = "SELECT * FROM camps WHERE minecraft_uuid = ?"; + try (PreparedStatement states = connection.prepareStatement(sql)) { + states.setString(1, playerUUID.toString()); + ResultSet result = states.executeQuery(); + if (result.next()) { + return result.getInt("point_dep"); + } + } catch (SQLException e) { + throw new RuntimeException(e); } - } catch (SQLException e) { - throw new RuntimeException(e); - } - return 0; + return -1; + }); } public void updateColumnInt(String table, String column, int value) { - String sql = "UPDATE " + table + " SET " + column + " = ?"; - try (PreparedStatement stmt = connection.prepareStatement(sql)) { - stmt.setInt(1, value); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new RuntimeException(e); - } + Bukkit.getScheduler().runTaskAsynchronously(plugins, () -> { + String sql = "UPDATE " + table + " SET " + column + " = ?"; + try (PreparedStatement stmt = connection.prepareStatement(sql)) { + stmt.setInt(1, value); + stmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + }); } // TRADE METHODE @@ -595,7 +602,7 @@ public ResultSet getAllPlayer() { public String getPlayerCampName(Player player) { Integer campInteger = ContestCache.getPlayerCampsCache(player); - String campName = getString("contest","camp" + campInteger); + String campName = getString("contest","camp" + campInteger).join(); return campName; } public Integer getOfflinePlayerCamp(OfflinePlayer player) { @@ -614,12 +621,12 @@ public Integer getOfflinePlayerCamp(OfflinePlayer player) { public String getOfflinePlayerCampName(OfflinePlayer player) { Integer campInteger = getOfflinePlayerCamp(player); - String campName = getString("contest","camp" + campInteger); + String campName = getString("contest","camp" + campInteger).join();; return campName; } public ChatColor getOfflinePlayerCampChatColor(OfflinePlayer player) { Integer campInteger = getOfflinePlayerCamp(player); - String color = getString("contest","color" + campInteger); + String color = getString("contest","color" + campInteger).join();; ChatColor campColor = ChatColor.valueOf(color); return campColor; } @@ -966,14 +973,16 @@ public void deleteTableContest(String table) { } public void addPointPlayer(Integer points_dep, Player player) { - String sql = "UPDATE camps SET point_dep = ? WHERE minecraft_uuid = ?"; - try (PreparedStatement stmt = connection.prepareStatement(sql)) { - stmt.setInt(1, points_dep); - stmt.setString(2, player.getUniqueId().toString()); - stmt.executeUpdate(); - } catch (SQLException e) { - throw new RuntimeException(e); - } + Bukkit.getScheduler().runTaskAsynchronously(plugins, () -> { + String sql = "UPDATE camps SET point_dep = ? WHERE minecraft_uuid = ?"; + try (PreparedStatement stmt = connection.prepareStatement(sql)) { + stmt.setInt(1, points_dep); + stmt.setString(2, player.getUniqueId().toString()); + stmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + }); } diff --git a/src/main/java/fr/communaywen/core/contest/menu/ConfirmMenu.java b/src/main/java/fr/communaywen/core/contest/menu/ConfirmMenu.java index 592a3d9d..d9eb519c 100644 --- a/src/main/java/fr/communaywen/core/contest/menu/ConfirmMenu.java +++ b/src/main/java/fr/communaywen/core/contest/menu/ConfirmMenu.java @@ -46,8 +46,8 @@ public void onInventoryClick(InventoryClickEvent click) {} public @NotNull Map getContent() { Map inventory = new HashMap<>(); - String campNameFinal = contestManager.getString("contest", getCampName); - String campColor = contestManager.getString("contest", getColor); + String campNameFinal = contestManager.getString("contest", getCampName).join();; + String campColor = contestManager.getString("contest", getColor).join();; ChatColor colorFinal = ChatColor.valueOf(campColor); List lore1 = new ArrayList(); @@ -71,7 +71,7 @@ public void onInventoryClick(InventoryClickEvent click) {} String substring = this.getCampName.substring(this.getCampName.length() - 1); contestManager.insertChoicePlayer(getOwner(), Integer.valueOf(substring)); getOwner().playSound(getOwner().getEyeLocation(), Sound.BLOCK_AMETHYST_BLOCK_RESONATE, 1.0F, 0.2F); - MessageManager.sendMessageType(getOwner(), "§7Vous avez bien rejoint : "+ colorFinal + "La Team " + contestManager.getString("contest", getCampName), Prefix.CONTEST, MessageType.SUCCESS, false); + MessageManager.sendMessageType(getOwner(), "§7Vous avez bien rejoint : "+ colorFinal + "La Team " + contestManager.getString("contest", getCampName).join(), Prefix.CONTEST, MessageType.SUCCESS, false); getOwner().closeInventory(); })); } diff --git a/src/main/java/fr/communaywen/core/contest/menu/ContributionMenu.java b/src/main/java/fr/communaywen/core/contest/menu/ContributionMenu.java index b452a472..8f2b0595 100644 --- a/src/main/java/fr/communaywen/core/contest/menu/ContributionMenu.java +++ b/src/main/java/fr/communaywen/core/contest/menu/ContributionMenu.java @@ -114,23 +114,30 @@ public void onInventoryClick(InventoryClickEvent click) { }).setOnClick(inventoryClickEvent -> { try { ItemStack shell_contestItem = CustomStack.getInstance("contest:contest_shell").getItemStack(); - int shell = 0; - for (ItemStack is : getOwner().getInventory().getContents()) { - if (is != null && is.isSimilar(shell_contestItem)) { - shell = shell + is.getAmount(); - } - } - if (ItemUtils.hasEnoughItems(getOwner(), shell_contest, shell)) { - ItemUtils.removeItemsFromInventory(getOwner(), shell_contest, shell); - contestManager.addPointPlayer(shell + contestManager.getPlayerPoints(getOwner()), getOwner()); - contestManager.updateColumnInt("contest", "points" + ContestCache.getPlayerCampsCache(getOwner()), shell + contestManager.getInt("contest", "points" + ContestCache.getPlayerCampsCache(getOwner()))); - MessageManager.sendMessageType(getOwner(), "§7Vous avez déposé§b " + shell + " Coquillage(s) de Contest§7 pour votre Team!", Prefix.CONTEST, MessageType.SUCCESS, true); + + int shellCount = Arrays.stream(getOwner().getInventory().getContents()).filter(is -> is != null && is.isSimilar(shell_contestItem)).mapToInt(ItemStack::getAmount).sum(); + + if (ItemUtils.hasEnoughItems(getOwner(), shell_contestItem.getType(), shellCount)) { + ItemUtils.removeItemsFromInventory(getOwner(), shell_contestItem.getType(), shellCount); + + contestManager.getPlayerPoints(getOwner()).thenAccept(playerPoints -> { + int newPlayerPoints = shellCount + playerPoints; + + contestManager.getInt("contest", "points" + ContestCache.getPlayerCampsCache(getOwner())) + .thenAccept(campPoints -> { + int updatedCampPoints = shellCount + campPoints; + + contestManager.updateColumnInt("contest", "points" + ContestCache.getPlayerCampsCache(getOwner()), updatedCampPoints); + + MessageManager.sendMessageType(getOwner(), "§7Vous avez déposé§b " + shellCount + " Coquillage(s) de Contest§7 pour votre Team!", Prefix.CONTEST, MessageType.SUCCESS, true); + }); + }); } else { MessageManager.sendMessageType(getOwner(), "§cVous n'avez pas de Coquillage(s) de Contest§7", Prefix.CONTEST, MessageType.ERROR, true); } - } catch (Exception e) { - throw new RuntimeException(e); - } + } catch (Exception e) { + throw new RuntimeException(e); + } })); } else if(i==16) { inventory.put(16, new ItemBuilder(this, Material.OMINOUS_TRIAL_KEY, itemMeta -> { diff --git a/src/main/java/fr/communaywen/core/economy/EconomyData.java b/src/main/java/fr/communaywen/core/economy/EconomyData.java index ca28334a..a2fece44 100644 --- a/src/main/java/fr/communaywen/core/economy/EconomyData.java +++ b/src/main/java/fr/communaywen/core/economy/EconomyData.java @@ -1,6 +1,8 @@ package fr.communaywen.core.economy; +import fr.communaywen.core.AywenCraftPlugin; import fr.communaywen.core.utils.database.DatabaseConnector; +import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -16,32 +18,36 @@ import java.util.UUID; public class EconomyData extends DatabaseConnector { + public static void saveBalances(UUID player, Map balances) { - try { - PreparedStatement statement = connection.prepareStatement("SELECT * FROM economie WHERE player = ?"); - statement.setString(1, player.toString()); + Bukkit.getScheduler().runTaskAsynchronously(AywenCraftPlugin.getInstance(), () -> { + try { + PreparedStatement statement = connection.prepareStatement("SELECT * FROM economie WHERE player = ?"); + statement.setString(1, player.toString()); - ResultSet rs = statement.executeQuery(); - PreparedStatement stm; - if (rs.next()) { - stm = connection.prepareStatement("UPDATE economie SET balance = ? WHERE player = ?"); - stm.setDouble(1, balances.getOrDefault(player, 0.0)); - stm.setString(2, player.toString()); - } else { - stm = connection.prepareStatement("INSERT INTO economie (player, balance) VALUES (?, ?)"); - stm.setString(1, player.toString()); - stm.setDouble(2, balances.getOrDefault(player, 0.0)); - } + ResultSet rs = statement.executeQuery(); + PreparedStatement stm; + if (rs.next()) { + stm = connection.prepareStatement("UPDATE economie SET balance = ? WHERE player = ?"); + stm.setDouble(1, balances.getOrDefault(player, 0.0)); + stm.setString(2, player.toString()); + } else { + stm = connection.prepareStatement("INSERT INTO economie (player, balance) VALUES (?, ?)"); + stm.setString(1, player.toString()); + stm.setDouble(2, balances.getOrDefault(player, 0.0)); + } + int affectedRows = stm.executeUpdate(); - int affectedRows = stm.executeUpdate(); + if (affectedRows == 0) { + throw new SQLException("Saving balance failed, no rows affected."); + } - if (affectedRows == 0) { - throw new SQLException("Saving balance failed, no rows affected."); + } catch (SQLException ignored) { } - - } catch (SQLException ignored) {} + }); } + public static Map loadBalances() { try { Map balances = new HashMap<>(); diff --git a/src/main/java/fr/communaywen/core/listeners/CustomFlagsEvents.java b/src/main/java/fr/communaywen/core/listeners/CustomFlagsEvents.java index 45fe631d..321b3833 100644 --- a/src/main/java/fr/communaywen/core/listeners/CustomFlagsEvents.java +++ b/src/main/java/fr/communaywen/core/listeners/CustomFlagsEvents.java @@ -7,9 +7,14 @@ import com.sk89q.worldguard.protection.regions.RegionContainer; import com.sk89q.worldguard.protection.regions.RegionQuery; import fr.communaywen.core.AywenCraftPlugin; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; public class CustomFlagsEvents implements Listener { @@ -21,7 +26,6 @@ public CustomFlagsEvents(AywenCraftPlugin plugins) { @EventHandler(priority = EventPriority.HIGH) public void onFlyToggle(org.bukkit.event.player.PlayerToggleFlightEvent event) { - // WorldGuard RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); RegionQuery query = container.createQuery(); @@ -36,6 +40,25 @@ public void onFlyToggle(org.bukkit.event.player.PlayerToggleFlightEvent event) { event.setCancelled(false); } else { event.setCancelled(true); + event.getPlayer().sendMessage("§cVous n'êtes pas autorisé à faire cela ici !"); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void onPlayerInteractEvent(PlayerInteractEvent event) { + Player player = event.getPlayer(); + // WorldGuard + RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); + RegionQuery query = container.createQuery(); + ApplicableRegionSet set = query.getApplicableRegions(BukkitAdapter.adapt(player.getLocation())); + + if (event.getMaterial() == Material.WIND_CHARGE) { + if (!set.testState(null, (StateFlag) plugin.getCustomFlags().get(StateFlag.class).get("disable-wind-charge"))) { + event.setCancelled(false); + } else { + event.setCancelled(true); + player.sendMessage("§cVous n'êtes pas autorisé à faire cela ici !"); + } } } } diff --git a/src/main/java/fr/communaywen/core/listeners/OnPlayers.java b/src/main/java/fr/communaywen/core/listeners/OnPlayers.java index 585cad19..575a2687 100644 --- a/src/main/java/fr/communaywen/core/listeners/OnPlayers.java +++ b/src/main/java/fr/communaywen/core/listeners/OnPlayers.java @@ -2,7 +2,8 @@ import fr.communaywen.core.AywenCraftPlugin; import fr.communaywen.core.contest.cache.ContestCache; -import fr.communaywen.core.contest.managers.ContestManager; +import fr.communaywen.core.luckyblocks.managers.LBPlayerManager; +import fr.communaywen.core.luckyblocks.utils.LBReminder; import fr.communaywen.core.managers.LeaderboardManager; import fr.communaywen.core.managers.RegionsManager; import fr.communaywen.core.utils.DraftAPI; @@ -14,7 +15,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Statistic; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -56,17 +56,6 @@ public void onPlayerJoin(PlayerJoinEvent event) { // Donne une permissions en fo event.setJoinMessage("§8[§a+§8] §r" + (userlp.getCachedData().getMetaData(queryOptions).getPrefix() != null ? userlp.getCachedData().getMetaData(queryOptions).getPrefix().replace("&", "§") : "") + "" + player.getName()); - String regionId = AywenCraftPlugin.getInstance().getConfig().getString("spawn.region"); - if (RegionsManager.isSpecifiedPlayerInRegion(player, regionId)) { - double x = AywenCraftPlugin.getInstance().getConfig().getDouble("spawn.x"); - double y = AywenCraftPlugin.getInstance().getConfig().getInt("spawn.y"); - double z = AywenCraftPlugin.getInstance().getConfig().getInt("spawn.z"); - String WORLD = AywenCraftPlugin.getInstance().getConfig().getString("spawn.world"); - - Location spawn = new Location(player.getServer().getWorld(WORLD), x, y, z, 0, 0); - player.teleport(spawn); - } - Bukkit.getScheduler().runTaskAsynchronously(AywenCraftPlugin.getInstance(), () -> { long timePlayed = player.getStatistic(Statistic.PLAY_ONE_MINUTE); LeaderboardManager.setTimePlayed(player, timePlayed); @@ -90,6 +79,11 @@ public void onPlayerJoin(PlayerJoinEvent event) { // Donne une permissions en fo player.sendMessage("Profitez de récompenses en liant votre compte Discord à Minecraft"); } + LBPlayerManager playerManager = AywenCraftPlugin.getInstance().getManagers().getLbPlayerManager(); + LBReminder reminder = new LBReminder(player, playerManager, AywenCraftPlugin.getInstance()); + + reminder.startReminder(); + if(ContestCache.getPhaseCache() == 2) { player.sendMessage( "§8§m §r\n" + @@ -150,14 +144,20 @@ public void onPlayerJoin(PlayerJoinEvent event) { // Donne une permissions en fo public void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); + User userlp = AywenCraftPlugin.getInstance().api.getUserManager().getUser(player.getUniqueId()); + QueryOptions queryOptions = AywenCraftPlugin.getInstance().api.getContextManager().getQueryOptions(userlp).orElse(QueryOptions.defaultContextualOptions()); + + event.setQuitMessage("§8[§c-§8] §r" + (userlp.getCachedData().getMetaData(queryOptions).getPrefix() != null ? userlp.getCachedData().getMetaData(queryOptions).getPrefix().replace("&", "§") : "") + "" + player.getName()); + + Bukkit.getScheduler().runTaskAsynchronously(AywenCraftPlugin.getInstance(), () -> { long timePlayed = player.getStatistic(Statistic.PLAY_ONE_MINUTE); LeaderboardManager.setTimePlayed(player, timePlayed); - User userlp = AywenCraftPlugin.getInstance().api.getUserManager().getUser(player.getUniqueId()); - QueryOptions queryOptions = AywenCraftPlugin.getInstance().api.getContextManager().getQueryOptions(userlp).orElse(QueryOptions.defaultContextualOptions()); + LBReminder reminder = new LBReminder(player, AywenCraftPlugin.getInstance().getManagers().getLbPlayerManager(), AywenCraftPlugin.getInstance()); + + reminder.stopReminder(); - event.setQuitMessage("§8[§c-§8] §r" + (userlp.getCachedData().getMetaData(queryOptions).getPrefix() != null ? userlp.getCachedData().getMetaData(queryOptions).getPrefix().replace("&", "§") : "") + "" + player.getName()); }); } diff --git a/src/main/java/fr/communaywen/core/listeners/ParticleListener.java b/src/main/java/fr/communaywen/core/listeners/ParticleListener.java index 227d99a7..ea367d73 100644 --- a/src/main/java/fr/communaywen/core/listeners/ParticleListener.java +++ b/src/main/java/fr/communaywen/core/listeners/ParticleListener.java @@ -57,7 +57,7 @@ public void run() { for (int i = 0; i < 100; i++) { // COULEUR CAMP 1 double x = minLocation.getX() + random.nextDouble() * (maxLocation.getX() - minLocation.getX()); - double y = minLocation.getY() + random.nextDouble() * (85 - minLocation.getY()); + double y = minLocation.getY() + random.nextDouble() * (85 - 60); double z = minLocation.getZ() + random.nextDouble() * (maxLocation.getZ() - minLocation.getZ()); Location particleLocation = new Location(world, x, y, z); @@ -66,7 +66,7 @@ public void run() { // COULEUR CAMP 2 double x2 = minLocation.getX() + random.nextDouble() * (maxLocation.getX() - minLocation.getX()); - double y2 = minLocation.getY() + random.nextDouble() * (85 - minLocation.getY()); + double y2 = minLocation.getY() + random.nextDouble() * (85 - 60); double z2 = minLocation.getZ() + random.nextDouble() * (maxLocation.getZ() - minLocation.getZ()); Location particleLocation2 = new Location(world, x2, y2, z2); @@ -75,9 +75,9 @@ public void run() { } } else { // PARTICULE DU SPAWN PAR DEFAUT - for (int i = 0; i < 80; i++) { + for (int i = 0; i < 120; i++) { double x = minLocation.getX() + random.nextDouble() * (maxLocation.getX() - minLocation.getX()); - double y = minLocation.getY() + random.nextDouble() * (130 - minLocation.getY()); + double y = minLocation.getY() + random.nextDouble() * (130 - 60); double z = minLocation.getZ() + random.nextDouble() * (maxLocation.getZ() - minLocation.getZ()); Location particleLocation = new Location(world, x, y, z); diff --git a/src/main/java/fr/communaywen/core/luckyblocks/utils/LBReminder.java b/src/main/java/fr/communaywen/core/luckyblocks/utils/LBReminder.java new file mode 100644 index 00000000..e770c121 --- /dev/null +++ b/src/main/java/fr/communaywen/core/luckyblocks/utils/LBReminder.java @@ -0,0 +1,54 @@ +package fr.communaywen.core.luckyblocks.utils; + +import fr.communaywen.core.AywenCraftPlugin; +import fr.communaywen.core.luckyblocks.managers.LBPlayerManager; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.event.ClickEvent; +import net.kyori.adventure.text.format.NamedTextColor; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.UUID; + +import static fr.communaywen.core.mailboxes.utils.MailboxUtils.getHoverEvent; +import static fr.communaywen.core.mailboxes.utils.MailboxUtils.getRunCommand; + +public class LBReminder { + + private final Player player; + private final LBPlayerManager playerManager; + private final AywenCraftPlugin plugin; + + public LBReminder(Player player, LBPlayerManager playerManager, AywenCraftPlugin plugin) { + this.player = player; + this.playerManager = playerManager; + this.plugin = plugin; + } + + public void startReminder() { + UUID playerUUID = player.getUniqueId(); + + Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, () -> { + if (!player.isOnline()) { + return; + } + + if (playerManager.canClaimLuckyBlocks(playerUUID)) { + MessageManager.sendMessageType(player, "Vous pouvez réclamer vos Lucky Block Quotidien!", Prefix.LUCKYBLOCK, MessageType.INFO, true); + Component message = Component.text("", NamedTextColor.GRAY) + .append(Component.text("Cliquez-ici", NamedTextColor.GRAY)) + .clickEvent(ClickEvent.runCommand("/lb claim")) + .hoverEvent(getHoverEvent("Récuperer le Claim")) + .append(Component.text(" pour obtenir vos récompenses", NamedTextColor.LIGHT_PURPLE)); + player.sendMessage(message); + } + }, 0L, 5 * 60 * 20L); + } + + public void stopReminder() { + Bukkit.getScheduler().cancelTasks(plugin); + } +} diff --git a/src/main/java/fr/communaywen/core/managers/LeaderboardManager.java b/src/main/java/fr/communaywen/core/managers/LeaderboardManager.java index 6062b4c8..b942cdfa 100644 --- a/src/main/java/fr/communaywen/core/managers/LeaderboardManager.java +++ b/src/main/java/fr/communaywen/core/managers/LeaderboardManager.java @@ -130,10 +130,10 @@ public static void createLeaderboardTeamTop() { public static void updateLeaderboardTeamTop() { if (textDisplayTeamTop == null) return; + List teamBalances = TeamManager.getTeams(); - teamBalances.sort((a, b) -> a.getBalance().intValue() - b.getBalance().intValue()); - teamBalances = teamBalances.reversed(); + teamBalances.sort((a, b) -> Double.compare(b.getBalance(), a.getBalance())); if (teamBalances.size() > 10) { teamBalances = teamBalances.subList(0, 10); @@ -145,8 +145,7 @@ public static void updateLeaderboardTeamTop() { int index = 1; for (Team team : teamBalances) { String teamName = team.getName(); - lines.add(MessageFormat.format("{0}# {1}: {2}", getColor(index) + index, ChatColor.GRAY + teamName, ChatColor.DARK_PURPLE + EconomieTeam.getTeamBalances(team.getName()).toString())); - + lines.add(MessageFormat.format("{0}# {1}: {2}", getColor(index) + index, ChatColor.GRAY + teamName, ChatColor.DARK_PURPLE + String.format("%.1f", EconomieTeam.getTeamBalances(team.getName()).doubleValue()))); index++; } diff --git a/src/main/java/fr/communaywen/core/scoreboard/ScoreboardManager.java b/src/main/java/fr/communaywen/core/scoreboard/ScoreboardManager.java index 95f24b59..d1ebfe1f 100644 --- a/src/main/java/fr/communaywen/core/scoreboard/ScoreboardManager.java +++ b/src/main/java/fr/communaywen/core/scoreboard/ScoreboardManager.java @@ -104,7 +104,7 @@ private void updateScoreboard(Player player, Scoreboard scoreboard, Objective ob objective.getScore(" ").setScore(9); objective.getScore("§8• §fTeam§7: " + (teambool ? "§a" + teamName.getName() : "§7Aucune team.")).setScore(8); - if (RegionsManager.isPlayerInRegion("spawn", Bukkit.getWorld("world"))) { + if (RegionsManager.isSpecifiedPlayerInRegion(player,"spawn")) { int heads = HeadManager.getHeadFoundIntCache(player); int maxHeads = HeadManager.getMaxHeads(); diff --git a/src/main/java/fr/communaywen/core/spawn/head/HeadListener.java b/src/main/java/fr/communaywen/core/spawn/head/HeadListener.java index 9392d596..86e60611 100644 --- a/src/main/java/fr/communaywen/core/spawn/head/HeadListener.java +++ b/src/main/java/fr/communaywen/core/spawn/head/HeadListener.java @@ -11,6 +11,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; @@ -33,6 +34,7 @@ public HeadListener(AywenCraftPlugin plugins) { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); if (event.getHand() != EquipmentSlot.HAND) { return; } @@ -50,26 +52,28 @@ public void onPlayerInteract(PlayerInteractEvent event) { double posZ = (double) headData.get("posZ"); Location headLocation = new Location(clickedBlockLocation.getWorld(), posX, posY, posZ); + if (headLocation.equals(clickedBlockLocation)) { - if (!HeadManager.hasFoundHead(event.getPlayer(), String.valueOf(headId))) { - HeadManager.saveFoundHead(event.getPlayer(), String.valueOf(headId)); - HeadManager.initPlayerDataCache(event.getPlayer()); - MessageManager.sendMessageType(event.getPlayer(), "§7Vous avez trouvé une tête! (§d" + HeadManager.getNumberHeads(event.getPlayer()) + "§8/§d" + HeadManager.getMaxHeads() + "§7)", Prefix.HEAD, MessageType.SUCCESS, true); - MessageManager.sendMessageType(event.getPlayer(), "§aVous avez collécté §62 LuckyBlock", Prefix.HEAD, MessageType.SUCCESS, true); + if (!HeadManager.hasFoundHead(player, String.valueOf(headId))) { + HeadManager.saveFoundHead(player, String.valueOf(headId)); + HeadManager.initPlayerDataCache(player); + + MessageManager.sendMessageType(player, "§7Vous avez trouvé une tête! (§d" + HeadManager.getNumberHeads(player) + "§8/§d" + HeadManager.getMaxHeads() + "§7)", Prefix.HEAD, MessageType.SUCCESS, true); + + MessageManager.sendMessageType(player, "§aVous avez collecté §62 LuckyBlock", Prefix.HEAD, MessageType.SUCCESS, true); ItemStack luckyblock = LBUtils.getLuckyBlockItem(); luckyblock.setAmount(2); - event.getPlayer().getInventory().addItem(luckyblock); + player.getInventory().addItem(luckyblock); - GuidelineManager.getAPI().getAdvancement("openmc:spawn/head/1").grant(event.getPlayer()); - if (HeadManager.getNumberHeads(event.getPlayer()) == HeadManager.getMaxHeads()) { - GuidelineManager.getAPI().getAdvancement("openmc:spawn/head/all").grant(event.getPlayer()); + GuidelineManager.getAPI().getAdvancement("openmc:spawn/head/1").grant(player); + + if (HeadManager.getNumberHeads(player) == HeadManager.getMaxHeads()) { + GuidelineManager.getAPI().getAdvancement("openmc:spawn/head/all").grant(player); } } else { - MessageManager.sendMessageType(event.getPlayer(), "§cVous avez déjà collecté cette tête", Prefix.HEAD, MessageType.ERROR, true); + MessageManager.sendMessageType(player, "§cVous avez déjà collecté cette tête", Prefix.HEAD, MessageType.ERROR, true); } - - break; } } } diff --git a/src/main/java/fr/communaywen/core/spawn/head/HeadManager.java b/src/main/java/fr/communaywen/core/spawn/head/HeadManager.java index 991e6498..43719c7a 100644 --- a/src/main/java/fr/communaywen/core/spawn/head/HeadManager.java +++ b/src/main/java/fr/communaywen/core/spawn/head/HeadManager.java @@ -25,39 +25,41 @@ public HeadManager(AywenCraftPlugin plugins) { } public static void saveFoundHead(Player player, String headId) { - try { - PreparedStatement selectStatement = connection.prepareStatement("SELECT heads FROM spawn_head WHERE uuid = ?"); - selectStatement.setString(1, player.getUniqueId().toString()); - ResultSet rs = selectStatement.executeQuery(); + Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { + try { + PreparedStatement selectStatement = connection.prepareStatement("SELECT heads FROM spawn_head WHERE uuid = ?"); + selectStatement.setString(1, player.getUniqueId().toString()); + ResultSet rs = selectStatement.executeQuery(); - JSONArray headsArray = new JSONArray(); + JSONArray headsArray = new JSONArray(); - if (rs.next()) { - String heads = rs.getString("heads"); - if (heads != null && !heads.isEmpty()) { - headsArray = new JSONArray(heads); + if (rs.next()) { + String heads = rs.getString("heads"); + if (heads != null && !heads.isEmpty()) { + headsArray = new JSONArray(heads); + } + } else { + PreparedStatement insertStatement = connection.prepareStatement("INSERT INTO spawn_head (uuid, heads) VALUES (?, ?)"); + insertStatement.setString(1, player.getUniqueId().toString()); + insertStatement.setString(2, "[]"); + insertStatement.executeUpdate(); } - } else { - PreparedStatement insertStatement = connection.prepareStatement("INSERT INTO spawn_head (uuid, heads) VALUES (?, ?)"); - insertStatement.setString(1, player.getUniqueId().toString()); - insertStatement.setString(2, "[]"); - insertStatement.executeUpdate(); - } - if (!headsArray.toList().contains(headId)) { - headsArray.put(headId); + if (!headsArray.toList().contains(headId)) { + headsArray.put(headId); - String sql = "UPDATE spawn_head SET heads = ? WHERE uuid = ?"; - try (PreparedStatement updateStatement = connection.prepareStatement(sql)) { - updateStatement.setString(1, headsArray.toString()); - updateStatement.setString(2, player.getUniqueId().toString()); - updateStatement.executeUpdate(); + String sql = "UPDATE spawn_head SET heads = ? WHERE uuid = ?"; + try (PreparedStatement updateStatement = connection.prepareStatement(sql)) { + updateStatement.setString(1, headsArray.toString()); + updateStatement.setString(2, player.getUniqueId().toString()); + updateStatement.executeUpdate(); + } } - } - } catch (SQLException e) { - e.printStackTrace(); - } + } catch (SQLException e) { + e.printStackTrace(); + } + }); } private static final Map playerCache = new HashMap<>(); diff --git a/src/main/java/fr/communaywen/core/spawn/jump/JumpListener.java b/src/main/java/fr/communaywen/core/spawn/jump/JumpListener.java index c1120696..e8552859 100644 --- a/src/main/java/fr/communaywen/core/spawn/jump/JumpListener.java +++ b/src/main/java/fr/communaywen/core/spawn/jump/JumpListener.java @@ -23,6 +23,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import java.util.HashMap; @@ -74,6 +75,23 @@ public void run() { jumpManager.endJump(player); MessageManager.sendMessageType(player, "§7Le Jump s'est §carreté §7car vous avez quitter le Spawn", Prefix.JUMP, MessageType.ERROR, true); } + if (player.isFlying()) { + jumpManager.endJump(player); + MessageManager.sendMessageType(player, "§7Le Jump s'est §carreté §7car vous avez voler durant le Jump", Prefix.JUMP, MessageType.ERROR, true); + } + if (player.isGliding()) { + jumpManager.endJump(player); + MessageManager.sendMessageType(player, "§7Le Jump s'est §carreté §7car vous avez voler avec des élytras durant le Jump", Prefix.JUMP, MessageType.ERROR, true); + } + if (player.isRiptiding()) { + jumpManager.endJump(player); + MessageManager.sendMessageType(player, "§7Le Jump s'est §carreté §7car vous avez voler avec un trident durant le Jump", Prefix.JUMP, MessageType.ERROR, true); + } + + if (player.hasPotionEffect(PotionEffectType.LEVITATION)) { + jumpManager.endJump(player); + MessageManager.sendMessageType(player, "§7Le Jump s'est §carreté §7car vous avez un Effet de Lévitation durant le Jump\n§7TIPS : Buvez du lait de Courgette", Prefix.JUMP, MessageType.ERROR, true); + } } } }; diff --git a/src/main/java/fr/communaywen/core/tpa/TPACommand.java b/src/main/java/fr/communaywen/core/tpa/TPACommand.java index d339a7b4..5dd3b96d 100644 --- a/src/main/java/fr/communaywen/core/tpa/TPACommand.java +++ b/src/main/java/fr/communaywen/core/tpa/TPACommand.java @@ -3,6 +3,10 @@ import fr.communaywen.core.AywenCraftPlugin; import fr.communaywen.core.credit.Credit; import fr.communaywen.core.credit.Feature; +import fr.communaywen.core.spawn.jump.JumpManager; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; @@ -28,22 +32,20 @@ public TPACommand(AywenCraftPlugin plugin) { @Command("tpa") @CommandPermission("ayw.command.tpa") - public void onCommand(Player player, @Named("joueur") String targetName) { + public void onCommand(Player player, Player target) { + String targetName = target.getName(); if (targetName == null || targetName.trim().isEmpty()) { - player.sendMessage(Component.text("[TPA] ❌ Vous devez spécifier un joueur.") - .color(TextColor.color(255, 0, 0))); + MessageManager.sendMessageType(player, "§cVous devez spécifier un joueur.", Prefix.TPA, MessageType.ERROR, true); return; } - Player target = Bukkit.getPlayer(targetName); if (target == null) { - player.sendMessage(Component.text("[TPA] ❌ Le joueur '" + targetName + "' n'est pas en ligne.") - .color(TextColor.color(255, 0, 0))); + MessageManager.sendMessageType(player, "§cLe joueur '" + targetName + "' n'est pas en ligne.", Prefix.TPA, MessageType.ERROR, true); return; } if (target.getWorld().getName().equals("dreamworld")) { - player.sendMessage("Vous ne pouvez pas téléporter quelq'un dans la dimension"); + MessageManager.sendMessageType(player, "§cVous ne pouvez pas téléporter quelqu'un dans la dimension", Prefix.TPA, MessageType.ERROR, true); return; } @@ -52,30 +54,33 @@ public void onCommand(Player player, @Named("joueur") String targetName) { public static void sendTPARequest(Player player, Player target, AywenCraftPlugin plugin) { if (player.equals(target)) { - player.sendMessage(Component.text("[TPA] ❌ Vous ne pouvez pas vous téléporter à vous-même.") - .color(TextColor.color(255, 0, 0))); + MessageManager.sendMessageType(player, "§cVous ne pouvez pas vous téléporter à vous-même.", Prefix.TPA, MessageType.ERROR, true); return; } if (TPAQueue.INSTANCE.hasPendingRequest(player)) { - player.sendMessage(Component.text("[TPA] ❌ Vous avez déjà une demande de téléportation en attente...") - .color(TextColor.color(255, 0, 0))); + MessageManager.sendMessageType(player, "§cVous avez déjà une demande de téléportation en attente...", Prefix.TPA, MessageType.ERROR, true); + return; + } + + if(JumpManager.isJumping(target)) { + MessageManager.sendMessageType(player, "§cLe destinataire est en Jump, impossible de vous tp", Prefix.TPA, MessageType.ERROR, true); + return; + } + + if(JumpManager.isJumping(player)) { + MessageManager.sendMessageType(player, "§cVous êtes en Jump, impossible de vous tp", Prefix.TPA, MessageType.ERROR, true); return; } TPAQueue.INSTANCE.addRequest(player, target); - player.sendMessage(Component.text("[TPA] ✅ Demande de téléportation envoyée à ") - .color(TextColor.color(0, 255, 0)) - .append(Component.text(target.getName()) - .color(TextColor.color(0, 255, 255))) - .append(Component.text(" ✅")) - .color(TextColor.color(0, 255, 0))); - - final Component message = Component.text(player.getName() + " vous a envoyé une demande de téléportation. Tapez /tpaccept pour accepter.") - .color(TextColor.color(0, 255, 255)) + MessageManager.sendMessageType(player, "§aDemande de téléportation envoyée à §e" + target.getName(), Prefix.TPA, MessageType.SUCCESS, true); + + final Component message = Component.text("§eTapez /tpaccept pour accepter.") .clickEvent(ClickEvent.runCommand("/tpaccept")) - .hoverEvent(HoverEvent.showText(Component.text("[TPA] §7[§aCliquez pour accepter§7]"))); + .hoverEvent(HoverEvent.showText(Component.text("§7[§aCliquez pour accepter§7]"))); + MessageManager.sendMessageType(target, "§a" + player.getName() + " vous a envoyé une demande de téléportation.", Prefix.TPA, MessageType.SUCCESS, true); plugin.getAdventure().player(target).sendMessage(message); new BukkitRunnable() { diff --git a/src/main/java/fr/communaywen/core/tpa/TPAQueue.java b/src/main/java/fr/communaywen/core/tpa/TPAQueue.java index 0c4ee8f2..e979e312 100644 --- a/src/main/java/fr/communaywen/core/tpa/TPAQueue.java +++ b/src/main/java/fr/communaywen/core/tpa/TPAQueue.java @@ -1,5 +1,8 @@ package fr.communaywen.core.tpa; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; import org.bukkit.entity.Player; import java.util.concurrent.ConcurrentHashMap; @@ -27,7 +30,8 @@ public void expireRequest(Player player, Player target) { if (tpaRequests.containsKey(target.getUniqueId())) { long requestTime = tpaRequestTimes.get(player.getUniqueId()); if (System.currentTimeMillis() - requestTime >= 120000) { // 2 minutes - player.sendMessage("§cVotre demande de téléportation à §f" + target.getName() + " §ca expiré."); + MessageManager.sendMessageType(player, "§cVotre demande de téléportation à §f" + target.getName() + " §ca expiré.", Prefix.TPA, MessageType.WARNING, true); + tpaRequests.remove(target.getUniqueId()); tpaRequestTimes.remove(player.getUniqueId()); } diff --git a/src/main/java/fr/communaywen/core/tpa/TpacceptCommand.java b/src/main/java/fr/communaywen/core/tpa/TpacceptCommand.java index 131f1a67..729936a1 100644 --- a/src/main/java/fr/communaywen/core/tpa/TpacceptCommand.java +++ b/src/main/java/fr/communaywen/core/tpa/TpacceptCommand.java @@ -1,6 +1,12 @@ package fr.communaywen.core.tpa; import fr.communaywen.core.AywenCraftPlugin; +import fr.communaywen.core.spawn.jump.JumpManager; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.TextColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import revxrsal.commands.annotation.Command; @@ -19,19 +25,24 @@ public TpacceptCommand(AywenCraftPlugin plugin) { public void onCommand(Player player) { Player requester = tpQueue.getRequester(player); if (requester == null) { - player.sendMessage("§cVous n'avez pas de demande de téléportation."); + MessageManager.sendMessageType(player, "§cVous n'avez pas de demande de téléportation.", Prefix.TPA, MessageType.ERROR, true); return; } if (player.getWorld().getName().equals("dreamworld")) { - player.sendMessage("§cVous ne pouvez pas vous téléportez dans un rêve"); + MessageManager.sendMessageType(player, "§cVous ne pouvez pas vous téléportez dans un rêve", Prefix.TPA, MessageType.ERROR, true); + return; + } + + if(JumpManager.isJumping(requester)) { + MessageManager.sendMessageType(player, "§cLa personne concerné est en Jump, impossible de le tp", Prefix.TPA, MessageType.ERROR, true); return; } tpQueue.removeRequest(player); - player.sendMessage("§a" + requester.getName() + " sera téléporté à vous dans 5 secondes. Ne bougez pas !"); - requester.sendMessage("§aVous serez téléporté à " + player.getName() + " dans 5 secondes. Ne bougez pas !"); + MessageManager.sendMessageType(player, "§a" + requester.getName() + " sera téléporté à vous dans 5 secondes. Ne bougez pas !", Prefix.TPA, MessageType.INFO, true); + MessageManager.sendMessageType(requester, "§aVous serez téléporté à " + player.getName() + " dans 5 secondes. Ne bougez pas !", Prefix.TPA, MessageType.INFO, true); new TeleportCountdown(plugin, requester, player).runTaskTimer(plugin, 0, 20); } @@ -58,15 +69,27 @@ private static class TeleportCountdown extends BukkitRunnable { public void run() { if (countdown <= 0) { requester.teleport(target); - requester.sendMessage("§aTéléportation réussie !"); - target.sendMessage("§a" + requester.getName() + " a été téléporté à vous."); + MessageManager.sendMessageType(requester, "§aTéléportation réussie !", Prefix.TPA, MessageType.SUCCESS, true); + MessageManager.sendMessageType(target, "§a" + requester.getName() + " a été téléporté à vous.", Prefix.TPA, MessageType.SUCCESS, true); cancel(); return; } if (requesterHasMoved()) { - requester.sendMessage("§cTéléportation annulée car vous avez bougé."); - target.sendMessage("§cTéléportation de " + requester.getName() + " annulée car il a bougé."); + MessageManager.sendMessageType(requester, "§cTéléportation annulée car vous avez bougé.", Prefix.TPA, MessageType.ERROR, true); + MessageManager.sendMessageType(target, "§cTéléportation de " + requester.getName() + " annulée car il a bougé.", Prefix.TPA, MessageType.ERROR, true); + cancel(); + return; + } + + if(JumpManager.isJumping(requester)) { + MessageManager.sendMessageType(requester, "§cLe destinataire est en Jump, impossible de vous tp", Prefix.TPA, MessageType.ERROR, true); + cancel(); + return; + } + + if(JumpManager.isJumping(target)) { + MessageManager.sendMessageType(target, "§cVous êtes en Jump, impossible de vous tp", Prefix.TPA, MessageType.ERROR, true); cancel(); return; } diff --git a/src/main/java/fr/communaywen/core/tpa/TpcancelCommand.java b/src/main/java/fr/communaywen/core/tpa/TpcancelCommand.java index a5927ab2..e31edba3 100644 --- a/src/main/java/fr/communaywen/core/tpa/TpcancelCommand.java +++ b/src/main/java/fr/communaywen/core/tpa/TpcancelCommand.java @@ -1,5 +1,8 @@ package fr.communaywen.core.tpa; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; import org.bukkit.entity.Player; import revxrsal.commands.annotation.Command; import revxrsal.commands.bukkit.annotation.CommandPermission; @@ -13,13 +16,13 @@ public class TpcancelCommand { public void onCommand(Player player) { Player target = tpQueue.getRequester(player); if (target == null) { - player.sendMessage("§cVous n'avez pas de demande de téléportation."); + MessageManager.sendMessageType(player, "§cVous n'avez pas de demande de téléportation.", Prefix.TPA, MessageType.ERROR, true); return; } tpQueue.removeRequest(player); - player.sendMessage("§cVous avez annulé votre demande de téléportation à §f" + target.getName() + "§c."); - target.sendMessage("§c" + player.getName() + " a annulé sa demande de téléportation."); + MessageManager.sendMessageType(player, "§cVous avez annulé votre demande de téléportation à §f" + target.getName() + "§c.", Prefix.TPA, MessageType.SUCCESS, true); + MessageManager.sendMessageType(target, "§c" + player.getName() + " a annulé sa demande de téléportation.", Prefix.TPA, MessageType.INFO, true); } } diff --git a/src/main/java/fr/communaywen/core/tpa/TpdenyCommand.java b/src/main/java/fr/communaywen/core/tpa/TpdenyCommand.java index 90bfd0ef..dcf20d92 100644 --- a/src/main/java/fr/communaywen/core/tpa/TpdenyCommand.java +++ b/src/main/java/fr/communaywen/core/tpa/TpdenyCommand.java @@ -1,5 +1,8 @@ package fr.communaywen.core.tpa; +import fr.communaywen.core.utils.constant.MessageManager; +import fr.communaywen.core.utils.constant.MessageType; +import fr.communaywen.core.utils.constant.Prefix; import org.bukkit.entity.Player; import revxrsal.commands.annotation.Command; import revxrsal.commands.bukkit.annotation.CommandPermission; @@ -13,13 +16,13 @@ public class TpdenyCommand { public void onCommand(Player player) { Player requester = tpQueue.getRequester(player); if (requester == null) { - player.sendMessage("§cVous n'avez pas de demande de téléportation."); + MessageManager.sendMessageType(player, "§cVous n'avez pas de demande de téléportation.", Prefix.TPA, MessageType.ERROR, true); return; } tpQueue.removeRequest(player); - requester.sendMessage("§c" + player.getName() + " a refusé votre demande de téléportation."); - player.sendMessage("§cVous avez refusé la demande de téléportation de §f" + requester.getName() + "§c."); + MessageManager.sendMessageType(requester, "§c" + player.getName() + " a refusé votre demande de téléportation.", Prefix.TPA, MessageType.INFO, true); + MessageManager.sendMessageType(player, "§cVous avez refusé la demande de téléportation de §f" + requester.getName() + "§c.", Prefix.TPA, MessageType.SUCCESS, true); } } diff --git a/src/main/java/fr/communaywen/core/utils/constant/Prefix.java b/src/main/java/fr/communaywen/core/utils/constant/Prefix.java index b9ad9493..9ec3b75b 100644 --- a/src/main/java/fr/communaywen/core/utils/constant/Prefix.java +++ b/src/main/java/fr/communaywen/core/utils/constant/Prefix.java @@ -20,12 +20,14 @@ public enum Prefix { FREEZE("§x§1§9§5§0§E§E§l@§x§1§9§5§0§E§E§lꜰ§x§1§9§5§0§E§E§lʀ§x§1§9§5§0§E§E§lᴇ§x§1§9§5§0§E§E§lᴇ§x§1§9§5§0§E§E§lᴢ§x§1§9§5§0§E§E§lᴇ"), HOME("§x§0§8§F§B§5§D§l@§x§2§5§F§C§6§7§lʜ§x§4§1§F§D§7§0§lᴏ§x§5§E§F§E§7§A§lᴍ§x§7§A§F§F§8§3§lᴇ"), CLAIM("§x§4§5§9§5§F§F§l@§x§4§1§9§1§F§B§lᴄ§x§3§D§8§D§F§7§lʟ§x§3§9§8§A§F§4§lᴀ§x§3§5§8§6§F§0§lɪ§x§3§1§8§2§E§C§lᴍ"), - CONTEST("§6§lCONTEST!"), + CONTEST("§x§F§F§A§7§0§0C§x§F§F§A§7§0§0o§x§F§F§A§7§0§0n§x§F§E§B§4§0§Ct§x§F§C§C§0§1§8e§x§F§B§C§D§2§4s§x§F§B§C§D§2§4t"), SPACE("§x§3§3§0§8§F§B§l@§x§3§6§0§D§F§B§lᴀ§x§3§A§1§1§F§C§lѕ§x§3§D§1§6§F§C§lᴛ§x§4§0§1§B§F§D§lʀ§x§4§4§2§0§F§D§lᴏ§x§4§7§2§4§F§D§lɴ§x§4§A§2§9§F§E§lᴏ§x§4§D§2§E§F§E§lᴍ§x§5§1§3§2§F§F§lɪ§x§5§4§3§7§F§F§lᴇ"), QUESTS("§x§2§4§A§0§F§9§lǫ§x§2§4§9§6§F§9§lᴜ§x§2§4§8§C§F§9§lᴇ§x§2§4§8§3§F§9§lѕ§x§2§4§7§9§F§9§lᴛ§x§2§4§6§F§F§9§lѕ"), - HEAD("§dHeads"), - JUMP("§2Jump"), - STAFF("§cStaff"), + MAYOR("§x§E§2§5§A§5§AM§x§E§2§5§A§5§Aa§x§E§1§6§F§6§Fy§x§D§F§8§5§8§5o§x§D§E§9§A§9§Ar"), + HEAD("§x§F§F§9§7§E§AH§x§F§F§9§7§E§Ae§x§F§B§9§1§E§1a§x§F§8§8§C§D§8d§x§F§4§8§6§C§Fs"), + JUMP("§x§0§0§7§D§0§AJ§x§0§0§7§D§0§Au§x§2§C§A§3§0§0m§x§2§C§A§3§0§0p"), + STAFF("§x§8§0§1§4§1§4S§x§F§F§0§0§2§3t§x§F§F§0§0§2§3a§x§F§F§0§0§2§3f§x§F§F§0§0§2§3f"), + TPA("§x§0§8§6§5§0§0T§x§0§5§7§0§0§7P§x§0§2§7§B§0§DA"), // Lucky Block's prefixes LUCKYBLOCK("§x§F§C§4§5§8§2L§x§F§C§5§C§9§2u§x§F§D§7§4§A§1c§x§F§D§8§B§B§1k§x§F§E§A§2§C§1y§x§F§E§B§9§D§0B§x§F§E§D§1§E§0l§x§F§F§E§8§E§Fo§x§F§F§F§F§F§Fc§x§F§F§F§F§F§Fk"), diff --git a/src/main/java/fr/communaywen/core/utils/database/DatabaseManager.java b/src/main/java/fr/communaywen/core/utils/database/DatabaseManager.java index 5b80daab..503ce2b6 100644 --- a/src/main/java/fr/communaywen/core/utils/database/DatabaseManager.java +++ b/src/main/java/fr/communaywen/core/utils/database/DatabaseManager.java @@ -141,7 +141,7 @@ public void init() throws SQLException { this.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS spawn_jump (uuid VARCHAR(36), best_time DOUBLE)").executeUpdate(); //Table pour le playtime - this.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS playtime (uuid VARCHAR(36), time LONG)").executeUpdate(); + this.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS playtime (uuid VARCHAR(36), time INT(11))").executeUpdate(); AywenCraftPlugin.getInstance().getLogger().info("\u001B[36m" + "Les tables ont été créées si besoin" + "\u001B[0m"); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 701d5128..b0790fb7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -77,4 +77,7 @@ permissions: default: false ayw.command.settings: description: "Settings" - default: true \ No newline at end of file + default: true + ayw.command.patchlogs: + description: "Patchlogs" + default: true