Update some dependencies

This commit is contained in:
Luck 2018-01-25 23:31:31 +00:00
parent 54dbede130
commit e28d15456c
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
14 changed files with 43 additions and 76 deletions

View File

@ -56,7 +56,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id> <id>attach-javadocs</id>

View File

@ -113,8 +113,6 @@ public class BukkitConnectionListener extends AbstractLoginListener implements L
this.plugin.getLog().severe("Player connection was re-allowed for " + e.getUniqueId()); this.plugin.getLog().severe("Player connection was re-allowed for " + e.getUniqueId());
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, ""); e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "");
} }
return;
} }
} }

View File

@ -40,23 +40,15 @@ public class DummyPermissibleBase extends PermissibleBase {
private static final Field PERMISSIONS_FIELD; private static final Field PERMISSIONS_FIELD;
static { static {
Field attachmentsField;
try { try {
attachmentsField = PermissibleBase.class.getDeclaredField("attachments"); ATTACHMENTS_FIELD = PermissibleBase.class.getDeclaredField("attachments");
attachmentsField.setAccessible(true); ATTACHMENTS_FIELD.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
ATTACHMENTS_FIELD = attachmentsField;
Field permissionsField; PERMISSIONS_FIELD = PermissibleBase.class.getDeclaredField("permissions");
try { PERMISSIONS_FIELD.setAccessible(true);
permissionsField = PermissibleBase.class.getDeclaredField("permissions");
permissionsField.setAccessible(true);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e);
} }
PERMISSIONS_FIELD = permissionsField;
} }
public static void nullFields(PermissibleBase permissibleBase) { public static void nullFields(PermissibleBase permissibleBase) {

View File

@ -59,14 +59,12 @@ public class LPPermissionAttachment extends PermissionAttachment {
private static final Field PERMISSION_ATTACHMENT_PERMISSIONS_FIELD; private static final Field PERMISSION_ATTACHMENT_PERMISSIONS_FIELD;
static { static {
Field permissionAttachmentPermissionsField;
try { try {
permissionAttachmentPermissionsField = PermissionAttachment.class.getDeclaredField("permissions"); PERMISSION_ATTACHMENT_PERMISSIONS_FIELD = PermissionAttachment.class.getDeclaredField("permissions");
permissionAttachmentPermissionsField.setAccessible(true); PERMISSION_ATTACHMENT_PERMISSIONS_FIELD.setAccessible(true);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e);
} }
PERMISSION_ATTACHMENT_PERMISSIONS_FIELD = permissionAttachmentPermissionsField;
} }
/** /**

View File

@ -56,35 +56,26 @@ public final class PermissibleInjector {
private static final Field PERMISSIBLE_BASE_ATTACHMENTS_FIELD; private static final Field PERMISSIBLE_BASE_ATTACHMENTS_FIELD;
static { static {
Field humanEntityPermissibleField;
Field permissibleBaseAttachmentsField;
try { try {
// Catch all. If this setup doesn't fully complete without
// exceptions, then the Injector will not work.
// Try to load the permissible field. // Try to load the permissible field.
Field humanEntityPermissibleField;
try { try {
// craftbukkit // craftbukkit
humanEntityPermissibleField = ReflectionUtil.obcClass("entity.CraftHumanEntity").getDeclaredField("perm"); humanEntityPermissibleField = ReflectionUtil.obcClass("entity.CraftHumanEntity").getDeclaredField("perm");
humanEntityPermissibleField.setAccessible(true); humanEntityPermissibleField.setAccessible(true);
} catch (Exception e) { } catch (Exception e) {
// glowstone // glowstone
humanEntityPermissibleField = Class.forName("net.glowstone.entity.GlowHumanEntity").getDeclaredField("permissions"); humanEntityPermissibleField = Class.forName("net.glowstone.entity.GlowHumanEntity").getDeclaredField("permissions");
humanEntityPermissibleField.setAccessible(true); humanEntityPermissibleField.setAccessible(true);
} }
HUMAN_ENTITY_PERMISSIBLE_FIELD = humanEntityPermissibleField;
// Try to load the attachments field. // Try to load the attachments field.
permissibleBaseAttachmentsField = PermissibleBase.class.getDeclaredField("attachments"); PERMISSIBLE_BASE_ATTACHMENTS_FIELD = PermissibleBase.class.getDeclaredField("attachments");
permissibleBaseAttachmentsField.setAccessible(true); PERMISSIBLE_BASE_ATTACHMENTS_FIELD.setAccessible(true);
} catch (ClassNotFoundException | NoSuchFieldException e) {
} catch (Throwable t) { throw new ExceptionInInitializerError(e);
throw new RuntimeException("Injector did not init successfully.", t);
} }
HUMAN_ENTITY_PERMISSIBLE_FIELD = humanEntityPermissibleField;
PERMISSIBLE_BASE_ATTACHMENTS_FIELD = permissibleBaseAttachmentsField;
} }
/** /**

View File

@ -39,14 +39,12 @@ public class SubscriptionMapInjector implements Runnable {
private static final Field PERM_SUBS_FIELD; private static final Field PERM_SUBS_FIELD;
static { static {
Field permSubsField;
try { try {
permSubsField = SimplePluginManager.class.getDeclaredField("permSubs"); PERM_SUBS_FIELD = SimplePluginManager.class.getDeclaredField("permSubs");
permSubsField.setAccessible(true); PERM_SUBS_FIELD.setAccessible(true);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e);
} }
PERM_SUBS_FIELD = permSubsField;
} }
private final LPBukkitPlugin plugin; private final LPBukkitPlugin plugin;

View File

@ -89,7 +89,7 @@
<dependency> <dependency>
<groupId>com.github.ben-manes.caffeine</groupId> <groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId> <artifactId>caffeine</artifactId>
<version>2.6.0</version> <version>2.6.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -144,7 +144,7 @@
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>2.7.3</version> <version>2.7.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Jedis --> <!-- Jedis -->
@ -158,7 +158,7 @@
<dependency> <dependency>
<groupId>org.mongodb</groupId> <groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId> <artifactId>mongo-java-driver</artifactId>
<version>3.5.0</version> <version>3.6.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- SnakeYAML --> <!-- SnakeYAML -->

View File

@ -34,20 +34,15 @@ public class ApiRegistrationUtil {
private static final Method REGISTER; private static final Method REGISTER;
private static final Method UNREGISTER; private static final Method UNREGISTER;
static { static {
Method register;
Method unregister;
try { try {
register = LuckPerms.class.getDeclaredMethod("registerProvider", LuckPermsApi.class); REGISTER = LuckPerms.class.getDeclaredMethod("registerProvider", LuckPermsApi.class);
register.setAccessible(true); REGISTER.setAccessible(true);
unregister = LuckPerms.class.getDeclaredMethod("unregisterProvider"); UNREGISTER = LuckPerms.class.getDeclaredMethod("unregisterProvider");
unregister.setAccessible(true); UNREGISTER.setAccessible(true);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e);
} }
REGISTER = register;
UNREGISTER = unregister;
} }
public static void registerProvider(LuckPermsApi luckPermsApi) { public static void registerProvider(LuckPermsApi luckPermsApi) {

View File

@ -61,22 +61,22 @@ public enum Dependency {
CAFFEINE( CAFFEINE(
"com{}github{}ben-manes{}caffeine", "com{}github{}ben-manes{}caffeine",
"caffeine", "caffeine",
"2.6.0", "2.6.1",
"JmT16VQnCnVBAjRJCQkkkjmSVx2jajpzeBuKwpbzDA8=", "5F55lb0PmSThBWkRJ9mwkvN+8xT6uDZKIwKk37QW0co=",
Relocation.of("caffeine", "com{}github{}benmanes{}caffeine") Relocation.of("caffeine", "com{}github{}benmanes{}caffeine")
), ),
MARIADB_DRIVER( MARIADB_DRIVER(
"org{}mariadb{}jdbc", "org{}mariadb{}jdbc",
"mariadb-java-client", "mariadb-java-client",
"2.2.0", "2.2.1",
"/q0LPGHrp3L9rvKr7TuA6urbtXBqvXis92mP4KhxzUw=", "K/WUWx66IX2PpclGA6Eeczs5FyuzqBdcmS/IzNLzKW8=",
Relocation.of("mariadb", "org{}mariadb{}jdbc") Relocation.of("mariadb", "org{}mariadb{}jdbc")
), ),
MYSQL_DRIVER( MYSQL_DRIVER(
"mysql", "mysql",
"mysql-connector-java", "mysql-connector-java",
"5.1.44", "5.1.45",
"d4RZVzTeWpoHBPB/tQP3mSafNy7L9MDUSOt4Ku9LGCc=", "WbqXFalbltVXkMdH8kxUmr1kXNHpQdrlSxOMATMwDWQ=",
Relocation.of("mysql", "com{}mysql") Relocation.of("mysql", "com{}mysql")
), ),
POSTGRESQL_DRIVER( POSTGRESQL_DRIVER(
@ -105,8 +105,8 @@ public enum Dependency {
HIKARI( HIKARI(
"com{}zaxxer", "com{}zaxxer",
"HikariCP", "HikariCP",
"2.7.4", "2.7.6",
"y9JE6/VmbydCqlV1z468+oqdkBswBk6aw+ECT178AT4=", "gEhb0Z6eOIgGT5mG9NhyyEtbBxJx/Rks6aDiWUnmqK4=",
Relocation.of("hikari", "com{}zaxxer{}hikari") Relocation.of("hikari", "com{}zaxxer{}hikari")
), ),
SLF4J_SIMPLE( SLF4J_SIMPLE(
@ -124,8 +124,8 @@ public enum Dependency {
MONGODB_DRIVER( MONGODB_DRIVER(
"org.mongodb", "org.mongodb",
"mongo-java-driver", "mongo-java-driver",
"3.5.0", "3.6.1",
"gxrbKVSI/xM6r+6uL7g7I0DzNV+hlNTtfw4UL13XdK8=", "Po8eyOBWv8XjREKSFrQh/NKHvLabtOysxbEFiD35cEk=",
Relocation.allOf( Relocation.allOf(
Relocation.of("mongodb", "com{}mongodb"), Relocation.of("mongodb", "com{}mongodb"),
Relocation.of("bson", "org{}bson") Relocation.of("bson", "org{}bson")

View File

@ -36,14 +36,12 @@ public class ReflectionClassLoader implements PluginClassLoader {
private static final Method ADD_URL_METHOD; private static final Method ADD_URL_METHOD;
static { static {
Method addUrlMethod;
try { try {
addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); ADD_URL_METHOD = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
addUrlMethod.setAccessible(true); ADD_URL_METHOD.setAccessible(true);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e);
} }
ADD_URL_METHOD = addUrlMethod;
} }
private final URLClassLoader classLoader; private final URLClassLoader classLoader;

View File

@ -28,6 +28,7 @@ package me.lucko.luckperms.common.storage.dao.mongodb;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mongodb.MongoClient; import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential; import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress; import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCollection;
@ -61,7 +62,6 @@ import me.lucko.luckperms.common.storage.dao.AbstractDao;
import org.bson.Document; import org.bson.Document;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -102,9 +102,9 @@ public class MongoDao extends AbstractDao {
ServerAddress address = new ServerAddress(host, port); ServerAddress address = new ServerAddress(host, port);
if (credential == null) { if (credential == null) {
this.mongoClient = new MongoClient(address, Collections.emptyList()); this.mongoClient = new MongoClient(address);
} else { } else {
this.mongoClient = new MongoClient(address, Collections.singletonList(credential)); this.mongoClient = new MongoClient(address, credential, MongoClientOptions.builder().build());
} }
this.database = this.mongoClient.getDatabase(this.configuration.getDatabase()); this.database = this.mongoClient.getDatabase(this.configuration.getDatabase());

View File

@ -37,9 +37,9 @@ import java.util.concurrent.TimeUnit;
public final class CollationKeyCache implements Comparator<String> { public final class CollationKeyCache implements Comparator<String> {
private static final CollationKeyCache INSTANCE = new CollationKeyCache(); private static final CollationKeyCache INSTANCE = new CollationKeyCache();
private static final Collator COLLATOR = Collator.getInstance(Locale.ENGLISH); private static final Collator COLLATOR;
static { static {
COLLATOR = Collator.getInstance(Locale.ENGLISH);
COLLATOR.setStrength(Collator.IDENTICAL); COLLATOR.setStrength(Collator.IDENTICAL);
COLLATOR.setDecomposition(Collator.FULL_DECOMPOSITION); COLLATOR.setDecomposition(Collator.FULL_DECOMPOSITION);
} }
@ -78,14 +78,11 @@ public final class CollationKeyCache implements Comparator<String> {
return i; return i;
} }
} }
// fallback to standard string comparison
return o1.compareTo(o2);
} catch (Exception e) { } catch (Exception e) {
// ignored // ignored
} }
// shrug // fallback to standard string comparison
return 0; return o1.compareTo(o2);
} }
} }

View File

@ -50,7 +50,7 @@ public class Cycle<E> {
/** /**
* The current position of the cursor * The current position of the cursor
*/ */
private AtomicInteger cursor = new AtomicInteger(0); private final AtomicInteger cursor = new AtomicInteger(0);
public Cycle(List<E> objects) { public Cycle(List<E> objects) {
if (objects == null || objects.isEmpty()) { if (objects == null || objects.isEmpty()) {

View File

@ -71,7 +71,7 @@ public class VerboseListener {
// the sender to notify each time the listener processes a check which passes the filter // the sender to notify each time the listener processes a check which passes the filter
private final Sender notifiedSender; private final Sender notifiedSender;
// the filter // the filter
private VerboseFilter filter; private final VerboseFilter filter;
// if we should notify the sender // if we should notify the sender
private final boolean notify; private final boolean notify;
// the number of checks we have processed // the number of checks we have processed