Major restructure: trusted -> plot members, helpers -> trusted

This commit is contained in:
boy0001 2015-05-14 22:55:57 +10:00
parent 9cb06d625d
commit cfe9f28534
30 changed files with 624 additions and 326 deletions

View File

@ -19,6 +19,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.plot.commands.Add;
import com.intellectualcrafters.plot.commands.Auto; import com.intellectualcrafters.plot.commands.Auto;
import com.intellectualcrafters.plot.commands.BukkitCommand; import com.intellectualcrafters.plot.commands.BukkitCommand;
import com.intellectualcrafters.plot.commands.Buy; import com.intellectualcrafters.plot.commands.Buy;
@ -42,10 +43,9 @@ import com.intellectualcrafters.plot.commands.DebugRoadRegen;
import com.intellectualcrafters.plot.commands.DebugSaveTest; import com.intellectualcrafters.plot.commands.DebugSaveTest;
import com.intellectualcrafters.plot.commands.DebugUUID; import com.intellectualcrafters.plot.commands.DebugUUID;
import com.intellectualcrafters.plot.commands.Delete; import com.intellectualcrafters.plot.commands.Delete;
import com.intellectualcrafters.plot.commands.Denied; import com.intellectualcrafters.plot.commands.Deny;
import com.intellectualcrafters.plot.commands.FlagCmd; import com.intellectualcrafters.plot.commands.FlagCmd;
import com.intellectualcrafters.plot.commands.Help; import com.intellectualcrafters.plot.commands.Help;
import com.intellectualcrafters.plot.commands.Helpers;
import com.intellectualcrafters.plot.commands.Home; import com.intellectualcrafters.plot.commands.Home;
import com.intellectualcrafters.plot.commands.Inbox; import com.intellectualcrafters.plot.commands.Inbox;
import com.intellectualcrafters.plot.commands.Info; import com.intellectualcrafters.plot.commands.Info;
@ -59,6 +59,7 @@ import com.intellectualcrafters.plot.commands.Purge;
import com.intellectualcrafters.plot.commands.Rate; import com.intellectualcrafters.plot.commands.Rate;
import com.intellectualcrafters.plot.commands.RegenAllRoads; import com.intellectualcrafters.plot.commands.RegenAllRoads;
import com.intellectualcrafters.plot.commands.Reload; import com.intellectualcrafters.plot.commands.Reload;
import com.intellectualcrafters.plot.commands.Remove;
import com.intellectualcrafters.plot.commands.SchematicCmd; import com.intellectualcrafters.plot.commands.SchematicCmd;
import com.intellectualcrafters.plot.commands.Set; import com.intellectualcrafters.plot.commands.Set;
import com.intellectualcrafters.plot.commands.SetOwner; import com.intellectualcrafters.plot.commands.SetOwner;
@ -68,9 +69,11 @@ import com.intellectualcrafters.plot.commands.TP;
import com.intellectualcrafters.plot.commands.Target; import com.intellectualcrafters.plot.commands.Target;
import com.intellectualcrafters.plot.commands.Template; import com.intellectualcrafters.plot.commands.Template;
import com.intellectualcrafters.plot.commands.Trim; import com.intellectualcrafters.plot.commands.Trim;
import com.intellectualcrafters.plot.commands.Trusted; import com.intellectualcrafters.plot.commands.Trust;
import com.intellectualcrafters.plot.commands.Unclaim; import com.intellectualcrafters.plot.commands.Unclaim;
import com.intellectualcrafters.plot.commands.Undeny;
import com.intellectualcrafters.plot.commands.Unlink; import com.intellectualcrafters.plot.commands.Unlink;
import com.intellectualcrafters.plot.commands.Untrust;
import com.intellectualcrafters.plot.commands.Visit; import com.intellectualcrafters.plot.commands.Visit;
import com.intellectualcrafters.plot.commands.WE_Anywhere; import com.intellectualcrafters.plot.commands.WE_Anywhere;
import com.intellectualcrafters.plot.commands.list; import com.intellectualcrafters.plot.commands.list;
@ -230,9 +233,14 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
MainCommand.subCommands.add(new Clear()); MainCommand.subCommands.add(new Clear());
MainCommand.subCommands.add(new Delete()); MainCommand.subCommands.add(new Delete());
MainCommand.subCommands.add(new SetOwner()); MainCommand.subCommands.add(new SetOwner());
MainCommand.subCommands.add(new Denied());
MainCommand.subCommands.add(new Helpers()); MainCommand.subCommands.add(new Trust());
MainCommand.subCommands.add(new Trusted()); MainCommand.subCommands.add(new Add());
MainCommand.subCommands.add(new Deny());
MainCommand.subCommands.add(new Untrust());
MainCommand.subCommands.add(new Remove());
MainCommand.subCommands.add(new Undeny());
MainCommand.subCommands.add(new Info()); MainCommand.subCommands.add(new Info());
MainCommand.subCommands.add(new list()); MainCommand.subCommands.add(new list());
MainCommand.subCommands.add(new Help()); MainCommand.subCommands.add(new Help());

View File

@ -658,7 +658,7 @@ import com.intellectualcrafters.plot.uuid.UUIDWrapper;
/** /**
* Get the numbers of plots, which the player is able to build in * Get the numbers of plots, which the player is able to build in
* *
* @param player Player, for whom we're getting the plots (trusted, helper and owner) * @param player Player, for whom we're getting the plots (trusted, member and owner)
* *
* @return the number of allowed plots * @return the number of allowed plots
* *

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Add extends SubCommand {
public Add() {
super(Command.ADD, "Allow a user to build while you are online", "add <player>", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot add <player>");
return true;
}
final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT);
}
if ((plot == null) || !plot.hasOwner()) {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.add")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
UUID uuid;
if (args[0].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
} else {
uuid = UUIDHandler.getUUID(args[0]);
}
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false;
}
if (!plot.members.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
}
plot.addMember(uuid);
DBFunc.setMember(loc.getWorld(), plot, uuid);
EventUtil.manager.callMember(plr, plot, uuid, true);
} else {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
MainUtil.sendMessage(plr, C.MEMBER_ADDED);
return true;
}
}

View File

@ -451,10 +451,12 @@ public class Cluster extends SubCommand {
} }
if (args[1].toLowerCase().equals("add")) { if (args[1].toLowerCase().equals("add")) {
cluster.helpers.add(uuid); cluster.helpers.add(uuid);
DBFunc.setHelper(cluster, uuid);
return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
} }
if (args[1].toLowerCase().equals("remove")) { if (args[1].toLowerCase().equals("remove")) {
cluster.helpers.remove(uuid); cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster, uuid);
return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);
} }
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster helpers <add|remove> <player>");

View File

@ -34,12 +34,21 @@ public enum Command {
// (Rating system) (ratings can be stored as the average, and number of // (Rating system) (ratings can be stored as the average, and number of
// ratings) // ratings)
// - /plot rate <number out of 10> // - /plot rate <number out of 10>
MOVE("move", ""),
ADD("add","a"),
TRUST("trust", "t"),
DENY("deny", "d"),
REMOVE("remove", "r"),
UNTRUST("untrust", "ut"),
UNDENY("undeny", "ud"),
MOVE("move"),
FLAG("flag", "f"), FLAG("flag", "f"),
TARGET("target"), TARGET("target"),
CLUSTER("cluster", "clusters"), CLUSTER("cluster", "clusters"),
BUY("buy", "b"), BUY("buy", "b"),
CREATEROADSCHEMATIC("createroadschematic"), CREATEROADSCHEMATIC("createroadschematic", "crs"),
DEBUGROADREGEN("debugroadregen"), DEBUGROADREGEN("debugroadregen"),
DEBUGFIXFLAGS("debugfixflags"), DEBUGFIXFLAGS("debugfixflags"),
REGENALLROADS("regenallroads"), REGENALLROADS("regenallroads"),
@ -51,29 +60,22 @@ public enum Command {
INBOX("inbox"), INBOX("inbox"),
DEBUGCLAIMTEST("debugclaimtest"), DEBUGCLAIMTEST("debugclaimtest"),
COMMENT("comment", "msg"), COMMENT("comment", "msg"),
TRUSTED("trusted", "trust"),
PASTE("paste"), PASTE("paste"),
CLIPBOARD("clipboard", "cboard"), CLIPBOARD("clipboard", "cboard"),
COPY("copy"), COPY("copy"),
KICK("kick", "k"), KICK("kick", "k"),
HELPERS("helpers", "hp"),
DENIED("denied", "dn"),
CLAIM("claim", "c"), CLAIM("claim", "c"),
MERGE("merge", "m"), MERGE("merge", "m"),
UNLINK("unlink", "u"), UNLINK("unlink", "u"),
CLEAR("clear", "clear", new CommandPermission("plots.clear")), CLEAR("clear", "", new CommandPermission("plots.clear")),
DELETE("delete", "d", new CommandPermission("plots.delete")), DELETE("delete", "", new CommandPermission("plots.delete")),
DEBUG("debug", "debug", new CommandPermission("plots.admin")), DEBUG("debug", "", new CommandPermission("plots.admin")),
INTERFACE("interface", "int", new CommandPermission("plots.interface")), INTERFACE("interface", "int", new CommandPermission("plots.interface")),
HOME("home", "h"), HOME("home", "h"),
INFO("info", "i"), INFO("info", "i"),
LIST("list", "l"), LIST("list", "l"),
SET("set", "s"), SET("set", "s"),
PURGE("purge"), PURGE("purge"),
OP("op", "add"),
DEOP("deop", "deadmin"),
BAN("ban", "block"),
UNBAN("unban", "unblock"),
DATABASE("database", "convert"), DATABASE("database", "convert"),
CONFIRM("confirm"), CONFIRM("confirm"),
TP("tp", "tp"), TP("tp", "tp"),

View File

@ -222,8 +222,8 @@ public class DebugUUID extends SubCommand {
if (value != null) { if (value != null) {
plot.owner = value; plot.owner = value;
} }
plot.helpers = new ArrayList<>();
plot.trusted = new ArrayList<>(); plot.trusted = new ArrayList<>();
plot.members = new ArrayList<>();
plot.denied = new ArrayList<>(); plot.denied = new ArrayList<>();
} }

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Deny extends SubCommand {
public Deny() {
super(Command.DENY, "Deny a user from a plot", "deny <player>", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot deny <player>");
return true;
}
final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT);
}
if ((plot == null) || !plot.hasOwner()) {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.deny")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
UUID uuid;
if (args[0].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
} else {
uuid = UUIDHandler.getUUID(args[0]);
}
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false;
}
if (!plot.denied.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.trusted.contains(uuid)) {
plot.trusted.remove(uuid);
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
}
if (plot.members.contains(uuid)) {
plot.members.remove(uuid);
DBFunc.removeMember(loc.getWorld(), plot, uuid);
}
plot.addDenied(uuid);
DBFunc.setDenied(loc.getWorld(), plot, uuid);
EventUtil.manager.callDenied(plr, plot, uuid, true);
} else {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
MainUtil.sendMessage(plr, C.DENIED_ADDED);
return true;
}
}

View File

@ -39,6 +39,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
/** /**
@ -103,8 +104,8 @@ public class Info extends SubCommand {
boolean trustedEveryone; boolean trustedEveryone;
// Wildcard player {added} // Wildcard player {added}
{ {
containsEveryone = (plot.helpers != null) && plot.helpers.contains(DBFunc.everyone); containsEveryone = (plot.trusted != null) && plot.trusted.contains(DBFunc.everyone);
trustedEveryone = (plot.trusted != null) && plot.trusted.contains(DBFunc.everyone); trustedEveryone = (plot.members != null) && plot.members.contains(DBFunc.everyone);
} }
// Unclaimed? // Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) { if (!hasOwner && !containsEveryone && !trustedEveryone) {
@ -122,20 +123,18 @@ public class Info extends SubCommand {
if (args.length == 1) { if (args.length == 1) {
info = getCaption(args[0].toLowerCase()); info = getCaption(args[0].toLowerCase());
if (info == null) { if (info == null) {
MainUtil.sendMessage(player, "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating"); MainUtil.sendMessage(player, "&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating");
return false; return false;
} }
} }
info = format(info, world, plot, player); formatAndSend(info, world, plot, player);
MainUtil.sendMessage(player, C.PLOT_INFO_HEADER);
MainUtil.sendMessage(player, info, false);
return true; return true;
} }
private String getCaption(final String string) { private String getCaption(final String string) {
switch (string) { switch (string) {
case "helpers": case "trusted":
return C.PLOT_INFO_HELPERS.s(); return C.PLOT_INFO_TRUSTED.s();
case "alias": case "alias":
return C.PLOT_INFO_ALIAS.s(); return C.PLOT_INFO_ALIAS.s();
case "biome": case "biome":
@ -148,8 +147,8 @@ public class Info extends SubCommand {
return C.PLOT_INFO_ID.s(); return C.PLOT_INFO_ID.s();
case "size": case "size":
return C.PLOT_INFO_SIZE.s(); return C.PLOT_INFO_SIZE.s();
case "trusted": case "members":
return C.PLOT_INFO_TRUSTED.s(); return C.PLOT_INFO_MEMBERS.s();
case "owner": case "owner":
return C.PLOT_INFO_OWNER.s(); return C.PLOT_INFO_OWNER.s();
case "rating": case "rating":
@ -159,7 +158,7 @@ public class Info extends SubCommand {
} }
} }
private String format(String info, final String world, final Plot plot, final PlotPlayer player) { private String formatAndSend(String info, final String world, final Plot plot, final PlotPlayer player) {
final PlotId id = plot.id; final PlotId id = plot.id;
final PlotId id2 = MainUtil.getTopPlot(plot).id; final PlotId id2 = MainUtil.getTopPlot(plot).id;
final int num = MainUtil.getPlotSelectionIds(id, id2).size(); final int num = MainUtil.getPlotSelectionIds(id, id2).size();
@ -167,10 +166,13 @@ public class Info extends SubCommand {
Location top = MainUtil.getPlotTopLoc(world, plot.id); Location top = MainUtil.getPlotTopLoc(world, plot.id);
Location bot = MainUtil.getPlotBottomLoc(world, plot.id).add(1,0,1); Location bot = MainUtil.getPlotBottomLoc(world, plot.id).add(1,0,1);
final String biome = BlockManager.manager.getBiome(bot.add((top.getX() - bot.getX()) / 2, 0, (top.getX() - bot.getX()) / 2)); final String biome = BlockManager.manager.getBiome(bot.add((top.getX() - bot.getX()) / 2, 0, (top.getX() - bot.getX()) / 2));
final String helpers = getPlayerList(plot.helpers);
final String trusted = getPlayerList(plot.trusted); final String trusted = getPlayerList(plot.trusted);
final String members = getPlayerList(plot.members);
final String denied = getPlayerList(plot.denied); final String denied = getPlayerList(plot.denied);
// TODO async
final String rating = String.format("%.1f", DBFunc.getRatings(plot)); final String rating = String.format("%.1f", DBFunc.getRatings(plot));
final String flags = "&6" + (StringUtils.join(FlagManager.getPlotFlags(plot), "").length() > 0 ? StringUtils.join(FlagManager.getPlotFlags(plot), "&7, &6") : "none"); final String flags = "&6" + (StringUtils.join(FlagManager.getPlotFlags(plot), "").length() > 0 ? StringUtils.join(FlagManager.getPlotFlags(plot), "&7, &6") : "none");
final boolean build = (player == null) || plot.isAdded(player.getUUID()); final boolean build = (player == null) || plot.isAdded(player.getUUID());
String owner = "none"; String owner = "none";
@ -186,14 +188,26 @@ public class Info extends SubCommand {
info = info.replaceAll("%num%", num + ""); info = info.replaceAll("%num%", num + "");
info = info.replaceAll("%biome%", biome); info = info.replaceAll("%biome%", biome);
info = info.replaceAll("%owner%", owner); info = info.replaceAll("%owner%", owner);
info = info.replaceAll("%helpers%", helpers); info = info.replaceAll("%members%", members);
info = info.replaceAll("%trusted%", trusted); info = info.replaceAll("%trusted%", trusted);
info = info.replaceAll("%helpers%", trusted);
info = info.replaceAll("%denied%", denied); info = info.replaceAll("%denied%", denied);
info = info.replaceAll("%rating%", rating); info = info.replaceAll("%rating%", rating);
info = info.replaceAll("%flags%", Matcher.quoteReplacement(flags)); info = info.replaceAll("%flags%", Matcher.quoteReplacement(flags));
info = info.replaceAll("%build%", build + ""); info = info.replaceAll("%build%", build + "");
info = info.replaceAll("%desc%", "No description set."); info = info.replaceAll("%desc%", "No description set.");
return info;
if (info.contains("%rating%")) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
}
});
}
MainUtil.sendMessage(player, C.PLOT_INFO_HEADER);
MainUtil.sendMessage(player, info, false);
} }
private String getPlayerList(final Collection<UUID> uuids) { private String getPlayerList(final Collection<UUID> uuids) {

View File

@ -87,6 +87,7 @@ public class Rate extends SubCommand {
} else { } else {
sendMessage(plr, C.COMMAND_WENT_WRONG); sendMessage(plr, C.COMMAND_WENT_WRONG);
} }
DBFunc.setRating(plot, plr.getUUID(), rating);
return true; return true;
} }
} }

View File

@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
public class Reload extends SubCommand { public class Reload extends SubCommand {
public Reload() { public Reload() {
super("reload", "plots.admin.command.reload", "Reload configurations", "", "reload", CommandCategory.INFO, false); super("reload", "plots.admin.command.reload", "Reload configurations", "reload", CommandCategory.INFO, false);
} }
@Override @Override

View File

@ -20,7 +20,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -28,21 +28,20 @@ import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Denied extends SubCommand { public class Remove extends SubCommand {
public Denied() { public Remove() {
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true); super(Command.REMOVE, "Remove a player from a plot", "remove <player>", CommandCategory.ACTIONS, true);
} }
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length != 1) {
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot remove <player>");
return true; return true;
} }
final Location loc = plr.getLocation(); final Location loc = plr.getLocation();
@ -54,76 +53,89 @@ public class Denied extends SubCommand {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.denied")) { if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.remove")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { int count = 0;
UUID uuid; if (args[0].equals("unknown")) {
if (args[1].equalsIgnoreCase("*")) { Iterator<UUID> i = plot.members.iterator();
uuid = DBFunc.everyone; while (i.hasNext()) {
} else { UUID uuid = i.next();
uuid = UUIDHandler.getUUID(args[1]); if (UUIDHandler.getName(uuid) == null) {
} DBFunc.removeMember(plot.world, plot, uuid);
if (uuid == null) { i.remove();
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]); count++;
return false;
}
if (!plot.denied.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
} }
}
i = plot.trusted.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
if (UUIDHandler.getName(uuid) == null) {
DBFunc.removeTrusted(plot.world, plot, uuid);
i.remove();
count++;
}
}
i = plot.denied.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
if (UUIDHandler.getName(uuid) == null) {
DBFunc.removeDenied(plot.world, plot, uuid);
i.remove();
count++;
}
}
}
else if (args[0].equals("*")){
Iterator<UUID> i = plot.members.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
DBFunc.removeMember(plot.world, plot, uuid);
i.remove();
count++;
}
i = plot.trusted.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
DBFunc.removeTrusted(plot.world, plot, uuid);
i.remove();
count++;
}
i = plot.denied.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
DBFunc.removeDenied(plot.world, plot, uuid);
i.remove();
count++;
}
}
else {
UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
if (plot.trusted.contains(uuid)) { if (plot.trusted.contains(uuid)) {
DBFunc.removeTrusted(plot.world, plot, uuid);
plot.trusted.remove(uuid); plot.trusted.remove(uuid);
DBFunc.removeTrusted(loc.getWorld(), plot, uuid); count++;
} }
if (plot.helpers.contains(uuid)) { else if (plot.members.contains(uuid)) {
plot.helpers.remove(uuid); DBFunc.removeMember(plot.world, plot, uuid);
DBFunc.removeHelper(loc.getWorld(), plot, uuid); plot.members.remove(uuid);
count++;
} }
plot.addDenied(uuid); else if (plot.denied.contains(uuid)) {
DBFunc.setDenied(loc.getWorld(), plot, uuid); DBFunc.removeDenied(plot.world, plot, uuid);
EventUtil.manager.callDenied(plr, plot, uuid, true); plot.denied.remove(uuid);
} else { count++;
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) {
final Plot pl = MainUtil.getPlot(player.getLocation());
if ((pl != null) && pl.id.equals(plot.id)) {
MainUtil.sendMessage(player, C.YOU_BE_DENIED);
player.teleport(BlockManager.manager.getSpawn(loc.getWorld()));
} }
} }
MainUtil.sendMessage(plr, C.DENIED_ADDED); }
return true; if (count == 0) {
} else if (args[0].equalsIgnoreCase("remove")) { MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
if (args[1].equalsIgnoreCase("*")) { return false;
if (plot.denied.size() == 0) { }
MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); else {
return true; MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + "");
}
for (UUID uuid : plot.denied) {
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
}
plot.denied = new ArrayList<>();
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
return true;
}
final UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.denied.contains(uuid)) {
MainUtil.sendMessage(plr, C.WAS_NOT_ADDED);
return true;
}
plot.removeDenied(uuid);
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
EventUtil.manager.callDenied(plr, plot, uuid, false);
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
} else {
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
return true;
} }
return true; return true;
} }

View File

@ -37,7 +37,7 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class SetOwner extends SubCommand { public class SetOwner extends SubCommand {
public SetOwner() { public SetOwner() {
super("setowner", "plots.set.owner", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true); super("setowner", "plots.set.owner", "Set the plot owner", "setowner <player>", "so", CommandCategory.ACTIONS, true);
} }
/* /*

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Trust extends SubCommand {
public Trust() {
super(Command.TRUST, "Allow a player to build in a plot", "trust <player>", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot trust <player>");
return true;
}
final Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT);
}
if ((plot == null) || !plot.hasOwner()) {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false;
}
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.trust")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true;
}
UUID uuid;
if (args[0].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
} else {
uuid = UUIDHandler.getUUID(args[0]);
}
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
return false;
}
if (!plot.trusted.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.members.contains(uuid)) {
plot.members.remove(uuid);
DBFunc.removeMember(loc.getWorld(), plot, uuid);
}
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
}
plot.addTrusted(uuid);
DBFunc.setTrusted(loc.getWorld(), plot, uuid);
EventUtil.manager.callTrusted(plr, plot, uuid, true);
} else {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
MainUtil.sendMessage(plr, C.TRUSTED_ADDED);
return true;
}
}

View File

@ -20,7 +20,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -33,16 +33,15 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
@SuppressWarnings("deprecation") public class Undeny extends SubCommand {
public class Trusted extends SubCommand { public Undeny() {
public Trusted() { super(Command.UNDENY, "Remove a denied user from a plot", "undeny <player>", CommandCategory.ACTIONS, true);
super(Command.TRUSTED, "Manage trusted users for a plot", "trusted {add|remove} {player}", CommandCategory.ACTIONS, true);
} }
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length != 1) {
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot undeny <player>");
return true; return true;
} }
final Location loc = plr.getLocation(); final Location loc = plr.getLocation();
@ -54,68 +53,48 @@ public class Trusted extends SubCommand {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.trusted")) { if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.undeny")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { int count = 0;
UUID uuid; if (args[0].equals("unknown")) {
if (args[1].equalsIgnoreCase("*")) { Iterator<UUID> i = plot.denied.iterator();
uuid = DBFunc.everyone; i = plot.denied.iterator();
} else { while (i.hasNext()) {
uuid = UUIDHandler.getUUID(args[1]); UUID uuid = i.next();
} if (UUIDHandler.getName(uuid) == null) {
if (uuid == null) { DBFunc.removeDenied(plot.world, plot, uuid);
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]); i.remove();
return false; count++;
}
if (!plot.trusted.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
}
if (plot.helpers.contains(uuid)) {
plot.helpers.remove(uuid);
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
} }
}
}
else if (args[0].equals("*")){
Iterator<UUID> i = plot.denied.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
DBFunc.removeDenied(plot.world, plot, uuid);
i.remove();
count++;
}
}
else {
UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
if (plot.denied.contains(uuid)) { if (plot.denied.contains(uuid)) {
DBFunc.removeDenied(plot.world, plot, uuid);
plot.denied.remove(uuid); plot.denied.remove(uuid);
DBFunc.removeDenied(loc.getWorld(), plot, uuid); count++;
} }
plot.addTrusted(uuid);
DBFunc.setTrusted(loc.getWorld(), plot, uuid);
EventUtil.manager.callTrusted(plr, plot, uuid, true);
} else {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
} }
MainUtil.sendMessage(plr, C.TRUSTED_ADDED); }
return true; if (count == 0) {
} else if (args[0].equalsIgnoreCase("remove")) { MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
if (args[1].equalsIgnoreCase("*")) { return false;
if (plot.trusted.size() == 0) { }
MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); else {
return true; MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + "");
}
for (UUID uuid : plot.trusted) {
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
}
plot.trusted = new ArrayList<>();
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
return true;
}
final UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.trusted.contains(uuid)) {
MainUtil.sendMessage(plr, C.T_WAS_NOT_ADDED);
return true;
}
plot.removeTrusted(uuid);
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
EventUtil.manager.callTrusted(plr, plot, uuid, false);
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
} else {
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
return true;
} }
return true; return true;
} }

View File

@ -20,7 +20,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -33,15 +33,15 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
public class Helpers extends SubCommand { public class Untrust extends SubCommand {
public Helpers() { public Untrust() {
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS, true); super(Command.UNTRUST, "Remove a trusted user from a plot", "untrust <player>", CommandCategory.ACTIONS, true);
} }
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
if (args.length < 2) { if (args.length != 1) {
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot untrust <player>");
return true; return true;
} }
final Location loc = plr.getLocation(); final Location loc = plr.getLocation();
@ -53,68 +53,48 @@ public class Helpers extends SubCommand {
MainUtil.sendMessage(plr, C.PLOT_UNOWNED); MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.helpers")) { if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.untrust")) {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS); MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
if (args[0].equalsIgnoreCase("add")) { int count = 0;
UUID uuid; if (args[0].equals("unknown")) {
if (args[1].equalsIgnoreCase("*")) { Iterator<UUID> i = plot.trusted.iterator();
uuid = DBFunc.everyone; i = plot.trusted.iterator();
} else { while (i.hasNext()) {
uuid = UUIDHandler.getUUID(args[1]); UUID uuid = i.next();
} if (UUIDHandler.getName(uuid) == null) {
if (uuid == null) { DBFunc.removeTrusted(plot.world, plot, uuid);
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[1]); i.remove();
return false; count++;
}
if (!plot.helpers.contains(uuid)) {
if (plot.isOwner(uuid)) {
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
return false;
} }
}
}
else if (args[0].equals("*")){
Iterator<UUID> i = plot.trusted.iterator();
while (i.hasNext()) {
UUID uuid = i.next();
DBFunc.removeTrusted(plot.world, plot, uuid);
i.remove();
count++;
}
}
else {
UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
if (plot.trusted.contains(uuid)) { if (plot.trusted.contains(uuid)) {
DBFunc.removeTrusted(plot.world, plot, uuid);
plot.trusted.remove(uuid); plot.trusted.remove(uuid);
DBFunc.removeTrusted(loc.getWorld(), plot, uuid); count++;
} }
if (plot.denied.contains(uuid)) {
plot.denied.remove(uuid);
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
}
plot.addHelper(uuid);
DBFunc.setHelper(loc.getWorld(), plot, uuid);
EventUtil.manager.callHelper(plr, plot, uuid, true);
} else {
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
return false;
} }
MainUtil.sendMessage(plr, C.HELPER_ADDED); }
return true; if (count == 0) {
} else if (args[0].equalsIgnoreCase("remove")) { MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
if (args[1].equalsIgnoreCase("*")) { return false;
if (plot.helpers.size() == 0) { }
MainUtil.sendMessage(plr, C.WAS_NOT_ADDED); else {
return true; MainUtil.sendMessage(plr, C.REMOVED_PLAYERS, count + "");
}
for (UUID uuid : plot.helpers) {
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
}
plot.helpers = new ArrayList<>();
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
return true;
}
final UUID uuid = UUIDHandler.getUUID(args[1]);
if (!plot.helpers.contains(uuid)) {
MainUtil.sendMessage(plr, C.WAS_NOT_ADDED);
return false;
}
plot.removeHelper(uuid);
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
EventUtil.manager.callHelper(plr, plot, uuid, false);
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
} else {
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
return true;
} }
return true; return true;
} }

View File

@ -130,7 +130,7 @@ public class list extends SubCommand {
} }
plots = new ArrayList<Plot>(); plots = new ArrayList<Plot>();
for (Plot plot : PlotSquared.getPlots()) { for (Plot plot : PlotSquared.getPlots()) {
if (plot.helpers.contains(plr.getUUID()) || plot.trusted.contains(plr.getUUID())) { if (plot.trusted.contains(plr.getUUID()) || plot.members.contains(plr.getUUID())) {
plots.add(plot); plots.add(plot);
} }
} }

View File

@ -53,7 +53,7 @@ public enum C {
/* /*
* Cluster * Cluster
*/ */
CLUSTER_AVAILABLE_ARGS("$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, $4helpers$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_AVAILABLE_ARGS("$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, $4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"),
CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"), CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"),
CLUSTER_LIST_ELEMENT("$2 - $1%s\n", "Cluster"), CLUSTER_LIST_ELEMENT("$2 - $1%s\n", "Cluster"),
CLUSTER_INTERSECTION("$2The proposed area overlaps with $1%s$2 existing cluster/s", "Cluster"), CLUSTER_INTERSECTION("$2The proposed area overlaps with $1%s$2 existing cluster/s", "Cluster"),
@ -69,7 +69,7 @@ public enum C {
CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster", "Cluster"), CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster", "Cluster"),
CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving", "Cluster"), CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving", "Cluster"),
CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", "Cluster"), CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster", "Cluster"),
CLUSTER_REMOVED_HELPER("$4Successfully removed a helper to the cluster", "Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"),
CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"),
CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
CLUSTER_INFO("$1Current cluster: $2%id%\n$1Name: $2%name%\n$1Owner: $2%owner%\n$1Size: $2%size%\n$1Rights: $2%rights%", "Cluster"), CLUSTER_INFO("$1Current cluster: $2%id%\n$1Name: $2%name%\n$1Owner: $2%owner%\n$1Size: $2%size%\n$1Rights: $2%rights%", "Cluster"),
@ -337,24 +337,10 @@ public enum C {
*/ */
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"), PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
/*
* PLOT_INFO("" +
* "$1ID$2: $4%id%$2\n" +
* "$1Alias$2: $4%alias%\n" +
* "$1Owner$2: $4%owner%\n" +
* "$1Helpers$2: $4%helpers%\n" +
* "$1Trusted$2: $4%trusted%\n" +
* "$1Denied$2: $4%denied%\n" +
* "$1Flags$2: $4%flags%\n" +
* "$1Biome$2: $4%biome%\n" +
* "$1Rating$2: $4%rating%$2/$410\n" +
* "$1Can build$2: $4%build%"
* ),
*/
PLOT_INFO_HEADER("$3====== $1INFO $3======", false, "Info"), PLOT_INFO_HEADER("$3====== $1INFO $3======", false, "Info"),
PLOT_INFO("$1ID: $2%id%$1\n" + "$1Alias: $2%alias%$1\n" + "$1Owner: $2%owner%$1\n" + "$1Biome: $2%biome%$1\n" + "$1Can Build: $2%build%$1\n" + "$1Rating: $2%rating%$1/$210$1\n" + "$1Helpers: $2%helpers%$1\n" + "$1Trusted: $2%trusted%$1\n" + "$1Denied: $2%denied%$1\n" + "$1Flags: $2%flags%", "Info"), PLOT_INFO("$1ID: $2%id%$1\n" + "$1Alias: $2%alias%$1\n" + "$1Owner: $2%owner%$1\n" + "$1Biome: $2%biome%$1\n" + "$1Can Build: $2%build%$1\n" + "$1Rating: $2%rating%$1/$210$1\n" + "$1Trusted: $2%trusted%$1\n" + "$1Members: $2%members%$1\n" + "$1Denied: $2%denied%$1\n" + "$1Flags: $2%flags%", "Info"),
PLOT_INFO_HELPERS("$1Helpers:$2 %helpers%", "Info"),
PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"),
PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"),
PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"),
PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"), PLOT_INFO_FLAGS("$1Flags:$2 %flags%", "Info"),
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"), PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"),
@ -433,23 +419,22 @@ public enum C {
FLAG_NOT_ADDED("$2The flag could not be added", "Flag"), FLAG_NOT_ADDED("$2The flag could not be added", "Flag"),
FLAG_REMOVED("$4Successfully removed flag", "Flag"), FLAG_REMOVED("$4Successfully removed flag", "Flag"),
FLAG_ADDED("$4Successfully added flag", "Flag"), FLAG_ADDED("$4Successfully added flag", "Flag"),
/*
* Helper
*/
HELPER_ADDED("$4You successfully added a helper to the plot", "Helper"),
HELPER_REMOVED("$4You successfully removed a helper from the plot", "Helper"),
HELPER_NEED_ARGUMENT("$2Arguments are missing. $1/plot helpers add <name> $2or $1/plot helpers remove <name>", "Helper"),
WAS_NOT_ADDED("$2That player was not added as a helper on this plot", "Helper"),
PLOT_REMOVED_HELPER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Helper"),
/* /*
* Trusted * Trusted
*/ */
ALREADY_OWNER("$2That user is already the plot owner.", "Trusted"), TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"),
ALREADY_ADDED("$2That user is already added to that category.", "Trusted"), TRUSTED_REMOVED("$4You successfully removed a trusted user from the plot", "Trusted"),
TRUSTED_ADDED("$4You successfully added a trusted user to the plot", "Trusted"), WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"),
TRUSTED_REMOVED("$1You successfully removed a trusted user from the plot", "Trusted"), PLOT_REMOVED_USER("$1Plot %s of which you were added to has been deleted due to owner inactivity", "Trusted"),
TRUSTED_NEED_ARGUMENT("$2Arguments are missing. $1/plot trusted add <name> $2or $1/plot trusted remove <name>", "Trusted"), /*
T_WAS_NOT_ADDED("$2That player was not added as a trusted user on this plot", "Trusted"), * Member
*/
REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"),
ALREADY_OWNER("$2That user is already the plot owner.", "Member"),
ALREADY_ADDED("$2That user is already added to that category.", "Member"),
MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"),
MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"),
MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"),
/* /*
* Set Owner * Set Owner
*/ */

View File

@ -219,7 +219,7 @@ public interface AbstractDB {
* @param plot Plot Object * @param plot Plot Object
* @param uuid Player that should be removed * @param uuid Player that should be removed
*/ */
public void removeHelper(final String world, final Plot plot, final UUID uuid); public void removeTrusted(final String world, final Plot plot, final UUID uuid);
/** /**
* @param cluster PlotCluster Object * @param cluster PlotCluster Object
@ -231,7 +231,7 @@ public interface AbstractDB {
* @param plot Plot Object * @param plot Plot Object
* @param uuid Player that should be removed * @param uuid Player that should be removed
*/ */
public void removeTrusted(final String world, final Plot plot, final UUID uuid); public void removeMember(final String world, final Plot plot, final UUID uuid);
/** /**
* *
@ -244,7 +244,7 @@ public interface AbstractDB {
* @param plot Plot Object * @param plot Plot Object
* @param uuid Player that should be removed * @param uuid Player that should be removed
*/ */
public void setHelper(final String world, final Plot plot, final UUID uuid); public void setTrusted(final String world, final Plot plot, final UUID uuid);
/** /**
* @param cluster PlotCluster Object * @param cluster PlotCluster Object
@ -256,7 +256,7 @@ public interface AbstractDB {
* @param plot Plot Object * @param plot Plot Object
* @param uuid Player that should be added * @param uuid Player that should be added
*/ */
public void setTrusted(final String world, final Plot plot, final UUID uuid); public void setMember(final String world, final Plot plot, final UUID uuid);
/** /**
* *
@ -287,6 +287,14 @@ public interface AbstractDB {
*/ */
public double getRatings(final Plot plot); public double getRatings(final Plot plot);
/**
* Set a rating for a plot
* @param plot
* @param rater
* @param value
*/
public void setRating(final Plot plot, UUID rater, int value);
/** /**
* Remove a plot comment * Remove a plot comment
* *

View File

@ -90,7 +90,7 @@ public class DBFunc {
} }
/** /**
* Create all settings + (helpers, denied, trusted) * Create all settings + (trusted, denied, members)
* *
* @param plots List containing all plot objects * @param plots List containing all plot objects
*/ */
@ -253,8 +253,8 @@ public class DBFunc {
* @param plot * @param plot
* @param uuid * @param uuid
*/ */
public static void removeHelper(final String world, final Plot plot, final UUID uuid) { public static void removeTrusted(final String world, final Plot plot, final UUID uuid) {
dbManager.removeHelper(world, plot, uuid); dbManager.removeTrusted(world, plot, uuid);
} }
/** /**
@ -285,8 +285,8 @@ public class DBFunc {
* @param plot * @param plot
* @param uuid * @param uuid
*/ */
public static void removeTrusted(final String world, final Plot plot, final UUID uuid) { public static void removeMember(final String world, final Plot plot, final UUID uuid) {
dbManager.removeTrusted(world, plot, uuid); dbManager.removeMember(world, plot, uuid);
} }
/** /**
@ -303,8 +303,8 @@ public class DBFunc {
* @param plot * @param plot
* @param uuid * @param uuid
*/ */
public static void setHelper(final String world, final Plot plot, final UUID uuid) { public static void setTrusted(final String world, final Plot plot, final UUID uuid) {
dbManager.setHelper(world, plot, uuid); dbManager.setTrusted(world, plot, uuid);
} }
public static void setHelper(final PlotCluster cluster, final UUID uuid) { public static void setHelper(final PlotCluster cluster, final UUID uuid) {
@ -316,8 +316,8 @@ public class DBFunc {
* @param plot * @param plot
* @param uuid * @param uuid
*/ */
public static void setTrusted(final String world, final Plot plot, final UUID uuid) { public static void setMember(final String world, final Plot plot, final UUID uuid) {
dbManager.setTrusted(world, plot, uuid); dbManager.setMember(world, plot, uuid);
} }
public static void setInvited(final String world, final PlotCluster cluster, final UUID uuid) { public static void setInvited(final String world, final PlotCluster cluster, final UUID uuid) {
@ -346,6 +346,10 @@ public class DBFunc {
return dbManager.getRatings(plot); return dbManager.getRatings(plot);
} }
public static void setRating(Plot plot, UUID rater, int value) {
dbManager.setRating(plot, rater, value);
}
public static HashMap<String, HashSet<PlotCluster>> getClusters() { public static HashMap<String, HashSet<PlotCluster>> getClusters() {
return dbManager.getClusters(); return dbManager.getClusters();
} }

View File

@ -193,13 +193,13 @@ public class SQLManager implements AbstractDB {
denied.add(new UUIDPair(id, uuid)); denied.add(new UUIDPair(id, uuid));
} }
} }
if (plot.trusted != null) { if (plot.members != null) {
for (UUID uuid : plot.trusted) { for (UUID uuid : plot.members) {
trusted.add(new UUIDPair(id, uuid)); trusted.add(new UUIDPair(id, uuid));
} }
} }
if (plot.helpers != null) { if (plot.trusted != null) {
for (UUID uuid : plot.helpers) { for (UUID uuid : plot.trusted) {
helpers.add(new UUIDPair(id, uuid)); helpers.add(new UUIDPair(id, uuid));
} }
} }
@ -835,7 +835,7 @@ public class SQLManager implements AbstractDB {
} }
final Plot plot = plots.get(id); final Plot plot = plots.get(id);
if (plot != null) { if (plot != null) {
plot.addHelper(user); plot.addTrusted(user);
} else { } else {
PlotSquared.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
} }
@ -854,7 +854,7 @@ public class SQLManager implements AbstractDB {
} }
final Plot plot = plots.get(id); final Plot plot = plots.get(id);
if (plot != null) { if (plot != null) {
plot.addTrusted(user); plot.addMember(user);
} else { } else {
PlotSquared.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
} }
@ -1409,7 +1409,7 @@ public class SQLManager implements AbstractDB {
} }
@Override @Override
public void removeHelper(final String world, final Plot plot, final UUID uuid) { public void removeTrusted(final String world, final Plot plot, final UUID uuid) {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1428,7 +1428,7 @@ public class SQLManager implements AbstractDB {
} }
@Override @Override
public void removeTrusted(final String world, final Plot plot, final UUID uuid) { public void removeMember(final String world, final Plot plot, final UUID uuid) {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1447,7 +1447,7 @@ public class SQLManager implements AbstractDB {
} }
@Override @Override
public void setHelper(final String world, final Plot plot, final UUID uuid) { public void setTrusted(final String world, final Plot plot, final UUID uuid) {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1484,7 +1484,7 @@ public class SQLManager implements AbstractDB {
} }
@Override @Override
public void setTrusted(final String world, final Plot plot, final UUID uuid) { public void setMember(final String world, final Plot plot, final UUID uuid) {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1560,6 +1560,27 @@ public class SQLManager implements AbstractDB {
return 0.0d; return 0.0d;
} }
@Override
public void setRating(final Plot plot, final UUID rater, final int value) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
try {
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT IGNORE INTO `" + SQLManager.this.prefix + "plot_ratings` (`plot_plot_id`, `rating`, `player`) VALUES(?,?,?)");
statement.setInt(1, getId(plot.world, plot.id));
statement.setInt(2, value);
statement.setString(3, rater.toString());
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
PlotSquared.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
}
});
}
@Override @Override
public void delete(final PlotCluster cluster) { public void delete(final PlotCluster cluster) {
ClusterManager.removeCluster(cluster); ClusterManager.removeCluster(cluster);

View File

@ -230,7 +230,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
} }
} }
if (plots.get(world).containsKey(id)) { if (plots.get(world).containsKey(id)) {
plots.get(world).get(id).helpers.add(helper); plots.get(world).get(id).trusted.add(helper);
} }
} }

View File

@ -27,7 +27,7 @@ public class WEManager {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
for (Plot plot : PlotSquared.getPlots(player.getLocation().getWorld()).values()) { for (Plot plot : PlotSquared.getPlots(player.getLocation().getWorld()).values()) {
if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) { if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) {
if (plot.isOwner(uuid) || plot.helpers.contains(uuid)) { if (plot.isOwner(uuid) || plot.trusted.contains(uuid)) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id); Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
regions.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ())); regions.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()));

View File

@ -53,13 +53,13 @@ public class InfoInventory implements InventoryHolder {
public InfoInventory build() { public InfoInventory build() {
final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(this.player)); final UUID uuid = UUIDHandler.getUUID(BukkitUtil.getPlayer(this.player));
final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.owner), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid)); final ItemStack generalInfo = getItem(Material.EMERALD, "&cPlot Info", "&cID: &6" + this.plot.getId().toString(), "&cOwner: &6" + getName(this.plot.owner), "&cAlias: &6" + this.plot.settings.getAlias(), "&cBiome: &6" + this.plot.settings.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + this.plot.isAdded(uuid), "&cIs Denied: &6" + this.plot.isDenied(uuid));
final ItemStack helpers = getItem(Material.EMERALD, "&cHelpers", "&cAmount: &6" + this.plot.helpers.size(), "&8Click to view a list of the plot helpers"); final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of the trusted users");
final ItemStack trusted = getItem(Material.EMERALD, "&cTrusted", "&cAmount: &6" + this.plot.trusted.size(), "&8Click to view a list of trusted players"); final ItemStack members = getItem(Material.EMERALD, "&cMembers", "&cAmount: &6" + this.plot.members.size(), "&8Click to view a list of plot members");
final ItemStack denied = getItem(Material.EMERALD, "&cDenied", "&cAmount: &6" + this.plot.denied.size(), "&8Click to view a list of denied players"); final ItemStack denied = getItem(Material.EMERALD, "&cDenied", "&cAmount: &6" + this.plot.denied.size(), "&8Click to view a list of denied players");
final ItemStack flags = getItem(Material.EMERALD, "&cFlags", "&cAmount: &6" + this.plot.settings.flags.size(), "&8Click to view a list of plot flags"); final ItemStack flags = getItem(Material.EMERALD, "&cFlags", "&cAmount: &6" + this.plot.settings.flags.size(), "&8Click to view a list of plot flags");
this.inventory.setItem(2, generalInfo); this.inventory.setItem(2, generalInfo);
this.inventory.setItem(3, helpers); this.inventory.setItem(3, trusted);
this.inventory.setItem(4, trusted); this.inventory.setItem(4, members);
this.inventory.setItem(5, denied); this.inventory.setItem(5, denied);
this.inventory.setItem(6, flags); this.inventory.setItem(6, flags);
return this; return this;

View File

@ -53,13 +53,13 @@ public class Plot implements Cloneable {
*/ */
public boolean deny_entry; public boolean deny_entry;
/** /**
* List of helpers (with plot permissions) * List of trusted (with plot permissions)
*/
public ArrayList<UUID> helpers;
/**
* List of trusted users (with plot permissions)
*/ */
public ArrayList<UUID> trusted; public ArrayList<UUID> trusted;
/**
* List of members users (with plot permissions)
*/
public ArrayList<UUID> members;
/** /**
* List of denied players * List of denied players
*/ */
@ -83,17 +83,17 @@ public class Plot implements Cloneable {
* *
* @param id * @param id
* @param owner * @param owner
* @param helpers * @param trusted
* @param denied * @param denied
*/ */
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) { public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String world) {
this.id = id; this.id = id;
this.settings = new PlotSettings(this); this.settings = new PlotSettings(this);
this.owner = owner; this.owner = owner;
this.deny_entry = this.owner == null; this.deny_entry = this.owner == null;
this.helpers = helpers; this.trusted = trusted;
this.denied = denied; this.denied = denied;
this.trusted = new ArrayList<>(); this.members = new ArrayList<>();
this.settings.setAlias(""); this.settings.setAlias("");
this.delete = false; this.delete = false;
this.settings.flags = new HashSet<Flag>(); this.settings.flags = new HashSet<Flag>();
@ -105,17 +105,17 @@ public class Plot implements Cloneable {
* *
* @param id * @param id
* @param owner * @param owner
* @param helpers * @param trusted
* @param denied * @param denied
* @param merged * @param merged
*/ */
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final BlockLoc position, final Set<Flag> flags, final String world, final boolean[] merged) { public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> trusted, final ArrayList<UUID> members, final ArrayList<UUID> denied, final String alias, final BlockLoc position, final Set<Flag> flags, final String world, final boolean[] merged) {
this.id = id; this.id = id;
this.settings = new PlotSettings(this); this.settings = new PlotSettings(this);
this.owner = owner; this.owner = owner;
this.deny_entry = this.owner != null; this.deny_entry = this.owner != null;
this.members = members;
this.trusted = trusted; this.trusted = trusted;
this.helpers = helpers;
this.denied = denied; this.denied = denied;
this.settings.setAlias(alias); this.settings.setAlias(alias);
this.settings.setPosition(position); this.settings.setPosition(position);
@ -151,7 +151,7 @@ public class Plot implements Cloneable {
} }
/** /**
* Check if the player is either the owner or on the helpers list * Check if the player is either the owner or on the trusted list
* *
* @param uuid * @param uuid
* *
@ -188,7 +188,7 @@ public class Plot implements Cloneable {
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
final Plot p = (Plot) super.clone(); final Plot p = (Plot) super.clone();
if (!p.equals(this) || (p != this)) { if (!p.equals(this) || (p != this)) {
return new Plot(this.id, this.owner, this.helpers, this.trusted, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, this.world, this.settings.getMerged()); return new Plot(this.id, this.owner, this.trusted, this.members, this.denied, this.settings.getAlias(), this.settings.getPosition(), this.settings.flags, this.world, this.settings.getMerged());
} }
return p; return p;
} }
@ -207,8 +207,8 @@ public class Plot implements Cloneable {
* *
* @param uuid * @param uuid
*/ */
public void addHelper(final UUID uuid) { public void addTrusted(final UUID uuid) {
this.helpers.add(uuid); this.trusted.add(uuid);
} }
/** /**
@ -216,8 +216,8 @@ public class Plot implements Cloneable {
* *
* @param uuid * @param uuid
*/ */
public void addTrusted(final UUID uuid) { public void addMember(final UUID uuid) {
this.trusted.add(uuid); this.members.add(uuid);
} }
/** /**
@ -248,7 +248,7 @@ public class Plot implements Cloneable {
* @param uuid * @param uuid
*/ */
public void removeHelper(final UUID uuid) { public void removeHelper(final UUID uuid) {
this.helpers.remove(uuid); this.trusted.remove(uuid);
} }
/** /**
@ -257,7 +257,7 @@ public class Plot implements Cloneable {
* @param uuid * @param uuid
*/ */
public void removeTrusted(final UUID uuid) { public void removeTrusted(final UUID uuid) {
this.trusted.remove(uuid); this.members.remove(uuid);
} }
@Override @Override

View File

@ -85,10 +85,10 @@ public class PlotHandler {
if (plot.denied.contains(uuid)) { if (plot.denied.contains(uuid)) {
return false; return false;
} }
if (plot.helpers.contains(uuid) || plot.helpers.contains(DBFunc.everyone)) { if (plot.trusted.contains(uuid) || plot.trusted.contains(DBFunc.everyone)) {
return true; return true;
} }
if (plot.trusted.contains(uuid) || plot.trusted.contains(DBFunc.everyone)) { if (plot.members.contains(uuid) || plot.members.contains(DBFunc.everyone)) {
if (PlotHandler.isOnline(plot)) { if (PlotHandler.isOnline(plot)) {
return true; return true;
} }

View File

@ -45,7 +45,7 @@ public abstract class EventUtil {
public abstract void callDenied(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added); public abstract void callDenied(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
public abstract void callHelper(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
public abstract void callTrusted(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added); public abstract void callTrusted(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
public abstract void callMember(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
} }

View File

@ -94,10 +94,16 @@ public class ExpireManager {
} }
final PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id); final PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
for (final UUID helper : plot.helpers) { for (final UUID helper : plot.trusted) {
final PlotPlayer player = UUIDHandler.getPlayer(helper); final PlotPlayer player = UUIDHandler.getPlayer(helper);
if (player != null) { if (player != null) {
MainUtil.sendMessage(player, C.PLOT_REMOVED_HELPER, plot.id.toString()); MainUtil.sendMessage(player, C.PLOT_REMOVED_USER, plot.id.toString());
}
}
for (final UUID helper : plot.members) {
final PlotPlayer player = UUIDHandler.getPlayer(helper);
if (player != null) {
MainUtil.sendMessage(player, C.PLOT_REMOVED_USER, plot.id.toString());
} }
} }
final PlotManager manager = PlotSquared.getPlotManager(world); final PlotManager manager = PlotSquared.getPlotManager(world);

View File

@ -84,8 +84,8 @@ public class MainUtil {
if (plot == null) { if (plot == null) {
continue; continue;
} }
if (plot.helpers != null) { if (plot.trusted != null) {
myplot.helpers = plot.helpers; myplot.trusted = plot.trusted;
} }
if (plot.denied != null) { if (plot.denied != null) {
myplot.denied = plot.denied; myplot.denied = plot.denied;
@ -1162,20 +1162,20 @@ public class MainUtil {
plot.settings.setMerged(currentPlot.settings.getMerged()); plot.settings.setMerged(currentPlot.settings.getMerged());
DBFunc.setMerged(world, plot, currentPlot.settings.getMerged()); DBFunc.setMerged(world, plot, currentPlot.settings.getMerged());
} }
if (currentPlot.members != null && currentPlot.members.size() > 0) {
plot.members = currentPlot.members;
for (UUID member : plot.members) {
DBFunc.setMember(world, plot, member);
}
}
if (currentPlot.trusted != null && currentPlot.trusted.size() > 0) { if (currentPlot.trusted != null && currentPlot.trusted.size() > 0) {
plot.trusted = currentPlot.trusted; plot.members = currentPlot.trusted;
for (UUID trusted : plot.trusted) { for (UUID trusted : plot.trusted) {
DBFunc.setTrusted(world, plot, trusted); DBFunc.setTrusted(world, plot, trusted);
} }
} }
if (currentPlot.helpers != null && currentPlot.helpers.size() > 0) {
plot.trusted = currentPlot.helpers;
for (UUID helpers : plot.helpers) {
DBFunc.setHelper(world, plot, helpers);
}
}
if (currentPlot.denied != null && currentPlot.denied.size() > 0) { if (currentPlot.denied != null && currentPlot.denied.size() > 0) {
plot.trusted = currentPlot.denied; plot.members = currentPlot.denied;
for (UUID denied : plot.denied) { for (UUID denied : plot.denied) {
DBFunc.setDenied(world, plot, denied); DBFunc.setDenied(world, plot, denied);
} }

View File

@ -99,12 +99,12 @@ public class BukkitEventUtil extends EventUtil {
} }
@Override @Override
public void callHelper(PlotPlayer initiator, Plot plot, UUID player, boolean added) { public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
} }
@Override @Override
public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added));
} }

View File

@ -90,10 +90,10 @@ public class UUIDHandler {
public static HashSet<UUID> getAllUUIDS() { public static HashSet<UUID> getAllUUIDS() {
HashSet<UUID> uuids = new HashSet<UUID>(); HashSet<UUID> uuids = new HashSet<UUID>();
for (Plot plot : PlotSquared.getPlotsRaw()) { for (Plot plot : PlotSquared.getPlotsRaw()) {
for (UUID uuid : plot.helpers) { for (UUID uuid : plot.trusted) {
uuids.add(uuid); uuids.add(uuid);
} }
for (UUID uuid : plot.trusted) { for (UUID uuid : plot.members) {
uuids.add(uuid); uuids.add(uuid);
} }
for (UUID uuid : plot.denied) { for (UUID uuid : plot.denied) {