mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-11 01:38:07 +02:00
Fixed "Thrown Potion # has no item!?"
This commit is contained in:
parent
61f091308c
commit
75fb4f2e53
@ -46,6 +46,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
|
||||||
public class LibsDisguises extends JavaPlugin {
|
public class LibsDisguises extends JavaPlugin {
|
||||||
|
|
||||||
private static LibsDisguises instance;
|
private static LibsDisguises instance;
|
||||||
|
@ -203,7 +203,6 @@ public class PacketsManager {
|
|||||||
mods.write(4, yaw);
|
mods.write(4, yaw);
|
||||||
mods.write(5, pitch);
|
mods.write(5, pitch);
|
||||||
} else if (disguise.getType().isPlayer()) {
|
} else if (disguise.getType().isPlayer()) {
|
||||||
//TODO: Make player disguises visible again
|
|
||||||
PlayerDisguise playerDisguise = (PlayerDisguise) disguise;
|
PlayerDisguise playerDisguise = (PlayerDisguise) disguise;
|
||||||
String name = playerDisguise.getSkin() != null ? playerDisguise.getSkin() : playerDisguise.getName();
|
String name = playerDisguise.getSkin() != null ? playerDisguise.getSkin() : playerDisguise.getName();
|
||||||
int entityId = disguisedEntity.getEntityId();
|
int entityId = disguisedEntity.getEntityId();
|
||||||
@ -521,13 +520,13 @@ public class PacketsManager {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.isAsync()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setPacket(event.getPacket().deepClone());
|
event.setPacket(event.getPacket().deepClone());
|
||||||
StructureModifier<Object> mods = event.getPacket().getModifier();
|
StructureModifier<Object> mods = event.getPacket().getModifier();
|
||||||
Player observer = event.getPlayer();
|
Player observer = event.getPlayer();
|
||||||
if (event.getPacketType() == Server.NAMED_SOUND_EFFECT) {
|
if (event.getPacketType() == Server.NAMED_SOUND_EFFECT) {
|
||||||
if (event.isAsync()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object soundEffect = mods.read(0);
|
Object soundEffect = mods.read(0);
|
||||||
SoundType soundType = null;
|
SoundType soundType = null;
|
||||||
Location soundLoc = new Location(observer.getWorld(), ((Integer) mods.read(2)) / 8D,
|
Location soundLoc = new Location(observer.getWorld(), ((Integer) mods.read(2)) / 8D,
|
||||||
|
@ -12,6 +12,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -104,6 +105,10 @@ public class ReflectionManager {
|
|||||||
case "EnderPearl":
|
case "EnderPearl":
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), getNmsClass("EntityLiving")).newInstance(world, createEntityInstance("Cow"));
|
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World"), getNmsClass("EntityLiving")).newInstance(world, createEntityInstance("Cow"));
|
||||||
break;
|
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:
|
default:
|
||||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user