Update some dependencies

This commit is contained in:
Luck
2018-01-25 23:31:31 +00:00
Unverified
parent 54dbede130
commit e28d15456c
14 changed files with 43 additions and 76 deletions
@@ -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;
}
}
@@ -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) {
@@ -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;
}
/**
@@ -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;
}
/**
@@ -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;