Skip to content

Commit 7b044ed

Browse files
committed
chore: clean up codebase
1 parent 09b88e8 commit 7b044ed

File tree

8 files changed

+39
-82
lines changed

8 files changed

+39
-82
lines changed

build.gradle.kts

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import groovy.lang.Closure
22
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
3-
import com.palantir.gradle.gitversion.VersionDetails
43
import org.gradle.api.tasks.compile.JavaCompile
54
import org.gradle.language.jvm.tasks.ProcessResources
65
import xyz.jpenilla.runpaper.task.RunServer
7-
import xyz.jpenilla.runwaterfall.task.RunWaterfall
86
import xyz.jpenilla.runvelocity.task.RunVelocity
7+
import xyz.jpenilla.runwaterfall.task.RunWaterfall
98

109

1110

@@ -14,13 +13,12 @@ val PLUGIN_NAME = "ASLEaglerHook"
1413
val PLUGIN_IDEN = "asleaglerhook"
1514
val PLUGIN_DOMN = "xyz.webmc.$PLUGIN_IDEN"
1615
val PLUGIN_DESC = "An EaglerXServer addon to display the AdvancedServerList MOTD."
17-
val PLUGIN_VERS = "1.0.1"
16+
val PLUGIN_VERS = "1.0.2"
1817
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
1918
val PLUGIN_DEPA = listOf("EaglercraftXServer", "AdvancedServerList")
2019
val PLUGIN_DEPB = listOf("eaglerxserver", "advancedserverlist")
2120
val PLUGIN_SDPA = listOf("PAPIProxyBridge", "Maintenance")
2221
val PLUGIN_SDPB = listOf("papiproxybridge", "maintenance")
23-
val PLUGIN_PROV = emptyList<String>()
2422
val PLUGIN_ATHR = listOf("Colbster937")
2523
val PLUGIN_CTBR = emptyList<String>()
2624

@@ -30,7 +28,6 @@ val PLUGIN_CTBR = emptyList<String>()
3028
val PLUGIN_DEPA_J = getBungeeDeps(PLUGIN_DEPA)
3129
val PLUGIN_DEPB_J = getVelocityDeps(PLUGIN_DEPB, PLUGIN_SDPB)
3230
val PLUGIN_SDPA_J = getBungeeDeps(PLUGIN_SDPA)
33-
val PLUGIN_PROV_J = getBungeeDeps(PLUGIN_PROV)
3431
val PLUGIN_ATHR_J = getBungeeDeps(PLUGIN_ATHR)
3532
val PLUGIN_CTBR_J = getBungeeDeps(PLUGIN_CTBR)
3633

@@ -43,14 +40,11 @@ val MTNCE_VER = "4.2.1"
4340
plugins {
4441
id("java")
4542
id("com.gradleup.shadow") version "9.3.1"
46-
id("com.palantir.git-version") version "4.2.0"
43+
id("com.palantir.git-version") version "4.3.0"
4744
id("xyz.jpenilla.run-velocity") version "3.0.2"
4845
id("xyz.jpenilla.run-waterfall") version "3.0.2"
4946
}
5047

51-
@Suppress("UNCHECKED_CAST")
52-
val GIT_INFO = (extra["versionDetails"] as Closure<VersionDetails>)()
53-
5448
repositories {
5549
mavenCentral()
5650
maven("https://repo.papermc.io/repository/maven-public/")
@@ -63,7 +57,7 @@ repositories {
6357
}
6458

6559
dependencies {
66-
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
60+
compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
6761
compileOnly("net.md-5:bungeecord-api:1.21-R0.5-SNAPSHOT")
6862
compileOnly("net.lax1dude.eaglercraft.backend:api-velocity:1.0.0")
6963
compileOnly("net.lax1dude.eaglercraft.backend:api-bungee:1.0.0")
@@ -96,18 +90,15 @@ val BUILD_PROPS = mapOf(
9690
"plugin_depa" to PLUGIN_DEPA_J,
9791
"plugin_depb" to PLUGIN_DEPB_J,
9892
"plugin_sdpa" to PLUGIN_SDPA_J,
99-
"plugin_prov" to PLUGIN_PROV_J,
10093
"plugin_athr" to PLUGIN_ATHR_J,
10194
"plugin_ctbr" to PLUGIN_CTBR_J,
102-
"git_cm_hash" to GIT_INFO.gitHashFull,
10395
)
10496

105-
tasks.withType<JavaCompile>().configureEach {
106-
options.encoding = "UTF-8"
97+
tasks.named<JavaCompile>("compileJava") {
10798
options.release.set(21)
10899
}
109100

110-
tasks.withType<ProcessResources>().configureEach {
101+
tasks.named<ProcessResources>("processResources") {
111102
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
112103
outputs.upToDateWhen { false }
113104

@@ -117,25 +108,14 @@ tasks.withType<ProcessResources>().configureEach {
117108
}
118109
}
119110

120-
doLast {
121-
val file = destinationDir.resolve("build.properties")
122-
file.parentFile.mkdirs()
123-
file.writeText(
124-
BUILD_PROPS.entries.joinToString("\n") { (k, v) ->
125-
"$k = $v"
126-
}
127-
)
128-
}
129-
130111
inputs.files(tasks.named<JavaCompile>("compileJava").map { it.outputs.files })
131112
}
132113

133-
tasks.withType<Jar>().configureEach {
114+
tasks.named<Jar>("jar") {
134115
enabled = false
135116
}
136117

137-
tasks.withType<ShadowJar>().configureEach {
138-
enabled = true
118+
tasks.named<ShadowJar>("shadowJar") {
139119
doFirst {
140120
delete(layout.buildDirectory.dir("libs"))
141121
mkdir(layout.buildDirectory.dir("libs"))
@@ -155,25 +135,25 @@ tasks.register("printVars") {
155135
}
156136
}
157137

158-
tasks.withType<RunWaterfall>().configureEach {
159-
waterfallVersion("1.21")
160-
runDirectory.set(layout.projectDirectory.dir("run/waterfall"))
138+
tasks.named<RunVelocity>("runVelocity") {
139+
velocityVersion("3.5.0-SNAPSHOT")
140+
runDirectory.set(layout.projectDirectory.dir("run/velocity"))
161141
downloadPlugins {
162142
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
163-
url("https://codeberg.org/Andre601/AdvancedServerList/releases/download/v$ASLPL_VER/AdvancedServerList-BungeeCord-$ASLPL_VER.jar")
164-
github("WiIIiam278", "PAPIProxyBridge", PAPIP_VER, "PAPIProxyBridge-Bungee-" + PAPIP_VER + ".jar")
165-
github("kennytv", "Maintenance", MTNCE_VER, "Maintenance-" + MTNCE_VER + ".jar")
143+
url("https://codeberg.org/Andre601/AdvancedServerList/releases/download/v$ASLPL_VER/AdvancedServerList-Velocity-$ASLPL_VER.jar")
144+
github("WiIIiam278", "PAPIProxyBridge", PAPIP_VER, "PAPIProxyBridge-Velocity-" + PAPIP_VER + ".jar")
145+
github("kennytv", "Maintenance", MTNCE_VER, "Maintenance-Velocity-" + MTNCE_VER + ".jar")
166146
}
167147
}
168148

169-
tasks.withType<RunVelocity>().configureEach {
170-
velocityVersion("3.4.0-SNAPSHOT")
171-
runDirectory.set(layout.projectDirectory.dir("run/velocity"))
149+
tasks.named<RunWaterfall>("runWaterfall") {
150+
waterfallVersion("1.21")
151+
runDirectory.set(layout.projectDirectory.dir("run/waterfall"))
172152
downloadPlugins {
173153
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
174-
url("https://codeberg.org/Andre601/AdvancedServerList/releases/download/v$ASLPL_VER/AdvancedServerList-Velocity-$ASLPL_VER.jar")
175-
github("WiIIiam278", "PAPIProxyBridge", PAPIP_VER, "PAPIProxyBridge-Velocity-" + PAPIP_VER + ".jar")
176-
github("kennytv", "Maintenance", MTNCE_VER, "Maintenance-Velocity-" + MTNCE_VER + ".jar")
154+
url("https://codeberg.org/Andre601/AdvancedServerList/releases/download/v$ASLPL_VER/AdvancedServerList-BungeeCord-$ASLPL_VER.jar")
155+
github("WiIIiam278", "PAPIProxyBridge", PAPIP_VER, "PAPIProxyBridge-Bungee-" + PAPIP_VER + ".jar")
156+
github("kennytv", "Maintenance", MTNCE_VER, "Maintenance-" + MTNCE_VER + ".jar")
177157
}
178158
}
179159

src/main/java/xyz/webmc/asleaglerhook/base/ASLEaglerHook.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
1717
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
1818

19-
@SuppressWarnings({ "rawtypes" })
2019
public final class ASLEaglerHook {
21-
public static final void init(final IEaglerXServerAPI eaglerAPI) {
20+
public static final void init(final IEaglerXServerAPI<?> eaglerAPI) {
2221
final AdvancedServerListAPI api = AdvancedServerListAPI.get();
2322
api.addPlaceholderProvider(new EaglerASLPlaceholder(eaglerAPI));
2423
}
@@ -63,8 +62,8 @@ public static final byte[] convertFavicon(final byte[] favicon) {
6362
}
6463

6564
return ret;
66-
} catch (final Exception e) {
67-
throw new RuntimeException(e);
65+
} catch (final Exception ex) {
66+
throw new RuntimeException(ex);
6867
}
6968
}
7069

@@ -74,7 +73,7 @@ public static final boolean isMaintenance() {
7473
final Class<?> cls = Class.forName("eu.kennytv.maintenance.api.MaintenanceProvider", true, cl);
7574
final Object provider = cls.getMethod("get").invoke(null);
7675
return (boolean) provider.getClass().getMethod("isMaintenance").invoke(provider);
77-
} catch (final Exception e) {
76+
} catch (final Exception ex) {
7877
return false;
7978
}
8079
}

src/main/java/xyz/webmc/asleaglerhook/base/BuildInfo.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/java/xyz/webmc/asleaglerhook/base/IASLEaglerHookPlugin.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
99

1010
public interface IASLEaglerHookPlugin<F> {
11-
public byte[] getFaviconBytes(final F favicon);
11+
public abstract byte[] getFaviconBytes(final F favicon);
1212

13-
public Class<F> getFaviconClass();
13+
public abstract Class<F> getFaviconClass();
1414

15-
public String parsePAPIPlaceholders(final String text, final GenericPlayer player);
15+
public abstract String parsePAPIPlaceholders(final String text, final GenericPlayer player);
1616

17-
public PluginCore<F> getASL();
17+
public abstract PluginCore<F> getASL();
1818

19-
public GenericPlayer createPlayer(final CachedPlayer player, final int protocol);
19+
public abstract GenericPlayer createPlayer(final CachedPlayer player, final int protocol);
2020

21-
public GenericServer createServer(final int playersOnline, final int playersMax, final String host);
21+
public abstract GenericServer createServer(final int playersOnline, final int playersMax, final String host);
2222

23-
public GenericServerListEvent callEvent(final ProfileEntry entry);
23+
public abstract GenericServerListEvent callEvent(final ProfileEntry entry);
2424

25-
public boolean isMaintenancePluginLoaded();
25+
public abstract boolean isMaintenancePluginLoaded();
2626
}

src/main/java/xyz/webmc/asleaglerhook/base/asl/EaglerASLPlaceholder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
import ch.andre601.advancedserverlist.api.objects.GenericServer;
66
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
77

8-
@SuppressWarnings({ "rawtypes" })
98
public final class EaglerASLPlaceholder extends PlaceholderProvider {
10-
private final IEaglerXServerAPI api;
9+
private final IEaglerXServerAPI<?> api;
1110

12-
public EaglerASLPlaceholder(final IEaglerXServerAPI api) {
11+
public EaglerASLPlaceholder(final IEaglerXServerAPI<?> api) {
1312
super("eagler");
1413
this.api = api;
1514
}

src/main/java/xyz/webmc/asleaglerhook/base/asl/EaglerPingEventWrapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public final class EaglerPingEventWrapper implements GenericEventWrapper<Object,
2828
private final IMOTDConnection motd;
2929
private boolean changed = false;
3030

31-
public EaglerPingEventWrapper(final IASLEaglerHookPlugin plugin, final IMOTDConnection motd) {
31+
public EaglerPingEventWrapper(final IASLEaglerHookPlugin<?> plugin, final IMOTDConnection motd) {
3232
this.plugin = plugin;
3333
this.motd = motd;
3434
}
@@ -66,7 +66,6 @@ public final void hidePlayers() {
6666

6767
@Override
6868
public final void playerCount(final String name) {
69-
7069
}
7170

7271
@Override

src/main/java/xyz/webmc/asleaglerhook/velocity/ASLEaglerHookVelocity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ public final class ASLEaglerHookVelocity implements IASLEaglerHookPlugin<Favicon
4040
public ASLEaglerHookVelocity(final ProxyServer proxy) {
4141
this.proxy = proxy;
4242
}
43-
43+
4444
@Subscribe
4545
public final void init(ProxyInitializeEvent event) {
46-
this.plugin = (PluginCore<Favicon>) this.proxy.getPluginManager().getPlugin("advancedserverlist").get().getInstance().get();
46+
this.plugin = (PluginCore<Favicon>) this.proxy.getPluginManager().getPlugin("advancedserverlist").get()
47+
.getInstance().get();
4748
ASLEaglerHook.init(EaglerXServerAPI.instance());
4849
}
4950

@@ -106,7 +107,7 @@ public final GenericServerListEvent callEvent(final ProfileEntry entry) {
106107
final PreServerListSetEvent event = new VelocityPreServerListSetEvent(entry);
107108
try {
108109
this.proxy.getEventManager().fire(event).get();
109-
} catch (InterruptedException | ExecutionException e) {
110+
} catch (InterruptedException | ExecutionException ex) {
110111
return null;
111112
}
112113
return event;

src/main/resources/bungee.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ website: ${plugin_site}
66
author: ${plugin_athr}
77
contributors: ${plugin_ctbr}
88
depends: ${plugin_depa}
9-
provides: ${plugin_prov}
109
softdepend: ${plugin_sdpa}

0 commit comments

Comments
 (0)