Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9cf5e01
Replace Maven pom.xml with Gradle multi-project build
Peashooter101 Jun 4, 2026
6239c1b
Add core platform interfaces and SimpleNicksCore
Peashooter101 Jun 4, 2026
114ad6f
Add core data classes, util enums, and config handlers
Peashooter101 Jun 4, 2026
26f46b5
Add core SqlHandler and Cache
Peashooter101 Jun 4, 2026
bd9db7a
Add core NicknameProcessor, NickUtils, and Exceptions
Peashooter101 Jun 4, 2026
5dff36e
Add Paper platform adapter, config provider, and sender context
Peashooter101 Jun 4, 2026
54b23bd
Add Paper entry point and resources
Peashooter101 Jun 4, 2026
509bae7
Add Paper commands and subcommands
Peashooter101 Jun 4, 2026
4a548f1
Add Paper listeners, hooks, and SaveMigrator
Peashooter101 Jun 4, 2026
d8ad270
Fix Gradle build configuration for Java 25 + Shadow + multi-module
Peashooter101 Jun 4, 2026
a92942f
Fix javax.annotation imports and update .gitignore for Gradle
Peashooter101 Jun 4, 2026
7a3ec2a
Rename reobf output jar to SimpleNicks-paper-{version}.jar
Peashooter101 Jun 4, 2026
c40c30d
Fix tab list not clearing on /nick reset
Peashooter101 Jun 4, 2026
1f97ee4
Fix /nick who time display and config not recreating on reload
Peashooter101 Jun 4, 2026
8310442
Fix locale.yml recreating with custom values after deletion
Peashooter101 Jun 4, 2026
d963570
Fix admin subcommands not updating display name and tab list
Peashooter101 Jun 4, 2026
343266e
Remove old src/ directory
Peashooter101 Jun 4, 2026
8907f39
Add Fabric module stub
Peashooter101 Jun 4, 2026
9aea212
Add Fabric module for Minecraft 26.1
Peashooter101 Jun 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,13 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# Maven
target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Gradle
.gradle/
**/build/
**/.gradle/

# Common working directory
run/
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
allprojects {
group = 'simplexity'
version = '3.2.2'
}

subprojects {
apply plugin: 'java'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}

repositories {
mavenCentral()
maven { url 'https://repo.papermc.io/repository/maven-public/' }
maven { url 'https://maven.fabricmc.net/' }
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url 'https://oss.sonatype.org/content/groups/public/' }
maven { url 'https://maven.nucleoid.xyz/' }
}
}
21 changes: 21 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id 'java-library'
}

java {
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
}

tasks.withType(JavaCompile).configureEach {
options.release = 21
}

dependencies {
compileOnly "net.kyori:adventure-api:${adventureVersion}"
compileOnly "net.kyori:adventure-text-minimessage:${miniMessageVersion}"
compileOnly "org.slf4j:slf4j-api:${slf4jVersion}"
api "com.zaxxer:HikariCP:${hikariVersion}"
compileOnly "org.jetbrains:annotations:24.0.0"
compileOnly "com.mojang:brigadier:1.3.10"
}
75 changes: 75 additions & 0 deletions core/src/main/java/simplexity/simplenicks/SimpleNicksCore.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package simplexity.simplenicks;

import net.kyori.adventure.text.minimessage.MiniMessage;
import org.jetbrains.annotations.NotNull;
import simplexity.simplenicks.platform.PlatformAdapter;

/**
* Central singleton for the SimpleNicks core.
* <p>
* Initialized by the platform entry point (e.g. {@code SimpleNicks} on Paper,
* {@code SimpleNicksFabric} on Fabric) before any core class is used.
* All core classes access the platform through {@link #get()}.
* </p>
*/
public final class SimpleNicksCore {

private static SimpleNicksCore instance;

private final PlatformAdapter platform;
private final MiniMessage miniMessage;

private SimpleNicksCore(@NotNull PlatformAdapter platform) {
this.platform = platform;
this.miniMessage = platform.getMiniMessage();
}

/**
* Initializes the core with the given platform adapter.
* Must be called before any core class accesses {@link #get()}.
*
* @param platform the platform-specific adapter
*/
public static void initialize(@NotNull PlatformAdapter platform) {
instance = new SimpleNicksCore(platform);
}

/**
* Returns the active core instance.
*
* @return the core singleton
* @throws IllegalStateException if {@link #initialize(PlatformAdapter)} has not been called
*/
@NotNull
public static SimpleNicksCore get() {
if (instance == null) throw new IllegalStateException("SimpleNicksCore has not been initialized");
return instance;
}

/**
* Tears down the core instance. Called during plugin/mod shutdown.
*/
public static void shutdown() {
instance = null;
}

/**
* Returns the platform adapter for this environment.
*
* @return the platform adapter
*/
@NotNull
public PlatformAdapter platform() {
return platform;
}

/**
* Returns the configured {@link MiniMessage} instance.
*
* @return the MiniMessage instance
*/
@NotNull
public MiniMessage miniMessage() {
return miniMessage;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package simplexity.simplenicks.commands;

import org.jetbrains.annotations.NotNull;
import simplexity.simplenicks.saving.Cache;
import simplexity.simplenicks.saving.Nickname;
import simplexity.simplenicks.saving.SqlHandler;

import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
* Handles the high-level logic for nickname management.
* <p>
* This class acts as the main entry point for commands or other
* external systems that want to interact with nicknames.
* It delegates persistence and caching to {@link Cache} and {@link SqlHandler}.
* </p>
*/
@SuppressWarnings("UnusedReturnValue")
public class NicknameProcessor {
private static NicknameProcessor instance;

private NicknameProcessor() {
}

public static NicknameProcessor getInstance() {
if (instance == null) instance = new NicknameProcessor();
return instance;
}

/**
* Sets a player's active nickname.
*
* @param uuid the player's UUID
* @param username the player's last known username
* @param nickname the nickname string to assign
* @return {@code true} if the nickname was set successfully,
* {@code false} if it failed to persist or cache
*/
public boolean setNickname(@NotNull UUID uuid, @NotNull String username, @NotNull String nickname) {
return Cache.getInstance().setActiveNickname(uuid, username, nickname);
}

/**
* Resets a player's nickname back to their original username.
*
* @param uuid the player's UUID
* @return {@code true} if the nickname was cleared successfully,
* {@code false} if the database update failed
*/
public boolean resetNickname(@NotNull UUID uuid) {
return Cache.getInstance().clearCurrentNickname(uuid);
}

/**
* Saves a nickname to the player's list of saved nicknames.
*
* @param uuid the player's UUID
* @param username the player's last known username
* @param nickname the nickname string to save
* @return {@code true} if the nickname was saved successfully,
* {@code false} if it failed to persist or cache
*/
public boolean saveNickname(@NotNull UUID uuid, @NotNull String username, @NotNull String nickname) {
return Cache.getInstance().saveNickname(uuid, username, nickname);
}

/**
* Deletes a previously saved nickname for a player.
*
* @param uuid the player's UUID
* @param nickname the nickname string to delete
* @return {@code true} if the nickname was deleted successfully,
* {@code false} if no such nickname was found or persistence failed
*/
public boolean deleteNickname(@NotNull UUID uuid, @NotNull String nickname) {
return Cache.getInstance().deleteSavedNickname(uuid, nickname);
}

/**
* Gets all saved nicknames for a player.
* <p>
* Uses the in-memory cache if the player is online,
* otherwise queries SQL directly.
* </p>
*
* @param uuid the player's UUID
* @param isOnline whether the player is currently online
* @return a non-null list of {@link Nickname}; empty if none exist
*/
@NotNull
public List<Nickname> getSavedNicknames(@NotNull UUID uuid, boolean isOnline) {
if (isOnline) return Cache.getInstance().getSavedNicknames(uuid);
List<Nickname> nicks = SqlHandler.getInstance().getSavedNicknamesForPlayer(uuid);
if (nicks == null) return new ArrayList<>();
return nicks;
}

/**
* Gets the currently active nickname for a player.
* <p>
* Uses the in-memory cache if the player is online,
* otherwise queries SQL directly.
* </p>
*
* @param uuid the player's UUID
* @param isOnline whether the player is currently online
* @return the current {@link Nickname}, or {@code null} if none is set
*/
@Nullable
public Nickname getCurrentNickname(@NotNull UUID uuid, boolean isOnline) {
if (isOnline) return Cache.getInstance().getActiveNickname(uuid);
return SqlHandler.getInstance().getCurrentNicknameForPlayer(uuid);
}

/**
* Gets the number of saved nicknames for a player.
* <p>
* Uses the in-memory cache if the player is online,
* otherwise queries SQL directly.
* </p>
*
* @param uuid the player's UUID
* @param isOnline whether the player is currently online
* @return the number of saved nicknames
*/
public int getCurrentSavedNickCount(@NotNull UUID uuid, boolean isOnline) {
if (isOnline) return Cache.getInstance().getSavedNickCount(uuid);
List<Nickname> savedNicks = SqlHandler.getInstance().getSavedNicknamesForPlayer(uuid);
if (savedNicks == null || savedNicks.isEmpty()) return 0;
return savedNicks.size();
}

/**
* Checks if a player has already saved the given nickname.
*
* @param uuid the player's UUID
* @param nickname the nickname string to search for
* @return {@code true} if the player already saved this nickname,
* {@code false} otherwise
*/
public boolean playerAlreadySavedThis(@NotNull UUID uuid, @NotNull String nickname) {
return SqlHandler.getInstance().userAlreadySavedThisName(uuid, nickname);
}
}
Loading