Merge branch 'development'

This commit is contained in:
Brianna 2020-04-27 20:03:53 -04:00
commit b7082f9a7f
5 changed files with 31 additions and 9 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "SongodaCore"
path: "/builds/$CI_PROJECT_PATH"
version: "2.3.28"
version: "2.3.29"
build:
stage: build

View File

@ -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),

View File

@ -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);

View File

@ -34,7 +34,6 @@ public class EntityUtils {
} catch (NoSuchFieldException ee) {
ee.printStackTrace();
}
e.printStackTrace();
}
}

View File

@ -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<PermissionAttachmentInfo> 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;
}
}