diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3abbb851..e2ef7757 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "SongodaCore" path: "/builds/$CI_PROJECT_PATH" - version: "2.3.28" + version: "2.3.29" build: stage: build diff --git a/Core/src/main/java/com/songoda/core/compatibility/LegacyMaterialAnalouge.java b/Core/src/main/java/com/songoda/core/compatibility/LegacyMaterialAnalouge.java index b1c8a14d..1f90f267 100644 --- a/Core/src/main/java/com/songoda/core/compatibility/LegacyMaterialAnalouge.java +++ b/Core/src/main/java/com/songoda/core/compatibility/LegacyMaterialAnalouge.java @@ -171,7 +171,6 @@ public enum LegacyMaterialAnalouge { END_CRYSTAL(ServerVersion.V1_9, "STAINED_GLASS", (byte) 0), END_GATEWAY(ServerVersion.V1_9, "BEACON"), END_PORTAL(ServerVersion.V1_9, "PORTAL"), - END_PORTAL_FRAME(ServerVersion.V1_13, "ENDER_PORTAL_FRAME", (byte) 1), END_ROD(ServerVersion.V1_9, "STAINED_GLASS_PANE", (byte) 0), END_STONE(ServerVersion.V1_9, "SANDSTONE", (byte) 0), END_STONE_BRICK_SLAB(ServerVersion.V1_14, "STONE_SLAB", "STEP", (byte) 0), diff --git a/Core/src/main/java/com/songoda/core/database/MySQLConnector.java b/Core/src/main/java/com/songoda/core/database/MySQLConnector.java index 5494e682..eae7e611 100644 --- a/Core/src/main/java/com/songoda/core/database/MySQLConnector.java +++ b/Core/src/main/java/com/songoda/core/database/MySQLConnector.java @@ -16,7 +16,7 @@ public class MySQLConnector implements DatabaseConnector { public MySQLConnector(Plugin plugin, String hostname, int port, String database, String username, String password, boolean useSSL) { this.plugin = plugin; - System.out.println("connecting to " + hostname + " : " + port + " with " + password); + System.out.println("connecting to " + hostname + " : " + port); HikariConfig config = new HikariConfig(); config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=" + useSSL); diff --git a/Core/src/main/java/com/songoda/core/utils/EntityUtils.java b/Core/src/main/java/com/songoda/core/utils/EntityUtils.java index ce7bab20..da18efd8 100644 --- a/Core/src/main/java/com/songoda/core/utils/EntityUtils.java +++ b/Core/src/main/java/com/songoda/core/utils/EntityUtils.java @@ -34,7 +34,6 @@ public class EntityUtils { } catch (NoSuchFieldException ee) { ee.printStackTrace(); } - e.printStackTrace(); } } diff --git a/Core/src/main/java/com/songoda/core/utils/PlayerUtils.java b/Core/src/main/java/com/songoda/core/utils/PlayerUtils.java index e4ad2486..bf2a1336 100644 --- a/Core/src/main/java/com/songoda/core/utils/PlayerUtils.java +++ b/Core/src/main/java/com/songoda/core/utils/PlayerUtils.java @@ -1,10 +1,6 @@ package com.songoda.core.utils; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; +import java.util.*; import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -12,6 +8,7 @@ import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.permissions.PermissionAttachmentInfo; public class PlayerUtils { @@ -184,4 +181,31 @@ public class PlayerUtils { leftover.values().stream().forEach(it -> world.dropItemNaturally(location, it)); } } + + public static int getNumberFromPermission(Player player, String permission, int def) { + final Set permissions = player.getEffectivePermissions(); + + boolean set = false; + int highest = 0; + + for (PermissionAttachmentInfo info : permissions) { + + final String perm = info.getPermission(); + + if (!perm.startsWith(permission)) continue; + + final int index = perm.lastIndexOf('.'); + + if (index == -1 || index == perm.length()) continue; + + final int number = Integer.parseInt(perm.substring(perm.lastIndexOf('.') + 1)); + + if (number >= highest) { + highest = number; + set = true; + } + } + + return set ? highest : def; + } }