mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-05 18:31:40 +01:00
Adds an option to '/as info' to list regions without group
This commit is contained in:
parent
fb51da84ae
commit
75b752a235
@ -121,12 +121,16 @@ buys-notUpdated: "Not all signs have been updated, maybe reload fixes it."
|
||||
reload-reloaded: "The config has been reloaded successfully."
|
||||
reload-noPermission: "You don't have permission to reload the config."
|
||||
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>."
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region|nogroup>."
|
||||
info-noPermission: "You don't have permission to get information about regions."
|
||||
info-all-rents: "Regions registered for renting: &7%0%."
|
||||
info-all-noRents: "There are no regions registered for renting."
|
||||
info-all-buys: "Regions registered for buying: &7%0%."
|
||||
info-all-noBuys: "There are no regions registered for buying."
|
||||
info-nogroupRents: "Rent regions without group: &7%0%."
|
||||
info-nogroupBuys: "Buy regions without group: &7%0%."
|
||||
info-nogroupNoRents: "There are no rent regions without a group."
|
||||
info-nogroupNoBuys: "There are no buy regions without a group."
|
||||
info-rented: "Rented regions: &7%0%."
|
||||
info-noRented: "No regions are rented."
|
||||
info-unrented: "Unrented regions: &7%0%."
|
||||
|
@ -10,6 +10,7 @@ import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RegionGroup;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -362,6 +363,51 @@ public class InfoCommand extends CommandAreaShop {
|
||||
} else {
|
||||
plugin.message(sender, "info-regionHelp");
|
||||
}
|
||||
}
|
||||
|
||||
/* List of regions without a group */
|
||||
else if(args[1].equalsIgnoreCase("nogroup")) {
|
||||
String message = "";
|
||||
/* Message for rents */
|
||||
List<String> rents = plugin.getFileManager().getRentNames();
|
||||
// Remove regions that have a group
|
||||
for(RegionGroup group : plugin.getFileManager().getGroups()) {
|
||||
rents.removeAll(group.getMembers());
|
||||
}
|
||||
// Create the list message
|
||||
Iterator<String> itRent = rents.iterator();
|
||||
if(itRent.hasNext()) {
|
||||
message = itRent.next();
|
||||
while(itRent.hasNext()) {
|
||||
message += ", " + itRent.next();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-nogroupNoRents");
|
||||
} else {
|
||||
plugin.message(sender, "info-nogroupRents", message);
|
||||
}
|
||||
|
||||
/* Message for buys */
|
||||
message = "";
|
||||
// Remove regions that have a group
|
||||
List<String> buys = plugin.getFileManager().getBuyNames();
|
||||
for(RegionGroup group : plugin.getFileManager().getGroups()) {
|
||||
buys.removeAll(group.getMembers());
|
||||
}
|
||||
// Create the list message
|
||||
Iterator<String> itBuy = buys.iterator();
|
||||
if(itBuy.hasNext()) {
|
||||
message = itBuy.next();
|
||||
while(itBuy.hasNext()) {
|
||||
message += ", " + itBuy.next();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-nogroupNoBuys");
|
||||
} else {
|
||||
plugin.message(sender, "info-nogroupBuys", message);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-help");
|
||||
}
|
||||
@ -394,7 +440,7 @@ public class InfoCommand extends CommandAreaShop {
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start, CommandSender sender) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(Arrays.asList("all", "rented", "forrent", "sold", "forsale", "player", "region"));
|
||||
result.addAll(Arrays.asList("all", "rented", "forrent", "sold", "forsale", "player", "region", "nogroup"));
|
||||
} else if(toComplete == 3) {
|
||||
if(start[2].equalsIgnoreCase("player")) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
|
Loading…
Reference in New Issue
Block a user