From eb35ba5fb015cb467da650cb943d484ce28da8cc Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 25 Oct 2014 00:08:21 +1100 Subject: [PATCH] fixes --- .../com/intellectualcrafters/plot/PlayerFunctions.java | 9 ++++++++- PlotSquared/src/com/intellectualcrafters/plot/Plot.java | 1 + .../src/com/intellectualcrafters/plot/PlotSettings.java | 2 ++ .../src/com/intellectualcrafters/plot/commands/Info.java | 4 ++-- .../intellectualcrafters/plot/database/SQLManager.java | 7 ++++++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java index ce0e10ed7..97bec2db9 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java @@ -182,7 +182,14 @@ public class PlayerFunctions { * @return */ 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; } /** diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Plot.java b/PlotSquared/src/com/intellectualcrafters/plot/Plot.java index ddcf159f0..8a7d3bcd2 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/Plot.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/Plot.java @@ -65,6 +65,7 @@ public class Plot implements Cloneable { * Has the plot changed since the last save cycle? */ public boolean hasChanged = false; + public boolean countsTowardsMax = false; /** * Primary constructor diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotSettings.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotSettings.java index 6fdd88f9d..d61617a92 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotSettings.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotSettings.java @@ -10,6 +10,8 @@ package com.intellectualcrafters.plot; import org.bukkit.block.Biome; +import com.intellectualcrafters.plot.database.DBFunc; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java index eea11751a..fb3189988 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java @@ -97,7 +97,7 @@ public class Info extends SubCommand { // Unclaimed? 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; } @@ -162,7 +162,7 @@ public class Info extends SubCommand { String trusted = getPlayerList(plot.trusted); String denied = getPlayerList(plot.denied); 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); String owner = "none"; diff --git a/PlotSquared/src/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/com/intellectualcrafters/plot/database/SQLManager.java index b813adf8e..14b2e6f2b 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/database/SQLManager.java @@ -435,7 +435,12 @@ public class SQLManager extends AbstractDB { for (int i = 0; i < flags.length; i++) { if (flags_string[i].contains(":")) { 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 { flags[i] = new Flag(FlagManager.getFlag(flags_string[i], true), "");