diff --git a/README.md b/README.md
index 13542fc..48a22a9 100644
--- a/README.md
+++ b/README.md
@@ -1,121 +1,15 @@
-# AdvancedServerList
+# AdvancedServerList-OG
-[AdvancedServerList](https://codeberg.org/Andre601/AdvancedServerList) is a plugin that allows you to customize your server's MOTD, favicon, Player count text and player count hover displayed in a player's multiplayer server list based on conditions and priorities.
+AdvancedServerList-OG is the TrueOG-maintained variant of AdvancedServerList for Purpur 1.19.4.
-This branch builds using gradle for Purpur 1.19.4. Maintained for [TrueOG Network](https://trueog.net/)
+## What is different from normal AdvancedServerList?
-## Downloads
+- Uses TrueOG's live config files and branding.
+- Player caching is fully removed.
+- No IP addresses are stored.
+- Player placeholders are not part of this OG variant.
+- Build/project naming is changed to `AdvancedServerList-OG`.
-
-
-
-
-
+## Notes
-## Supported Platforms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## What is a Server List Profile?
-
-A Server List Profile refers to a YAML file located in the plugin's `profiles` directory.
-It allows you to configure specific aspects of the server display in the MC-Client's multiplayer server list, such as the MOTD, player count text, player count hover or Favicon.
-
-> [*Read More*][profiles]
-
-### Conditions
-
-Thanks to conditions can you determine when a profile should be displayed in the player's server list, to allow displaying specific text (i.e. a warning when they are using an outdated version).
-
-When multiple profiles exist that have valid conditions will the one with the highest priority (Higher number = higher priority) be selected. Having no conditions makes it automatically true.
-
-> [*Read More*][conditions]
-
-### Placeholders
-
-Placeholders can be used within conditions to further customize them. They can also be used in any other text option to display their respective values.
-The format is `${ }` which was adopted from BungeeTabListPlus. Depending on what platform you use the plugin on are only specific placeholders available.
-
-If you're a plugin dev can you even add your own custom placeholders through AdvancedServerList's own API.
-
-> [*Read More*][placeholders]
-
-### Formatting
-
-The plugin uses the MiniMessage format for a consistent, easy way of formatting your text.
-Only certain options are usable for each option. As an example does motd support HEX colours and gradients, while the other options only support default colour codes.
-
-> [*Read More*][minimessage]
-
-## Dependencies
-
-All listed dependencies are optional.
-
-| Dependency | Platforms |
-|-------------------|----------------------|
-| [PlaceholderAPI] | Paper |
-| [ViaVersion] | Paper |
-| [PAPIProxyBridge] | BungeeCord, Velocity |
-| [Maintenance] | All |
-
-## Statistics
-
-This plugin sends statistics to [bStats] to display.
-You can disable this in the global bStats config file located in `/plugins/bstats/`
-
-- [BungeeCord][bstats-bungee]
-- [Paper/Spigot][bstats-spigot]
-- [Velocity][bstats-velocity]
-
-## Screenshots
-
-
-
-
-
-## Support
-
-
-
-
-
-
-
-
-
-
-
-
-[profiles]: https://asl.andre601.ch/profiles/
-[conditions]: https://asl.andre601.ch/profiles/#condition
-[placeholders]: https://asl.andre601.ch/profiles/placeholders/
-[minimessage]: https://asl.andre601.ch/profiles/formatting/
-
-[modrinth]: https://modrinth.com/plugin/advancedserverlist
-
-[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
-[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
-[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
-[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
-
-[bstats]: https://bstats.org
-[bstats-bungee]: https://bstats.org/plugin/bungeecord/AdvancedServerList/15585
-[bstats-spigot]: https://bstats.org/plugin/bukkit/AdvancedServerList/15584
-[bstats-velocity]: https://bstats.org/plugin/velocity/AdvancedServerList/15587
-
-[gallery]: https://modrinth.com/mod/advancedserverlist/gallery
+This project keeps the same general MOTD/profile system focus as AdvancedServerList, while matching TrueOG deployment and branding requirements.
diff --git a/core/src/main/java/ch/andre601/advancedserverlist/core/AdvancedServerList.java b/core/src/main/java/ch/andre601/advancedserverlist/core/AdvancedServerList.java
index f2c82bc..07f7211 100644
--- a/core/src/main/java/ch/andre601/advancedserverlist/core/AdvancedServerList.java
+++ b/core/src/main/java/ch/andre601/advancedserverlist/core/AdvancedServerList.java
@@ -96,9 +96,6 @@ public class AdvancedServerList {
}
public void disable() {
- getPlugin().getPluginLogger().info("Saving playercache.json file...");
- getPlayerHandler().save();
-
if (updateChecker != null) {
getPlugin().getPluginLogger().info("Disabling Update Checker...");
updateChecker.disable();
@@ -111,9 +108,6 @@ public class AdvancedServerList {
plugin.clearFaviconCache();
}
- public void clearPlayerCache() {
- getPlayerHandler().clearCache();
- }
private void load() {
printBanner();
@@ -155,7 +149,7 @@ public class AdvancedServerList {
plugin.loadEvents();
getPlugin().getPluginLogger().info("Events loaded!");
- getPlugin().getPluginLogger().info("Loading playercache.json...");
+ getPlugin().getPluginLogger().info("Loading live player handling...");
getPlayerHandler().load();
getPlugin().getPluginLogger().info("AdvancedServerList is ready!");
diff --git a/core/src/main/java/ch/andre601/advancedserverlist/core/commands/CommandHandler.java b/core/src/main/java/ch/andre601/advancedserverlist/core/commands/CommandHandler.java
index 1a7ac90..58518aa 100644
--- a/core/src/main/java/ch/andre601/advancedserverlist/core/commands/CommandHandler.java
+++ b/core/src/main/java/ch/andre601/advancedserverlist/core/commands/CommandHandler.java
@@ -38,7 +38,6 @@ public class CommandHandler {
public CommandHandler(AdvancedServerList> core) {
subCommands.add(new Help());
subCommands.add(new Reload(core));
- subCommands.add(new ClearCache(core));
}
public void handle(CmdSender sender, String[] args) {
@@ -78,8 +77,6 @@ public class CommandHandler {
sender.sendMsg("/asl help - Shows this help");
sender.sendMsg();
sender.sendMsg("/asl reload - Reloads the config.yml and profiles");
- sender.sendMsg();
- sender.sendMsg("/asl clearCache - Clears the Player and Favicon cache");
}
}
@@ -114,28 +111,4 @@ public class CommandHandler {
sender.sendPrefixedMsg("Reload complete!");
}
}
-
- private static class ClearCache extends PluginCommand {
-
- private final AdvancedServerList> core;
-
- public ClearCache(AdvancedServerList> core) {
- super("clearCache");
-
- this.core = core;
- }
-
- @Override
- public void handle(CmdSender sender) {
- sender.sendPrefixedMsg("Clearing caches...");
-
- core.clearFaviconCache();
- sender.sendPrefixedMsg("Successfully cleared Favicon Cache!");
-
- core.clearPlayerCache();
- sender.sendPrefixedMsg("Successfully cleared Player Cache!");
-
- sender.sendPrefixedMsg("Cache clearing complete!");
- }
- }
}
diff --git a/core/src/main/java/ch/andre601/advancedserverlist/core/interfaces/commands/CmdSender.java b/core/src/main/java/ch/andre601/advancedserverlist/core/interfaces/commands/CmdSender.java
index f1a8a62..f7f1ae5 100644
--- a/core/src/main/java/ch/andre601/advancedserverlist/core/interfaces/commands/CmdSender.java
+++ b/core/src/main/java/ch/andre601/advancedserverlist/core/interfaces/commands/CmdSender.java
@@ -27,8 +27,8 @@ package ch.andre601.advancedserverlist.core.interfaces.commands;
public interface CmdSender {
- String prefix = "[AdvancedServerList] ";
- String errorPrefix = "[AdvancedServerList] ";
+ String prefix = "[AdvancedServerList-OG] ";
+ String errorPrefix = "[AdvancedServerList-OG] ";
boolean hasPermission(String permission);
diff --git a/core/src/main/java/ch/andre601/advancedserverlist/core/profiles/players/PlayerHandler.java b/core/src/main/java/ch/andre601/advancedserverlist/core/profiles/players/PlayerHandler.java
index 7faf115..521486b 100644
--- a/core/src/main/java/ch/andre601/advancedserverlist/core/profiles/players/PlayerHandler.java
+++ b/core/src/main/java/ch/andre601/advancedserverlist/core/profiles/players/PlayerHandler.java
@@ -28,142 +28,43 @@ package ch.andre601.advancedserverlist.core.profiles.players;
import ch.andre601.advancedserverlist.core.AdvancedServerList;
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
-import com.google.gson.Gson;
-import io.leangen.geantyref.TypeToken;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
+import java.util.UUID;
public class PlayerHandler {
private final AdvancedServerList> core;
private final PluginLogger logger;
- private final Path cache;
-
- private final Type listType = new TypeToken>() {}.getType();
- private final Gson gson = new Gson();
// UUID of MHF_Question
private final UUID defaultUUID = UUID.fromString("606e2ff0-ed77-4842-9d6c-e1d3321c7838");
- private List cachedPlayers = new ArrayList<>();
private CachedPlayer defaultPlayer = null;
public PlayerHandler(AdvancedServerList> core) {
this.core = core;
this.logger = core.getPlugin().getPluginLogger();
- this.cache = core.getPlugin().getFolderPath().resolve("playercache.json");
}
public void load() {
- if (!cache.toFile().exists()) {
- logger.info("No playercache.json file present. Skipping...");
- return;
- }
-
- if (core.getFileHandler().getBoolean("disableCache")) {
- logger.info("'disable_cache' is set to true. Skipping playercache.json loading...");
- return;
- }
-
- try {
- BufferedReader reader = Files.newBufferedReader(cache);
-
- cachedPlayers = gson.fromJson(reader, listType);
-
- reader.close();
- } catch (IOException ex) {
- logger.warn("Encountered IOException while reading the playercache.json file!", ex);
- return;
- }
-
- // In case Gson messes up... I guess.
- if (cachedPlayers == null) {
- logger.warn("Couldn't load players from playercache.json file. Is the JSON valid?");
- // Create new ArrayList instance to avoid further issues.
- cachedPlayers = new ArrayList<>();
- return;
- }
-
- logger.info("Loaded %d players into cache!", cachedPlayers.size());
- }
-
- public void save() {
- if (cachedPlayers.isEmpty()) {
- logger.info("No players in cache to save. Skipping...");
- return;
- }
-
- if (core.getFileHandler().getBoolean("disableCache")) {
- logger.info("'disable_cache' is set to true. Skipping saving of cached players...");
- return;
- }
-
- try (BufferedWriter writer = Files.newBufferedWriter(cache, StandardCharsets.UTF_8)) {
- gson.toJson(cachedPlayers, listType, writer);
- logger.info("Successfully saved playercache.json file.");
- } catch (IOException ex) {
- logger.warn("Encountered IOException while saving cached players to playercache.json!", ex);
- }
- }
-
- public void addPlayer(String ip, String name, UUID uuid) {
- if (contains(ip) || core.getFileHandler().getBoolean("disableCache")) return;
-
- cachedPlayers.add(new CachedPlayer(ip, name, uuid));
+ logger.info("Player cache is disabled in AdvancedServerList-OG. Skipping...");
}
public CachedPlayer getCachedPlayer(String key) {
- if (!contains(key) || core.getFileHandler().getBoolean("disableCache")) return getDefaultPlayer();
-
- for (CachedPlayer player : cachedPlayers) {
- if (player.getIp().equals(key)) return player;
- }
-
return getDefaultPlayer();
}
public CachedPlayer getCachedPlayer(UUID uuid) {
- for (CachedPlayer player : cachedPlayers) {
- if (player.getUuid().equals(uuid)) return player;
- }
-
return getDefaultPlayer();
}
public void clearCache() {
- cachedPlayers.clear();
defaultPlayer = null;
}
- private boolean contains(String ip) {
- for (CachedPlayer player : cachedPlayers) {
- if (player.getIp().equals(ip)) return true;
- }
-
- return false;
- }
-
private CachedPlayer getDefaultPlayer() {
if (defaultPlayer != null) return defaultPlayer;
- return (defaultPlayer = new CachedPlayer(
- "0.0.0.0",
- core.getFileHandler().getString("Anonymous", "unknownPlayer", "name"),
- convertToUUID(core.getFileHandler().getString(defaultUUID.toString(), "unknownPlayer", "uuid"))));
+ return (defaultPlayer = new CachedPlayer("0.0.0.0", "Anonymous", defaultUUID));
}
- private UUID convertToUUID(String uuid) {
- try {
- return UUID.fromString(uuid);
- } catch (IllegalArgumentException ex) {
- // This is always a valid UUID.
- return defaultUUID;
- }
- }
}
diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml
index b7e0261..6466778 100644
--- a/core/src/main/resources/config.yml
+++ b/core/src/main/resources/config.yml
@@ -1,26 +1,3 @@
-#
-# Used for when AdvancedServerList doesn't have a cached player to use for player placeholders.
-#
-unknownPlayer:
- #
- # The name to use. Defaults to Anonymous.
- #
- name: "Anonymous"
- #
- # The UUID to use. Defaults to 606e2ff0-ed77-4842-9d6c-e1d3321c7838 (UUID of MHF_Question).
- #
- uuid: "606e2ff0-ed77-4842-9d6c-e1d3321c7838"
-
-#
-# Should the Caching of players be disabled?
-#
-# When set to true will AdvancedServerList not load any players from the cache.data file (if present) nor save any to it.
-# Placeholders that rely on the player being cached (such as ${player name}) will not work while this option is enabled.
-#
-# Defaults to false when not present.
-#
-disableCache: false
-
#
# Should AdvancedServerList check for new versions?
#
diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts
index a5af51f..a626e3f 100644
--- a/paper/build.gradle.kts
+++ b/paper/build.gradle.kts
@@ -27,14 +27,13 @@ dependencies {
implementation(project(":core"))
implementation("ch.andre601.asl-api:platform-bukkit:3.2.0")
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
- compileOnly("me.clip:placeholderapi:2.11.5")
compileOnly("com.viaversion:viaversion-api:4.9.2")
}
tasks.withType().configureEach { dependsOn(project(":core").tasks.named("jar")) }
tasks.shadowJar {
- archiveBaseName.set("AdvancedServerList")
+ archiveBaseName.set("AdvancedServerList-OG")
archiveClassifier.set("")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
relocate("org.bstats", "ch.andre601.advancedserverlist.spigot.depends.bstats")
diff --git a/paper/src/main/java/ch/andre601/advancedserverlist/paper/PaperCore.java b/paper/src/main/java/ch/andre601/advancedserverlist/paper/PaperCore.java
index b46bcb8..c6790ed 100644
--- a/paper/src/main/java/ch/andre601/advancedserverlist/paper/PaperCore.java
+++ b/paper/src/main/java/ch/andre601/advancedserverlist/paper/PaperCore.java
@@ -33,8 +33,6 @@ import ch.andre601.advancedserverlist.paper.commands.CmdAdvancedServerList;
import ch.andre601.advancedserverlist.paper.listeners.LoadEvent;
import ch.andre601.advancedserverlist.paper.logging.PaperLogger;
import ch.andre601.advancedserverlist.paper.objects.WorldCache;
-import ch.andre601.advancedserverlist.paper.objects.placeholders.PaperPlayerPlaceholders;
-import ch.andre601.advancedserverlist.paper.objects.placeholders.PaperServerPlaceholders;
import java.nio.file.Path;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@@ -62,7 +60,7 @@ public class PaperCore extends JavaPlugin implements PluginCore paperPlayer.getName();
- case "protocol" -> String.valueOf(paperPlayer.getProtocol());
- case "uuid" -> paperPlayer.getUUID().toString();
- case "hasPlayedBefore" -> String.valueOf(paperPlayer.hasPlayedBefore());
- case "isBanned" -> String.valueOf(paperPlayer.isBanned());
- case "isWhitelisted" -> String.valueOf(paperPlayer.isWhitelisted());
- default -> null;
- };
- }
-}
diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml
index 24212f7..db45893 100644
--- a/paper/src/main/resources/paper-plugin.yml
+++ b/paper/src/main/resources/paper-plugin.yml
@@ -1,4 +1,4 @@
-name: 'AdvancedServerList'
+name: 'AdvancedServerList-OG'
author: 'Andre_601'
version: '${version}'
description: '${description}'
@@ -23,7 +23,7 @@ dependencies:
# The below stuff is NOT used by Paper plugin.
commands:
advancedserverlist:
- description: 'Main command of AdvancedServerList'
+ description: 'Main command of AdvancedServerList-OG'
usage: '/ [help|reload]'
aliases:
- 'asl'
diff --git a/paper/src/main/resources/plugin.yml b/paper/src/main/resources/plugin.yml
index aec128f..4db6ac5 100644
--- a/paper/src/main/resources/plugin.yml
+++ b/paper/src/main/resources/plugin.yml
@@ -2,7 +2,7 @@
# This file is kept for Folia support.
#
-name: 'AdvancedServerList'
+name: 'AdvancedServerList-OG'
author: 'Andre_601'
version: '${version}'
description: 'Customize your MOTD'
@@ -23,8 +23,8 @@ softdepend:
commands:
advancedserverlist:
- description: 'Main command of AdvancedServerList'
- usage: '/ [help|reload|clearCache]'
+ description: 'Main command of AdvancedServerList-OG'
+ usage: '/ [help|reload]'
aliases:
- 'asl'
permission: 'advancedserverlist.admin'
@@ -52,6 +52,3 @@ permissions:
advancedserverlist.command.reload:
description: 'Grants access to /asl reload'
default: op
- advancedserverlist.command.clearcache:
- description: 'Clears the Player and Favicon cache'
- default: op
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 3f7b09f..4c05761 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -22,7 +22,7 @@
~ SOFTWARE.
*/
-rootProject.name = "AdvancedServerList"
+rootProject.name = "AdvancedServerList-OG"
include(":core", ":paper")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)