本文整理汇总了Java中org.bukkit.entity.Player.sendBlockChange方法的典型用法代码示例。如果您正苦于以下问题:Java Player.sendBlockChange方法的具体用法?Java Player.sendBlockChange怎么用?Java Player.sendBlockChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.sendBlockChange方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean execute(CommandSender sender, String[] args) {
Player p = (Player) sender;
if (args.length != 1) {
Chat.player(sender, "&4[SG] &cPlease include the world name");
return true;
}
Chat.player(sender, Map.getList().toString());
Map m = Map.getByID(1);
for (Location l : m.getSpawns()) {
l.setWorld(m.getWorld());
p.sendBlockChange(l, Material.GLOWSTONE, (byte) 0);
}
Chat.player(sender, "&2[SG] &aSpawns have been shown with glowstone");
return true;
}
示例2: clearVisualBlock
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Clears a visual block at a given location for a player.
*
* @param player
* the player to clear for
* @param location
* the location to clear at
* @param sendRemovalPacket
* if a packet to send a block change should be sent (this is used to prevent unnecessary packets sent when disconnecting or changing worlds, for example)
* @return if the visual block was shown in the first place
*/
public boolean clearVisualBlock(Player player, Location location, boolean sendRemovalPacket) {
synchronized (storedVisualises) {
VisualBlock visualBlock = this.storedVisualises.remove(player.getUniqueId(), location);
if (sendRemovalPacket && visualBlock != null) {
// Have to send a packet to the original block type, don't send if the fake block has the same data properties though.
Block block = location.getBlock();
VisualBlockData visualBlockData = visualBlock.getBlockData();
if (visualBlockData.getBlockType() != block.getType() || visualBlockData.getData() != block.getData()) {
player.sendBlockChange(location, block.getType(), block.getData());
}
return true;
}
}
return false;
}
示例3: generate
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public LinkedHashMap<Location, VisualBlockData> generate(Player player, Iterable<Location> locations, VisualType visualType, boolean canOverwrite) {
synchronized (storedVisualises) {
LinkedHashMap<Location, VisualBlockData> results = new LinkedHashMap<>();
ArrayList<VisualBlockData> filled = visualType.blockFiller().bulkGenerate(player, locations);
if (filled != null) {
int count = 0;
for (Location location : locations) {
if (!canOverwrite && storedVisualises.contains(player.getUniqueId(), location)) {
continue;
}
Material previousType = location.getBlock().getType();
if (previousType.isSolid() || previousType != Material.AIR) {
continue;
}
VisualBlockData visualBlockData = filled.get(count++);
results.put(location, visualBlockData);
player.sendBlockChange(location, visualBlockData.getBlockType(), visualBlockData.getData());
storedVisualises.put(player.getUniqueId(), location, new VisualBlock(visualType, visualBlockData, location));
}
}
return results;
}
}
示例4: sendBlockChange
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void sendBlockChange(Player player, Location loc, Material type, int data) {
player.sendBlockChange(loc, type, (byte) data);
}
示例5: sendBlockChange
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void sendBlockChange(Player player, Location blockLocation, BlockState blockState) {
player.sendBlockChange(blockLocation, blockState.id, (byte)blockState.meta);
}
示例6: send
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void send(Player p) {
p.sendBlockChange(loc, mat, data);
}