mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-01 14:07:56 +01:00
Some misc cleanup
This commit is contained in:
parent
8754123535
commit
11998b2dd6
@ -60,10 +60,7 @@ public enum DataQueryOrder implements Comparator<DataType> {
|
|||||||
if (o1 == o2) {
|
if (o1 == o2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Boolean.compare(
|
return o1 == DataType.TRANSIENT ? 1 : -1;
|
||||||
o1 == DataType.TRANSIENT,
|
|
||||||
o2 == DataType.TRANSIENT
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -76,10 +73,7 @@ public enum DataQueryOrder implements Comparator<DataType> {
|
|||||||
if (o1 == o2) {
|
if (o1 == o2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return -Boolean.compare(
|
return o1 == DataType.TRANSIENT ? -1 : 1;
|
||||||
o1 == DataType.TRANSIENT,
|
|
||||||
o2 == DataType.TRANSIENT
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
|||||||
|
|
||||||
private static boolean checkIncompatibleVersion() {
|
private static boolean checkIncompatibleVersion() {
|
||||||
try {
|
try {
|
||||||
Class<?> aClass = Class.forName("com.google.gson.internal.bind.TreeTypeAdapter");
|
Class.forName("com.google.gson.internal.bind.TreeTypeAdapter");
|
||||||
return false;
|
return false;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -250,36 +250,43 @@ public class LoggedAction implements Action {
|
|||||||
private Target.Type targetType = null;
|
private Target.Type targetType = null;
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder timestamp(@NonNull Instant timestamp) {
|
public @NonNull Builder timestamp(@NonNull Instant timestamp) {
|
||||||
this.timestamp = timestamp.getEpochSecond();
|
this.timestamp = timestamp.getEpochSecond();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder source(@NonNull UUID source) {
|
public @NonNull Builder source(@NonNull UUID source) {
|
||||||
this.sourceUniqueId = Objects.requireNonNull(source, "source");
|
this.sourceUniqueId = Objects.requireNonNull(source, "source");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder sourceName(@NonNull String sourceName) {
|
public @NonNull Builder sourceName(@NonNull String sourceName) {
|
||||||
this.sourceName = Objects.requireNonNull(sourceName, "sourceName");
|
this.sourceName = Objects.requireNonNull(sourceName, "sourceName");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder targetType(Action.Target.Type type) {
|
public @NonNull Builder targetType(Action.Target.Type type) {
|
||||||
this.targetType = Objects.requireNonNull(type, "type");
|
this.targetType = Objects.requireNonNull(type, "type");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder target(UUID target) {
|
public @NonNull Builder target(UUID target) {
|
||||||
this.targetUniqueId = target; // nullable
|
this.targetUniqueId = target; // nullable
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder targetName(@NonNull String targetName) {
|
public @NonNull Builder targetName(@NonNull String targetName) {
|
||||||
this.targetName = Objects.requireNonNull(targetName, "targetName");
|
this.targetName = Objects.requireNonNull(targetName, "targetName");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @NonNull Builder description(@NonNull String description) {
|
public @NonNull Builder description(@NonNull String description) {
|
||||||
this.description = Objects.requireNonNull(description, "description");
|
this.description = Objects.requireNonNull(description, "description");
|
||||||
return this;
|
return this;
|
||||||
|
@ -68,24 +68,28 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMetaValue(String key, MetaCheckEvent.Origin origin) {
|
public String getMetaValue(String key, MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getMetaValue(key, origin);
|
String value = super.getMetaValue(key, origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), key, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), key, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getPrefix(MetaCheckEvent.Origin origin) {
|
public String getPrefix(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getPrefix(origin);
|
String value = super.getPrefix(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Prefix.NODE_KEY, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Prefix.NODE_KEY, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSuffix(MetaCheckEvent.Origin origin) {
|
public String getSuffix(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getSuffix(origin);
|
String value = super.getSuffix(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Suffix.NODE_KEY, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Suffix.NODE_KEY, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map<String, List<String>> getMeta(MetaCheckEvent.Origin origin) {
|
public Map<String, List<String>> getMeta(MetaCheckEvent.Origin origin) {
|
||||||
return new MonitoredMetaMap(super.getMeta(origin), origin);
|
return new MonitoredMetaMap(super.getMeta(origin), origin);
|
||||||
}
|
}
|
||||||
@ -97,6 +101,7 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public @Nullable String getPrimaryGroup(MetaCheckEvent.Origin origin) {
|
public @Nullable String getPrimaryGroup(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getPrimaryGroup(origin);
|
String value = super.getPrimaryGroup(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), "primarygroup", String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), "primarygroup", String.valueOf(value));
|
||||||
|
@ -44,14 +44,6 @@ public interface UserManager<T extends User> extends Manager<UUID, User, T> {
|
|||||||
*/
|
*/
|
||||||
T getByUsername(String name);
|
T getByUsername(String name);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a user object by uuid
|
|
||||||
*
|
|
||||||
* @param uuid The uuid to search by
|
|
||||||
* @return a {@link User} object if the user is loaded, returns null if the user is not loaded
|
|
||||||
*/
|
|
||||||
T getIfLoaded(UUID uuid);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the user the default group if necessary.
|
* Gives the user the default group if necessary.
|
||||||
*
|
*
|
||||||
|
@ -35,6 +35,7 @@ import org.spongepowered.api.service.permission.Subject;
|
|||||||
*/
|
*/
|
||||||
public interface ProxiedSubject extends Subject, ProxiedServiceObject {
|
public interface ProxiedSubject extends Subject, ProxiedServiceObject {
|
||||||
|
|
||||||
|
@Override
|
||||||
@NonNull LPSubjectReference asSubjectReference();
|
@NonNull LPSubjectReference asSubjectReference();
|
||||||
|
|
||||||
@NonNull QueryOptions getQueryOptions();
|
@NonNull QueryOptions getQueryOptions();
|
||||||
|
@ -29,9 +29,6 @@ import me.lucko.luckperms.common.api.LuckPermsApiProvider;
|
|||||||
import me.lucko.luckperms.common.event.AbstractEventBus;
|
import me.lucko.luckperms.common.event.AbstractEventBus;
|
||||||
|
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
import org.spongepowered.api.event.Listener;
|
|
||||||
import org.spongepowered.api.event.cause.EventContextKeys;
|
|
||||||
import org.spongepowered.api.event.game.GameReloadEvent;
|
|
||||||
import org.spongepowered.api.plugin.PluginContainer;
|
import org.spongepowered.api.plugin.PluginContainer;
|
||||||
|
|
||||||
public class SpongeEventBus extends AbstractEventBus<PluginContainer> {
|
public class SpongeEventBus extends AbstractEventBus<PluginContainer> {
|
||||||
@ -57,15 +54,4 @@ public class SpongeEventBus extends AbstractEventBus<PluginContainer> {
|
|||||||
throw new IllegalArgumentException("Object " + plugin + " (" + plugin.getClass().getName() + ") is not a plugin.");
|
throw new IllegalArgumentException("Object " + plugin + " (" + plugin.getClass().getName() + ") is not a plugin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listener
|
|
||||||
public void onReload(GameReloadEvent e) {
|
|
||||||
// sponge doesn't really support unloading of plugins at runtime.
|
|
||||||
// this probably won't ever work/be useful, but I suppose it's worth a try.
|
|
||||||
PluginContainer pluginContainer = e.getContext().get(EventContextKeys.PLUGIN).orElse(null);
|
|
||||||
if (pluginContainer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
unregisterHandlers(pluginContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,10 @@ public abstract class CalculatedSubject implements LPSubject {
|
|||||||
return this.plugin.getService().getDefaultSubjects().getTypeDefaults(getParentCollection().getIdentifier());
|
return this.plugin.getService().getDefaultSubjects().getTypeDefaults(getParentCollection().getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract CalculatedSubjectData getSubjectData();
|
public abstract CalculatedSubjectData getSubjectData();
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract CalculatedSubjectData getTransientSubjectData();
|
public abstract CalculatedSubjectData getTransientSubjectData();
|
||||||
|
|
||||||
public Map<String, Boolean> getCombinedPermissions(QueryOptions filter) {
|
public Map<String, Boolean> getCombinedPermissions(QueryOptions filter) {
|
||||||
|
Loading…
Reference in New Issue
Block a user