fix titles

This commit is contained in:
boy0001 2015-02-03 12:47:10 +11:00
parent eb5ae0ec3c
commit 450e34265e
2 changed files with 76 additions and 80 deletions

View File

@ -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);
}

View File

@ -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);
}