mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix illegal argument exception when a proxied Sponge calculator adds an empty context (#780)
This commit is contained in:
parent
31d435dc2b
commit
b1fa4263ed
@ -32,6 +32,25 @@ import java.util.Set;
|
||||
|
||||
abstract class AbstractDelegatingContextSet extends AbstractSet<Context> implements DelegatingContextSet {
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return getDelegate().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return getDelegate().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Context) {
|
||||
Context context = (Context) o;
|
||||
return !context.getKey().isEmpty() && !context.getValue().isEmpty() && getDelegate().has(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getDelegate().hashCode();
|
||||
|
@ -50,25 +50,6 @@ public class DelegatingImmutableContextSet extends AbstractDelegatingContextSet
|
||||
return this.delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.delegate.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.delegate.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Context) {
|
||||
Context context = (Context) o;
|
||||
return this.delegate.has(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<Context> iterator() {
|
||||
|
@ -50,25 +50,6 @@ public class DelegatingMutableContextSet extends AbstractDelegatingContextSet {
|
||||
return this.delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.delegate.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.delegate.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Context) {
|
||||
Context context = (Context) o;
|
||||
return this.delegate.has(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<Context> iterator() {
|
||||
@ -80,6 +61,9 @@ public class DelegatingMutableContextSet extends AbstractDelegatingContextSet {
|
||||
if (context == null) {
|
||||
throw new NullPointerException("context");
|
||||
}
|
||||
if (context.getKey().isEmpty() || context.getValue().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean has = this.delegate.has(context);
|
||||
this.delegate.add(context);
|
||||
@ -90,6 +74,9 @@ public class DelegatingMutableContextSet extends AbstractDelegatingContextSet {
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Context) {
|
||||
Context context = (Context) o;
|
||||
if (context.getKey().isEmpty() || context.getValue().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
boolean had = this.delegate.has(context);
|
||||
this.delegate.remove(context.getKey(), context.getValue());
|
||||
return had;
|
||||
|
Loading…
Reference in New Issue
Block a user