Add ProtocolLib version of Player#sendBlockChange
This commit is contained in:
parent
c4cf9d4f04
commit
21f3391a9d
@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import com.comphenix.packetwrapper.WrapperPlayClientUpdateSign;
|
import com.comphenix.packetwrapper.WrapperPlayClientUpdateSign;
|
||||||
|
import com.comphenix.packetwrapper.WrapperPlayServerBlockChange;
|
||||||
import com.comphenix.packetwrapper.WrapperPlayServerOpenSignEditor;
|
import com.comphenix.packetwrapper.WrapperPlayServerOpenSignEditor;
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
@ -16,6 +17,7 @@ import com.comphenix.protocol.events.PacketAdapter;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
|
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -100,6 +102,14 @@ public class FakeSignFactory {
|
|||||||
/* Send block change */
|
/* Send block change */
|
||||||
player.sendBlockChange(signLocation, Material.WALL_SIGN, (byte)0);
|
player.sendBlockChange(signLocation, Material.WALL_SIGN, (byte)0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: those didn't seem to work
|
||||||
|
WrapperPlayServerBlockChange block = new WrapperPlayServerBlockChange();
|
||||||
|
block.setBlockData(WrappedBlockData.createData(Material.WALL_SIGN));
|
||||||
|
block.setLocation(new BlockPosition(signLocation.toVector()));
|
||||||
|
block.sendPacket(player);
|
||||||
|
*/
|
||||||
|
|
||||||
/* Set sign content */
|
/* Set sign content */
|
||||||
player.sendSignChange(signLocation, defaultText);
|
player.sendSignChange(signLocation, defaultText);
|
||||||
}
|
}
|
||||||
@ -116,7 +126,17 @@ public class FakeSignFactory {
|
|||||||
if (defaultText != null) {
|
if (defaultText != null) {
|
||||||
/* Make sign disappear */
|
/* Make sign disappear */
|
||||||
Location signLocation = new Location(player.getWorld(), (double)x, (double)y, (double)z);
|
Location signLocation = new Location(player.getWorld(), (double)x, (double)y, (double)z);
|
||||||
|
|
||||||
|
/* Send block change */
|
||||||
player.sendBlockChange(signLocation, Material.AIR, (byte)0);
|
player.sendBlockChange(signLocation, Material.AIR, (byte)0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: those didn't seem to work
|
||||||
|
WrapperPlayServerBlockChange block = new WrapperPlayServerBlockChange();
|
||||||
|
block.setBlockData(WrappedBlockData.createData(Material.AIR));
|
||||||
|
block.setLocation(new BlockPosition(signLocation.toVector()));
|
||||||
|
block.sendPacket(player);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
signLocations.put(player.getName(), new Vector(x, y, z));
|
signLocations.put(player.getName(), new Vector(x, y, z));
|
||||||
listeners.put(player.getName(), response);
|
listeners.put(player.getName(), response);
|
||||||
|
Loading…
Reference in New Issue
Block a user