Remove relocation
This commit is contained in:
parent
cadd5ddb24
commit
a4312fdb51
4
pom.xml
4
pom.xml
@ -454,10 +454,6 @@
|
|||||||
<pattern>com.alessiodp.libby</pattern>
|
<pattern>com.alessiodp.libby</pattern>
|
||||||
<shadedPattern>fr.xephi.authme.libs.com.alessiodp.libby</shadedPattern>
|
<shadedPattern>fr.xephi.authme.libs.com.alessiodp.libby</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
<relocation>
|
|
||||||
<pattern>net.kyori.adventure</pattern>
|
|
||||||
<shadedPattern>fr.xephi.authme.libs.net.kyori.adventure</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>net.kyori.examination</pattern>
|
<pattern>net.kyori.examination</pattern>
|
||||||
<shadedPattern>fr.xephi.authme.libs.net.kyori.examination</shadedPattern>
|
<shadedPattern>fr.xephi.authme.libs.net.kyori.examination</shadedPattern>
|
||||||
|
|||||||
@ -16,23 +16,17 @@ public class MiniMessageUtils {
|
|||||||
private static final char SECTION_CHAR = '§';
|
private static final char SECTION_CHAR = '§';
|
||||||
private static final char AMPERSAND_CHAR = '&';
|
private static final char AMPERSAND_CHAR = '&';
|
||||||
private static final boolean HEX_SUPPORTED = Utils.MAJOR_VERSION >= 16;
|
private static final boolean HEX_SUPPORTED = Utils.MAJOR_VERSION >= 16;
|
||||||
private static Class<?> componentClass;
|
|
||||||
private static Method methodDisallow;
|
private static Method methodDisallow;
|
||||||
private static Method methodKick;
|
private static Method methodKick;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
componentClass = Class.forName("net{}kyori{}adventure{}text{}Component".replace("{}", "."));
|
methodDisallow = AsyncPlayerPreLoginEvent.class.getMethod("disallow", AsyncPlayerPreLoginEvent.Result.class, Component.class);
|
||||||
} catch (Exception e) {
|
|
||||||
componentClass = null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
methodDisallow = AsyncPlayerPreLoginEvent.class.getMethod("disallow", AsyncPlayerPreLoginEvent.Result.class, componentClass);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
methodDisallow = null;
|
methodDisallow = null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
methodKick = Player.class.getMethod("kick", componentClass);
|
methodKick = Player.class.getMethod("kick", Component.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
methodKick = null;
|
methodKick = null;
|
||||||
}
|
}
|
||||||
@ -64,13 +58,11 @@ public class MiniMessageUtils {
|
|||||||
* @param player the player to kick
|
* @param player the player to kick
|
||||||
* @param message the message to send
|
* @param message the message to send
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("all")
|
|
||||||
public static void kickPlayer(Player player, Component message) {
|
public static void kickPlayer(Player player, Component message) {
|
||||||
if (methodKick != null) {
|
if (methodKick != null) {
|
||||||
try {
|
try {
|
||||||
methodKick.invoke(player, componentClass.cast((Object) message));
|
methodKick.invoke(player, message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof ClassCastException) e.printStackTrace();
|
|
||||||
player.kickPlayer(LegacyComponentSerializer.legacySection().serialize(message));
|
player.kickPlayer(LegacyComponentSerializer.legacySection().serialize(message));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -85,14 +77,12 @@ public class MiniMessageUtils {
|
|||||||
* @param result the event result to set
|
* @param result the event result to set
|
||||||
* @param message the denial message
|
* @param message the denial message
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("all")
|
|
||||||
public static void disallowPreLoginEvent(AsyncPlayerPreLoginEvent event,
|
public static void disallowPreLoginEvent(AsyncPlayerPreLoginEvent event,
|
||||||
AsyncPlayerPreLoginEvent.Result result, Component message) {
|
AsyncPlayerPreLoginEvent.Result result, Component message) {
|
||||||
if (methodDisallow != null) {
|
if (methodDisallow != null) {
|
||||||
try {
|
try {
|
||||||
methodDisallow.invoke(event, result, componentClass.cast((Object) message));
|
methodDisallow.invoke(event, result, message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof ClassCastException) e.printStackTrace();
|
|
||||||
event.disallow(result, LegacyComponentSerializer.legacySection().serialize(message));
|
event.disallow(result, LegacyComponentSerializer.legacySection().serialize(message));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user