@UIController("main")
public class MainController {
public BukkitView<?, ?> index(Player player) {
String greeting = "hello, " + player.getName() + "!"; // 將顯示玩家的名稱
return new BukkitView<>(MainView.class, greeting);
}
@ClickMapping(view = MainView.class, pattern = 'A')
public void clicked(Player player, @FromPattern('Z') List<ItemStack> items, ItemStack clicked){
player.sendMessage("you clicked "+clicked.getType());
assert items.stream().allMatch(item -> item.getType() == Material.BLACK_STAINED_GLASS_PANE);
assert clicked.getType() == Material.DIAMOND_BLOCK;
}
}
@UIController("main")
public class MainController {
public BukkitView<?, ?> index(Player player) {
String greeting = "hello, " + player.getName() + "!"; // 將顯示玩家的名稱
return new BukkitView<>(MainView.class, greeting);
}
@ClickMapping(view = MainView.class, pattern = 'A')
public void clicked(Player player, @FromPattern('Z') Map<Integer, ItemStack> items, ItemStack clicked){
player.sendMessage("you clicked "+clicked.getType());
assert items.keySet().containsAll(List.of(1, 2, 3, 4, 5, 6, 7, 8));
}