mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 20:17:55 +01:00
remove lombok from api and attach sources
This commit is contained in:
parent
9a3eeca411
commit
ca9037461a
@ -148,7 +148,7 @@ You can add LuckPerms as a Maven dependency by adding the following to your proj
|
||||
<dependency>
|
||||
<groupId>me.lucko.luckperms</groupId>
|
||||
<artifactId>luckperms-api</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
````
|
||||
@ -181,6 +181,7 @@ Additionally, you can use wildcards to grant users access to a selection of comm
|
||||
* **All user commands** - luckperms.user.*
|
||||
* **All group commands** - luckperms.group.*
|
||||
* **All track commands** - luckperms.track.*
|
||||
* **All log commands** - luckperms.log.*
|
||||
|
||||
### General
|
||||
* /perms - n/a
|
||||
|
13
api/pom.xml
13
api/pom.xml
@ -21,6 +21,19 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
package me.lucko.luckperms;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -31,12 +29,9 @@ import java.util.Optional;
|
||||
/**
|
||||
* Static access to LuckPerms
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class LuckPerms {
|
||||
|
||||
private static LuckPermsApi api = null;
|
||||
|
||||
|
||||
/**
|
||||
* Gets an instance of {@link LuckPermsApi}
|
||||
* @return an api instance
|
||||
@ -66,4 +61,8 @@ public final class LuckPerms {
|
||||
api = null;
|
||||
}
|
||||
|
||||
private LuckPerms() {
|
||||
throw new UnsupportedOperationException("This class cannot be instantiated.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,25 +22,44 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
public final class LogEntry implements Comparable<LogEntry> {
|
||||
public static LogEntryBuilder builder() {
|
||||
return new LogEntryBuilder();
|
||||
}
|
||||
private static final String FORMAT = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
|
||||
|
||||
@NonNull private final long timestamp;
|
||||
@NonNull private final UUID actor;
|
||||
@NonNull private final String actorName;
|
||||
@NonNull private final char type;
|
||||
private final long timestamp;
|
||||
private final UUID actor;
|
||||
private final String actorName;
|
||||
private final char type;
|
||||
private final UUID acted;
|
||||
@NonNull private final String actedName;
|
||||
@NonNull private final String action;
|
||||
private final String actedName;
|
||||
private final String action;
|
||||
|
||||
public LogEntry(long timestamp, UUID actor, String actorName, char type, UUID acted, String actedName, String action) {
|
||||
if (actor == null) {
|
||||
throw new NullPointerException("actor");
|
||||
}
|
||||
if (actorName == null) {
|
||||
throw new NullPointerException("actorName");
|
||||
}
|
||||
if (actedName == null) {
|
||||
throw new NullPointerException("actedName");
|
||||
}
|
||||
if (action == null) {
|
||||
throw new NullPointerException("action");
|
||||
}
|
||||
|
||||
this.timestamp = timestamp;
|
||||
this.actor = actor;
|
||||
this.actorName = actorName;
|
||||
this.type = type;
|
||||
this.acted = acted;
|
||||
this.actedName = actedName;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LogEntry o) {
|
||||
@ -55,10 +74,146 @@ public final class LogEntry implements Comparable<LogEntry> {
|
||||
|
||||
public String getFormatted() {
|
||||
return String.format(FORMAT,
|
||||
getActorName(),
|
||||
Character.toString(getType()),
|
||||
getActedName(),
|
||||
getAction()
|
||||
actorName,
|
||||
Character.toString(type),
|
||||
actedName,
|
||||
action
|
||||
);
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public UUID getActor() {
|
||||
return actor;
|
||||
}
|
||||
|
||||
public String getActorName() {
|
||||
return actorName;
|
||||
}
|
||||
|
||||
public char getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public UUID getActed() {
|
||||
return acted;
|
||||
}
|
||||
|
||||
public String getActedName() {
|
||||
return actedName;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LogEntry(timestamp=" + this.getTimestamp() + ", actor=" + this.getActor() + ", actorName=" +
|
||||
this.getActorName() + ", type=" + this.getType() + ", acted=" + this.getActed() + ", actedName=" +
|
||||
this.getActedName() + ", action=" + this.getAction() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof LogEntry)) return false;
|
||||
final LogEntry other = (LogEntry) o;
|
||||
if (this.getTimestamp() != other.getTimestamp()) return false;
|
||||
final Object this$actor = this.getActor();
|
||||
final Object other$actor = other.getActor();
|
||||
if (this$actor == null ? other$actor != null : !this$actor.equals(other$actor)) return false;
|
||||
final Object this$actorName = this.getActorName();
|
||||
final Object other$actorName = other.getActorName();
|
||||
if (this$actorName == null ? other$actorName != null : !this$actorName.equals(other$actorName)) return false;
|
||||
if (this.getType() != other.getType()) return false;
|
||||
final Object this$acted = this.getActed();
|
||||
final Object other$acted = other.getActed();
|
||||
if (this$acted == null ? other$acted != null : !this$acted.equals(other$acted)) return false;
|
||||
final Object this$actedName = this.getActedName();
|
||||
final Object other$actedName = other.getActedName();
|
||||
if (this$actedName == null ? other$actedName != null : !this$actedName.equals(other$actedName)) return false;
|
||||
final Object this$action = this.getAction();
|
||||
final Object other$action = other.getAction();
|
||||
return this$action == null ? other$action == null : this$action.equals(other$action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final long $timestamp = this.getTimestamp();
|
||||
result = result * PRIME + (int) ($timestamp >>> 32 ^ $timestamp);
|
||||
final Object $actor = this.getActor();
|
||||
result = result * PRIME + ($actor == null ? 43 : $actor.hashCode());
|
||||
final Object $actorName = this.getActorName();
|
||||
result = result * PRIME + ($actorName == null ? 43 : $actorName.hashCode());
|
||||
result = result * PRIME + this.getType();
|
||||
final Object $acted = this.getActed();
|
||||
result = result * PRIME + ($acted == null ? 43 : $acted.hashCode());
|
||||
final Object $actedName = this.getActedName();
|
||||
result = result * PRIME + ($actedName == null ? 43 : $actedName.hashCode());
|
||||
final Object $action = this.getAction();
|
||||
result = result * PRIME + ($action == null ? 43 : $action.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static class LogEntryBuilder {
|
||||
private long timestamp;
|
||||
private UUID actor;
|
||||
private String actorName;
|
||||
private char type;
|
||||
private UUID acted;
|
||||
private String actedName;
|
||||
private String action;
|
||||
|
||||
public LogEntryBuilder timestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder actor(UUID actor) {
|
||||
this.actor = actor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder actorName(String actorName) {
|
||||
this.actorName = actorName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder type(char type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder acted(UUID acted) {
|
||||
this.acted = acted;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder actedName(String actedName) {
|
||||
this.actedName = actedName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntryBuilder action(String action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogEntry build() {
|
||||
return new LogEntry(timestamp, actor, actorName, type, acted, actedName, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LogEntry.LogEntryBuilder(timestamp=" + this.timestamp + ", actor=" + this.actor + ", actorName=" +
|
||||
this.actorName + ", type=" + this.type + ", acted=" + this.acted + ", actedName=" + this.actedName +
|
||||
", action=" + this.action + ")";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
package me.lucko.luckperms.api.data;
|
||||
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface Callback<T> {
|
||||
@ -34,11 +32,17 @@ public interface Callback<T> {
|
||||
return t -> {};
|
||||
}
|
||||
|
||||
static <T> Callback<T> of(@NonNull Runnable runnable) {
|
||||
static <T> Callback<T> of(Runnable runnable) {
|
||||
if (runnable == null) {
|
||||
throw new NullPointerException("runnable");
|
||||
}
|
||||
return t -> runnable.run();
|
||||
}
|
||||
|
||||
static <T> Callback<T> of(@NonNull Consumer<T> consumer) {
|
||||
static <T> Callback<T> of(Consumer<T> consumer) {
|
||||
if (consumer == null) {
|
||||
throw new NullPointerException("consumer");
|
||||
}
|
||||
return consumer::accept;
|
||||
}
|
||||
|
||||
|
@ -119,5 +119,12 @@
|
||||
<version>1.7.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -112,6 +112,13 @@
|
||||
<version>1.7.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -60,6 +60,13 @@
|
||||
<version>19.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -45,11 +45,11 @@ public class LogUserHistory extends SubCommand<Log> {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, List<String> args, String label) {
|
||||
String user = args.get(0);
|
||||
final int[] page = {-999};
|
||||
int page = -999;
|
||||
|
||||
if (args.size() == 2) {
|
||||
try {
|
||||
page[0] = Integer.parseInt(args.get(1));
|
||||
page = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
// invalid page
|
||||
return showLog(-1, null, null, null);
|
||||
@ -58,11 +58,11 @@ public class LogUserHistory extends SubCommand<Log> {
|
||||
|
||||
UUID uuid = Util.parseUuid(user);
|
||||
if (uuid != null) {
|
||||
if (page[0] == -999) {
|
||||
page[0] = log.getUserHistoryMaxPages(uuid);
|
||||
if (page == -999) {
|
||||
page = log.getUserHistoryMaxPages(uuid);
|
||||
}
|
||||
|
||||
return showLog(page[0], uuid, sender, log);
|
||||
return showLog(page, uuid, sender, log);
|
||||
|
||||
}
|
||||
|
||||
@ -81,11 +81,11 @@ public class LogUserHistory extends SubCommand<Log> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (page[0] == -999) {
|
||||
page[0] = log.getUserHistoryMaxPages(uuid1);
|
||||
if (page == -999) {
|
||||
page = log.getUserHistoryMaxPages(uuid1);
|
||||
}
|
||||
|
||||
return showLog(page[0], uuid1, sender, log);
|
||||
return showLog(page, uuid1, sender, log);
|
||||
}
|
||||
|
||||
Message.USER_INVALID_ENTRY.send(sender, user);
|
||||
|
@ -90,7 +90,7 @@ public abstract class Datastore {
|
||||
|
||||
/*
|
||||
These methods will schedule the operation to run async. The callback will be ran when the task is complete.
|
||||
Callbacks are ran on the main Bukkit server thread (if applicable)
|
||||
Callbacks are ran on the main server thread (except on BungeeCord)
|
||||
*/
|
||||
public void logAction(LogEntry entry, Callback<Boolean> callback) {
|
||||
doAsync(() -> {
|
||||
|
10
pom.xml
10
pom.xml
@ -38,14 +38,4 @@
|
||||
<url>https://repo.spongepowered.org/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -142,5 +142,12 @@
|
||||
<version>1.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user