本文整理汇总了Java中cn.nukkit.form.window.FormWindowSimple.addButton方法的典型用法代码示例。如果您正苦于以下问题:Java FormWindowSimple.addButton方法的具体用法?Java FormWindowSimple.addButton怎么用?Java FormWindowSimple.addButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.form.window.FormWindowSimple
的用法示例。
在下文中一共展示了FormWindowSimple.addButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import cn.nukkit.form.window.FormWindowSimple; //导入方法依赖的package包/类
@Override
public boolean execute(CommandSender player, String alias, String[] args) {
if (player instanceof Player) {
if (player.isOp()) {
final FormWindowSimple window = new FormWindowSimple("World Teleport UI", "Teleport to any world");
Map<Integer, Level> level = getPlugin().getServer().getLevels();
window.addButton(new ElementButton("Cancel"));
for (Level lvl : level.values()) {
window.addButton(new ElementButton(lvl.getFolderName()));
}
((Player) player).showFormWindow(window);
} else {
player.sendMessage(TextFormat.RED + "You have to be op to use this command!");
}
} else {
player.sendMessage(TextFormat.RED + "You can only use /hub in-game!");
}
return true;
}
示例2: addChallengesFormOverlay
import cn.nukkit.form.window.FormWindowSimple; //导入方法依赖的package包/类
public void addChallengesFormOverlay(Player player) {
FormWindowSimple panelIsland = new FormWindowSimple("Challenges Menu", getLocale(player).panelChallengesHeader);
for (String toButton : plugin.getChallenges().getChallengeConfig().getSection("challenges.challengeList").getKeys(false)) {
panelIsland.addButton(new ElementButton(toButton));
}
int id = player.showFormWindow(panelIsland);
panelDataId.put(id, PanelType.TYPE_CHALLENGES);
}
示例3: addHomeFormOverlay
import cn.nukkit.form.window.FormWindowSimple; //导入方法依赖的package包/类
public void addHomeFormOverlay(Player p) {
ArrayList<IslandData> listHome = plugin.getDatabase().getIslands(p.getName());
FormWindowSimple islandHome = new FormWindowSimple("Home list", getLocale(p).panelHomeHeader.replace("[function]", "teleport"));
for (IslandData pd : listHome) {
islandHome.addButton(new ElementButton(pd.getName()));
}
int id = p.showFormWindow(islandHome);
panelDataId.put(id, PanelType.TYPE_HOMES);
}