1
建設我有一個Listbukkit插件的Minecraft胸部填充和從類int類型列表
private List<ChestPoint> chestpoints = new ArrayList<>();
和ChestPoint.java
int x;
int y;
int z;
String findhardness;
String arena;
,並要設置胸前,並用
填補他們if(cmd.getName().equalsIgnoreCase("buildfillchests")) {
ItemStack itemsforchest = new ItemStack(Material.CHEST, 1728);
if(args.length == 1){
for(ChestPoint cp : chestpoints){
Location chestloc = null;
if(cp.arena == null ? args[0] == null : cp.arena.equals(args[0])){
chestloc.setX(cp.x);
chestloc.setY(cp.y);
chestloc.setZ(cp.z);
if(chestloc.getBlock().getType() == Material.AIR){
chestloc.getBlock().setType(Material.CHEST);
Inventory chestinv = ((Chest) chestloc.getBlock().getState()).getInventory();
chestinv.addItem(itemsforchest);
}
}
}
} else {
if(args.length == 3 && "by".equals(args[0]) && "all".equals(args[1]) && "chests".equals(args[2])){
for(ChestPoint cp : chestpoints){
Location chestloc = null;
chestloc.setX(cp.x);
chestloc.setY(cp.y);
chestloc.setZ(cp.z);
if(chestloc.getBlock().getType() == Material.AIR){
chestloc.getBlock().setType(Material.CHEST);
Inventory chestinv = ((Chest) chestloc.getBlock().getState()).getInventory();
chestinv.addItem(itemsforchest);
}
}
} else {
sender.sendMessage(ChatColor.RED + "Es funktioniert nur /buildfillchests <arena> oder /buildfillchests by all chests");
}
}
這不行! 我想在胸部胸甲點上設置胸部,並用胸部填充胸部!但在我的日誌文件中沒有記錄錯誤! 有人可以找到我的惡作劇嗎?
您是否在plugin.yml中註冊了該命令? – kabb
嘗試設置'itemsforchest'到一個ItemStack只有64個項目,看看是否有效 – Jojodmo