mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix parent set command also adding default
This commit is contained in:
parent
2573f46f40
commit
ebb24aefa1
@ -261,17 +261,17 @@ public class PermissionHolderDelegate implements PermissionHolder {
|
||||
|
||||
@Override
|
||||
public void clearParents() {
|
||||
master.clearParents();
|
||||
master.clearParents(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearParents(String server) {
|
||||
master.clearParents(server);
|
||||
master.clearParents(server, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearParents(String server, String world) {
|
||||
master.clearParents(server, world);
|
||||
master.clearParents(server, world, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,13 +58,13 @@ public class ParentClear extends SharedSubCommand {
|
||||
|
||||
switch (ContextHelper.determine(server, world)) {
|
||||
case NONE:
|
||||
holder.clearParents();
|
||||
holder.clearParents(true);
|
||||
break;
|
||||
case SERVER:
|
||||
holder.clearParents(server);
|
||||
holder.clearParents(server, true);
|
||||
break;
|
||||
case SERVER_AND_WORLD:
|
||||
holder.clearParents(server, world);
|
||||
holder.clearParents(server, world, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class ParentSet extends SharedSubCommand {
|
||||
|
||||
switch (ContextHelper.determine(server, world)) {
|
||||
case NONE:
|
||||
holder.clearParents(null, null);
|
||||
holder.clearParents(null, null, false);
|
||||
|
||||
try {
|
||||
holder.setInheritGroup(group);
|
||||
@ -88,12 +88,11 @@ public class ParentSet extends SharedSubCommand {
|
||||
Message.SET_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), group.getDisplayName());
|
||||
break;
|
||||
case SERVER:
|
||||
holder.clearParents(server, null);
|
||||
holder.clearParents(server, null, false);
|
||||
|
||||
try {
|
||||
holder.setInheritGroup(group, server);
|
||||
} catch (ObjectAlreadyHasException ignored) {
|
||||
}
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
|
||||
if (server.equalsIgnoreCase("global") && holder instanceof User) {
|
||||
((User) holder).getPrimaryGroup().setStoredValue(group.getName());
|
||||
@ -102,7 +101,7 @@ public class ParentSet extends SharedSubCommand {
|
||||
Message.SET_PARENT_SERVER_SUCCESS.send(sender, holder.getFriendlyName(), group.getDisplayName(), server);
|
||||
break;
|
||||
case SERVER_AND_WORLD:
|
||||
holder.clearParents(server, world);
|
||||
holder.clearParents(server, world, false);
|
||||
|
||||
try {
|
||||
holder.setInheritGroup(group, server, world);
|
||||
|
@ -1130,7 +1130,7 @@ public abstract class PermissionHolder {
|
||||
plugin.getApiProvider().getEventFactory().handleNodeClear(this, before, after);
|
||||
}
|
||||
|
||||
public void clearParents() {
|
||||
public void clearParents(boolean giveDefault) {
|
||||
ImmutableSet<Node> before = ImmutableSet.copyOf(getNodes().values());
|
||||
|
||||
synchronized (nodes) {
|
||||
@ -1139,7 +1139,7 @@ public abstract class PermissionHolder {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this instanceof User) {
|
||||
if (this instanceof User && giveDefault) {
|
||||
plugin.getUserManager().giveDefaultIfNeeded((User) this, false);
|
||||
}
|
||||
invalidateCache();
|
||||
@ -1147,7 +1147,7 @@ public abstract class PermissionHolder {
|
||||
plugin.getApiProvider().getEventFactory().handleNodeClear(this, before, after);
|
||||
}
|
||||
|
||||
public void clearParents(String server) {
|
||||
public void clearParents(String server, boolean giveDefault) {
|
||||
String finalServer = Optional.ofNullable(server).orElse("global");
|
||||
|
||||
ImmutableSet<Node> before = ImmutableSet.copyOf(getNodes().values());
|
||||
@ -1159,7 +1159,7 @@ public abstract class PermissionHolder {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this instanceof User) {
|
||||
if (this instanceof User && giveDefault) {
|
||||
plugin.getUserManager().giveDefaultIfNeeded((User) this, false);
|
||||
}
|
||||
invalidateCache();
|
||||
@ -1167,7 +1167,7 @@ public abstract class PermissionHolder {
|
||||
plugin.getApiProvider().getEventFactory().handleNodeClear(this, before, after);
|
||||
}
|
||||
|
||||
public void clearParents(String server, String world) {
|
||||
public void clearParents(String server, String world, boolean giveDefault) {
|
||||
String finalServer = Optional.ofNullable(server).orElse("global");
|
||||
String finalWorld = Optional.ofNullable(world).orElse("null");
|
||||
|
||||
@ -1182,7 +1182,7 @@ public abstract class PermissionHolder {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this instanceof User) {
|
||||
if (this instanceof User && giveDefault) {
|
||||
plugin.getUserManager().giveDefaultIfNeeded((User) this, false);
|
||||
}
|
||||
invalidateCache();
|
||||
|
Loading…
Reference in New Issue
Block a user