mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fixed getPlots() causing NPE
This commit is contained in:
parent
f2a389f850
commit
fd823d2910
@ -192,7 +192,7 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Flag
|
* Flag
|
||||||
*/
|
*/
|
||||||
NEED_KEY("&cYou need to specify a flag"),
|
NEED_KEY("&cPossible values: &6%values%"),
|
||||||
NOT_VALID_FLAG("&cThat is not a valid flag"),
|
NOT_VALID_FLAG("&cThat is not a valid flag"),
|
||||||
NOT_VALID_VALUE("&cFlag values must be alphanumerical"),
|
NOT_VALID_VALUE("&cFlag values must be alphanumerical"),
|
||||||
FLAG_NOT_IN_PLOT("&cThe plot does not have that flag"),
|
FLAG_NOT_IN_PLOT("&cThe plot does not have that flag"),
|
||||||
|
@ -24,6 +24,9 @@ public class Flag {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
if (this.value.equals("")) {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
return this.key+":"+this.value;
|
return this.key+":"+this.value;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,7 +62,6 @@ public class PlotHelper {
|
|||||||
sign.setLine(1, C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
sign.setLine(1, C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
||||||
sign.setLine(2, C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
sign.setLine(2, C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
||||||
sign.setLine(3, C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
sign.setLine(3, C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", plr.getName()));
|
||||||
System.out.print(10);
|
|
||||||
sign.update(true);
|
sign.update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,11 +170,13 @@ public class PlotMain extends JavaPlugin {
|
|||||||
ArrayList<Plot> myplots = new ArrayList<Plot>();
|
ArrayList<Plot> myplots = new ArrayList<Plot>();
|
||||||
for (HashMap<PlotId, Plot> world:plots.values()) {
|
for (HashMap<PlotId, Plot> world:plots.values()) {
|
||||||
for (Plot plot:world.values()) {
|
for (Plot plot:world.values()) {
|
||||||
|
if (plot.hasOwner()) {
|
||||||
if (plot.getOwner().equals(uuid)) {
|
if (plot.getOwner().equals(uuid)) {
|
||||||
myplots.add(plot);
|
myplots.add(plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new HashSet<Plot>(myplots);
|
return new HashSet<Plot>(myplots);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -187,10 +189,12 @@ public class PlotMain extends JavaPlugin {
|
|||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
ArrayList<Plot> myplots = new ArrayList<Plot>();
|
ArrayList<Plot> myplots = new ArrayList<Plot>();
|
||||||
for (Plot plot:getPlots(world).values()) {
|
for (Plot plot:getPlots(world).values()) {
|
||||||
|
if (plot.hasOwner()) {
|
||||||
if (plot.getOwner().equals(uuid)) {
|
if (plot.getOwner().equals(uuid)) {
|
||||||
myplots.add(plot);
|
myplots.add(plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new HashSet<Plot>(myplots);
|
return new HashSet<Plot>(myplots);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +42,7 @@ public class Claim extends SubCommand{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean result = claimPlot(plr, plot, false);
|
boolean result = claimPlot(plr, plot, false);
|
||||||
if (!result) {
|
if (result) {
|
||||||
PlayerFunctions.sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
PlayerFunctions.sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class Set extends SubCommand{
|
|||||||
|
|
||||||
if(args[0].equalsIgnoreCase("flag")) {
|
if(args[0].equalsIgnoreCase("flag")) {
|
||||||
if(args.length < 2) {
|
if(args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_KEY);
|
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", StringUtils.join(PlotMain.getFlags(),"&c, &6")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!PlotMain.isRegisteredFlag(args[1])) {
|
if (!PlotMain.isRegisteredFlag(args[1])) {
|
||||||
|
@ -293,9 +293,14 @@ public class DBFunc {
|
|||||||
flags_string = ((String) settings.get("flags")).split(",");
|
flags_string = ((String) settings.get("flags")).split(",");
|
||||||
Flag[] flags = new Flag[flags_string.length];
|
Flag[] flags = new Flag[flags_string.length];
|
||||||
for (int i = 0; i<flags.length; i++) {
|
for (int i = 0; i<flags.length; i++) {
|
||||||
|
if (flags_string[i].contains(":")) {
|
||||||
String[] split = flags_string[i].split(":");
|
String[] split = flags_string[i].split(":");
|
||||||
flags[i] = new Flag(split[0], split[1]);
|
flags[i] = new Flag(split[0], split[1]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
flags[i] = new Flag(flags_string[i], "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<UUID> helpers = plotHelpers(id);
|
ArrayList<UUID> helpers = plotHelpers(id);
|
||||||
ArrayList<UUID> denied = plotDenied(id);
|
ArrayList<UUID> denied = plotDenied(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user