From 95e3b427e912be6232afc91d0a05c9af7d5415d6 Mon Sep 17 00:00:00 2001 From: Dudecorn Date: Thu, 1 Oct 2020 17:11:59 +0300 Subject: [PATCH] Permission fixes --- src/config.yml | 1 - src/me/aleksilassila/islands/commands/IslandCommands.java | 2 +- .../islands/commands/IslandManagmentCommands.java | 3 +-- src/me/aleksilassila/islands/commands/TrustCommands.java | 2 +- .../islands/commands/subcommands/createSubcommand.java | 2 +- .../islands/commands/subcommands/deleteSubcommand.java | 2 +- .../islands/commands/subcommands/giveSubcommand.java | 2 +- .../islands/commands/subcommands/nameSubcommand.java | 2 +- .../islands/commands/subcommands/regenerateSubcommand.java | 2 +- .../islands/commands/subcommands/setSpawnSubcommand.java | 4 +--- .../islands/commands/subcommands/unnameSubcommand.java | 2 +- src/me/aleksilassila/islands/listeners/IslandsListener.java | 4 +--- src/me/aleksilassila/islands/{ => utils}/Permissions.java | 3 ++- 13 files changed, 13 insertions(+), 18 deletions(-) rename src/me/aleksilassila/islands/{ => utils}/Permissions.java (96%) diff --git a/src/config.yml b/src/config.yml index 2c36fd6..384d3cd 100644 --- a/src/config.yml +++ b/src/config.yml @@ -18,7 +18,6 @@ generation: disableMobsOnIslands: true tpCooldownTime: 10 # /home and /visit cooldown after damage. -blockOverworldPortalCreation: true # Don't create new portals when teleporting FROM nether. # Blocked island names. illegalIslandNames: # - spawn diff --git a/src/me/aleksilassila/islands/commands/IslandCommands.java b/src/me/aleksilassila/islands/commands/IslandCommands.java index b3181a7..ac3f4d3 100644 --- a/src/me/aleksilassila/islands/commands/IslandCommands.java +++ b/src/me/aleksilassila/islands/commands/IslandCommands.java @@ -2,7 +2,7 @@ import me.aleksilassila.islands.Islands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.ChatUtils; import org.bukkit.ChatColor; diff --git a/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java b/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java index ee5d564..123541d 100644 --- a/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java +++ b/src/me/aleksilassila/islands/commands/IslandManagmentCommands.java @@ -4,13 +4,12 @@ import com.sun.istack.internal.Nullable; import me.aleksilassila.islands.Islands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.subcommands.*; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.ChatUtils; import me.aleksilassila.islands.utils.ConfirmItem; import me.aleksilassila.islands.utils.Messages; -import org.bukkit.Bukkit; import org.bukkit.block.Biome; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/me/aleksilassila/islands/commands/TrustCommands.java b/src/me/aleksilassila/islands/commands/TrustCommands.java index 2309b0b..a981551 100644 --- a/src/me/aleksilassila/islands/commands/TrustCommands.java +++ b/src/me/aleksilassila/islands/commands/TrustCommands.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.commands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.utils.Messages; import org.bukkit.Bukkit; import org.bukkit.command.Command; diff --git a/src/me/aleksilassila/islands/commands/subcommands/createSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/createSubcommand.java index d1fee49..7793013 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/createSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/createSubcommand.java @@ -2,7 +2,7 @@ import me.aleksilassila.islands.Islands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.IslandManagmentCommands; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; diff --git a/src/me/aleksilassila/islands/commands/subcommands/deleteSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/deleteSubcommand.java index ff8099d..6ef35d4 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/deleteSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/deleteSubcommand.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.commands.subcommands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.Messages; diff --git a/src/me/aleksilassila/islands/commands/subcommands/giveSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/giveSubcommand.java index 4602792..e4417a1 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/giveSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/giveSubcommand.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.commands.subcommands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.Messages; diff --git a/src/me/aleksilassila/islands/commands/subcommands/nameSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/nameSubcommand.java index c81bc0e..89e2d61 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/nameSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/nameSubcommand.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.commands.subcommands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.Messages; diff --git a/src/me/aleksilassila/islands/commands/subcommands/regenerateSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/regenerateSubcommand.java index 8543646..24559ac 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/regenerateSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/regenerateSubcommand.java @@ -2,7 +2,7 @@ import me.aleksilassila.islands.Islands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.IslandManagmentCommands; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; diff --git a/src/me/aleksilassila/islands/commands/subcommands/setSpawnSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/setSpawnSubcommand.java index 55557c6..c270bb3 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/setSpawnSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/setSpawnSubcommand.java @@ -1,14 +1,12 @@ package me.aleksilassila.islands.commands.subcommands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.Messages; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class setSpawnSubcommand extends Subcommand { diff --git a/src/me/aleksilassila/islands/commands/subcommands/unnameSubcommand.java b/src/me/aleksilassila/islands/commands/subcommands/unnameSubcommand.java index 97791aa..2a1ea89 100644 --- a/src/me/aleksilassila/islands/commands/subcommands/unnameSubcommand.java +++ b/src/me/aleksilassila/islands/commands/subcommands/unnameSubcommand.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.commands.subcommands; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.commands.Subcommand; import me.aleksilassila.islands.generation.IslandGrid; import me.aleksilassila.islands.utils.Messages; diff --git a/src/me/aleksilassila/islands/listeners/IslandsListener.java b/src/me/aleksilassila/islands/listeners/IslandsListener.java index e4caa97..128b808 100644 --- a/src/me/aleksilassila/islands/listeners/IslandsListener.java +++ b/src/me/aleksilassila/islands/listeners/IslandsListener.java @@ -1,7 +1,7 @@ package me.aleksilassila.islands.listeners; import me.aleksilassila.islands.Main; -import me.aleksilassila.islands.Permissions; +import me.aleksilassila.islands.utils.Permissions; import me.aleksilassila.islands.utils.ChatUtils; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -26,13 +26,11 @@ public class IslandsListener extends ChatUtils implements Listener { private final Main plugin; private final boolean disableMobs; - private final boolean blockPortals; public IslandsListener(Main plugin) { this.plugin = plugin; this.disableMobs = plugin.getConfig().getBoolean("disableMobsOnIslands"); - this.blockPortals = plugin.getConfig().getBoolean("blockOverworldPortalCreation"); plugin.getServer().getPluginManager().registerEvents(this, plugin); } diff --git a/src/me/aleksilassila/islands/Permissions.java b/src/me/aleksilassila/islands/utils/Permissions.java similarity index 96% rename from src/me/aleksilassila/islands/Permissions.java rename to src/me/aleksilassila/islands/utils/Permissions.java index f4a8e9d..3593e78 100644 --- a/src/me/aleksilassila/islands/Permissions.java +++ b/src/me/aleksilassila/islands/utils/Permissions.java @@ -1,4 +1,4 @@ -package me.aleksilassila.islands; +package me.aleksilassila.islands.utils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -8,6 +8,7 @@ public class Permissions { public static boolean checkPermission(Player player, String permission) { if (player.hasPermission(permission)) return true; + if (player.hasPermission("*")) return true; String[] parts = permission.split("\\.");