mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +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) {
|
||||
return 0;
|
||||
}
|
||||
return Boolean.compare(
|
||||
o1 == DataType.TRANSIENT,
|
||||
o2 == DataType.TRANSIENT
|
||||
);
|
||||
return o1 == DataType.TRANSIENT ? 1 : -1;
|
||||
}
|
||||
},
|
||||
|
||||
@ -76,10 +73,7 @@ public enum DataQueryOrder implements Comparator<DataType> {
|
||||
if (o1 == o2) {
|
||||
return 0;
|
||||
}
|
||||
return -Boolean.compare(
|
||||
o1 == DataType.TRANSIENT,
|
||||
o2 == DataType.TRANSIENT
|
||||
);
|
||||
return o1 == DataType.TRANSIENT ? -1 : 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -287,7 +287,7 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
|
||||
|
||||
private static boolean checkIncompatibleVersion() {
|
||||
try {
|
||||
Class<?> aClass = Class.forName("com.google.gson.internal.bind.TreeTypeAdapter");
|
||||
Class.forName("com.google.gson.internal.bind.TreeTypeAdapter");
|
||||
return false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return true;
|
||||
|
@ -250,36 +250,43 @@ public class LoggedAction implements Action {
|
||||
private Target.Type targetType = null;
|
||||
private String description = null;
|
||||
|
||||
@Override
|
||||
public @NonNull Builder timestamp(@NonNull Instant timestamp) {
|
||||
this.timestamp = timestamp.getEpochSecond();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder source(@NonNull UUID source) {
|
||||
this.sourceUniqueId = Objects.requireNonNull(source, "source");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder sourceName(@NonNull String sourceName) {
|
||||
this.sourceName = Objects.requireNonNull(sourceName, "sourceName");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder targetType(Action.Target.Type type) {
|
||||
this.targetType = Objects.requireNonNull(type, "type");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder target(UUID target) {
|
||||
this.targetUniqueId = target; // nullable
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder targetName(@NonNull String targetName) {
|
||||
this.targetName = Objects.requireNonNull(targetName, "targetName");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Builder description(@NonNull String description) {
|
||||
this.description = Objects.requireNonNull(description, "description");
|
||||
return this;
|
||||
|
@ -68,24 +68,28 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMetaValue(String key, MetaCheckEvent.Origin origin) {
|
||||
String value = super.getMetaValue(key, origin);
|
||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), key, String.valueOf(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(MetaCheckEvent.Origin origin) {
|
||||
String value = super.getPrefix(origin);
|
||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Prefix.NODE_KEY, String.valueOf(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(MetaCheckEvent.Origin origin) {
|
||||
String value = super.getSuffix(origin);
|
||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Suffix.NODE_KEY, String.valueOf(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getMeta(MetaCheckEvent.Origin origin) {
|
||||
return new MonitoredMetaMap(super.getMeta(origin), origin);
|
||||
}
|
||||
@ -97,6 +101,7 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getPrimaryGroup(MetaCheckEvent.Origin origin) {
|
||||
String value = super.getPrimaryGroup(origin);
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -35,6 +35,7 @@ import org.spongepowered.api.service.permission.Subject;
|
||||
*/
|
||||
public interface ProxiedSubject extends Subject, ProxiedServiceObject {
|
||||
|
||||
@Override
|
||||
@NonNull LPSubjectReference asSubjectReference();
|
||||
|
||||
@NonNull QueryOptions getQueryOptions();
|
||||
|
@ -29,9 +29,6 @@ import me.lucko.luckperms.common.api.LuckPermsApiProvider;
|
||||
import me.lucko.luckperms.common.event.AbstractEventBus;
|
||||
|
||||
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;
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract CalculatedSubjectData getSubjectData();
|
||||
|
||||
@Override
|
||||
public abstract CalculatedSubjectData getTransientSubjectData();
|
||||
|
||||
public Map<String, Boolean> getCombinedPermissions(QueryOptions filter) {
|
||||
|
Loading…
Reference in New Issue
Block a user