Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
735c643
fixing git
WizardlyBump17 Aug 9, 2024
4c36438
applying the colors when getting from the config
WizardlyBump17 Aug 15, 2024
180f3a2
improved the logging
WizardlyBump17 Sep 7, 2024
5e7a81a
added methods to manipulate constructors reflectively
WizardlyBump17 Sep 12, 2024
7653270
version changed
WizardlyBump17 Sep 12, 2024
d81be3f
using the "escape" parameter
WizardlyBump17 Sep 20, 2024
b2598d7
added the DateReader class
WizardlyBump17 Sep 20, 2024
548cd8e
relocating the dateparser dependency
WizardlyBump17 Sep 20, 2024
bf0fb56
added support for some prefixed dates
WizardlyBump17 Sep 20, 2024
92c3724
uhum, did it complain about it only now?
WizardlyBump17 Sep 25, 2024
4869353
reworked the ItemFilter. A total of 0 plugins will break
WizardlyBump17 Sep 25, 2024
e1bd566
version changed
WizardlyBump17 Sep 25, 2024
443168f
excluding the lombok
WizardlyBump17 Oct 4, 2024
50b26d3
removed the workflow
WizardlyBump17 Oct 4, 2024
75469cb
added support for the attribute system
WizardlyBump17 Oct 11, 2024
1d9c01d
using the StringUtil to apply the placeholders
WizardlyBump17 Oct 14, 2024
d1dcb2b
appending the key if it was not found
WizardlyBump17 Oct 14, 2024
0706e58
appending lists to the lore
WizardlyBump17 Oct 26, 2024
ead9501
version changed
WizardlyBump17 Oct 26, 2024
ac45e09
reworked the command system
WizardlyBump17 Nov 13, 2024
b0181a6
registering the command extractors
WizardlyBump17 Nov 13, 2024
4528843
fixed the arguments list
WizardlyBump17 Nov 13, 2024
272137f
weakened the constructor's visibility
WizardlyBump17 Nov 13, 2024
e22e013
added the CommandManager#registerCommands(Collection) method
WizardlyBump17 Nov 13, 2024
f58b63c
added the CommandData#getName() method
WizardlyBump17 Nov 13, 2024
8046e8f
added the RegisteredCommand#onRegister(CommandManager) method
WizardlyBump17 Nov 13, 2024
3f0866b
added the RegisteredPluginCommand class
WizardlyBump17 Nov 13, 2024
5b24ac6
added the CommandMapAdapter system
WizardlyBump17 Nov 14, 2024
88b3209
added the RegisteredCommand#onUnregister(CommandManager) method
WizardlyBump17 Nov 14, 2024
c68bdf0
added the CommandMapAdapter for the other versions
WizardlyBump17 Nov 14, 2024
c60e2ec
renamed to RegisteredBukkitCommand
WizardlyBump17 Nov 14, 2024
c81482e
added the ArgsNode.literal(String) method
WizardlyBump17 Nov 14, 2024
0afb70e
calling the RegisteredCommand#onUnregister(CommandManager) method whe…
WizardlyBump17 Nov 14, 2024
b4cdfc1
using the public lookup
WizardlyBump17 Nov 14, 2024
f074945
unregistering the command properly
WizardlyBump17 Nov 14, 2024
a6f8dcc
using the fields instead of their values
WizardlyBump17 Nov 14, 2024
519250d
added the RequiredSenderType annotation
WizardlyBump17 Nov 14, 2024
9417cd9
moved the sender check to the RegisteredCommand
WizardlyBump17 Nov 14, 2024
c45cd78
moved the sender type requirement to the CommandData interface
WizardlyBump17 Nov 14, 2024
ecbdb5c
deleted the unused file
WizardlyBump17 Nov 14, 2024
a874f8a
improved the sender checking
WizardlyBump17 Nov 14, 2024
04af805
fixed the RegisteredCommand#canExecute(CommandSender) method by check…
WizardlyBump17 Nov 15, 2024
4ba1757
made CommandData be an abstract class
WizardlyBump17 Nov 15, 2024
25b9e5b
added the SimpleCommandData system
WizardlyBump17 Nov 15, 2024
9052f1f
added the ArgsNode.userInput(String, ArgsReader) method
WizardlyBump17 Nov 15, 2024
f3eb68a
added the CommandSender#hasId(UUID) method
WizardlyBump17 Nov 15, 2024
8fac630
added the ArgsNode.userInput(String, Class) method
WizardlyBump17 Nov 15, 2024
421a46f
using the CommandManager to execute the command instead
WizardlyBump17 Nov 16, 2024
658cd00
removed the unused field
WizardlyBump17 Nov 16, 2024
faadaea
made the CommandManager store commands using a Map where the key is t…
WizardlyBump17 Nov 16, 2024
7f15598
annotated with NotNull
WizardlyBump17 Nov 16, 2024
a83e178
added methods to manipulate the CommandManager#getCommandExtractors()
WizardlyBump17 Nov 16, 2024
e7d02f1
using a List instead
WizardlyBump17 Nov 16, 2024
fb83f0b
moved to the proper package and renamed the classes implementing Comm…
WizardlyBump17 Nov 23, 2024
47e9fe1
added the BasicCommandSender class
WizardlyBump17 Nov 24, 2024
5f1c5cd
added the builder system
WizardlyBump17 Nov 24, 2024
986fb39
added some tests for the BasicCommandSender
WizardlyBump17 Nov 24, 2024
f631248
added the annotations dependency to the test scope
WizardlyBump17 Dec 5, 2024
fe6cbc3
version changed
WizardlyBump17 Jan 14, 2025
f3d9f58
improved the build.gradle
WizardlyBump17 Jan 14, 2025
6017fed
added the MiniMessageUtil class
WizardlyBump17 Feb 15, 2025
1384fd8
added support for the Adventure API on non-Paper environments
WizardlyBump17 Feb 16, 2025
618c6ce
added some methods with some Adventure stuff
WizardlyBump17 Feb 16, 2025
8c12af8
version changed :D
WizardlyBump17 Apr 17, 2025
756ca77
using suppliers
WizardlyBump17 May 24, 2025
5d9087e
version changed
WizardlyBump17 May 24, 2025
6c6b967
Merge branch '1.20.6+' into new-command-system-1.20.6
WizardlyBump17 Jul 14, 2025
9254ad8
sync with 1.20.6+
WizardlyBump17 Jul 14, 2025
43d2c2d
added the Adapter interface
WizardlyBump17 Jul 14, 2025
efa2b8d
added versions to stuff
WizardlyBump17 Jul 14, 2025
4b2f1f8
changed the branch
WizardlyBump17 Jul 14, 2025
b665d6a
changed the version schema
WizardlyBump17 Jul 14, 2025
c0d2f69
there is no + on the name
WizardlyBump17 Jul 14, 2025
949a401
subprojects
WizardlyBump17 Jul 14, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- published
push:
branches:
- 1.20.6\+
- new-command-system-1.20.6

env:
USERNAME: ${{ github.actor }}
Expand Down
16 changes: 15 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ subprojects {
apply plugin: 'maven-publish'

group = 'com.wizardlybump17.wlib'
version = "1.6.8+1.20.6" + ("true".equalsIgnoreCase(System.getenv("WLIB_SNAPSHOT")) ? "-SNAPSHOT." + System.getenv("WLIB_SNAPSHOT_NUMBER") : "")
version = "1.6.8-ncs-1.20.6+" + ("true".equalsIgnoreCase(System.getenv("WLIB_SNAPSHOT")) ? "-SNAPSHOT." + System.getenv("WLIB_SNAPSHOT_NUMBER") : "")

repositories {
mavenLocal()
Expand Down Expand Up @@ -81,4 +81,18 @@ subprojects {
}
}
}

dependencies {
testImplementation(
platform('org.junit:junit-bom:5.10.2'),
'org.junit.jupiter:junit-jupiter:5.10.2'
)
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
}
3 changes: 3 additions & 0 deletions bukkit-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dependencies {
'org.jetbrains:annotations:23.0.0',
"io.papermc.paper:paper-api:1.20.6-R0.1-20240702.153951-124",
)
compileOnly("net.kyori:adventure-api:4.18.0")
compileOnly("net.kyori:adventure-text-minimessage:4.18.0")
compileOnly("net.kyori:adventure-platform-bukkit:4.3.4")
implementation(
project(':utils')
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.wizardlybump17.wlib.util.bukkit;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.NotNull;

import java.util.Map;

public final class MiniMessageUtil {

private MiniMessageUtil() {
}

public static @NotNull Component getMessage(@NotNull String message, @NotNull Map<String, Object> placeholders) {
MiniMessage miniMessage = MiniMessage.miniMessage();
if (placeholders.isEmpty())
return miniMessage.deserialize(message);

TagResolver[] resolvers = new TagResolver[placeholders.size()];
int resolverIndex = 0;
for (Map.Entry<String, Object> entry : placeholders.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
resolvers[resolverIndex++] = TagResolver.builder()
.tag(
key,
Tag.inserting(value instanceof Component component ? component : Component.text(String.valueOf(value)))
)
.build();
}
return miniMessage.deserialize(message, resolvers);
}

public static @NotNull Component getMessage(@NotNull String message) {
return getMessage(message, Map.of());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.wizardlybump17.wlib.bungee.command;

import com.wizardlybump17.wlib.bungee.command.sender.GenericSender;
import com.wizardlybump17.wlib.bungee.command.sender.ProxiedPlayerSender;
import com.wizardlybump17.wlib.bungee.command.sender.BungeeCommandSender;
import com.wizardlybump17.wlib.command.CommandManager;
import com.wizardlybump17.wlib.command.CommandSender;
import com.wizardlybump17.wlib.command.exception.CommandException;
import com.wizardlybump17.wlib.command.holder.CommandExecutor;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;

import java.util.logging.Level;

public class BungeeCommandExecutor extends Command implements CommandExecutor {

private final CommandManager manager;
Expand All @@ -18,17 +18,16 @@ public BungeeCommandExecutor(CommandManager manager, String name) {
}

@Override
public void execute(CommandSender<?> sender, String commandName, String[] args) {
public void execute(com.wizardlybump17.wlib.command.sender.CommandSender<?> sender, String commandName, String[] args) throws CommandException {
manager.execute(sender, commandName + " " + String.join(" ", args));
}

@Override
public void execute(net.md_5.bungee.api.CommandSender sender, String[] args) {
CommandSender<?> realSender;
if (sender instanceof ProxiedPlayer)
realSender = new ProxiedPlayerSender((ProxiedPlayer) sender);
else
realSender = new GenericSender(sender);
execute(realSender, getName(), args);
try {
execute(new BungeeCommandSender(sender), getName(), args);
} catch (CommandException e) {
manager.getHolder().getLogger().log(Level.SEVERE, "Error while executing a command", e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.wizardlybump17.wlib.bungee.command;

import com.wizardlybump17.wlib.command.CommandManager;
import com.wizardlybump17.wlib.command.RegisteredCommand;
import com.wizardlybump17.wlib.command.registered.RegisteredCommand;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.Plugin;
import org.jetbrains.annotations.NotNull;

public class BungeeCommandManager extends CommandManager {

Expand All @@ -12,7 +13,7 @@ public BungeeCommandManager(BungeeCommandHolder holder) {
}

@Override
public void registerCommands(Object... objects) {
public void registerCommands(@NotNull Object @NotNull ... objects) {
super.registerCommands(objects);
for (Object object : objects) {
for (RegisteredCommand command : getCommands(object)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.wizardlybump17.wlib.bungee.command.sender;

import com.wizardlybump17.wlib.command.CommandSender;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ConnectedPlayer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.jetbrains.annotations.NotNull;

import java.util.UUID;

@RequiredArgsConstructor
public class GenericSender implements CommandSender<net.md_5.bungee.api.CommandSender> {
public class BungeeCommandSender implements com.wizardlybump17.wlib.command.sender.CommandSender<net.md_5.bungee.api.CommandSender> {

private final net.md_5.bungee.api.CommandSender handle;

Expand Down Expand Up @@ -34,12 +38,16 @@ public boolean hasPermission(String permission) {
return handle.hasPermission(permission);
}

@Override
public GenericSender toGeneric() {
return this;
public @NotNull ProxiedPlayer asProxiedPlayer() {
return (ProxiedPlayer) handle;
}

public static boolean isGeneric() {
return true;
public @NotNull ConnectedPlayer asConnectedPlayer() {
return (ConnectedPlayer) handle;
}

@Override
public boolean hasId(@NotNull UUID id) {
return handle instanceof ProxiedPlayer player && player.getUniqueId().equals(id);
}
}

This file was deleted.

1 change: 1 addition & 0 deletions commands/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
implementation("com.github.sisyphsu:dateparser:1.0.11") {
exclude(group: "org.projectlombok", module: "lombok")
}
testCompileOnly("org.jetbrains:annotations:26.0.1")
}

shadowJar {
Expand Down
Loading