use of biz.princeps.landlord.guis.ManageGUIAll in project LandLord by SpatiumPrinceps.
the class ListLands method onListLands.
public void onListLands(Player sender, LPlayer target, int page) {
List<ProtectedRegion> lands = new ArrayList<>(plugin.getWgHandler().getRegions(target.getUuid()));
if (lands.size() > 0) {
String mode = plugin.getConfig().getString("CommandSettings.ListLands.mode");
if (mode.equals("gui")) {
MultiPagedGUI landGui = new MultiPagedGUI(sender, 5, plugin.getLangManager().getRawString("Commands.ListLands.header").replace("%player%", target.getName()));
lands.forEach(land -> landGui.addIcon(new Icon(new ItemStack(Material.GRASS)).setName(land.getId())));
landGui.setIcon(52, new Icon(new ItemStack(Material.BEACON)).setName(lm.getRawString("Commands.ListLands.manageAll")).addClickAction((p, ic2) -> {
ManageGUIAll manageGUIAll = new ManageGUIAll(sender, landGui, plugin.getWgHandler().getRegionsAsOL(target.getUuid()));
manageGUIAll.display();
}));
landGui.display();
} else {
// Chat based system
List<String> formatted = new ArrayList<>();
String segment = lm.getRawString("Commands.ListLands.chat.segment");
lands.forEach(land -> {
OwnedLand ol = plugin.getLand(land);
formatted.add(segment.replace("%landname%", ol.getName()).replace("%members%", ol.printMembers()));
});
String prev = lm.getRawString("Commands.ListLands.chat.previous");
String next = lm.getRawString("Commands.ListLands.chat.next");
MultiPagedMessage message = new MultiPagedMessage("/land list", plugin.getLangManager().getRawString("Commands.ListLands.header").replace("%player%", target.getName()), plugin.getConfig().getInt("CommandSettings.ListLands.landsPerPage"), formatted, prev, next, page);
sender.spigot().sendMessage(message.create());
}
} else {
sender.sendMessage(plugin.getLangManager().getString("Commands.ListLands.noLands"));
}
}
use of biz.princeps.landlord.guis.ManageGUIAll in project LandLord by SpatiumPrinceps.
the class ManageAll method onManageAll.
public void onManageAll(Player player) {
List<OwnedLand> lands = new ArrayList<>();
for (World world : Bukkit.getWorlds()) {
for (ProtectedRegion pr : plugin.getWgHandler().getRegions(player.getUniqueId(), world)) {
lands.add(plugin.getLand(pr));
}
}
ManageGUIAll gui = new ManageGUIAll(player, lands);
gui.display();
}
Aggregations