mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
title detection
This commit is contained in:
parent
688544da28
commit
d9aa12b984
@ -8,11 +8,11 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>2.8.10.0</version>
|
||||
<version>2.8.11</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
<finalName>PlotSquared-${project.version}</finalName>
|
||||
<finalName>PlotSquared</finalName>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
|
@ -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,8 +292,7 @@ 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);
|
||||
@ -303,9 +300,6 @@ public class DefaultTitleManager {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private Class<?> getPrimitiveType(final Class<?> clazz) {
|
||||
|
@ -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,9 +292,14 @@ 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 {
|
||||
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);
|
||||
@ -304,9 +307,6 @@ public class DefaultTitleManager_183 {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private Class<?> getPrimitiveType(final Class<?> clazz) {
|
||||
|
@ -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,10 +266,10 @@ 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);
|
||||
@ -276,9 +277,6 @@ public class HackTitleManager {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,10 +285,10 @@ 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);
|
||||
@ -298,9 +296,6 @@ public class HackTitleManager {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
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);
|
||||
version = (Integer) getMethod("getVersion", networkManager.getClass()).invoke(networkManager);
|
||||
return version;
|
||||
} catch (final Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
Integer version = (Integer) getMethod("getVersion", networkManager.getClass()).invoke(networkManager);
|
||||
return version;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user