我对bukkit很新,但我不明白为什么会这样。玩家名称不会使用bukkit显示在标志上。之前有用,但我不知道我做了什么阻止了它的工作。我正在使用插头1.9。使用' Bukkit.broadcastMessage()'显示播放器名称。但是。
以下是我的代码的一部分:
if (cmd.getName().equalsIgnoreCase("sign") && sender instanceof Player){
Player player = (Player) sender;
Location location = player.getLocation();
World someWorld = Bukkit.getServer().getWorld("world");
double playerx = location.getX();
double playery = location.getY();
double playerz = location.getZ();
int px = (int)playerx;
int py = (int)playery;
int pz = (int)playerz;
Location nLoc = new Location(someWorld, px+1, py+1, pz);
Location sLoc = new Location(someWorld, px+1, py+1, pz-1);
Block block = someWorld.getBlockAt(nLoc);
block.setType(Material.WOOD);
Block block1 = someWorld.getBlockAt(sLoc);
block1.setType(Material.WALL_SIGN);
Sign sign = (Sign) block1.getState();
sign.setLine(0, "Hello "+player.getName());
sign.setLine(1, "Welcome To My");
sign.setLine(2, "Server!");
Bukkit.broadcastMessage("Name: "+player.getName());
sign.update(true);