mirror of
https://github.com/jpenilla/MiniMOTD.git
synced 2026-11-07 09:52:33 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe41b21d9b | ||
|
|
cbbe201710 | ||
|
|
30d58fc0f9 | ||
|
|
067ec4ea65 | ||
|
|
22f805f4ab | ||
|
|
ed21f45573 | ||
|
|
41b1fdffe3 | ||
|
|
142f7a34f7 | ||
|
|
ed7fe3591b |
No files matched your search
+1
-1
@@ -3,5 +3,5 @@ plugins {
|
||||
}
|
||||
|
||||
group = "xyz.jpenilla"
|
||||
version = "2.0.3"
|
||||
version = "2.0.4"
|
||||
description = "Use MiniMessage text formatting in the server list MOTD."
|
||||
@@ -14,7 +14,7 @@ dependencies {
|
||||
|
||||
tasks {
|
||||
runServer {
|
||||
minecraftVersion("1.17")
|
||||
minecraftVersion("1.17.1")
|
||||
}
|
||||
generateBukkitPluginDescription {
|
||||
mustRunAfter(clean)
|
||||
|
||||
@@ -34,7 +34,7 @@ import xyz.jpenilla.minimotd.common.MiniMOTD;
|
||||
import xyz.jpenilla.minimotd.common.PingResponse;
|
||||
import xyz.jpenilla.minimotd.common.config.MiniMOTDConfig;
|
||||
|
||||
final class PaperPingListener implements Listener {
|
||||
public final class PaperPingListener implements Listener {
|
||||
private final MiniMOTDPlugin plugin;
|
||||
private final LegacyComponentSerializer unusualHexSerializer = LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().build();
|
||||
private final MiniMOTD<CachedServerIcon> miniMOTD;
|
||||
|
||||
@@ -33,7 +33,7 @@ import xyz.jpenilla.minimotd.common.MiniMOTD;
|
||||
import xyz.jpenilla.minimotd.common.PingResponse;
|
||||
import xyz.jpenilla.minimotd.common.config.MiniMOTDConfig;
|
||||
|
||||
final class PingListener implements Listener {
|
||||
public final class PingListener implements Listener {
|
||||
private final MiniMOTD<CachedServerIcon> miniMOTD;
|
||||
private final LegacyComponentSerializer unusualHexSerializer = LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().build();
|
||||
private final MiniMOTDPlugin plugin;
|
||||
|
||||
@@ -44,5 +44,5 @@ public final class Constants {
|
||||
|
||||
public static final int MINECRAFT_1_16_PROTOCOL_VERSION = 735;
|
||||
|
||||
public static final Component COMMAND_PREFIX = MiniMessage.get().parse("<white>[</white><gradient:#0047AB:#ADD8E6>" + PluginMetadata.NAME + "<white>]</white>");
|
||||
public static final Component COMMAND_PREFIX = MiniMessage.get().parse("<white>[</white><gradient:#0047AB:#ADD8E6>" + PluginMetadata.NAME + "</gradient><white>]</white>");
|
||||
}
|
||||
@@ -54,23 +54,23 @@ public final class MiniMOTD<I> {
|
||||
return this.platform;
|
||||
}
|
||||
|
||||
public final Path dataDirectory() {
|
||||
public Path dataDirectory() {
|
||||
return this.platform.dataDirectory();
|
||||
}
|
||||
|
||||
public final IconManager<I> iconManager() {
|
||||
public IconManager<I> iconManager() {
|
||||
return this.iconManager;
|
||||
}
|
||||
|
||||
public final Logger logger() {
|
||||
public Logger logger() {
|
||||
return this.platform.logger();
|
||||
}
|
||||
|
||||
public final ConfigManager configManager() {
|
||||
public ConfigManager configManager() {
|
||||
return this.configManager;
|
||||
}
|
||||
|
||||
public final PingResponse<I> createMOTD(final MiniMOTDConfig config, final int onlinePlayers, final int maxPlayers) {
|
||||
public PingResponse<I> createMOTD(final MiniMOTDConfig config, final int onlinePlayers, final int maxPlayers) {
|
||||
final PingResponse.PlayerCount count = config.modifyPlayerCount(onlinePlayers, maxPlayers);
|
||||
final PingResponse.Builder<I> response = PingResponse.<I>builder()
|
||||
.playerCount(count)
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class PingResponse<I> {
|
||||
|
||||
/**
|
||||
* If {@link #icon()} is non-null, the provided {@link Consumer} will be called using
|
||||
* it's return value. If {@link #icon()} is {@code null}, do nothing.
|
||||
* its return value. If {@link #icon()} is {@code null}, do nothing.
|
||||
*
|
||||
* @param iconConsumer icon consumer
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ public final class PingResponse<I> {
|
||||
|
||||
/**
|
||||
* If {@link #motd()} is non-null, the provided {@link Consumer} will be called using
|
||||
* it's return value. If {@link #motd()} is {@code null}, do nothing.
|
||||
* its return value. If {@link #motd()} is {@code null}, do nothing.
|
||||
*
|
||||
* @param motdConsumer motd consumer
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,7 @@ public final class ConfigLoader<C> {
|
||||
private static final TypeSerializerCollection SERIALIZERS;
|
||||
|
||||
static {
|
||||
SERIALIZERS = TypeSerializerCollection.defaults()
|
||||
.childBuilder()
|
||||
SERIALIZERS = TypeSerializerCollection.builder()
|
||||
.register(PlayerCountModifier.serializer())
|
||||
.build();
|
||||
}
|
||||
@@ -50,11 +49,13 @@ public final class ConfigLoader<C> {
|
||||
public ConfigLoader(
|
||||
final @NonNull Class<C> configClass,
|
||||
final @NonNull Path configPath,
|
||||
final @NonNull ConfigurationOptions options
|
||||
final @NonNull UnaryOperator<ConfigurationOptions> optionsModifier
|
||||
) {
|
||||
this.loader = HoconConfigurationLoader.builder()
|
||||
.path(configPath)
|
||||
.defaultOptions(options.serializers(SERIALIZERS))
|
||||
.defaultOptions(options ->
|
||||
optionsModifier.apply(options)
|
||||
.serializers(builder -> builder.registerAll(SERIALIZERS)))
|
||||
.build();
|
||||
try {
|
||||
this.mapper = ObjectMapper.factory().get(configClass);
|
||||
@@ -66,19 +67,11 @@ public final class ConfigLoader<C> {
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigLoader(
|
||||
final @NonNull Class<C> configClass,
|
||||
final @NonNull Path configPath,
|
||||
final @NonNull UnaryOperator<ConfigurationOptions> options
|
||||
) {
|
||||
this(configClass, configPath, options.apply(ConfigurationOptions.defaults()));
|
||||
}
|
||||
|
||||
public ConfigLoader(
|
||||
final @NonNull Class<C> configClass,
|
||||
final @NonNull Path configPath
|
||||
) {
|
||||
this(configClass, configPath, ConfigurationOptions.defaults());
|
||||
this(configClass, configPath, options -> options);
|
||||
}
|
||||
|
||||
public @NonNull C load() throws ConfigurateException {
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class PluginSettings {
|
||||
|
||||
@Comment("Set whether to enable virtual host testing mode.\n"
|
||||
+ "When enabled, MiniMOTD will print virtual host debug info to the console on each server ping.")
|
||||
private final boolean virtualHostTestMode = false;
|
||||
private boolean virtualHostTestMode = false;
|
||||
|
||||
public boolean virtualHostTestMode() {
|
||||
return this.virtualHostTestMode;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id("minimotd.platform-conventions")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("fabric-loom")
|
||||
id("quiet-fabric-loom")
|
||||
}
|
||||
|
||||
val shade: Configuration by configurations.creating
|
||||
|
||||
@@ -11,7 +11,7 @@ plugins:
|
||||
xyz.jpenilla.run-paper: 1.0.3
|
||||
|
||||
versions:
|
||||
indra: 2.0.5
|
||||
indra: 2.0.6
|
||||
shadow: 7.0.0
|
||||
testLoggerPlugin: 3.0.0
|
||||
adventure: 4.8.1
|
||||
@@ -27,11 +27,11 @@ versions:
|
||||
bstats: 2.2.1
|
||||
paperApi: 1.16.5-R0.1-SNAPSHOT
|
||||
waterfallApi: 1.16-R0.4-SNAPSHOT
|
||||
fabricApi: 0.34.9+1.17
|
||||
fabricLoader: 0.11.3
|
||||
fabricMinecraft: 1.17
|
||||
fabricApi: 0.37.0+1.17
|
||||
fabricLoader: 0.11.6
|
||||
fabricMinecraft: 1.17.1
|
||||
spongeApi7: 7.2.0
|
||||
velocityApi: 1.1.7
|
||||
velocityApi: 3.0.0
|
||||
jupiterEngine: 5.7.0
|
||||
|
||||
dependencies:
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -72,7 +72,7 @@ case "`uname`" in
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
|
||||
+3
-2
@@ -3,7 +3,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
//mavenLocal()
|
||||
// mavenLocal()
|
||||
mavenCentral()
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
@@ -18,13 +18,14 @@ pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://repo.jpenilla.xyz/snapshots/")
|
||||
}
|
||||
includeBuild("build-logic")
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("ca.stellardrift.polyglot-version-catalogs") version "5.0.0"
|
||||
id("fabric-loom") version "0.8-SNAPSHOT"
|
||||
id("quiet-fabric-loom") version "0.8-SNAPSHOT"
|
||||
}
|
||||
|
||||
rootProject.name = "MiniMOTD"
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.spongepowered.api.command.CommandExecutor;
|
||||
import org.spongepowered.api.command.CommandResult;
|
||||
import org.spongepowered.api.command.parameter.CommandContext;
|
||||
import org.spongepowered.api.config.ConfigDir;
|
||||
import org.spongepowered.api.event.EventListenerRegistration;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.lifecycle.LoadedGameEvent;
|
||||
import org.spongepowered.api.event.lifecycle.RefreshGameEvent;
|
||||
@@ -81,9 +82,10 @@ public final class MiniMOTDPlugin implements MiniMOTDPlatform<Favicon> {
|
||||
}
|
||||
});
|
||||
Sponge.eventManager().registerListener(
|
||||
pluginContainer,
|
||||
ClientPingServerEvent.class,
|
||||
this.injector.getInstance(ClientPingServerEventListener.class)
|
||||
EventListenerRegistration.builder(ClientPingServerEvent.class)
|
||||
.plugin(pluginContainer)
|
||||
.listener(this.injector.getInstance(ClientPingServerEventListener.class))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user