Skip to content

Commit

Permalink
refactor: stop using lombok
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Oct 16, 2024
1 parent 831a3f9 commit 61bbc73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
4 changes: 0 additions & 4 deletions spark-allay/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ tasks.withType(JavaCompile) {

dependencies {
implementation project(':spark-common')
implementation 'org.projectlombok:lombok:1.18.32'

compileOnly 'org.allaymc.allay:api:master-SNAPSHOT'

annotationProcessor('org.projectlombok:lombok:1.18.32')
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.lucko.spark.allay;

import me.lucko.spark.common.platform.PlatformInfo;
import org.allaymc.api.AllayAPI;
import org.allaymc.api.network.ProtocolInfo;

/**
Expand All @@ -25,11 +26,11 @@ public String getBrand() {

@Override
public String getVersion() {
return "1.0.0";
return AllayAPI.API_VERSION;
}

@Override
public String getMinecraftVersion() {
return ProtocolInfo.PACKET_CODEC.getMinecraftVersion();
return ProtocolInfo.getMinecraftVersionStr();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.lucko.spark.allay;

import lombok.extern.slf4j.Slf4j;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
Expand All @@ -21,7 +20,6 @@
/**
* @author IWareQ
*/
@Slf4j
public class AllaySparkPlugin extends Plugin implements SparkPlugin {

private SparkPlatform platform;
Expand Down Expand Up @@ -65,18 +63,12 @@ public Stream<AllayCommandSender> getCommandSenders() {

@Override
public void executeAsync(Runnable task) {
Server.getInstance().getScheduler().scheduleRepeating(this, () -> {
task.run();
return false;
}, 1, true);
Server.getInstance().getScheduler().runLaterAsync(this, task);
}

@Override
public void executeSync(Runnable task) {
Server.getInstance().getScheduler().scheduleRepeating(this, () -> {
task.run();
return false;
}, 1);
Server.getInstance().getScheduler().runLater(this, task);
}

// https://stackoverflow.com/questions/20795373/how-to-map-levels-of-java-util-logging-and-slf4j-logger
Expand All @@ -90,7 +82,7 @@ public void log(Level level, String msg) {
default -> org.slf4j.event.Level.ERROR;
};

log.atLevel(slf4jLevel).log(msg);
pluginLogger.atLevel(slf4jLevel).log(msg);
}

@Override
Expand All @@ -109,7 +101,8 @@ public Collection<SourceMetadata> getKnownSources() {
Server.getInstance().getPluginManager().getPlugins().values(),
container -> container.descriptor().getName(),
container -> container.descriptor().getVersion(),
container -> String.join(", ", container.descriptor().getAuthors())
container -> String.join(", ", container.descriptor().getAuthors()),
container -> container.descriptor().getDescription()
);
}

Expand Down

0 comments on commit 61bbc73

Please sign in to comment.