Sneak test
Dieser Commit ist enthalten in:
Ursprung
9d89c169d1
Commit
675ef2d274
@ -19,11 +19,6 @@
|
||||
|
||||
package de.steamwar.spectatesystem.elements;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.utility.Util;
|
||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||
import de.steamwar.spectatesystem.SpectateSystem;
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -31,10 +26,8 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public abstract class REntity {
|
||||
|
||||
@ -108,16 +101,11 @@ public abstract class REntity {
|
||||
|
||||
public void sneak(boolean sneaking) {
|
||||
entity.setSneaking(sneaking);
|
||||
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
|
||||
packet.getIntegers().write(0, entity.getId());
|
||||
packet.getWatchableCollectionModifier().write(0, Util.asList(new WrappedWatchableObject(0, (byte)0x02)));
|
||||
System.out.println(packet);
|
||||
entity.getDataWatcher().register(new DataWatcherObject<>(0, DataWatcherRegistry.a), (byte)0x02);
|
||||
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), false);
|
||||
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||
} catch (InvocationTargetException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Invocation target exception", e);
|
||||
}
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren