From 3c610d2e4834f0bee8af1babfc99fa7429aef3c8 Mon Sep 17 00:00:00 2001 From: Bierque Jason Date: Wed, 31 Jan 2024 13:32:28 +0100 Subject: [PATCH] [ci-skip] clean + reformat code --- .../api/event/SkyblockChangeGameRuleEvent.java | 2 +- .../fr/euphyllia/skyllia/api/skyblock/Island.java | 1 - .../model/permissions/PermissionsCommandIsland.java | 3 +-- .../cache/PermissionGameRuleInIslandCache.java | 6 +----- .../common/subcommands/GameRuleSubCommand.java | 8 ++++---- .../euphyllia/skyllia/configuration/LanguageToml.java | 11 +++++------ .../database/query/exec/IslandPermissionQuery.java | 1 - .../bukkitevents/PortailAlternativeFoliaEvent.java | 2 -- .../bukkitevents/gamerule/entity/ExplosionEvent.java | 4 ---- .../bukkitevents/gamerule/entity/GriefingEvent.java | 2 -- .../bukkitevents/gamerule/entity/MobSpawnEvent.java | 1 - .../bukkitevents/gamerule/entity/PickupEvent.java | 2 +- .../listeners/bukkitevents/player/PlayerEvent.java | 5 ++++- .../listeners/bukkitevents/player/TeleportEvent.java | 9 +-------- .../skyllia/managers/skyblock/IslandHook.java | 4 ++-- .../skyllia/managers/skyblock/SkyblockManager.java | 1 - 16 files changed, 20 insertions(+), 42 deletions(-) diff --git a/api/src/main/java/fr/euphyllia/skyllia/api/event/SkyblockChangeGameRuleEvent.java b/api/src/main/java/fr/euphyllia/skyllia/api/event/SkyblockChangeGameRuleEvent.java index c0abc1b9..cdb7578f 100644 --- a/api/src/main/java/fr/euphyllia/skyllia/api/event/SkyblockChangeGameRuleEvent.java +++ b/api/src/main/java/fr/euphyllia/skyllia/api/event/SkyblockChangeGameRuleEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; -public class SkyblockChangeGameRuleEvent extends Event { +public class SkyblockChangeGameRuleEvent extends Event { private static final HandlerList handlerList = new HandlerList(); diff --git a/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/Island.java b/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/Island.java index 798dd1cd..6028680e 100644 --- a/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/Island.java +++ b/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/Island.java @@ -4,7 +4,6 @@ import fr.euphyllia.skyllia.api.skyblock.model.Position; import fr.euphyllia.skyllia.api.skyblock.model.RoleType; import fr.euphyllia.skyllia.api.skyblock.model.WarpIsland; -import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import org.bukkit.Location; import org.jetbrains.annotations.Nullable; diff --git a/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/model/permissions/PermissionsCommandIsland.java b/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/model/permissions/PermissionsCommandIsland.java index 30546629..702bc8be 100644 --- a/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/model/permissions/PermissionsCommandIsland.java +++ b/api/src/main/java/fr/euphyllia/skyllia/api/skyblock/model/permissions/PermissionsCommandIsland.java @@ -21,8 +21,7 @@ public enum PermissionsCommandIsland implements Permissions { BAN(4_096), UNBAN(8_192), MANAGE_TRUST(16_384), - MANAGE_GAMERULE(32_768) - ; + MANAGE_GAMERULE(32_768); private final long permissionValue; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/cache/PermissionGameRuleInIslandCache.java b/plugin/src/main/java/fr/euphyllia/skyllia/cache/PermissionGameRuleInIslandCache.java index be002062..62e9f704 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/cache/PermissionGameRuleInIslandCache.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/cache/PermissionGameRuleInIslandCache.java @@ -1,16 +1,12 @@ package fr.euphyllia.skyllia.cache; -import fr.euphyllia.skyllia.api.skyblock.model.PermissionRoleIsland; -import fr.euphyllia.skyllia.api.skyblock.model.RoleType; -import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; -import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -public class PermissionGameRuleInIslandCache { +public class PermissionGameRuleInIslandCache { private static final Logger logger = LogManager.getLogger(PermissionGameRuleInIslandCache.class); private static ConcurrentHashMap gameruleByIslandId; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/commands/common/subcommands/GameRuleSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyllia/commands/common/subcommands/GameRuleSubCommand.java index 403a8284..f78241aa 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/commands/common/subcommands/GameRuleSubCommand.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/commands/common/subcommands/GameRuleSubCommand.java @@ -1,13 +1,15 @@ package fr.euphyllia.skyllia.commands.common.subcommands; import fr.euphyllia.skyllia.Main; -import fr.euphyllia.skyllia.api.event.SkyblockChangePermissionEvent; import fr.euphyllia.skyllia.api.skyblock.Island; import fr.euphyllia.skyllia.api.skyblock.Players; import fr.euphyllia.skyllia.api.skyblock.model.PermissionRoleIsland; import fr.euphyllia.skyllia.api.skyblock.model.RoleType; import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; -import fr.euphyllia.skyllia.api.skyblock.model.permissions.*; +import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsCommandIsland; +import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsInventory; +import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsIsland; +import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import fr.euphyllia.skyllia.commands.SubCommandInterface; import fr.euphyllia.skyllia.configuration.LanguageToml; import fr.euphyllia.skyllia.managers.skyblock.PermissionManager; @@ -15,10 +17,8 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java index 4292b13e..f8c80fef 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/configuration/LanguageToml.java @@ -116,6 +116,10 @@ public class LanguageToml { public static String messageASetMaxMembersCommandNotEnoughArgs = "La commande est incomplète : /skyllia setmaxmembres value confirm"; public static String messageASetMaxMembersNotConfirmedArgs = "Vous n'avez pas ajouter le \"confirm\" à la fin"; public static String messageASetMaxMembersNAN = "Le nombre indiqué est incorrect."; + public static String messageGameRuleCommandNotEnoughArgs = "La commande est incomplète : /skyllia gamerule "; + public static String messageGameRuleInvalid = "La gamerule n'existe pas"; + public static String messageGameRuleUpdateSuccess = "La gamerule a été mise à jour "; + public static String messageGameRuleUpdateFailed = "Une erreur s'est produite lors de la mise à jour de la gamerule"; private static boolean verbose; public static void init(File configFile) { @@ -259,15 +263,10 @@ private static void islandHomeLanguage() { messageHomeCreateSuccess = getString("island.home.set.success", messageHomeCreateSuccess); } - public static String messageGameRuleCommandNotEnoughArgs = "La commande est incomplète : /skyllia gamerule "; - public static String messageGameRuleInvalid = "La gamerule n'existe pas"; - public static String messageGameRuleUpdateSuccess = "La gamerule a été mise à jour "; - public static String messageGameRuleUpdateFailed = "Une erreur s'est produite lors de la mise à jour de la gamerule"; - private static void islandGameRuleLanguage() { messageGameRuleCommandNotEnoughArgs = getString("island.gamerule.not-enough-args", messageGameRuleCommandNotEnoughArgs); messageGameRuleInvalid = getString("island.gamerule.gamerule-invalid", messageGameRuleInvalid); - messageGameRuleUpdateSuccess = getString("island.gamerule.success", messageGameRuleUpdateSuccess); + messageGameRuleUpdateSuccess = getString("island.gamerule.success", messageGameRuleUpdateSuccess); messageGameRuleUpdateFailed = getString("island.gamerule.failed", messageGameRuleUpdateFailed); } diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/database/query/exec/IslandPermissionQuery.java b/plugin/src/main/java/fr/euphyllia/skyllia/database/query/exec/IslandPermissionQuery.java index bcca27fc..65ae9992 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/database/query/exec/IslandPermissionQuery.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/database/query/exec/IslandPermissionQuery.java @@ -5,7 +5,6 @@ import fr.euphyllia.skyllia.api.skyblock.Island; import fr.euphyllia.skyllia.api.skyblock.model.PermissionRoleIsland; import fr.euphyllia.skyllia.api.skyblock.model.RoleType; -import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/PortailAlternativeFoliaEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/PortailAlternativeFoliaEvent.java index ca9d7793..0b1f0ead 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/PortailAlternativeFoliaEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/PortailAlternativeFoliaEvent.java @@ -1,13 +1,11 @@ package fr.euphyllia.skyllia.listeners.bukkitevents; import fr.euphyllia.skyllia.api.InterneAPI; -import fr.euphyllia.skyllia.api.configuration.WorldConfig; import fr.euphyllia.skyllia.api.event.PlayerPrepareChangeWorldSkyblockEvent; import fr.euphyllia.skyllia.listeners.ListenersUtils; import fr.euphyllia.skyllia.utils.WorldUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/ExplosionEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/ExplosionEvent.java index db09f48a..1e641fa0 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/ExplosionEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/ExplosionEvent.java @@ -3,19 +3,15 @@ import fr.euphyllia.skyllia.api.InterneAPI; import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.listeners.ListenersUtils; -import fr.euphyllia.skyllia.listeners.bukkitevents.gamerule.BlockGameRuleEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.Location; import org.bukkit.entity.EntityType; -import org.bukkit.entity.Mob; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityPickupItemEvent; -import java.util.Locale; import java.util.concurrent.CopyOnWriteArrayList; public class ExplosionEvent implements Listener { diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/GriefingEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/GriefingEvent.java index 03ac2c03..6787ffba 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/GriefingEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/GriefingEvent.java @@ -12,8 +12,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityChangeBlockEvent; -import java.util.Locale; - public class GriefingEvent implements Listener { private final InterneAPI api; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/MobSpawnEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/MobSpawnEvent.java index 3b6bea32..42b1ea76 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/MobSpawnEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/MobSpawnEvent.java @@ -5,7 +5,6 @@ import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.listeners.ListenersUtils; import fr.euphyllia.skyllia.utils.EntityUtils; -import fr.euphyllia.skyllia.utils.PlayerUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.Location; diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/PickupEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/PickupEvent.java index 0c18404c..e0f2aa71 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/PickupEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/gamerule/entity/PickupEvent.java @@ -23,7 +23,7 @@ public PickupEvent(InterneAPI interneAPI) { @EventHandler(priority = EventPriority.LOW) public void onPickupItem(final EntityPickupItemEvent event) { if (event.isCancelled()) return; - if (event.getEntity() instanceof Mob){ + if (event.getEntity() instanceof Mob) { ListenersUtils.checkGameRuleIsland(event.getEntity().getLocation(), GameRuleIsland.MOB_PICKUP_ITEMS, event); } } diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/PlayerEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/PlayerEvent.java index a6493aef..44291fd3 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/PlayerEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/PlayerEvent.java @@ -10,7 +10,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerDropItemEvent; public class PlayerEvent implements Listener { diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/TeleportEvent.java b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/TeleportEvent.java index ef1a9683..bdb2f5ad 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/TeleportEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/TeleportEvent.java @@ -2,18 +2,11 @@ import fr.euphyllia.skyllia.api.InterneAPI; import fr.euphyllia.skyllia.api.event.PlayerPrepareChangeWorldSkyblockEvent; -import fr.euphyllia.skyllia.api.skyblock.Island; import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsIsland; import fr.euphyllia.skyllia.listeners.ListenersUtils; -import fr.euphyllia.skyllia.managers.skyblock.SkyblockManager; -import fr.euphyllia.skyllia.utils.PlayerUtils; -import fr.euphyllia.skyllia.utils.RegionUtils; -import fr.euphyllia.skyllia.utils.WorldUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -43,7 +36,7 @@ public void onPlayerTeleportOnIsland(final PlayerTeleportEvent event) { PlayerTeleportEvent.TeleportCause teleportCause = event.getCause(); if (teleportCause.equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) { ListenersUtils.callPlayerPrepareChangeWorldSkyblockEvent(event.getPlayer(), - PlayerPrepareChangeWorldSkyblockEvent.PortalType.END, destination.getWorld().getName()); + PlayerPrepareChangeWorldSkyblockEvent.PortalType.END, destination.getWorld().getName()); } else if (teleportCause.equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)) { ListenersUtils.callPlayerPrepareChangeWorldSkyblockEvent(event.getPlayer(), PlayerPrepareChangeWorldSkyblockEvent.PortalType.NETHER, destination.getWorld().getName()); diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/IslandHook.java b/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/IslandHook.java index cd2a2b70..a362cbdc 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/IslandHook.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/IslandHook.java @@ -8,7 +8,6 @@ import fr.euphyllia.skyllia.api.skyblock.model.Position; import fr.euphyllia.skyllia.api.skyblock.model.RoleType; import fr.euphyllia.skyllia.api.skyblock.model.WarpIsland; -import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import fr.euphyllia.skyllia.configuration.ConfigToml; import org.bukkit.Bukkit; @@ -165,7 +164,8 @@ public boolean updateMember(Players member) { return this.plugin.getInterneAPI().getSkyblockManager().updateMember(this, member).join(); } - @Override @Deprecated(forRemoval = true) + @Override + @Deprecated(forRemoval = true) public boolean updatePermissionIsland(PermissionsType permissionsType, RoleType roleType, long permissions) { return this.plugin.getInterneAPI().getSkyblockManager().updatePermissionIsland(this, permissionsType, roleType, permissions).join(); } diff --git a/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/SkyblockManager.java b/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/SkyblockManager.java index 827995be..6dc9573e 100644 --- a/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/SkyblockManager.java +++ b/plugin/src/main/java/fr/euphyllia/skyllia/managers/skyblock/SkyblockManager.java @@ -7,7 +7,6 @@ import fr.euphyllia.skyllia.api.skyblock.model.PermissionRoleIsland; import fr.euphyllia.skyllia.api.skyblock.model.RoleType; import fr.euphyllia.skyllia.api.skyblock.model.WarpIsland; -import fr.euphyllia.skyllia.api.skyblock.model.gamerule.GameRuleIsland; import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsType; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager;