Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
370 commits
Select commit Hold shift + click to select a range
ce52c79
added more tests
WizardlyBump17 Nov 11, 2025
0eef0ae
properly handling the no parameters case
WizardlyBump17 Nov 11, 2025
ba63b25
added more tests
WizardlyBump17 Nov 11, 2025
530d1e6
if less than zero
WizardlyBump17 Nov 11, 2025
4b98766
added more tests
WizardlyBump17 Nov 11, 2025
f028176
added the String node
WizardlyBump17 Nov 11, 2025
8ebe6a3
added some allowed inputs for strings
WizardlyBump17 Nov 11, 2025
6f048f9
starting the final tests
WizardlyBump17 Nov 11, 2025
bdb0e61
empty results
WizardlyBump17 Nov 12, 2025
9ebfcef
it can not be null
WizardlyBump17 Nov 12, 2025
204fa87
looking for a child
WizardlyBump17 Nov 12, 2025
2698ccf
overriding the Object#toString() method
WizardlyBump17 Nov 12, 2025
c9693b5
added more tests
WizardlyBump17 Nov 12, 2025
265c3ba
ignoring literal inputs
WizardlyBump17 Nov 12, 2025
ea2d15d
fixed the tests
WizardlyBump17 Nov 12, 2025
29ace8c
it can not be empty
WizardlyBump17 Nov 12, 2025
d2227b8
returning a generic error if the last node or last input index was le…
WizardlyBump17 Nov 12, 2025
07d9f79
zero
WizardlyBump17 Nov 12, 2025
7449959
a better package
WizardlyBump17 Nov 12, 2025
7cb1980
added the MethodCommandNodeFactory system
WizardlyBump17 Nov 12, 2025
b5e3ad4
using the factory to create the CommandNode
WizardlyBump17 Nov 12, 2025
d292b59
throwing a better exception
WizardlyBump17 Nov 12, 2025
8637e32
silly me, I forgot about the children (need to add tests for that)
WizardlyBump17 Nov 12, 2025
912309b
equalsIgnoreExecutor
WizardlyBump17 Nov 20, 2025
6d131df
lets see if the structure keeps the same
WizardlyBump17 Nov 20, 2025
991d7dc
fixed the equals check
WizardlyBump17 Nov 24, 2025
8b1421e
more tests
WizardlyBump17 Nov 24, 2025
c627264
reorganizing the AllowedInputs system
WizardlyBump17 Nov 24, 2025
482aad5
using the new stuff
WizardlyBump17 Nov 24, 2025
03d10f9
added the getter
WizardlyBump17 Nov 24, 2025
6b36f7a
improved the AllowedNumberInputs
WizardlyBump17 Nov 24, 2025
8247df0
improved the String input
WizardlyBump17 Nov 24, 2025
3fd7578
minor changes
WizardlyBump17 Nov 24, 2025
c47dbb7
all primitive numbers
WizardlyBump17 Nov 25, 2025
6816a7c
the last primitives
WizardlyBump17 Nov 25, 2025
659968c
minor changes
WizardlyBump17 Nov 25, 2025
0fb21d7
UUIDs
WizardlyBump17 Nov 25, 2025
7aaaa4b
made them implement AllowedListInputs
WizardlyBump17 Nov 25, 2025
05ad28a
?
WizardlyBump17 Nov 25, 2025
032eebe
better packages
WizardlyBump17 Nov 25, 2025
72a9a7e
more
WizardlyBump17 Nov 25, 2025
035077d
more!
WizardlyBump17 Nov 25, 2025
b22afd1
renamed
WizardlyBump17 Nov 25, 2025
62d5cfe
yea, i did that
WizardlyBump17 Nov 25, 2025
46a5a00
always be sure
WizardlyBump17 Nov 25, 2025
9f71a0d
back to the stone age
WizardlyBump17 Nov 25, 2025
e53bccb
made some work on some monkeys
WizardlyBump17 Nov 25, 2025
3b5f860
using the AllowedStringInputs
WizardlyBump17 Nov 26, 2025
9f2b8dc
registering the default factories
WizardlyBump17 Nov 26, 2025
d68b1f5
are we liberal or conservative?
WizardlyBump17 Nov 26, 2025
2ad6208
CTRL C CTRL V moment
WizardlyBump17 Nov 26, 2025
7388a42
added the UUID CommandNode extractor
WizardlyBump17 Nov 26, 2025
8b9babd
dependency injection
WizardlyBump17 Nov 30, 2025
95dd283
different toStrings
WizardlyBump17 Nov 30, 2025
393a9c0
versions
WizardlyBump17 Dec 1, 2025
3c93970
Merge branch '1.20.6+' into skull-fix-1.20.6+
WizardlyBump17 Dec 1, 2025
54196bc
properly loading the skull skin
WizardlyBump17 Dec 1, 2025
df24b30
Merge pull request #13 from WizardlyBump17/skull-fix-1.20.6+
WizardlyBump17 Dec 3, 2025
af17e03
override and test
WizardlyBump17 Dec 1, 2025
61db269
small tests
WizardlyBump17 Dec 5, 2025
74efe1c
using the latest version
WizardlyBump17 Dec 5, 2025
2b4ebfd
Gradle KTS and minor changes
WizardlyBump17 Dec 5, 2025
446f50c
some of them can be nullable
WizardlyBump17 Dec 5, 2025
3210631
better documentation
WizardlyBump17 Dec 6, 2025
b61e8e6
starting the command system
WizardlyBump17 Dec 6, 2025
fc355b7
added the CommandManager#clear() method
WizardlyBump17 Dec 6, 2025
1a2bcf6
you never know when someone is doing async
WizardlyBump17 Dec 6, 2025
0f2a394
added some getters
WizardlyBump17 Dec 6, 2025
c5588f1
added the command executor
WizardlyBump17 Dec 6, 2025
622c196
added listeners for hte CommandManager
WizardlyBump17 Dec 6, 2025
440cd47
you are unmodifiable, but the underlying Map is not
WizardlyBump17 Dec 6, 2025
268313a
commands can have holders now
WizardlyBump17 Dec 6, 2025
3b86405
actually calling the listeners
WizardlyBump17 Dec 6, 2025
7bfc602
made it be public
WizardlyBump17 Dec 6, 2025
db1b067
added the CommandManager#isEmpty() method
WizardlyBump17 Dec 6, 2025
d26cc0e
added tests for the CommandManagerListener
WizardlyBump17 Dec 6, 2025
a7912a2
added the Command#getName() method
WizardlyBump17 Dec 6, 2025
5fc553b
added the BukkitCommandManagerListener
WizardlyBump17 Dec 6, 2025
014d4d8
I think snapshots will be better now
WizardlyBump17 Dec 6, 2025
3672d77
forgot the -2
WizardlyBump17 Dec 6, 2025
6f0fb07
manual dispatches
WizardlyBump17 Dec 6, 2025
850b587
Revert "manual dispatches"
WizardlyBump17 Dec 6, 2025
f59de39
Revert "forgot the -2"
WizardlyBump17 Dec 6, 2025
551e136
Revert "I think snapshots will be better now"
WizardlyBump17 Dec 6, 2025
7f3a55d
fuck
WizardlyBump17 Dec 6, 2025
be582d3
added support for OfflinePlayer in the command system
WizardlyBump17 Dec 6, 2025
6ba8c53
unregistering commands
WizardlyBump17 Dec 6, 2025
648ce14
renamed
WizardlyBump17 Dec 6, 2025
3e77826
testing the AssertionUtil
WizardlyBump17 Dec 7, 2025
2939bdb
log the error
WizardlyBump17 Dec 7, 2025
841fe86
not allowing the creation of duplicate node names
WizardlyBump17 Dec 7, 2025
1cb20c3
merging the executor and permission too
WizardlyBump17 Dec 8, 2025
2e83a29
getting the total nodes
WizardlyBump17 Dec 8, 2025
4833892
comparing using a Comparator
WizardlyBump17 Dec 8, 2025
2dff490
testing the merge
WizardlyBump17 Dec 8, 2025
09aa9b5
appending a suffix to arguments
WizardlyBump17 Dec 8, 2025
947d987
it has a 2
WizardlyBump17 Dec 8, 2025
d69e63a
removed the debug code
WizardlyBump17 Dec 8, 2025
53e85ab
nah, it doesnt need a suffix. The CommandArguments need a small rework
WizardlyBump17 Dec 8, 2025
1f98012
not passing LiteralCommandNode results
WizardlyBump17 Dec 8, 2025
5c7e3fd
removed the commented code
WizardlyBump17 Dec 9, 2025
8a5580e
testing the command arguments
WizardlyBump17 Dec 9, 2025
7205621
it is the other way around
WizardlyBump17 Dec 9, 2025
f84fd3c
fuck 2
WizardlyBump17 Dec 9, 2025
91d7a39
starting a better suggestion system
WizardlyBump17 Dec 9, 2025
fbeaec2
added some suggestions
WizardlyBump17 Dec 9, 2025
acee67a
toString
WizardlyBump17 Dec 9, 2025
bb354c2
working on the suggestion system
WizardlyBump17 Dec 9, 2025
540043d
working on the suggestion system
WizardlyBump17 Dec 9, 2025
fa497f3
fixed the tests
WizardlyBump17 Dec 9, 2025
b08aba6
using a List instead
WizardlyBump17 Dec 10, 2025
d65c0bc
returning the last child
WizardlyBump17 Dec 10, 2025
a0acbd0
added the Suggester
WizardlyBump17 Dec 10, 2025
9aa14ee
suggestions
WizardlyBump17 Dec 12, 2025
7996d99
using only one constructor
WizardlyBump17 Dec 12, 2025
bb629ac
x more to go
WizardlyBump17 Dec 13, 2025
0f0c823
x more to go
WizardlyBump17 Dec 13, 2025
d39c78c
x more to go
WizardlyBump17 Dec 13, 2025
89d072b
x more to go
WizardlyBump17 Dec 13, 2025
f9f4f09
x more to go
WizardlyBump17 Dec 13, 2025
b595426
x more to go
WizardlyBump17 Dec 14, 2025
21e63ba
x more to go
WizardlyBump17 Dec 14, 2025
8a654c5
x more to go
WizardlyBump17 Dec 14, 2025
a003ba8
sync with the recent changes
WizardlyBump17 Dec 14, 2025
9e3671d
the suggestions are now Strings
WizardlyBump17 Dec 15, 2025
c0a5cb6
finished the number suggestion tests
WizardlyBump17 Dec 15, 2025
f08a983
testing strings
WizardlyBump17 Dec 15, 2025
85fe9ba
it is not needed to try parsing the input, just return all suggestions
WizardlyBump17 Dec 15, 2025
fcf438d
testing UUIDs
WizardlyBump17 Dec 15, 2025
661dd1e
suggesting only stuff that starts with the current input
WizardlyBump17 Dec 15, 2025
f8dd2dd
improved the suggestions
WizardlyBump17 Dec 15, 2025
25bf362
using a LinkedHashMap
WizardlyBump17 Dec 15, 2025
6670058
clearing the last error
WizardlyBump17 Dec 15, 2025
d0e787f
added support to create commands using the Command from Bukkit
WizardlyBump17 Dec 15, 2025
f9c677e
removing the command by name too
WizardlyBump17 Dec 15, 2025
12f1a7a
private constructors
WizardlyBump17 Dec 15, 2025
0753e28
requiring an AllowedOfflinePlayerInputs
WizardlyBump17 Dec 15, 2025
7d7e741
accepting Players too
WizardlyBump17 Dec 15, 2025
51a359a
added support for Players
WizardlyBump17 Dec 15, 2025
d3195db
requiring an AllowedPlayerInputs
WizardlyBump17 Dec 15, 2025
92f5bfc
Collections.unmodifiableMap(Map)
WizardlyBump17 Dec 15, 2025
f68a53b
added the CommandManager#getHoldersByFullName() method
WizardlyBump17 Dec 15, 2025
b5a4239
clearing the holdersByFullName too
WizardlyBump17 Dec 15, 2025
2c971c2
listening the pre and post clear
WizardlyBump17 Dec 15, 2025
fd5fe40
properly unregistering the Bukkit commands
WizardlyBump17 Dec 15, 2025
bcba0a6
using the class name
WizardlyBump17 Dec 15, 2025
e78c361
not letting some stuff to happen
WizardlyBump17 Dec 15, 2025
c1f1f9f
properly merging commands
WizardlyBump17 Dec 15, 2025
f35aa11
preparing the ground for the FullCommandResult
WizardlyBump17 Dec 16, 2025
0b7d1d0
preparing the ground for the FullCommandResult
WizardlyBump17 Dec 16, 2025
7467c88
Revert "preparing the ground for the FullCommandResult"
WizardlyBump17 Dec 16, 2025
1f8bb8e
Revert "preparing the ground for the FullCommandResult"
WizardlyBump17 Dec 16, 2025
8bfcc3f
added the SuggesterException
WizardlyBump17 Dec 16, 2025
c97d999
handling the SuggesterException
WizardlyBump17 Dec 16, 2025
9567ef6
added the CachingSuggester
WizardlyBump17 Dec 16, 2025
e73d268
fixed the cache expiration check
WizardlyBump17 Dec 16, 2025
a026484
added support for JsonElements
WizardlyBump17 Dec 17, 2025
3e83701
removed lombok from the WLib class
WizardlyBump17 Dec 17, 2025
c9d5b4b
fixed build.gradle
WizardlyBump17 Dec 17, 2025
2fbaff8
passing a string instead
WizardlyBump17 Dec 17, 2025
a58d536
improved the messages
WizardlyBump17 Dec 17, 2025
bc22f9a
some changes to the quoted string system
WizardlyBump17 Dec 17, 2025
962b5e1
properly handling escapes
WizardlyBump17 Dec 17, 2025
45e632e
added the CommandResult#id() method
WizardlyBump17 Dec 17, 2025
9d3745c
some changes
WizardlyBump17 Dec 17, 2025
e7bda3e
fixed the Bukkit suggestions
WizardlyBump17 Dec 17, 2025
4c73f73
more changes
WizardlyBump17 Dec 18, 2025
2b81c94
fixed the escape
WizardlyBump17 Dec 18, 2025
d2e6932
escaping some suggestions
WizardlyBump17 Dec 18, 2025
37336b0
just realized the NotNull annotation is not retained at runtime
WizardlyBump17 Dec 19, 2025
e434915
added the BukkitCommandSender.CONSOLE field
WizardlyBump17 Dec 19, 2025
97ac25c
caching the CommandSender
WizardlyBump17 Dec 20, 2025
867fc5d
added the NoContentResult
WizardlyBump17 Dec 20, 2025
2f1017c
added the NotFoundResult
WizardlyBump17 Dec 20, 2025
da897a6
added the ConflictResult
WizardlyBump17 Dec 22, 2025
602b205
skipping NMS on publish
WizardlyBump17 Dec 24, 2025
089208e
added the AllowedInputs.Any class
WizardlyBump17 Dec 26, 2025
4621d45
added the InstantCommandNode
WizardlyBump17 Dec 26, 2025
2014006
returning null if needed
WizardlyBump17 Dec 26, 2025
7f53a8d
added the MiniMessageUtil.getMessage(String, String, Object, Map) method
WizardlyBump17 Dec 27, 2025
12a1db4
added the MiniMessageUtil.getMessage(String, String, Object, String, …
WizardlyBump17 Dec 27, 2025
a5e2d65
added the EnumSuggester
WizardlyBump17 Dec 27, 2025
a1c0b88
added the EnumCommandNode
WizardlyBump17 Dec 27, 2025
427be21
moved the JsonElementCommandNode system to the commands module
WizardlyBump17 Dec 29, 2025
9fce7f3
added a default ValuesSuggester implementation
WizardlyBump17 Dec 29, 2025
91b98ac
implementing equals, hashCode and toString
WizardlyBump17 Dec 29, 2025
bf27eda
added a simple implementation of the AllowedListInputs
WizardlyBump17 Dec 29, 2025
480d628
fixed
WizardlyBump17 Dec 29, 2025
f7bf715
improved the ComponentCollector
WizardlyBump17 Jan 10, 2026
7d0f42a
properly using the preprocessor system
WizardlyBump17 Jan 24, 2026
45be564
excluding gson to get a smaller jar
WizardlyBump17 Jan 26, 2026
38a6bc3
accepting null from the argument list
WizardlyBump17 Jan 26, 2026
750dde5
accepting null from the argument list
WizardlyBump17 Jan 26, 2026
6c49e8c
testing "accepting null from the arguments list"
WizardlyBump17 Jan 26, 2026
a872eae
improved the NMS ignoring
WizardlyBump17 Jan 27, 2026
8e25d9f
rootProject there
WizardlyBump17 Jan 27, 2026
a8e70ae
just fucking work please
WizardlyBump17 Jan 27, 2026
409551a
PLEASE
WizardlyBump17 Jan 27, 2026
b97ae64
guess you cant duplicate
WizardlyBump17 Jan 27, 2026
78826a5
we will get this done eventually
WizardlyBump17 Jan 27, 2026
222d528
playing around
WizardlyBump17 Jan 27, 2026
14de4b8
playing around
WizardlyBump17 Jan 27, 2026
c00f1af
Revert "playing around"
WizardlyBump17 Jan 27, 2026
356afcd
Revert "playing around"
WizardlyBump17 Jan 27, 2026
82c58b8
Revert "we will get this done eventually"
WizardlyBump17 Jan 27, 2026
eecd62d
Revert "guess you cant duplicate"
WizardlyBump17 Jan 27, 2026
492ced6
Revert "PLEASE"
WizardlyBump17 Jan 27, 2026
dcf6f2f
Revert "just fucking work please"
WizardlyBump17 Jan 27, 2026
9da8748
ignoring NMS at settings.gradle
WizardlyBump17 Jan 27, 2026
651235a
improved NMS ignoring
WizardlyBump17 Jan 27, 2026
01120ce
merged the workflows
WizardlyBump17 Jan 27, 2026
567e46e
wait for it to build
WizardlyBump17 Jan 27, 2026
7027b81
mb
WizardlyBump17 Jan 27, 2026
9f79822
mb
WizardlyBump17 Jan 27, 2026
ab4cf3d
mb
WizardlyBump17 Jan 27, 2026
5367b2b
mb
WizardlyBump17 Jan 27, 2026
c6536ee
uploading to the release
WizardlyBump17 Jan 27, 2026
a7b3f92
generational fumble
WizardlyBump17 Jan 27, 2026
91ad68e
on second thought...
WizardlyBump17 Jan 27, 2026
8393df7
those arbitrary restrictions...
WizardlyBump17 Jan 27, 2026
120b0a4
there will be a whole between the versions, but who cares?
WizardlyBump17 Jan 28, 2026
9340769
do we need some escaping?
WizardlyBump17 Jan 28, 2026
91a0eaf
added the StringUtil.pascalToCamel(String) method
WizardlyBump17 Jan 28, 2026
8cefd8b
camel
WizardlyBump17 Jan 28, 2026
c87a2ec
a better way to get the insertion
WizardlyBump17 Jan 28, 2026
9a25d99
handling JSON
WizardlyBump17 Jan 28, 2026
082cb8f
Revert "improved the ComponentCollector"
WizardlyBump17 Jan 30, 2026
fcfc862
only handle that if it is the last input
WizardlyBump17 Jan 30, 2026
226392c
added the PaginatedInventoryBuilder#setReplacementActionByCustomData(…
WizardlyBump17 Jan 30, 2026
2666619
added the PaginatedInventoryBuilder#setReplacementActionByCustomData(…
WizardlyBump17 Jan 30, 2026
6d0a397
added the BadRequestResult
WizardlyBump17 Feb 2, 2026
70ce8e5
added the UnprocessableContentResult
WizardlyBump17 Feb 3, 2026
a7145ef
let the other command do the merge
WizardlyBump17 Feb 12, 2026
e49c5df
you can be anything
WizardlyBump17 Feb 19, 2026
79dfefe
using an ItemMeta instead
WizardlyBump17 Feb 26, 2026
8184051
added the ItemMetaHandlerModel.getApplicableModelOptional(Material) m…
WizardlyBump17 Feb 26, 2026
05b0c26
using the ItemMeta
WizardlyBump17 Feb 26, 2026
423ff8b
deprecation notice
WizardlyBump17 Feb 26, 2026
24d3ec6
using the ItemMeta instead
WizardlyBump17 Feb 26, 2026
21491be
small rework on the constructors
WizardlyBump17 Feb 26, 2026
818e6ac
Merge branch 'item-builder-small-rework' into new-command-system-1.20…
WizardlyBump17 Feb 26, 2026
6fe3840
using an Object for the key instead
WizardlyBump17 Feb 28, 2026
1cc40fc
added methods to replace the ItemStack of an ItemButton
WizardlyBump17 Feb 28, 2026
36f231c
Merge branch 'inventory-builder-improvements' into new-command-system…
WizardlyBump17 Feb 28, 2026
a725985
replacing items based on the original ones
WizardlyBump17 Feb 28, 2026
d593847
Merge branch 'inventory-builder-improvements' into new-command-system…
WizardlyBump17 Feb 28, 2026
f6ff05d
fixed a stack overflow
WizardlyBump17 Mar 1, 2026
027476f
fixed a stack overflow
WizardlyBump17 Mar 1, 2026
56c9c65
replacing items based on ItemButtons
WizardlyBump17 Mar 1, 2026
805f15d
Merge branch 'inventory-builder-improvements' into new-command-system…
WizardlyBump17 Mar 1, 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
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Publish to GitHub Packages
name: Build and upload

on:
push:
pull_request:
types:
- opened
- reopened
workflow_dispatch:
release:
types:
- published
push:
branches:
- new-command-system-1.20.6
- created

env:
USERNAME: ${{ github.actor }}
Expand All @@ -17,13 +20,12 @@ jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
contents: read
steps:
- name: Get current date
run: echo "WLIB_BUILD_DATE=$(date +'%Y-%m-%d_%H-%M-%S')" >> "$GITHUB_ENV"
- name: Get snapshot number
run: echo "WLIB_SNAPSHOT_NUMBER=$((${{ github.run_number }}+${{ github.run_attempt }}))" >> $GITHUB_ENV
run: echo "WLIB_SNAPSHOT_NUMBER=$((${{ github.run_number }}+${{ github.run_attempt }}+68))" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
Expand All @@ -48,5 +50,27 @@ jobs:
for file in */build/libs/*.jar; do
gh release upload ${{ github.event.release.tag_name }} $file
done
- name: Publish
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: ${{ github.event_name != 'pull_request' }}
needs:
- build
steps:
- name: Get current date
run: echo "WLIB_BUILD_DATE=$(date +'%Y-%m-%d_%H-%M-%S')" >> "$GITHUB_ENV"
- name: Get snapshot number
run: echo "WLIB_SNAPSHOT_NUMBER=$((${{ github.run_number }}+${{ github.run_attempt }}+68))" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Clean, Build and Publish
run: ./gradlew publish

41 changes: 0 additions & 41 deletions .github/workflows/build.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/build/
.idea/
.gradle/
/build.properties
35 changes: 8 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.gradleup.shadow") version "8.3.2"
id("com.gradleup.shadow") version "9.2.2"
id 'maven-publish'
id("systems.manifold.manifold-gradle-plugin") version "0.0.2-alpha" apply false
}

subprojects {
Expand All @@ -9,7 +10,7 @@ subprojects {
apply plugin: 'maven-publish'

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

repositories {
mavenLocal()
Expand All @@ -20,9 +21,6 @@ subprojects {
}
}

sourceCompatibility = '21'
targetCompatibility = '21'

tasks {
compileJava {
options.encoding = 'UTF-8'
Expand All @@ -38,26 +36,22 @@ subprojects {

java {
withSourcesJar()
sourceCompatibility = 21
targetCompatibility = 21
}
}

subprojects {
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.3"))
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
testImplementation(platform("org.junit:junit-bom:6.0.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-launcher")
}

test {
useJUnitPlatform()
}

if (project.name == 'versions' || project.name.matches('v\\d_\\d+_R\\d+')) {
tasks.withType(PublishToMavenRepository).configureEach {
it.enabled = false
}
return
}

publishing {
repositories {
maven {
Expand All @@ -72,23 +66,10 @@ subprojects {
publications {
gpr(MavenPublication) {
from(components.java)
pom.withXml {
asNode().dependencies.dependency.each { dep ->
if (dep.artifactId.last().value().last().matches('v\\d_\\d+_R\\d+'))
dep.parent().remove(dep)
}
}
}
}
}

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

test {
useJUnitPlatform()
testLogging {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package com.wizardlybump17.wlib.util.bukkit;

import com.google.gson.JsonNull;
import com.google.gson.JsonPrimitive;
import com.wizardlybump17.wlib.util.StringUtil;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
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 org.jetbrains.annotations.Nullable;

import java.util.Map;

public final class MiniMessageUtil {

private static final @NotNull TextComponent NULL = Component.text("null");

private MiniMessageUtil() {
}

Expand All @@ -21,18 +28,60 @@ private MiniMessageUtil() {
TagResolver[] resolvers = new TagResolver[placeholders.size()];
int resolverIndex = 0;
for (Map.Entry<String, Object> entry : placeholders.entrySet()) {
String key = entry.getKey();
String key = StringUtil.pascalToCamel(entry.getKey());
Object value = entry.getValue();
resolvers[resolverIndex++] = TagResolver.builder()
.tag(
key,
Tag.inserting(value instanceof Component component ? component : Component.text(String.valueOf(value)))
Tag.inserting(getInsertion(value))
)
.build();
}
return miniMessage.deserialize(message, resolvers);
}

public static @NotNull Component getMessage(@NotNull String message, @NotNull String placeholderKey, @NotNull Object placeholderValue, @NotNull String prefix, @NotNull Map<String , ?> additionalPlaceholders) {
MiniMessage miniMessage = MiniMessage.miniMessage();
if (additionalPlaceholders.isEmpty())
return getMessage(message, Map.of(placeholderKey, placeholderValue));

TagResolver[] resolvers = new TagResolver[additionalPlaceholders.size() + 1];
int resolverIndex = 0;
for (Map.Entry<String, ?> entry : additionalPlaceholders.entrySet()) {
String key = StringUtil.pascalToCamel(entry.getKey());
Object value = entry.getValue();
resolvers[resolverIndex++] = TagResolver.builder()
.tag(
prefix + key,
Tag.inserting(getInsertion(value))
)
.build();
}
resolvers[resolverIndex] = TagResolver.builder()
.tag(
prefix + placeholderKey,
Tag.inserting(getInsertion(placeholderValue))
)
.build();
return miniMessage.deserialize(message, resolvers);
}

private static @NotNull Component getInsertion(@Nullable Object object) {
if (object == null)
return NULL;

return switch (object) {
case Component component -> component;
case JsonPrimitive jsonPrimitive -> Component.text(jsonPrimitive.getAsString());
case JsonNull ignored -> NULL;
default -> Component.text(String.valueOf(object));
};
}

public static @NotNull Component getMessage(@NotNull String message, @NotNull String placeholderKey, @NotNull Object placeholderValue, @NotNull Map<String , ?> additionalPlaceholders) {
return getMessage(message, placeholderKey, placeholderValue, "", additionalPlaceholders);
}

public static @NotNull Component getMessage(@NotNull String message) {
return getMessage(message, Map.of());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.wizardlybump17.wlib.util.bukkit.collector;

import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;

public class ComponentCollector implements Collector<Component, Component[], Component> {

public static final @NotNull ComponentCollector COMMA = new ComponentCollector(Component.text(", "));
public static final @NotNull ComponentCollector NEW_LINE = new ComponentCollector(Component.text("\n"));
public static final @NotNull ComponentCollector EMPTY = new ComponentCollector(Component.empty());

private final @NotNull Component separator;

public ComponentCollector(@NotNull Component separator) {
this.separator = separator;
}

@Override
public @NotNull Supplier<Component[]> supplier() {
return () -> new Component[1];
}

@Override
public @NotNull BiConsumer<Component[], Component> accumulator() {
return (array, component) -> {
if (array[0] == null)
array[0] = component;
else
array[0] = array[0].append(separator).append(component);
};
}

@Override
public @NotNull BinaryOperator<Component[]> combiner() {
return (left, right) -> {
if (left[0] == null)
left[0] = right[0];
else
left[0] = left[0].append(separator).append(right[0]);
return left;
};
}

@Override
public @NotNull Function<Component[], Component> finisher() {
return array -> Objects.requireNonNullElseGet(array[0], Component::empty);
}

@Override
public @NotNull Set<Characteristics> characteristics() {
return Set.of();
}

public @NotNull Component getSeparator() {
return separator;
}
}
2 changes: 1 addition & 1 deletion bungee/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
compileOnly(
'org.projectlombok:lombok:1.18.32',
'org.jetbrains:annotations:23.0.0',
'net.md-5:bungeecord-api:1.18-R0.1-SNAPSHOT',
'net.md-5:bungeecord-api:1.21-R0.3',
)
annotationProcessor('org.projectlombok:lombok:1.18.32')
implementation(
Expand Down

This file was deleted.

Loading