Update API to 4.1

This commit is contained in:
Luck
2018-02-23 22:13:41 +00:00
Unverified
parent 2889c28815
commit 168e712324
18 changed files with 71 additions and 41 deletions
@@ -52,8 +52,7 @@ public final class ApiNodeFactory implements me.lucko.luckperms.api.NodeFactory
@Nonnull
@Override
public Node.Builder newBuilderFromExisting(@Nonnull Node other) {
Objects.requireNonNull(other, "other");
return NodeFactory.builder(other);
return Objects.requireNonNull(other, "other").toBuilder();
}
@Nonnull
@@ -50,7 +50,7 @@ public class ApiPlatformInfo implements PlatformInfo {
@Override
public double getApiVersion() {
return 4.0;
return 4.1;
}
@Nonnull
@@ -55,7 +55,7 @@ public enum CommandSpec {
)
),
DEBUG("Produce debugging output", "/%s debug"),
VERBOSE("Manage verbose permission checking", "/%s verbose <true|false> [filter]",
VERBOSE("Manage verbose permission checking", "/%s verbose <on|record|off|paste> [filter]",
Arg.list(
Arg.create("on|record|off|paste", true, "whether to enable/disable logging, or to paste the logged output"),
Arg.create("filter", false, "the filter to match entries against")
@@ -686,7 +686,7 @@ public abstract class PermissionHolder {
Node previous = existing.get();
// Create a new node with the same properties, but add the expiry dates together
Node newNode = NodeFactory.builder(node).setExpiry(previous.getExpiryUnixTime() + node.getSecondsTilExpiry()).build();
Node newNode = node.toBuilder().setExpiry(previous.getExpiryUnixTime() + node.getSecondsTilExpiry()).build();
// Remove the old node & add the new one.
ImmutableCollection<Node> before = getEnduringNodes().values();
@@ -230,12 +230,7 @@ public abstract class ForwardingNode implements Node {
}
@Override
public String getKey() {
return delegate().getKey();
}
@Override
public Boolean setValue(Boolean value) {
return delegate().setValue(value);
public Builder toBuilder() {
return delegate().toBuilder();
}
}
@@ -162,6 +162,11 @@ public final class ImmutableNode implements Node {
this.hashCode = calculateHashCode();
}
@Override
public Builder toBuilder() {
return new NodeBuilder(this);
}
@Nonnull
@Override
public String getPermission() {
@@ -443,16 +448,6 @@ public final class ImmutableNode implements Node {
public abstract boolean areEqual(@Nonnull ImmutableNode o1, @Nonnull ImmutableNode o2);
}
@Override
public Boolean setValue(Boolean value) {
throw new UnsupportedOperationException();
}
@Override
public String getKey() {
return getPermission();
}
private static String internString(String s) {
return s == null ? null : s.intern();
}
@@ -62,10 +62,6 @@ public final class NodeFactory {
return new NodeBuilder(s);
}
public static Node.Builder builder(Node other) {
return new NodeBuilder(other);
}
public static Node.Builder buildGroupNode(String groupName) {
return new NodeBuilder(groupNode(groupName));
}