mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-12 10:24:07 +01:00
fix titles
This commit is contained in:
parent
eb5ae0ec3c
commit
450e34265e
@ -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;
|
||||
@ -222,12 +223,14 @@ public class DefaultTitleManager {
|
||||
*
|
||||
* @param player
|
||||
* Player
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public void send(Player player) {
|
||||
public void send(Player player) throws Exception {
|
||||
if (packetTitle != null) {
|
||||
// First reset previous settings
|
||||
resetTitle(player);
|
||||
try {
|
||||
// Send timings first
|
||||
Object handle = getHandle(player);
|
||||
Object connection = getField(handle.getClass(), "playerConnection").get(handle);
|
||||
@ -259,16 +262,13 @@ public class DefaultTitleManager {
|
||||
sendPacket.invoke(connection, packet);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the title to all players
|
||||
* @throws Exception
|
||||
*/
|
||||
public void broadcast() {
|
||||
public void broadcast() throws Exception {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
send(p);
|
||||
}
|
||||
|
@ -221,12 +221,11 @@ public class HackTitleManager {
|
||||
* @param player
|
||||
* Player
|
||||
*/
|
||||
public void send(Player player) {
|
||||
public void send(Player player) throws Exception {
|
||||
if (getProtocolVersion(player) >= 47 && isSpigot()
|
||||
&& packetTitle != null) {
|
||||
// First reset previous settings
|
||||
resetTitle(player);
|
||||
try {
|
||||
// Send timings first
|
||||
Object handle = getHandle(player);
|
||||
Object connection = getField(handle.getClass(),
|
||||
@ -271,16 +270,13 @@ public class HackTitleManager {
|
||||
actions[1], serialized);
|
||||
sendPacket.invoke(connection, packet);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast the title to all players
|
||||
*/
|
||||
public void broadcast() {
|
||||
public void broadcast() throws Exception {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
send(p);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user