This commit is contained in:
boy0001 2014-10-25 00:08:21 +11:00
parent c367dfa510
commit eb35ba5fb0
5 changed files with 19 additions and 4 deletions

View File

@ -182,7 +182,14 @@ public class PlayerFunctions {
* @return * @return
*/ */
public static int getPlayerPlotCount(World world, Player plr) { public static int getPlayerPlotCount(World world, Player plr) {
return getPlayerPlots(world, plr).size(); UUID uuid = plr.getUniqueId();
int count = 0;
for (Plot plot: PlotMain.getPlots(world).values()) {
if (plot.hasOwner() && plot.owner.equals(uuid) && plot.countsTowardsMax) {
count++;
}
}
return count;
} }
/** /**

View File

@ -65,6 +65,7 @@ public class Plot implements Cloneable {
* Has the plot changed since the last save cycle? * Has the plot changed since the last save cycle?
*/ */
public boolean hasChanged = false; public boolean hasChanged = false;
public boolean countsTowardsMax = false;
/** /**
* Primary constructor * Primary constructor

View File

@ -10,6 +10,8 @@ package com.intellectualcrafters.plot;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.database.DBFunc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View File

@ -97,7 +97,7 @@ public class Info extends SubCommand {
// Unclaimed? // Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) { if (!hasOwner && !containsEveryone && !trustedEveryone) {
PlayerFunctions.sendMessage(player, C.PLOT_INFO_UNCLAIMED, plot.id.x + ";" + plot.id.y); PlayerFunctions.sendMessage(player, C.PLOT_INFO_UNCLAIMED, (plot.id.x + ";" + plot.id.y));
return true; return true;
} }
@ -162,7 +162,7 @@ public class Info extends SubCommand {
String trusted = getPlayerList(plot.trusted); String trusted = getPlayerList(plot.trusted);
String denied = getPlayerList(plot.denied); String denied = getPlayerList(plot.denied);
String rating = String.format("%.1f", DBFunc.getRatings(plot)); String rating = String.format("%.1f", DBFunc.getRatings(plot));
String flags = StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), ",") : "none"; String flags = "&3"+ (StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), "&7, &3") : "none");
boolean build = player==null ? true : plot.hasRights(player); boolean build = player==null ? true : plot.hasRights(player);
String owner = "none"; String owner = "none";

View File

@ -435,7 +435,12 @@ public class SQLManager extends AbstractDB {
for (int i = 0; i < flags.length; i++) { for (int i = 0; i < flags.length; i++) {
if (flags_string[i].contains(":")) { if (flags_string[i].contains(":")) {
String[] split = flags_string[i].split(":"); String[] split = flags_string[i].split(":");
flags[i] = new Flag(FlagManager.getFlag(split[0], true), split[1]); try {
flags[i] = new Flag(FlagManager.getFlag(split[0], true), split[1]);
}
catch (Exception e) {
// invalid flag... ignoring it for now.
}
} }
else { else {
flags[i] = new Flag(FlagManager.getFlag(flags_string[i], true), ""); flags[i] = new Flag(FlagManager.getFlag(flags_string[i], true), "");