mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-25 03:42:24 +00:00
Removed "useCurrentThread" parameter from "hidePlayer" method
This commit is contained in:
parent
6e8e450534
commit
d4da428bc1
@ -207,44 +207,29 @@ public class Hologram {
|
|||||||
/**
|
/**
|
||||||
* @param p Player from which the hologram should be hidden
|
* @param p Player from which the hologram should be hidden
|
||||||
*/
|
*/
|
||||||
public void hidePlayer(final Player p, boolean useCurrentThread) {
|
public void hidePlayer(final Player p) {
|
||||||
if (useCurrentThread) {
|
new BukkitRunnable() {
|
||||||
sendDestroyPackets(p);
|
@Override
|
||||||
} else {
|
public void run() {
|
||||||
new BukkitRunnable() {
|
for (Object o : nmsArmorStands) {
|
||||||
@Override
|
try {
|
||||||
public void run() {
|
int id = (int) entityArmorStandClass.getMethod("getId").invoke(o);
|
||||||
sendDestroyPackets(p);
|
|
||||||
|
Object packet = packetPlayOutEntityDestroyClass.getConstructor(int[].class).newInstance((Object) new int[] {id});
|
||||||
|
|
||||||
|
Utils.sendPacket(plugin, packet, p);
|
||||||
|
} catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) {
|
||||||
|
plugin.getLogger().severe("Could not hide Hologram from player with reflection");
|
||||||
|
plugin.debug("Could not hide Hologram from player with reflection");
|
||||||
|
plugin.debug(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(plugin);
|
}
|
||||||
}
|
}.runTaskAsynchronously(plugin);
|
||||||
|
|
||||||
visible.remove(p);
|
visible.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDestroyPackets(Player p) {
|
|
||||||
for (Object o : nmsArmorStands) {
|
|
||||||
try {
|
|
||||||
int id = (int) entityArmorStandClass.getMethod("getId").invoke(o);
|
|
||||||
|
|
||||||
Object packet = packetPlayOutEntityDestroyClass.getConstructor(int[].class).newInstance((Object) new int[] {id});
|
|
||||||
|
|
||||||
Utils.sendPacket(plugin, packet, p);
|
|
||||||
} catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) {
|
|
||||||
plugin.getLogger().severe("Could not hide Hologram from player with reflection");
|
|
||||||
plugin.debug("Could not hide Hologram from player with reflection");
|
|
||||||
plugin.debug(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param p Player from which the hologram should be hidden
|
|
||||||
*/
|
|
||||||
public void hidePlayer(final Player p) {
|
|
||||||
hidePlayer(p, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param p Player to check
|
* @param p Player to check
|
||||||
* @return Whether the hologram is visible to the player
|
* @return Whether the hologram is visible to the player
|
||||||
|
Loading…
Reference in New Issue
Block a user