diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index ab2ca1d87..a0b2dbd92 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,11 +8,11 @@ UTF-8 PlotSquared - 2.8.10.0 + 2.8.11 PlotSquared jar - PlotSquared-${project.version} + PlotSquared src/main/java diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java index 6902460b4..789d03d74 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager.java @@ -273,9 +273,10 @@ public class DefaultTitleManager { * * @param player * Player + * @throws IllegalAccessException + * @throws IllegalArgumentException */ - public void clearTitle(final Player player) { - try { + public void clearTitle(final Player player) throws Exception { // Send timings first final Object handle = getHandle(player); final Object connection = getField(handle.getClass(), "playerConnection").get(handle); @@ -283,9 +284,6 @@ public class DefaultTitleManager { final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[3], null); sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } } /** @@ -294,18 +292,14 @@ public class DefaultTitleManager { * @param player * Player */ - public void resetTitle(final Player player) { - try { + public void resetTitle(final Player player) throws Exception { // Send timings first - final Object handle = getHandle(player); - final Object connection = getField(handle.getClass(), "playerConnection").get(handle); - final Object[] actions = this.packetActions.getEnumConstants(); - final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); - final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[4], null); - sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } + final Object handle = getHandle(player); + final Object connection = getField(handle.getClass(), "playerConnection").get(handle); + final Object[] actions = this.packetActions.getEnumConstants(); + final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); + final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[4], null); + sendPacket.invoke(connection, packet); } private Class getPrimitiveType(final Class clazz) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager_183.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager_183.java index cb175c28a..4e8ff569c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager_183.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitleManager_183.java @@ -274,9 +274,10 @@ public class DefaultTitleManager_183 { * * @param player * Player + * @throws IllegalAccessException + * @throws IllegalArgumentException */ - public void clearTitle(final Player player) { - try { + public void clearTitle(final Player player) throws Exception { // Send timings first final Object handle = getHandle(player); final Object connection = getField(handle.getClass(), "playerConnection").get(handle); @@ -284,9 +285,6 @@ public class DefaultTitleManager_183 { final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[3], null); sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } } /** @@ -294,19 +292,21 @@ public class DefaultTitleManager_183 { * * @param player * Player + * @throws SecurityException + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws IllegalArgumentException + * @throws IllegalAccessException + * @throws InstantiationException */ - public void resetTitle(final Player player) { - try { - // Send timings first - final Object handle = getHandle(player); - final Object connection = getField(handle.getClass(), "playerConnection").get(handle); - final Object[] actions = this.packetActions.getEnumConstants(); - final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); - final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[4], null); - sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } + public void resetTitle(final Player player) throws Exception { + // Send timings first + final Object handle = getHandle(player); + final Object connection = getField(handle.getClass(), "playerConnection").get(handle); + final Object[] actions = this.packetActions.getEnumConstants(); + final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); + final Object packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[4], null); + sendPacket.invoke(connection, packet); } private Class getPrimitiveType(final Class clazz) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java index f5d015b83..52034bfa5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitleManager.java @@ -1,6 +1,7 @@ package com.intellectualcrafters.plot.titles; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -265,20 +266,17 @@ public class HackTitleManager { * * @param player * Player + * @throws Exception */ - public void clearTitle(final Player player) { + public void clearTitle(final Player player) throws Exception { if ((getProtocolVersion(player) >= 47) && isSpigot()) { - try { - // Send timings first - final Object handle = getHandle(player); - final Object connection = getField(handle.getClass(), "playerConnection").get(handle); - final Object[] actions = this.packetActions.getEnumConstants(); - final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); - final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[3]); - sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } + // Send timings first + final Object handle = getHandle(player); + final Object connection = getField(handle.getClass(), "playerConnection").get(handle); + final Object[] actions = this.packetActions.getEnumConstants(); + final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); + final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[3]); + sendPacket.invoke(connection, packet); } } @@ -287,20 +285,17 @@ public class HackTitleManager { * * @param player * Player + * @throws Exception */ - public void resetTitle(final Player player) { + public void resetTitle(final Player player) throws Exception { if ((getProtocolVersion(player) >= 47) && isSpigot()) { - try { - // Send timings first - final Object handle = getHandle(player); - final Object connection = getField(handle.getClass(), "playerConnection").get(handle); - final Object[] actions = this.packetActions.getEnumConstants(); - final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); - final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[4]); - sendPacket.invoke(connection, packet); - } catch (final Exception e) { - e.printStackTrace(); - } + // Send timings first + final Object handle = getHandle(player); + final Object connection = getField(handle.getClass(), "playerConnection").get(handle); + final Object[] actions = this.packetActions.getEnumConstants(); + final Method sendPacket = getMethod(connection.getClass(), "sendPacket"); + final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[4]); + sendPacket.invoke(connection, packet); } } @@ -310,18 +305,13 @@ public class HackTitleManager { * @param player * Player * @return Protocol version + * @throws Exception */ - private int getProtocolVersion(final Player player) { - int version = 0; - try { - final Object handle = getHandle(player); - final Object connection = getField(handle.getClass(), "playerConnection").get(handle); - final Object networkManager = getValue("networkManager", connection); - version = (Integer) getMethod("getVersion", networkManager.getClass()).invoke(networkManager); - return version; - } catch (final Exception ex) { - ex.printStackTrace(); - } + private int getProtocolVersion(final Player player) throws Exception { + final Object handle = getHandle(player); + final Object connection = getField(handle.getClass(), "playerConnection").get(handle); + final Object networkManager = getValue("networkManager", connection); + Integer version = (Integer) getMethod("getVersion", networkManager.getClass()).invoke(networkManager); return version; }