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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.0.0</version>
<executions>
<execution>
<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());
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "");
}
return;
}
}

View File

@ -40,23 +40,15 @@ public class DummyPermissibleBase extends PermissibleBase {
private static final Field PERMISSIONS_FIELD;
static {
Field attachmentsField;
try {
attachmentsField = PermissibleBase.class.getDeclaredField("attachments");
attachmentsField.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
ATTACHMENTS_FIELD = attachmentsField;
ATTACHMENTS_FIELD = PermissibleBase.class.getDeclaredField("attachments");
ATTACHMENTS_FIELD.setAccessible(true);
Field permissionsField;
try {
permissionsField = PermissibleBase.class.getDeclaredField("permissions");
permissionsField.setAccessible(true);
PERMISSIONS_FIELD = PermissibleBase.class.getDeclaredField("permissions");
PERMISSIONS_FIELD.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
PERMISSIONS_FIELD = permissionsField;
}
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;
static {
Field permissionAttachmentPermissionsField;
try {
permissionAttachmentPermissionsField = PermissionAttachment.class.getDeclaredField("permissions");
permissionAttachmentPermissionsField.setAccessible(true);
PERMISSION_ATTACHMENT_PERMISSIONS_FIELD = PermissionAttachment.class.getDeclaredField("permissions");
PERMISSION_ATTACHMENT_PERMISSIONS_FIELD.setAccessible(true);
} catch (NoSuchFieldException 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;
static {
Field humanEntityPermissibleField;
Field permissibleBaseAttachmentsField;
try {
// Catch all. If this setup doesn't fully complete without
// exceptions, then the Injector will not work.
// Try to load the permissible field.
Field humanEntityPermissibleField;
try {
// craftbukkit
humanEntityPermissibleField = ReflectionUtil.obcClass("entity.CraftHumanEntity").getDeclaredField("perm");
humanEntityPermissibleField.setAccessible(true);
} catch (Exception e) {
// glowstone
humanEntityPermissibleField = Class.forName("net.glowstone.entity.GlowHumanEntity").getDeclaredField("permissions");
humanEntityPermissibleField.setAccessible(true);
}
HUMAN_ENTITY_PERMISSIBLE_FIELD = humanEntityPermissibleField;
// Try to load the attachments field.
permissibleBaseAttachmentsField = PermissibleBase.class.getDeclaredField("attachments");
permissibleBaseAttachmentsField.setAccessible(true);
} catch (Throwable t) {
throw new RuntimeException("Injector did not init successfully.", t);
PERMISSIBLE_BASE_ATTACHMENTS_FIELD = PermissibleBase.class.getDeclaredField("attachments");
PERMISSIBLE_BASE_ATTACHMENTS_FIELD.setAccessible(true);
} catch (ClassNotFoundException | NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
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;
static {
Field permSubsField;
try {
permSubsField = SimplePluginManager.class.getDeclaredField("permSubs");
permSubsField.setAccessible(true);
PERM_SUBS_FIELD = SimplePluginManager.class.getDeclaredField("permSubs");
PERM_SUBS_FIELD.setAccessible(true);
} catch (NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
PERM_SUBS_FIELD = permSubsField;
}
private final LPBukkitPlugin plugin;

View File

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

View File

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

View File

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

View File

@ -36,14 +36,12 @@ public class ReflectionClassLoader implements PluginClassLoader {
private static final Method ADD_URL_METHOD;
static {
Method addUrlMethod;
try {
addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
addUrlMethod.setAccessible(true);
ADD_URL_METHOD = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
ADD_URL_METHOD.setAccessible(true);
} catch (NoSuchMethodException e) {
throw new ExceptionInInitializerError(e);
}
ADD_URL_METHOD = addUrlMethod;
}
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.collect.ImmutableList;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
@ -61,7 +62,6 @@ import me.lucko.luckperms.common.storage.dao.AbstractDao;
import org.bson.Document;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@ -102,9 +102,9 @@ public class MongoDao extends AbstractDao {
ServerAddress address = new ServerAddress(host, port);
if (credential == null) {
this.mongoClient = new MongoClient(address, Collections.emptyList());
this.mongoClient = new MongoClient(address);
} 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());

View File

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

View File

@ -50,7 +50,7 @@ public class Cycle<E> {
/**
* The current position of the cursor
*/
private AtomicInteger cursor = new AtomicInteger(0);
private final AtomicInteger cursor = new AtomicInteger(0);
public Cycle(List<E> objects) {
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
private final Sender notifiedSender;
// the filter
private VerboseFilter filter;
private final VerboseFilter filter;
// if we should notify the sender
private final boolean notify;
// the number of checks we have processed