Fixed "Thrown Potion # has no item!?"

This commit is contained in:
NavidK0 2016-03-14 21:53:25 -04:00
parent 61f091308c
commit 75fb4f2e53
3 changed files with 9 additions and 4 deletions

View File

@ -46,6 +46,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.lang.reflect.Field;
public class LibsDisguises extends JavaPlugin {
private static LibsDisguises instance;

View File

@ -203,7 +203,6 @@ public class PacketsManager {
mods.write(4, yaw);
mods.write(5, pitch);
} else if (disguise.getType().isPlayer()) {
//TODO: Make player disguises visible again
PlayerDisguise playerDisguise = (PlayerDisguise) disguise;
String name = playerDisguise.getSkin() != null ? playerDisguise.getSkin() : playerDisguise.getName();
int entityId = disguisedEntity.getEntityId();
@ -521,13 +520,13 @@ public class PacketsManager {
if (event.isCancelled()) {
return;
}
if (event.isAsync()) {
return;
}
event.setPacket(event.getPacket().deepClone());
StructureModifier<Object> mods = event.getPacket().getModifier();
Player observer = event.getPlayer();
if (event.getPacketType() == Server.NAMED_SOUND_EFFECT) {
if (event.isAsync()) {
return;
}
Object soundEffect = mods.read(0);
SoundType soundType = null;
Location soundLoc = new Location(observer.getWorld(), ((Integer) mods.read(2)) / 8D,

View File

@ -12,6 +12,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.bukkit.Art;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@ -104,6 +105,10 @@ public class ReflectionManager {
case "EnderPearl":
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), getNmsClass("EntityLiving")).newInstance(world, createEntityInstance("Cow"));
break;
case "Potion":
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), Double.TYPE, Double.TYPE, Double.TYPE, getNmsClass("ItemStack"))
.newInstance(world, 0d, 0d, 0d, getNmsItem(new ItemStack(Material.SPLASH_POTION)));
break;
default:
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
break;