Permission for merging with friends

This commit is contained in:
boy0001 2015-07-14 03:42:02 +10:00
parent ab1a89e601
commit f2b0fa43dc
3 changed files with 12 additions and 1 deletions

View File

@ -159,6 +159,10 @@ public class Merge extends SubCommand {
multiUUID.add(u2);
}
if (multiMerge) {
if (!Permissions.hasPermission(plr, Permissions.MERGE_OTHER)) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, Permissions.MERGE_OTHER);
return false;
}
for (final UUID uuid : multiUUID) {
PlotPlayer accepter = UUIDHandler.getPlayer(uuid);
CmdConfirm.addPending(accepter, C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", plr.getName()), new Runnable() {

View File

@ -17,7 +17,9 @@ public enum Permissions {
// BREAK
BREAK_OTHER("plots.admin.break.other", "break"),
BREAK_ROAD("plots.admin.break.road", "break"),
BREAK_UNOWNED("plots.admin.break.unowned", "break");
BREAK_UNOWNED("plots.admin.break.unowned", "break"),
// MERGE
MERGE_OTHER("plots.merge.other", "merge");
public String s;
public String cat;
@ -26,6 +28,10 @@ public enum Permissions {
this.s = perm;
this.cat = cat;
}
public static boolean hasPermission(final PlotPlayer player, final Permissions perm) {
return hasPermission(player, perm.s);
}
public static boolean hasPermission(final PlotPlayer player, final String perm) {
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {

View File

@ -112,6 +112,7 @@ permissions:
plots.set.biome: true
plots.set.home: true
plots.merge: true
plots.merge.other: true
plots.unlink: true
plots.denied: true
plots.add: true