Compare commits

...
102 Commits
Author SHA1 Message Date
Jason Penilla 8c70ec3ea7 release: Version 2.2.2 2025-12-14 10:35:43 -07:00
Jason Penilla 7f43d73230 Bump minimum common Java requirement to 17
This is now the third-oldest LTS version, supporting anything older is not worth the build headache and outdated dependencies anymore.
2025-12-14 10:27:43 -07:00
Jason Penilla 1d4840e55f Bump minimum common Java requirement to 11 2025-12-14 10:23:05 -07:00
Jason Penilla 3bbb2dd18b Update for 1.21.11 2025-12-14 10:07:38 -07:00
Jason Penilla ff5d418387 Move disableAutoTargetJvm 2025-12-14 09:54:35 -07:00
renovate[bot] 17af4ab03a chore(deps): Update dependency io.github.miniplaceholders:miniplaceholders-api to v3.1.0 2025-12-14 09:50:08 -07:00
renovate[bot] a6d029d56b chore(deps): Update dependency io.papermc:hangar-publish-plugin to v0.1.4 2025-12-14 09:49:47 -07:00
Jason Penilla 1edfa4b53a Update junit 2025-12-14 09:48:56 -07:00
Jason Penilla 3f3cd43ab1 Update indra to v4 2025-12-14 09:46:15 -07:00
renovate[bot] 9728220a65 chore(deps): Update dependency net.fabricmc:fabric-loader to v0.18.2 2025-12-14 09:39:29 -07:00
renovate[bot] 0e23a15f3d chore(deps): Update gradle and github actions 2025-12-14 09:39:17 -07:00
renovate[bot] 43cbc6aaf4 chore(deps): Update gradle and github actions 2025-10-11 12:00:26 -07:00
Jason Penilla 811be6e946 2.2.2-SNAPSHOT 2025-10-09 10:50:50 -07:00
Jason Penilla 4a888a6032 release: Version 2.2.1 2025-10-09 10:45:57 -07:00
Jason Penilla 1854f552fe Update for Minecraft 1.21.10 2025-10-07 15:04:23 -07:00
Jason Penilla dd60234690 Fix mergeServiceFiles 2025-10-07 15:00:04 -07:00
renovate[bot] 2faeb581f1 chore(deps): Update gradle and github actions 2025-10-07 14:54:07 -07:00
renovate[bot] e5447dd94e chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.14.0 2025-10-07 14:53:50 -07:00
renovate[bot] 11c2dab22b chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v9.2.2 2025-10-07 14:53:42 -07:00
renovate[bot] c4b9c6e842 chore(deps): Update dependency net.fabricmc:fabric-loader to v0.17.2 2025-10-07 14:53:33 -07:00
renovate[bot] 7cfb191e2c chore(deps): Update dependency me.modmuss50:mod-publish-plugin to v1 2025-09-08 12:07:12 -07:00
renovate[bot] 110d409fa2 chore(deps): Update gradle and github actions 2025-09-07 20:06:13 -07:00
renovate[bot] facc10af69 chore(deps): Update slf4j monorepo to v1.7.36 2025-08-30 15:19:40 -07:00
renovate[bot] ec1ef8b2e7 chore(deps): Update dependency net.neoforged:neoforge to v21.8.39 2025-08-30 15:19:26 -07:00
renovate[bot] 57e2dbb731 chore(deps): Update dependency net.fabricmc.fabric-api:fabric-api to v0.133.0+1.21.8 2025-08-30 15:19:19 -07:00
renovate[bot] 931fa06d55 chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v9.1.0 2025-08-30 15:19:11 -07:00
Jason Penilla 47e642848e 2.2.1-SNAPSHOT 2025-08-30 15:10:43 -07:00
Jason Penilla 8b17cd0b8c release: Version 2.2.0 2025-08-30 14:59:00 -07:00
Jason Penilla 030d144e51 Don't register server init listener if MiniMOTD fails to init 2025-08-29 13:28:30 -07:00
Jason Penilla 14713f1585 Use API-provided Logger on Paper 2025-08-29 13:27:50 -07:00
Jason Penilla a5f4855a64 Update README 2025-08-29 12:40:24 -07:00
Jason Penilla 1e979808c3 Add MiniPlaceholders dependency to publishing metadata 2025-08-29 12:31:10 -07:00
Jason Penilla c113cc991e Bump minimum toolchain 2025-08-29 12:22:26 -07:00
Jason Penilla 6f44b52c03 Add support for MiniPlaceholders on native Adventure platforms 2025-08-29 12:15:15 -07:00
Jason Penilla 2cb658c3ba Switch to JSpecify nullness annotations 2025-08-29 11:36:11 -07:00
Jason Penilla 7e0dcf45a1 Update license headers 2025-08-29 11:35:25 -07:00
Jason Penilla 7230c27764 Implement native Paper platform (#318)
* Implement native Paper platform

* fix import order

* Add command description
2025-08-29 11:21:03 -07:00
Jason Penilla 7f0b547b17 mergeServiceFiles closes #317 2025-08-26 09:09:17 -07:00
renovate[bot] f0fea9c45a chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v9 2025-08-15 17:15:33 -07:00
renovate[bot] 950de09b40 chore(deps): Update dependency gradle to v9 2025-08-15 17:13:50 -07:00
renovate[bot] 7a35dcf3ab chore(deps): Update dependency net.fabricmc.fabric-api:fabric-api to v0.131.0+1.21.8 2025-08-15 17:12:10 -07:00
renovate[bot] 84b5557d30 chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.13.4 2025-08-15 17:10:23 -07:00
renovate[bot] 658178c477 chore(deps): Update plugin net.neoforged.moddev.repositories to v2.0.107 2025-08-15 17:10:09 -07:00
renovate[bot] ad529ec914 chore(deps): Update dependency net.neoforged:neoforge to v21.8.29 2025-08-08 10:20:37 -07:00
Jason Penilla 51b490be18 2.1.9-SNAPSHOT 2025-07-30 15:38:26 -07:00
Jason Penilla cd61adab95 release: Version 2.1.8 2025-07-30 15:32:38 -07:00
renovate[bot] fff3fc0711 chore(deps): Update adventurePlatformMod to v6.6.0 2025-07-30 15:02:12 -07:00
renovate[bot] 5bd936ebe8 chore(deps): Update dependency net.kyori:adventure-bom to v4.24.0 2025-07-30 14:59:02 -07:00
renovate[bot] 58566c4c73 chore(deps): Update indra to v3.2.0 2025-07-29 19:11:53 -07:00
Jason Penilla be16547182 Update adventure platforms 2025-07-29 19:07:59 -07:00
Jason Penilla 2fb0648c93 Link to Modrinth instead of GitHub from UpdateChecker 2025-07-28 12:34:42 -07:00
Jason Penilla 049e61df50 2.1.8-SNAPSHOT 2025-07-18 13:48:41 -07:00
Jason Penilla d4396a20bb release: Version 2.1.7 2025-07-18 13:44:29 -07:00
renovate[bot] 2ef09d0669 chore(deps): Update plugin net.neoforged.moddev.repositories to v2.0.103 2025-07-17 20:36:43 -07:00
Jason Penilla f7c7afd7e5 Update for 1.21.8 2025-07-17 20:36:23 -07:00
renovate[bot] d05dc770a5 chore(deps): Update dependency org.checkerframework:checker-qual to v3.49.5 2025-07-11 10:17:07 -07:00
renovate[bot] f8ade792bf chore(deps): Update dependency net.kyori:adventure-bom to v4.23.0 2025-07-11 10:17:00 -07:00
Jason Penilla 7dba88c9d2 Update for 1.21.7 (#301) 2025-07-11 09:55:14 -07:00
Jason Penilla b24955e113 build: Update repositories 2025-07-11 09:35:12 -07:00
renovate[bot] 89b8cbb26e chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.13.3 2025-07-11 09:22:25 -07:00
renovate[bot] 25902d132b chore(deps): Update gradle and github actions 2025-07-08 13:38:31 -07:00
renovate[bot] b1308e92ef chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v8.3.8 2025-07-01 11:30:30 -07:00
renovate[bot] 410272d025 chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.13.2 2025-06-29 19:03:52 -07:00
renovate[bot] e065283ae9 chore(deps): migrate config renovate.json 2025-06-29 19:03:45 -07:00
renovate[bot] c7a27a212f chore(deps): Update gradle and github actions 2025-06-29 18:58:01 -07:00
renovate[bot] ff99a0c231 chore(deps): Update dependency org.checkerframework:checker-qual to v3.49.4 2025-06-29 18:57:50 -07:00
renovate[bot] f8e8e81ace chore(deps): Update plugin org.gradle.toolchains.foojay-resolver-convention to v1 2025-06-29 18:57:39 -07:00
renovate[bot] 01a1091c5e chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v8.3.7 2025-06-29 18:57:24 -07:00
Jason Penilla 77a200203c Update adventure-platform 2025-05-10 17:13:36 -07:00
renovate[bot] cd88a2b73d chore(deps): Update dependency net.kyori:adventure-bom to v4.21.0 2025-04-30 11:21:43 -07:00
Jason Penilla 6a9bb08a1b 2.1.7-SNAPSHOT 2025-04-27 20:37:18 -07:00
Jason Penilla eab3617449 release: Version 2.1.6 2025-04-27 20:04:34 -07:00
Jason Penilla 73de0a0cff Update adventure-platform and loom 2025-04-27 19:29:03 -07:00
renovate[bot] ae1ea24c97 chore(deps): Update gradle and github actions 2025-04-27 15:30:02 -07:00
renovate[bot] 77e64e78bc chore(deps): Update dependency net.neoforged:neoforge to v21.5.62-beta 2025-04-27 15:29:56 -07:00
renovate[bot] a1bacb1747 chore(deps): Update dependency net.fabricmc.fabric-api:fabric-api to v0.121.0+1.21.5 2025-04-27 15:29:50 -07:00
Jason Penilla 8e6f9ea77d Minecraft 1.21.5 (#278) 2025-04-16 22:17:56 -07:00
renovate[bot] 03a95129f7 chore(deps): Update dependency net.fabricmc:fabric-loader to v0.16.14 2025-04-16 21:53:11 -07:00
renovate[bot] 6fc1f06fd9 chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.12.2 2025-04-16 21:48:38 -07:00
renovate[bot] cf918948c8 chore(deps): Update gradle and github actions 2025-04-16 21:48:32 -07:00
renovate[bot] 96254e790f chore(deps): Update dependency net.kyori:adventure-bom to v4.20.0 2025-04-05 18:01:22 -07:00
renovate[bot] ba6613e622 chore(deps): Update dependency net.fabricmc:fabric-loader to v0.16.12 2025-04-05 17:54:24 -07:00
renovate[bot] 1a1a4359c8 chore(deps): Update dependency org.checkerframework:checker-qual to v3.49.2 2025-04-05 17:54:15 -07:00
renovate[bot] 3e01f4a40c chore(deps): Update dependency io.papermc:hangar-publish-plugin to v0.1.3 2025-04-05 17:54:05 -07:00
renovate[bot] 31c24fc0f7 chore(deps): Update adventurePlatformMod to v6.3.0 2025-04-05 17:53:51 -07:00
renovate[bot] 87b74f6343 chore(deps): Update dependency net.neoforged:neoforge to v21.4.123 2025-03-28 09:42:07 -07:00
renovate[bot] 558e0a1b2c chore(deps): Update dependency net.fabricmc.fabric-api:fabric-api to v0.119.2+1.21.4 2025-03-28 09:42:00 -07:00
renovate[bot] 3fd8465433 chore(deps): Update dependency org.spongepowered:configurate-hocon to v4.2.0 2025-03-28 09:41:27 -07:00
renovate[bot] 689563a56e chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.12.1 2025-03-28 09:41:16 -07:00
renovate[bot] 180002e0e1 chore(deps): Update gradle and github actions 2025-02-24 16:08:07 -07:00
renovate[bot] b39cfdeb56 chore(deps): Update dependency org.checkerframework:checker-qual to v3.49.0 2025-02-24 16:07:49 -07:00
renovate[bot] 9a74c14f00 chore(deps): Update dependency net.fabricmc.fabric-api:fabric-api to v0.118.0+1.21.4 2025-02-24 16:07:40 -07:00
renovate[bot] ad8233a4d2 chore(deps): Update dependency org.junit.jupiter:junit-jupiter-engine to v5.12.0 2025-02-24 16:07:32 -07:00
renovate[bot] 0df4bc3c59 chore(deps): Update dependency net.kyori:adventure-bom to v4.19.0 2025-02-24 16:07:11 -07:00
renovate[bot] 9f216d90e6 chore(deps): Update dependency net.neoforged:neoforge to v21.4.95-beta 2025-02-24 15:58:17 -07:00
renovate[bot] 4c3f049e06 chore(deps): Update dependency net.fabricmc:fabric-loader to v0.16.10 2025-02-24 15:58:11 -07:00
renovate[bot] 095841448d chore(deps): Update dependency com.gradleup.shadow:shadow-gradle-plugin to v8.3.6 2025-02-24 15:58:04 -07:00
renovate[bot] 9378ea4d5d chore(deps): Update plugin sponge-gradle-plugin to v2.3.0 2025-01-01 21:39:08 -08:00
renovate[bot] 88a45eff62 chore(deps): Update dependency net.kyori:adventure-bom to v4.18.0 2025-01-01 21:38:58 -08:00
Jason Penilla a5a8d10940 Fix bukkit-bungeecord jar using deprecated Gradle features 2025-01-01 21:36:26 -08:00
Jason Penilla 79637815f6 Update Gradle wrapper to 8.12, loom to 1.9, switch to ModDevGradle for NeoForge 2025-01-01 21:20:46 -08:00
Jason Penilla 7f5a43f89f 2.1.6-SNAPSHOT 2025-01-01 20:59:37 -08:00
88 changed files with 944 additions and 373 deletions

No files matched your search

+1
View File
@@ -6,3 +6,4 @@ indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = off
ij_java_imports_layout=*,|,$*
+2
View File
@@ -117,3 +117,5 @@ run/
# Ignore Gradle build output directory
build/
.kotlin/
+4 -4
View File
@@ -10,8 +10,7 @@
- RGB colors are only able to be sent by proxies and 1.16+ servers, and can only be seen by 1.16+ clients.
#### Server Platforms
- [Paper](https://papermc.io/) / Spigot
- MiniMOTD is compatible with Spigot, however many features will not work. It is recommended to use Paper for full compatibility.
- [Paper](https://papermc.io/)
- [Sponge API 8](https://www.spongepowered.org/)
- [Sponge API 7](https://www.spongepowered.org/)
- [Fabric](https://fabricmc.net/) (requires [Fabric API](https://modrinth.com/mod/fabric-api))
@@ -27,8 +26,9 @@ Downloads can be obtained from any of:
- [Hangar](https://hangar.papermc.io/jmp/MiniMOTD)
- [GitHub releases](https://github.com/jpenilla/MiniMOTD/releases)
There is a separate jar for each platform. Paper and Spigot share the same jar, as do Waterfall and Bungeecord.
The `bukkit-bungeecord` jar is merged from the Paper/Spigot and Waterfall/Bungeecord jars for distribution on Spigot's site.
There is a separate jar for each platform. Waterfall and Bungeecord share the same jar.
There are two distributions for Bukkit-based servers: one for Paper >=1.21.8 only (`-paper` jar),
and one for all other supported versions (1.8.8 - 1.21.7, Spigot and Paper) (`-bukkit` jar).
#### Configuration
See the [wiki](https://github.com/jpenilla/MiniMOTD/wiki) for configuration details
+1
View File
@@ -1,3 +1,4 @@
plugins {
id("minimotd.build-logic")
alias(libs.plugins.run.paper) apply false
}
+3 -1
View File
@@ -19,9 +19,11 @@ dependencies {
}
api(libs.minimessage)
compileOnlyApi(libs.slf4jApi)
compileOnlyApi(libs.checkerQual)
compileOnlyApi(libs.jspecify)
compileOnlyApi(libs.gson)
testImplementation(libs.gson)
compileOnly(libs.brigadier)
compileOnly(libs.miniplaceholders)
}
sourceSets.main {
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,8 +27,7 @@ import java.util.stream.Stream;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
import static net.kyori.adventure.text.Component.space;
import static net.kyori.adventure.text.Component.text;
@@ -42,7 +41,7 @@ import static net.kyori.adventure.text.format.NamedTextColor.WHITE;
import static net.kyori.adventure.text.format.TextColor.color;
import static net.kyori.adventure.text.format.TextDecoration.STRIKETHROUGH;
@DefaultQualifier(NonNull.class)
@NullMarked
public final class CommandHandler {
private final MiniMOTD<?> miniMOTD;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -34,8 +34,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;
import javax.imageio.ImageIO;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
public final class IconManager<I> {
private final Map<String, I> icons = new ConcurrentHashMap<>();
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,16 +29,15 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
import org.slf4j.Logger;
import xyz.jpenilla.minimotd.common.config.ConfigManager;
import xyz.jpenilla.minimotd.common.config.MOTDConfig;
import xyz.jpenilla.minimotd.common.util.MiniPlaceholdersUtil;
import static net.kyori.adventure.text.Component.newline;
@DefaultQualifier(NonNull.class)
@NullMarked
public final class MiniMOTD<I> {
private final ConfigManager configManager;
private final IconManager<I> iconManager;
@@ -83,7 +82,7 @@ public final class MiniMOTD<I> {
.disablePlayerListHover(config.disablePlayerListHover())
.hidePlayerCount(config.hidePlayerCount());
@Nullable String iconString = null;
String iconString = null;
if (config.motdEnabled()) {
if (config.motds().isEmpty()) {
throw new IllegalStateException("MOTD is enabled, but there are no MOTDs in the config file?");
@@ -111,7 +110,11 @@ public final class MiniMOTD<I> {
final String max = Integer.toString(count.maxPlayers());
return MiniMessage.miniMessage().deserialize(
replacePlayerCount(input, online, max),
TagResolver.resolver(Placeholder.unparsed("online_players", online), Placeholder.unparsed("max_players", max))
TagResolver.resolver(
Placeholder.unparsed("online_players", online),
Placeholder.unparsed("max_players", max),
MiniPlaceholdersUtil.tagResolver()
)
);
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@ package xyz.jpenilla.minimotd.common;
import java.awt.image.BufferedImage;
import java.nio.file.Path;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
public interface MiniMOTDPlatform<I> {
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,13 +26,12 @@ package xyz.jpenilla.minimotd.common;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import static java.util.Objects.requireNonNull;
@DefaultQualifier(NonNull.class)
@NullMarked
public final class PingResponse<I> {
private final @Nullable I icon;
private final @Nullable Component motd;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.UnaryOperator;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.ConfigurationOptions;
@@ -39,7 +38,7 @@ import org.spongepowered.configurate.objectmapping.ObjectMapper;
import org.spongepowered.configurate.serialize.SerializationException;
import org.spongepowered.configurate.serialize.TypeSerializerCollection;
@DefaultQualifier(NonNull.class)
@NullMarked
public final class ConfigLoader<C> {
private static final TypeSerializerCollection SERIALIZERS;
@@ -94,13 +93,13 @@ public final class ConfigLoader<C> {
}
public ConfigLoader(
final @NonNull Class<C> configClass,
final @NonNull Path configPath
final Class<C> configClass,
final Path configPath
) {
this(configClass, configPath, options -> options);
}
public @NonNull C load() throws ConfigurateException {
public C load() throws ConfigurateException {
final CommentedConfigurationNode node = this.loader.load();
final C config = this.mapper.load(node);
for (final Consumer<C> processor : this.postProcess) {
@@ -109,7 +108,7 @@ public final class ConfigLoader<C> {
return config;
}
public void save(final @NonNull C config) throws ConfigurateException {
public void save(final C config) throws ConfigurateException {
final CommentedConfigurationNode node = this.loader.createNode();
this.mapper.save(config, node);
this.loader.save(node);
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -34,8 +34,8 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.spongepowered.configurate.ConfigurateException;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.util.Pair;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@ package xyz.jpenilla.minimotd.common.config;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import xyz.jpenilla.minimotd.common.PingResponse;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,8 +26,8 @@ package xyz.jpenilla.minimotd.common.config;
import java.lang.reflect.Type;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Predicate;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.spongepowered.configurate.serialize.ScalarSerializer;
import org.spongepowered.configurate.serialize.SerializationException;
import xyz.jpenilla.minimotd.common.util.Int2IntFunction;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,9 +26,9 @@ package xyz.jpenilla.minimotd.common.config;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Objects;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
@@ -63,7 +63,7 @@ public final class PluginSettings {
+ "checked in the order they are declared if there are no exact matches.")
private final Map<String, String> virtualHostConfigs = new LinkedHashMap<>();
private transient @MonotonicNonNull Map<String[], String> splitVirtualHostConfigs;
private transient @Nullable Map<String[], String> splitVirtualHostConfigs;
@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.")
@@ -74,6 +74,7 @@ public final class PluginSettings {
}
public @Nullable String findConfigStringForHost(@NonNull String host, final int port) {
Objects.requireNonNull(this.splitVirtualHostConfigs, "processVirtualHosts must be called first");
host = processTcpShieldHostname(host).toLowerCase(Locale.ENGLISH) + ':' + port;
final @Nullable String exactMatch = this.virtualHostConfigs.get(host);
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,66 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.common.util;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import java.util.function.Function;
import java.util.function.Predicate;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
import xyz.jpenilla.minimotd.common.CommandHandler;
@NullMarked
public final class BrigadierUtil {
private BrigadierUtil() {
}
public static <S> LiteralArgumentBuilder<S> buildTree(
final CommandHandler handler,
final Function<S, Audience> audienceExtractor,
final Predicate<S> permissionChecker
) {
final class WrappingExecutor implements Command<S> {
private final CommandHandler.Executor handler;
WrappingExecutor(final CommandHandler.Executor handler) {
this.handler = handler;
}
@Override
public int run(final CommandContext<S> context) {
this.handler.execute(audienceExtractor.apply(context.getSource()));
return Command.SINGLE_SUCCESS;
}
}
return LiteralArgumentBuilder.<S>literal("minimotd")
.requires(permissionChecker)
.executes(new WrappingExecutor(handler::help))
.then(LiteralArgumentBuilder.<S>literal("help").executes(new WrappingExecutor(handler::help)))
.then(LiteralArgumentBuilder.<S>literal("about").executes(new WrappingExecutor(handler::about)))
.then(LiteralArgumentBuilder.<S>literal("reload").executes(new WrappingExecutor(handler::reload)));
}
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@ package xyz.jpenilla.minimotd.common.util;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
public interface ComponentColorDownsampler {
static @NonNull ComponentColorDownsampler downsampler() {
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,68 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.common.util;
import io.github.miniplaceholders.api.MiniPlaceholders;
import java.util.Objects;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jspecify.annotations.NullMarked;
@NullMarked
public final class MiniPlaceholdersUtil {
private static final String KYORI_PREFIX = new String(new char[]{'n', 'e', 't', '.', 'k', 'y', 'o', 'r', 'i'});
private static byte miniPlaceholdersLoaded = -1;
private MiniPlaceholdersUtil() {
}
private static boolean miniPlaceholdersLoaded() {
if (miniPlaceholdersLoaded == -1) {
if (!TagResolver.class.getName().startsWith(KYORI_PREFIX)) {
miniPlaceholdersLoaded = 0;
return false;
}
try {
final String name = MiniPlaceholders.class.getName();
Objects.requireNonNull(name);
miniPlaceholdersLoaded = 1;
} catch (final NoClassDefFoundError error) {
miniPlaceholdersLoaded = 0;
}
}
return miniPlaceholdersLoaded == 1;
}
public static TagResolver tagResolver() {
if (!miniPlaceholdersLoaded()) {
return TagResolver.empty();
}
return tagResolver_();
}
private static TagResolver tagResolver_() {
return MiniPlaceholders.globalPlaceholders();
}
}
@@ -0,0 +1,129 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.common.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.jspecify.annotations.Nullable;
public abstract class Nag {
private static final String EQUALS_LINE = "====================================================";
private final List<String> lines = new ArrayList<>();
private boolean exception = false;
private boolean error = false;
public Nag lines(final String... lines) {
this.lines.addAll(Arrays.asList(lines));
return this;
}
public Nag line(final String line) {
this.lines.add(line);
return this;
}
public Nag error(final boolean withException) {
this.error = true;
this.exception = withException;
return this;
}
protected abstract void logError(String message, @Nullable Throwable throwable);
protected abstract void logWarn(String message, @Nullable Throwable throwable);
public void logBanner() {
final List<String> toLog = new ArrayList<>();
toLog.add(EQUALS_LINE);
toLog.addAll(this.lines);
toLog.add(EQUALS_LINE);
for (final String line : toLog) {
if (this.error) {
this.logError(line, null);
} else {
this.logWarn(line, null);
}
}
if (this.exception) {
// this.exception implies this.error
this.logError("Please see the above notice.", new RuntimeException("Please see the above notice."));
}
}
public static final class Slf4J extends Nag {
private final org.slf4j.Logger logger;
public Slf4J(final org.slf4j.Logger logger) {
this.logger = logger;
}
@Override
protected void logError(final String message, @Nullable final Throwable throwable) {
if (throwable != null) {
this.logger.error(message, throwable);
} else {
this.logger.error(message);
}
}
@Override
protected void logWarn(final String message, @Nullable final Throwable throwable) {
if (throwable != null) {
this.logger.warn(message, throwable);
} else {
this.logger.warn(message);
}
}
}
public static final class JavaUtilLogging extends Nag {
private final java.util.logging.Logger logger;
public JavaUtilLogging(final java.util.logging.Logger logger) {
this.logger = logger;
}
@Override
protected void logError(final String message, @Nullable final Throwable throwable) {
if (throwable != null) {
this.logger.log(java.util.logging.Level.SEVERE, message, throwable);
} else {
this.logger.severe(message);
}
}
@Override
protected void logWarn(final String message, @Nullable final Throwable throwable) {
if (throwable != null) {
this.logger.log(java.util.logging.Level.WARNING, message, throwable);
} else {
this.logger.warning(message);
}
}
}
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,8 +24,8 @@
package xyz.jpenilla.minimotd.common.util;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
public final class Pair<L, R> {
private final L left;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.Constants;
public final class UpdateChecker {
@@ -67,8 +67,8 @@ public final class UpdateChecker {
return Arrays.asList(
"There is an update available for " + Constants.PluginMetadata.NAME + "!",
"This server is running version " + currentVersion + ", which is " + (versionsBehind == -1 ? "UNKNOWN" : versionsBehind) + " versions outdated.",
"Download the latest version, " + versionList.get(0) + " from GitHub at the link below:",
versionMap.get(versionList.get(0))
"Download the latest version, " + versionList.get(0) + " from Modrinth at the link below:",
"https://modrinth.com/plugin/minimotd"
);
}
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
-27
View File
@@ -1,27 +0,0 @@
plugins {
id("minimotd.platform-conventions")
}
tasks.jar {
archiveClassifier.set("empty")
}
val platforms = setOf(
projects.minimotdBukkit,
projects.minimotdBungeecord,
).map { it.dependencyProject }
val dist = tasks.register<Jar>("bukkitAndBungeeJar") {
artifacts.add("archives", this)
archiveClassifier.set(null as String?)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
for (platform in platforms) {
val jarTask = platform.miniMOTDPlatform.jarTask
from(zipTree(jarTask.flatMap { it.archiveFile }))
}
}
miniMOTDPlatform {
jarTask.set(dist)
}
+1 -2
View File
@@ -1,8 +1,7 @@
group=xyz.jpenilla
version=2.1.5
version=2.2.2
description=Use MiniMessage text formatting in the server list MOTD.
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
@@ -2,5 +2,5 @@ object Constants {
const val GITHUB_USER = "jpenilla"
const val GITHUB_REPO = "MiniMOTD"
const val GITHUB_URL = "https://github.com/$GITHUB_USER/$GITHUB_REPO"
const val RELOCATION_BASE_PACKAGE = "xyz.jpenilla.minimotd.lib"
const val RELOCATION_BASE_PACKAGE = "minimotd"
}
@@ -1,11 +1,12 @@
import net.kyori.indra.git.IndraGitExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
import org.gradle.api.attributes.Attribute
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.getByType
fun Project.lastCommitHash(): String =
extensions.getByType<IndraGitExtension>().commit()?.name?.substring(0, 7) ?: "unknown"
extensions.getByType<IndraGitExtension>().commit().orNull?.name?.substring(0, 7) ?: "unknown"
val Project.libs: LibrariesForLibs
get() = extensions.getByType()
@@ -30,6 +31,23 @@ val bukkitVersions = listOf(
"1.17.1",
"1.18.2",
"1.19.4",
"1.20.4",
"1.20.5",
"1.20.6",
"1.21.1",
"1.21.2",
"1.21.3",
"1.21.4",
"1.21.5",
"1.21.6",
"1.21.7",
)
val paperVersions = listOf(
"1.21.8",
"1.21.9",
"1.21.10",
"1.21.11",
)
val productionJarAttribute = Attribute.of("minimotd.productionJar", String::class.java)
@@ -11,36 +11,36 @@ version = (version as String)
indra {
javaVersions {
minimumToolchain(17)
target(8)
target(17)
minimumToolchain(21)
testWith(17, 21, 25)
}
github(Constants.GITHUB_USER, Constants.GITHUB_REPO)
mitLicense()
}
java.disableAutoTargetJvm()
repositories {
mavenCentral {
mavenContent { releasesOnly() }
}
maven("https://oss.sonatype.org/content/repositories/snapshots/") {
mavenContent { snapshotsOnly() }
maven("https://repo.jpenilla.xyz/snapshots/") {
mavenContent {
snapshotsOnly()
includeGroup("xyz.jpenilla")
}
}
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
maven("https://central.sonatype.com/repository/maven-snapshots/") {
mavenContent { snapshotsOnly() }
}
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.spongepowered.org/repository/maven-public/")
maven("https://repo.jpenilla.xyz/snapshots/") {
mavenContent { snapshotsOnly() }
}
}
dependencies {
testImplementation(libs.jupiterEngine)
// TODO: work around archloom issue?
if (project.name != "minimotd-neoforge" && project.name != "minimotd-fabric") {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
testImplementation(libs.junitJupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks {
@@ -14,16 +14,18 @@ hangarPublish.publications.register("plugin") {
apiKey.set(providers.environmentVariable("HANGAR_UPLOAD_KEY"))
platforms {
paper {
jar.set(jar("bukkit"))
val vers = bukkitVersions.toMutableList()
vers -= "1.8.8"
vers -= "1.8.9"
vers += "1.8"
platformVersions.addAll(vers)
jar.set(jar("paper"))
platformVersions = paperVersions
dependencies.hangar("MiniPlaceholders") {
required = false
}
}
velocity {
jar.set(jar("velocity"))
platformVersions.addAll("3.4")
dependencies.hangar("MiniPlaceholders") {
required = false
}
}
waterfall {
jar.set(jar("bungeecord"))
@@ -32,3 +32,10 @@ if (name != "minimotd-bukkit-bungeecord") {
}
}
}
configurations.consumable("productionJar") {
outgoing {
artifact(platformExtension.jarTask)
}
attributes.attribute(productionJarAttribute, "true")
}
@@ -1,14 +1,17 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.file.DuplicatesStrategy
fun ShadowJar.commonRelocation(pkg: String) {
relocate(pkg, "${Constants.RELOCATION_BASE_PACKAGE}.$pkg")
}
fun ShadowJar.platformRelocation(platform: String, pkg: String) {
relocate(pkg, "${Constants.RELOCATION_BASE_PACKAGE}.platform_$platform.$pkg")
}
fun ShadowJar.commonConfiguration() {
mergeServiceFiles()
// Needed for mergeServiceFiles to work properly in Shadow 9+
filesMatching("META-INF/services/**") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
commonRelocation("org.spongepowered.configurate")
commonRelocation("com.typesafe.config")
dependencies {
+36 -27
View File
@@ -1,33 +1,37 @@
[plugins]
blossom = { id = "net.kyori.blossom", version = "2.1.0" }
sponge-gradle-plugin = { id = "org.spongepowered.gradle.plugin", version = "2.2.0" }
run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "run-task" }
run-velocity = { id = "xyz.jpenilla.run-velocity", version.ref = "run-task" }
run-waterfall = { id = "xyz.jpenilla.run-waterfall", version.ref = "run-task" }
[versions]
run-task = "2.3.1"
mod-publish-plugin = "0.8.4"
hangarPublishPlugin = "0.1.2"
indra = "3.1.3"
shadow = "8.3.5"
adventure = "4.17.0"
adventurePlatform = "4.3.4"
adventurePlatformMod = "6.2.0"
configurate = "4.1.2"
checkerQual = "3.48.2"
slf4j = "1.7.32"
run-task = "3.0.2"
resource-factory = "1.3.1"
mod-publish-plugin = "1.0.0"
hangarPublishPlugin = "0.1.4"
indra = "4.0.0"
shadow = "9.2.2"
adventure = "4.25.0"
adventurePlatform = "4.4.1"
adventurePlatformMod = "6.8.0"
configurate = "4.2.0"
slf4j = "1.7.36"
gson = "2.8.0"
bstats = "3.1.0"
paperApi = "1.16.5-R0.1-SNAPSHOT"
paperApiLegacy = "1.16.5-R0.1-SNAPSHOT"
paperApi = "1.21.11-R0.1-SNAPSHOT"
paperlib = "1.0.8"
waterfallApi = "1.16-R0.5-SNAPSHOT"
fabricApi = "0.114.0+1.21.4"
fabricLoader = "0.16.9"
minecraft = "1.21.4"
fabricApi = "0.139.5+1.21.11"
fabricLoader = "0.18.2"
minecraft = "1.21.11"
spongeApi7 = "7.2.0"
velocityApi = "3.4.0-SNAPSHOT"
jupiterEngine = "5.11.4"
neoforge = "21.11.6-beta"
[plugins]
blossom = { id = "net.kyori.blossom", version = "2.2.0" }
sponge-gradle-plugin = { id = "org.spongepowered.gradle.plugin", version = "2.3.0" }
run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "run-task" }
run-velocity = { id = "xyz.jpenilla.run-velocity" }
run-waterfall = { id = "xyz.jpenilla.run-waterfall" }
resource-factory-bukkit = { id = "xyz.jpenilla.resource-factory-bukkit-convention", version.ref = "resource-factory" }
resource-factory-paper = { id = "xyz.jpenilla.resource-factory-paper-convention", version.ref = "resource-factory" }
resource-factory-velocity = { id = "xyz.jpenilla.resource-factory-velocity-convention", version.ref = "resource-factory" }
[libraries]
adventureBom = { group = "net.kyori", name = "adventure-bom", version.ref = "adventure" }
@@ -40,10 +44,13 @@ adventurePlatformFabric = { group = "net.kyori", name = "adventure-platform-fabr
adventurePlatformNeoforge = { group = "net.kyori", name = "adventure-platform-neoforge", version.ref = "adventurePlatformMod" }
adventurePlatformSpongeApi = { group = "net.kyori", name = "adventure-platform-spongeapi", version.ref = "adventurePlatform" }
minimessage = { group = "net.kyori", name = "adventure-text-minimessage" }
miniplaceholders = "io.github.miniplaceholders:miniplaceholders-api:3.1.0"
brigadier = "com.mojang:brigadier:1.3.10"
configurateHocon = { group = "org.spongepowered", name = "configurate-hocon", version.ref = "configurate" }
checkerQual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerQual" }
jspecify = "org.jspecify:jspecify:1.0.0"
slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
slf4jJdk14 = { group = "org.slf4j", name = "slf4j-jdk14", version.ref = "slf4j" }
@@ -55,7 +62,8 @@ bstatsBungeecord = { group = "org.bstats", name = "bstats-bungeecord", version.r
bstatsVelocity = { group = "org.bstats", name = "bstats-velocity", version.ref = "bstats" }
bstatsSponge = { group = "org.bstats", name = "bstats-sponge", version.ref = "bstats" }
paperApi = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paperApi" }
paperApiLegacy = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paperApiLegacy" }
paperApi = { group = "io.papermc.paper", name = "paper-api", version.ref = "paperApi" }
paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
waterfallApi = { group = "io.github.waterfallmc", name = "waterfall-api", version.ref = "waterfallApi" }
@@ -64,13 +72,14 @@ fabricApi = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.re
fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" }
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
neoforge = { module = "net.neoforged:neoforge", version = "21.4.47-beta" }
# for renovate
zNeoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" }
spongeApi7 = { group = "org.spongepowered", name = "spongeapi", version.ref = "spongeApi7" }
velocityApi = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocityApi" }
jupiterEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "jupiterEngine" }
junitJupiter = "org.junit.jupiter:junit-jupiter:6.0.1"
# build-logic
indraCommon = { group = "net.kyori", name = "indra-common", version.ref = "indra" }
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+4 -8
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -115,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -173,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -206,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+1 -2
View File
@@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2024 Jason Penilla
Copyright (c) 2020-2025 Jason Penilla
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -1,6 +1,6 @@
This file is part of MiniMOTD, licensed under the MIT License.
Copyright (c) 2020-2024 Jason Penilla
Copyright (c) 2020-2025 Jason Penilla
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+18 -14
View File
@@ -1,6 +1,7 @@
plugins {
id("minimotd.shadow-platform")
alias(libs.plugins.run.paper)
alias(libs.plugins.resource.factory.bukkit)
}
dependencies {
@@ -9,15 +10,14 @@ dependencies {
implementation(libs.adventurePlatformBukkit)
implementation(libs.bstatsBukkit)
implementation(libs.paperlib)
compileOnly(libs.paperApi)
compileOnly(libs.paperApiLegacy)
}
tasks {
runServer {
minecraftVersion(minecraftVersion)
minecraftVersion("1.21.7")
}
shadowJar {
platformRelocation("bukkit", "xyz.jpenilla.minimotd.common")
commonRelocation("org.slf4j")
commonRelocation("io.leangen.geantyref")
commonRelocation("net.kyori")
@@ -27,22 +27,26 @@ tasks {
attributes("paperweight-mappings-namespace" to "mojang")
}
}
processResources {
val props = mapOf(
"version" to project.version,
"website" to Constants.GITHUB_URL,
"description" to project.description
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
bukkitPluginYaml {
name = "MiniMOTD"
main = "xyz.jpenilla.minimotd.bukkit.MiniMOTDBukkit"
foliaSupported = true
authors = listOf("jmp")
website = Constants.GITHUB_URL
commands.register("minimotd") {
description = "MiniMOTD Command"
permission = "minimotd.admin"
usage = "/minimotd help"
}
apiVersion = "1.13"
softDepend = listOf("ViaVersion")
}
runPaper.folia.registerTask()
publishMods.modrinth {
modLoaders.addAll("paper", "folia")
minecraftVersions.addAll(bukkitVersions)
minecraftVersions = bukkitVersions
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -31,7 +31,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.CommandHandler;
import static net.kyori.adventure.text.Component.text;
@@ -39,10 +39,10 @@ import static net.kyori.adventure.text.event.ClickEvent.runCommand;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
final class BukkitCommand implements CommandExecutor, TabCompleter {
private final MiniMOTDPlugin plugin;
private final MiniMOTDBukkit plugin;
private final CommandHandler handler;
BukkitCommand(final @NonNull MiniMOTDPlugin plugin) {
BukkitCommand(final @NonNull MiniMOTDBukkit plugin) {
this.plugin = plugin;
this.handler = new CommandHandler(plugin.miniMOTD());
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,18 +29,20 @@ import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.CachedServerIcon;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.MiniMOTDPlatform;
import xyz.jpenilla.minimotd.common.util.Nag;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
public final class MiniMOTDPlugin extends JavaPlugin implements MiniMOTDPlatform<CachedServerIcon> {
public final class MiniMOTDBukkit extends JavaPlugin implements MiniMOTDPlatform<CachedServerIcon> {
private static final boolean PAPER_PING_EVENT_EXISTS = findClass("com.destroystokyo.paper.event.server.PaperServerListPingEvent") != null;
private Logger logger;
@@ -50,6 +52,21 @@ public final class MiniMOTDPlugin extends JavaPlugin implements MiniMOTDPlatform
@Override
public void onEnable() {
this.logger = LoggerFactory.getLogger(this.getName());
if (PaperLib.getMinecraftVersion() > 21 || PaperLib.getMinecraftVersion() == 21 && PaperLib.getMinecraftPatchVersion() > 7) {
new Nag.Slf4J(this.logger).lines(
"You are using the incorrect MiniMOTD build for your server software.",
"This build is for Spigot/Paper 1.8.8 through 1.21.7.",
"Builds for Paper 1.21.8+ are available on Modrinth (https://modrinth.com/plugin/minimotd)",
"and Hangar (https://hangar.papermc.io/jmp/MiniMOTD).",
"When downloading be sure to check the supported versions/platforms",
"field on the versions page, and/or make the correct selections in",
"the download menu."
).error(true).logBanner();
this.getServer().getPluginManager().disablePlugin(this);
return;
}
this.miniMOTD = new MiniMOTD<>(this);
this.audiences = BukkitAudiences.create(this);
@@ -70,6 +87,7 @@ public final class MiniMOTDPlugin extends JavaPlugin implements MiniMOTDPlatform
}
final Metrics metrics = new Metrics(this, 8132);
metrics.addCustomChart(new SimplePie("variant", () -> "bukkit"));
if (this.miniMOTD.configManager().pluginSettings().updateChecker()) {
try {
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,7 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.util.CachedServerIcon;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.Constants;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.PingResponse;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.util.CachedServerIcon;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.PingResponse;
import xyz.jpenilla.minimotd.common.config.MOTDConfig;
@@ -1,16 +0,0 @@
name: MiniMOTD
version: $version
main: xyz.jpenilla.minimotd.bukkit.MiniMOTDPlugin
folia-supported: true
description: $description
authors:
- jmp
website: $website
commands:
minimotd:
description: MiniMOTD Command
permission: minimotd.admin
usage: /minimotd help
api-version: 1.13
softdepend:
- ViaVersion
-1
View File
@@ -12,7 +12,6 @@ dependencies {
tasks {
shadowJar {
platformRelocation("bungee", "xyz.jpenilla.minimotd.common")
commonRelocation("io.leangen.geantyref")
commonRelocation("net.kyori")
commonRelocation("org.bstats")
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@ package xyz.jpenilla.minimotd.bungee;
import net.kyori.adventure.audience.Audience;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.CommandHandler;
import static net.kyori.adventure.text.Component.text;
@@ -34,10 +34,10 @@ import static net.kyori.adventure.text.event.ClickEvent.runCommand;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
final class BungeeCommand extends Command {
private final MiniMOTDPlugin plugin;
private final MiniMOTDBungee plugin;
private final CommandHandler handler;
BungeeCommand(final @NonNull MiniMOTDPlugin plugin) {
BungeeCommand(final @NonNull MiniMOTDBungee plugin) {
super("minimotd");
this.plugin = plugin;
this.handler = new CommandHandler(plugin.miniMOTD());
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -33,8 +33,8 @@ import net.md_5.bungee.api.Favicon;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import org.bstats.bungeecord.Metrics;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xyz.jpenilla.minimotd.common.MiniMOTD;
@@ -43,7 +43,7 @@ import xyz.jpenilla.minimotd.common.PingResponse;
import xyz.jpenilla.minimotd.common.config.MOTDConfig;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
public final class MiniMOTDPlugin extends Plugin implements MiniMOTDPlatform<Favicon> {
public final class MiniMOTDBungee extends Plugin implements MiniMOTDPlatform<Favicon> {
private Logger logger;
private BungeeAudiences audiences;
private MiniMOTD<Favicon> miniMOTD;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -31,7 +31,7 @@ import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.Constants;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.PingResponse;
@@ -1,5 +1,5 @@
name: MiniMOTD
main: xyz.jpenilla.minimotd.bungee.MiniMOTDPlugin
main: xyz.jpenilla.minimotd.bungee.MiniMOTDBungee
version: $version
author: jmp
description: $description
+2 -1
View File
@@ -1,5 +1,5 @@
plugins {
id("xyz.jpenilla.quiet-architectury-loom")
id("quiet-fabric-loom")
id("minimotd.platform-conventions")
id("com.gradleup.shadow")
}
@@ -58,4 +58,5 @@ tasks {
publishMods.modrinth {
modLoaders.add("fabric")
minecraftVersions.addAll(minecraftVersion)
optional("miniplaceholders")
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -36,19 +36,19 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.protocol.status.ServerStatus;
import net.minecraft.server.MinecraftServer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xyz.jpenilla.minimotd.common.CommandHandler;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.MiniMOTDPlatform;
import xyz.jpenilla.minimotd.common.util.BrigadierUtil;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
import xyz.jpenilla.minimotd.fabric.access.ServerStatusFaviconAccess;
import static net.minecraft.commands.Commands.literal;
public final class MiniMOTDFabric implements ModInitializer, MiniMOTDPlatform<ServerStatus.Favicon> {
private static MiniMOTDFabric instance = null;
@@ -104,13 +104,12 @@ public final class MiniMOTDFabric implements ModInitializer, MiniMOTDPlatform<Se
}
}
final CommandHandler handler = new CommandHandler(this.miniMOTD);
CommandRegistrationCallback.EVENT.register((dispatcher, commandBuildContext, commandSelection) -> dispatcher.register(
literal("minimotd")
.requires(source -> source.hasPermission(4))
.then(literal("reload").executes(new WrappingExecutor(handler::reload)))
.then(literal("about").executes(new WrappingExecutor(handler::about)))
.then(literal("help").executes(new WrappingExecutor(handler::help)))
BrigadierUtil.buildTree(
new CommandHandler(this.miniMOTD),
sourceStack -> this.audiences().audience(sourceStack),
Commands.hasPermission(Commands.LEVEL_ADMINS)
)
));
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@
*/
package xyz.jpenilla.minimotd.fabric.access;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.Nullable;
public interface ServerStatusFaviconAccess {
@Nullable String cachedEncodedIcon();
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -28,7 +28,7 @@ import com.mojang.serialization.DataResult;
import com.mojang.serialization.codecs.PrimitiveCodec;
import java.util.function.Function;
import net.minecraft.network.protocol.status.ServerStatus;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,11 +27,10 @@ import java.util.Objects;
import java.util.Optional;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.status.ServerStatus;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
@SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unused"})
@DefaultQualifier(NonNull.class)
@NullMarked
public final class MutableServerStatus {
private Component description;
private Optional<ServerStatus.Players> players;
@@ -23,8 +23,9 @@
"minimotd-fabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.16.7",
"fabric": "*",
"minecraft": ">=1.21.3 <1.22-"
"fabricloader": ">=0.18.2",
"fabric-api": "*",
"minecraft": ">=1.21.11",
"adventure-platform-fabric": "*"
}
}
+21 -14
View File
@@ -1,27 +1,25 @@
plugins {
id("xyz.jpenilla.quiet-architectury-loom")
id("net.neoforged.moddev")
id("minimotd.platform-conventions")
id("com.gradleup.shadow")
}
neoForge {
enable {
version = libs.versions.neoforge.get()
}
}
val shade: Configuration by configurations.creating
dependencies {
minecraft(libs.minecraft)
mappings(loom.officialMojangMappings())
neoForge(libs.neoforge)
shade(implementation(projects.minimotdCommon) {
exclude("net.kyori")
exclude("com.google.errorprone")
})
modImplementation(libs.adventurePlatformNeoforge)
include(libs.adventurePlatformNeoforge)
}
miniMOTDPlatform {
jarTask.set(tasks.remapJar)
implementation(libs.adventurePlatformNeoforge)
jarJar(libs.adventurePlatformNeoforge)
}
indra {
@@ -36,9 +34,6 @@ tasks {
commonConfiguration()
commonRelocation("io.leangen.geantyref")
}
remapJar {
archiveFileName.set("${project.name}-mc$minecraftVersion-${project.version}.jar")
}
processResources {
val replacements = mapOf(
"version" to project.version.toString(),
@@ -52,7 +47,19 @@ tasks {
}
}
val productionJar = tasks.register<Zip>("productionJar") {
archiveFileName = "${project.name}-mc$minecraftVersion-${project.version}.jar"
destinationDirectory = layout.buildDirectory.dir("libs")
from(zipTree(tasks.shadowJar.flatMap { it.archiveFile }))
from(tasks.jarJar.flatMap { it.outputDirectory })
}
miniMOTDPlatform {
jarTask.set(productionJar)
}
publishMods.modrinth {
modLoaders.add("neoforge")
minecraftVersions.addAll(minecraftVersion)
optional("miniplaceholders")
}
-1
View File
@@ -1 +0,0 @@
loom.platform=neoforge
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,15 +23,13 @@
*/
package xyz.jpenilla.minimotd.neoforge;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.context.CommandContext;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import javax.imageio.ImageIO;
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.protocol.status.ServerStatus;
import net.minecraft.server.MinecraftServer;
import net.neoforged.fml.common.Mod;
@@ -40,17 +38,16 @@ import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.server.ServerStartedEvent;
import net.neoforged.neoforge.event.server.ServerStartingEvent;
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xyz.jpenilla.minimotd.common.CommandHandler;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.MiniMOTDPlatform;
import xyz.jpenilla.minimotd.common.util.BrigadierUtil;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
import xyz.jpenilla.minimotd.neoforge.access.ServerStatusFaviconAccess;
import static net.minecraft.commands.Commands.literal;
@Mod("minimotd")
public final class MiniMOTDNeoForge implements MiniMOTDPlatform<ServerStatus.Favicon> {
private static MiniMOTDNeoForge instance = null;
@@ -90,28 +87,13 @@ public final class MiniMOTDNeoForge implements MiniMOTDPlatform<ServerStatus.Fav
}
private void registerCommand() {
final class WrappingExecutor implements Command<CommandSourceStack> {
private final CommandHandler.Executor handler;
WrappingExecutor(final CommandHandler.@NonNull Executor handler) {
this.handler = handler;
}
@Override
public int run(final @NonNull CommandContext<CommandSourceStack> context) {
this.handler.execute(MiniMOTDNeoForge.this.audiences().audience(context.getSource()));
return Command.SINGLE_SUCCESS;
}
}
final CommandHandler handler = new CommandHandler(this.miniMOTD);
NeoForge.EVENT_BUS.addListener((RegisterCommandsEvent event) -> {
event.getDispatcher().register(
literal("minimotd")
.requires(source -> source.hasPermission(4))
.then(literal("reload").executes(new WrappingExecutor(handler::reload)))
.then(literal("about").executes(new WrappingExecutor(handler::about)))
.then(literal("help").executes(new WrappingExecutor(handler::help)))
BrigadierUtil.buildTree(
new CommandHandler(this.miniMOTD),
sourceStack -> this.audiences().audience(sourceStack),
Commands.hasPermission(Commands.LEVEL_ADMINS)
)
);
});
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@
*/
package xyz.jpenilla.minimotd.neoforge.access;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.Nullable;
public interface ServerStatusFaviconAccess {
@Nullable String cachedEncodedIcon();
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -28,7 +28,7 @@ import com.mojang.serialization.DataResult;
import com.mojang.serialization.codecs.PrimitiveCodec;
import java.util.function.Function;
import net.minecraft.network.protocol.status.ServerStatus;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jspecify.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,11 +27,10 @@ import java.util.Objects;
import java.util.Optional;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.status.ServerStatus;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
@SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unused"})
@DefaultQualifier(NonNull.class)
@NullMarked
public final class MutableServerStatus {
private Component description;
private Optional<ServerStatus.Players> players;
@@ -23,7 +23,7 @@ side = "BOTH"
[[dependencies.minimotd]]
modId = "minecraft"
type = "required"
versionRange = "[1.21.3,1.22)"
versionRange = "[1.21.11,)"
ordering = "NONE"
side = "BOTH"
+64
View File
@@ -0,0 +1,64 @@
import xyz.jpenilla.resourcefactory.paper.PaperPluginYaml.Load
plugins {
id("minimotd.shadow-platform")
alias(libs.plugins.run.paper)
alias(libs.plugins.resource.factory.bukkit)
alias(libs.plugins.resource.factory.paper)
}
dependencies {
implementation(projects.minimotdCommon)
implementation(libs.bstatsBukkit)
compileOnly(libs.paperApi)
}
tasks {
runServer {
minecraftVersion(minecraftVersion)
}
shadowJar {
configureForNativeAdventurePlatform()
commonRelocation("org.bstats")
dependencies {
exclude(dependency("io.leangen.geantyref:geantyref"))
}
}
}
indra {
javaVersions {
target(21)
}
}
bukkitPluginYaml {
name = "MiniMOTD"
main = "xyz.jpenilla.minimotd.paper.MiniMOTDStub"
foliaSupported = true
authors = listOf("jmp")
website = Constants.GITHUB_URL
apiVersion = "1.13"
}
paperPluginYaml {
name = "MiniMOTD"
main = "xyz.jpenilla.minimotd.paper.MiniMOTDPaper"
foliaSupported = true
authors = listOf("jmp")
website = Constants.GITHUB_URL
apiVersion = "1.21.8"
dependencies.server.register("MiniPlaceholders") {
required = false
load = Load.BEFORE
joinClasspath = true
}
}
runPaper.folia.registerTask()
publishMods.modrinth {
modLoaders.addAll("paper", "folia")
minecraftVersions = paperVersions
optional("miniplaceholders")
}
@@ -0,0 +1,100 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.paper;
import io.papermc.paper.command.brigadier.CommandSourceStack;
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
import io.papermc.paper.threadedregions.RegionizedServerInitEvent;
import java.awt.image.BufferedImage;
import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.CachedServerIcon;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import xyz.jpenilla.minimotd.common.CommandHandler;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.MiniMOTDPlatform;
import xyz.jpenilla.minimotd.common.util.BrigadierUtil;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
public final class MiniMOTDPaper extends JavaPlugin implements MiniMOTDPlatform<CachedServerIcon>, Listener {
private MiniMOTD<CachedServerIcon> miniMOTD;
@Override
public void onEnable() {
this.miniMOTD = new MiniMOTD<>(this);
this.getServer().getPluginManager().registerEvents(this, this);
this.getServer().getPluginManager().registerEvents(new PingListener(this.miniMOTD), this);
this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, event -> event.registrar().register(
this.getPluginMeta(),
BrigadierUtil.<CommandSourceStack>buildTree(
new CommandHandler(this.miniMOTD),
sourceStack -> Objects.requireNonNullElse(sourceStack.getExecutor(), sourceStack.getSender()),
sourceStack -> sourceStack.getSender().hasPermission("minimotd.admin")
).build(),
"MiniMOTD Command",
List.of()
));
final Metrics metrics = new Metrics(this, 8132);
metrics.addCustomChart(new SimplePie("variant", () -> "paper"));
}
@EventHandler
public void updateCheck(final RegionizedServerInitEvent event) {
if (!this.miniMOTD.configManager().pluginSettings().updateChecker()) {
return;
}
CompletableFuture.runAsync(() -> new UpdateChecker().checkVersion().forEach(this.getComponentLogger()::info)).whenComplete(($, thr) -> {
if (thr != null) {
this.getComponentLogger().warn("Exception checking for updates", thr);
}
});
}
@Override
public @NonNull Path dataDirectory() {
return this.getDataFolder().toPath();
}
@Override
public @NonNull Logger logger() {
return this.getComponentLogger();
}
@Override
public @NonNull CachedServerIcon loadIcon(final @NonNull BufferedImage image) throws Exception {
return this.getServer().loadServerIcon(image);
}
}
@@ -0,0 +1,72 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.paper;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.jpenilla.minimotd.common.util.Nag;
public final class MiniMOTDStub extends JavaPlugin {
@Override
public void onEnable() {
if (lavaChicken() && !Bukkit.getBukkitVersion().contains("1.21.7-")) {
// 1.21.8+, non-Paper
new Nag.JavaUtilLogging(this.getLogger()).lines(
"MiniMOTD does not support Spigot on Minecraft 1.21.8 or newer.",
"To continue using MiniMOTD on the latest Minecraft versions,",
"switch to Paper (https://papermc.io/software/paper)."
).error(true).logBanner();
this.getServer().getPluginManager().disablePlugin(this);
return;
}
// Pre-Paper-plugins or non-Paper
new Nag.JavaUtilLogging(this.getLogger()).lines(
"You are using the incorrect MiniMOTD build for your server software.",
"This build is for Paper 1.21.8+.",
"Builds for Spigot/Paper 1.8.8 through 1.21.7 are available on Modrinth (https://modrinth.com/plugin/minimotd).",
"When downloading be sure to check the supported versions/platforms",
"field on the versions page, and/or make the correct selections in",
"the download menu."
).error(true).logBanner();
this.getServer().getPluginManager().disablePlugin(this);
// Sadly I don't think there is any way to display a custom message for servers that support
// Paper plugins but are < 1.21.8 (without lying in the plugin yaml)...
// Hopefully users will realize they need to try a different build.
}
// Crude 1.21.7+ check
private static boolean lavaChicken() {
try {
final Material mat = Material.MUSIC_DISC_LAVA_CHICKEN;
new ItemStack(mat);
return true;
} catch (final Throwable thr) {
return false;
}
}
}
@@ -0,0 +1,67 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package xyz.jpenilla.minimotd.paper;
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.util.CachedServerIcon;
import org.jspecify.annotations.NonNull;
import xyz.jpenilla.minimotd.common.Constants;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.PingResponse;
import xyz.jpenilla.minimotd.common.config.MOTDConfig;
import xyz.jpenilla.minimotd.common.util.ComponentColorDownsampler;
public final class PingListener implements Listener {
private final MiniMOTD<CachedServerIcon> miniMOTD;
PingListener(final @NonNull MiniMOTD<CachedServerIcon> miniMOTD) {
this.miniMOTD = miniMOTD;
}
@EventHandler
public void handlePing(final @NonNull PaperServerListPingEvent event) {
final MOTDConfig cfg = this.miniMOTD.configManager().mainConfig();
final PingResponse<CachedServerIcon> response = this.miniMOTD.createMOTD(cfg, event.getNumPlayers(), event.getMaxPlayers());
response.playerCount().applyCount(event::setNumPlayers, event::setMaxPlayers);
response.motd(motd -> {
if (event.getClient().getProtocolVersion() < Constants.MINECRAFT_1_16_PROTOCOL_VERSION) {
event.motd(ComponentColorDownsampler.downsampler().downsample(motd));
} else {
event.motd(motd);
}
});
response.icon(event::setServerIcon);
if (response.disablePlayerListHover()) {
event.getListedPlayers().clear();
}
if (response.hidePlayerCount()) {
event.setHidePlayers(true);
}
}
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@ package xyz.jpenilla.minimotd.sponge7;
import com.google.inject.Inject;
import net.kyori.adventure.text.serializer.spongeapi.SpongeComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.spongepowered.api.event.EventListener;
import org.spongepowered.api.event.server.ClientPingServerEvent;
import org.spongepowered.api.network.status.Favicon;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,7 @@ import java.io.IOException;
import java.nio.file.Path;
import net.kyori.adventure.platform.spongeapi.SpongeAudiences;
import org.bstats.sponge.Metrics;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.Sponge;
+12 -1
View File
@@ -34,6 +34,11 @@ sponge {
loadOrder(PluginDependency.LoadOrder.AFTER)
optional(false)
}
dependency("miniplaceholders") {
loadOrder(PluginDependency.LoadOrder.AFTER)
optional(true)
version = "3.0.0"
}
}
}
@@ -50,10 +55,16 @@ publishMods.modrinth {
modLoaders.add("sponge")
minecraftVersions.addAll(
"1.16.5",
"1.17.1",
"1.18.2",
"1.19.4",
"1.20.6",
"1.21.1",
"1.21.3",
"1.21.4",
"1.21.5",
"1.21.8",
"1.21.10",
"1.21.11",
)
optional("miniplaceholders")
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@ package xyz.jpenilla.minimotd.sponge8;
import com.google.inject.Inject;
import java.lang.reflect.Method;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.spongepowered.api.MinecraftVersion;
import org.spongepowered.api.event.EventListener;
import org.spongepowered.api.event.server.ClientPingServerEvent;
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@ import com.google.inject.Injector;
import com.google.inject.TypeLiteral;
import java.awt.image.BufferedImage;
import java.nio.file.Path;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.api.Sponge;
+16 -12
View File
@@ -1,6 +1,7 @@
plugins {
id("minimotd.shadow-platform")
alias(libs.plugins.run.velocity)
alias(libs.plugins.resource.factory.velocity)
}
dependencies {
@@ -9,7 +10,11 @@ dependencies {
compileOnly(libs.velocityApi)
}
java.disableAutoTargetJvm()
indra {
javaVersions {
target(21)
}
}
tasks {
shadowJar {
@@ -20,20 +25,19 @@ tasks {
runVelocity {
velocityVersion(libs.versions.velocityApi.get())
}
processResources {
val props = mapOf(
"description" to project.description as String,
"url" to Constants.GITHUB_URL,
"version" to project.version,
)
inputs.properties(props)
filesMatching("velocity-plugin.json") {
expand(props)
}
}
}
velocityPluginJson {
name = "MiniMOTD"
id = "minimotd-velocity"
url = Constants.GITHUB_URL
authors = listOf("jmp")
main = "xyz.jpenilla.minimotd.velocity.MiniMOTDVelocity"
dependency("miniplaceholders", true)
}
publishMods.modrinth {
modLoaders.add("velocity")
minecraftVersions.addAll(minecraftVersion)
optional("miniplaceholders")
}
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -28,12 +28,8 @@ import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.TypeLiteral;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.CommandManager;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
@@ -43,14 +39,15 @@ import java.awt.image.BufferedImage;
import java.nio.file.Path;
import java.util.Set;
import org.bstats.velocity.Metrics;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import xyz.jpenilla.minimotd.common.CommandHandler;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.MiniMOTDPlatform;
import xyz.jpenilla.minimotd.common.util.BrigadierUtil;
import xyz.jpenilla.minimotd.common.util.UpdateChecker;
public final class MiniMOTDPlugin implements MiniMOTDPlatform<Favicon> {
public final class MiniMOTDVelocity implements MiniMOTDPlatform<Favicon> {
private static final Set<Class<?>> LISTENER_CLASSES = ImmutableSet.of(
PingListener.class
);
@@ -64,7 +61,7 @@ public final class MiniMOTDPlugin implements MiniMOTDPlatform<Favicon> {
private final Injector injector;
@Inject
public MiniMOTDPlugin(
public MiniMOTDVelocity(
final @NonNull ProxyServer server,
final @NonNull Logger logger,
final @NonNull CommandManager commandManager,
@@ -83,7 +80,7 @@ public final class MiniMOTDPlugin implements MiniMOTDPlatform<Favicon> {
@Override
protected void configure() {
this.bind(new TypeLiteral<MiniMOTD<Favicon>>() {
}).toInstance(MiniMOTDPlugin.this.miniMOTD);
}).toInstance(MiniMOTDVelocity.this.miniMOTD);
}
});
}
@@ -104,28 +101,16 @@ public final class MiniMOTDPlugin implements MiniMOTDPlatform<Favicon> {
}
private void registerCommand() {
final class WrappingExecutor implements Command<CommandSource> {
private final CommandHandler.Executor handler;
WrappingExecutor(final CommandHandler.@NonNull Executor handler) {
this.handler = handler;
}
@Override
public int run(final @NonNull CommandContext<CommandSource> context) {
this.handler.execute(context.getSource());
return Command.SINGLE_SUCCESS;
}
}
final CommandHandler handler = new CommandHandler(this.miniMOTD);
this.commandManager.register(this.commandManager.metaBuilder("minimotd").build(), new BrigadierCommand(
LiteralArgumentBuilder.<CommandSource>literal("minimotd")
.requires(source -> source.hasPermission("minimotd.admin"))
.then(LiteralArgumentBuilder.<CommandSource>literal("help").executes(new WrappingExecutor(handler::help)))
.then(LiteralArgumentBuilder.<CommandSource>literal("about").executes(new WrappingExecutor(handler::about)))
.then(LiteralArgumentBuilder.<CommandSource>literal("reload").executes(new WrappingExecutor(handler::reload)))
));
this.commandManager.register(
this.commandManager.metaBuilder("minimotd").plugin(this).build(),
new BrigadierCommand(
BrigadierUtil.buildTree(
new CommandHandler(this.miniMOTD),
source -> source,
source -> source.hasPermission("minimotd.admin")
)
)
);
}
@Override
@@ -1,7 +1,7 @@
/*
* This file is part of MiniMOTD, licensed under the MIT License.
*
* Copyright (c) 2020-2024 Jason Penilla
* Copyright (c) 2020-2025 Jason Penilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -35,14 +35,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import xyz.jpenilla.minimotd.common.MiniMOTD;
import xyz.jpenilla.minimotd.common.PingResponse;
import xyz.jpenilla.minimotd.common.config.MOTDConfig;
@DefaultQualifier(NonNull.class)
@NullMarked
public final class PingListener {
private final MiniMOTD<Favicon> miniMOTD;
private final ProxyServer proxy;
@@ -1,12 +0,0 @@
{
"id": "minimotd-velocity",
"name": "MiniMOTD",
"version": "$version",
"description": "$description",
"url": "$url",
"authors": [
"jmp"
],
"dependencies": [],
"main": "xyz.jpenilla.minimotd.velocity.MiniMOTDPlugin"
}
+20 -7
View File
@@ -1,10 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
"config:recommended"
],
"ignoreDeps": [
"xyz.jpenilla.quiet-architectury-loom",
"quiet-fabric-loom",
"com.mojang:minecraft",
"com.google.code.gson:gson"
],
@@ -14,24 +14,37 @@
"packageRules": [
{
"description": "Correct Fabric API version handling",
"matchPackageNames": ["net.fabricmc.fabric-api:fabric-api", "net.fabricmc.fabric-api:fabric-api-deprecated"],
"matchPackageNames": [
"net.fabricmc.fabric-api:fabric-api",
"net.fabricmc.fabric-api:fabric-api-deprecated"
],
"versioning": "regex:^(?<major>\\d+)(\\.(?<minor>\\d+))?(\\.(?<patch>\\d+))?(?:\\+(?<compatibility>.*))?$"
},
{
"description": "Correct NeoForge version handling",
"matchPackageNames": ["net.neoforged:neoforge"],
"matchPackageNames": [
"net.neoforged:neoforge"
],
"versioning": "regex:^(?<compatibility>(\\d+\\.){2})(?<minor>\\d+)(-beta)?$"
},
{
"matchManagers": ["github-actions", "gradle-wrapper"],
"matchManagers": [
"github-actions",
"gradle-wrapper"
],
"groupName": "gradle and github actions"
},
{
"matchDepTypes": ["plugin"],
"matchDepTypes": [
"plugin"
],
"groupName": "gradle and github actions"
},
{
"matchPaths": ["build-logic/*", "buildSrc/*"],
"matchFileNames": [
"build-logic/*",
"buildSrc/*"
],
"groupName": "gradle and github actions"
}
],
+7 -7
View File
@@ -4,16 +4,18 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.fabricmc.net/")
maven("https://maven.neoforged.net/releases/")
maven("https://maven.architectury.dev/")
maven("https://maven.neoforged.net/releases/") {
mavenContent { releasesOnly() }
}
maven("https://repo.jpenilla.xyz/snapshots/")
}
includeBuild("gradle/build-logic")
}
plugins {
id("xyz.jpenilla.quiet-architectury-loom") version "1.7-SNAPSHOT" apply false
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
id("net.neoforged.moddev.repositories") version "2.0.124" apply false
id("quiet-fabric-loom") version "1.13-SNAPSHOT" apply false
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
rootProject.name = "MiniMOTD"
@@ -24,11 +26,11 @@ fun setup(name: String, dir: String) {
}
fun platform(name: String) = setup("minimotd-$name", "platform/$name")
fun dist(name: String) = setup("minimotd-$name", "dist/$name")
setup("minimotd-common", "common")
sequenceOf(
"paper",
"bukkit",
"sponge8",
"sponge7",
@@ -37,5 +39,3 @@ sequenceOf(
"fabric",
"neoforge",
).forEach(::platform)
dist("bukkit-bungeecord")