Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to the latest Minecraft version with Velocity migration #28

Open
wants to merge 38 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7a469eb
Bump minecraft version
p0loskun Sep 7, 2024
be75bca
Added new dependencies
p0loskun Sep 15, 2024
391a4c2
Updated gradle build scripts
p0loskun Sep 15, 2024
83d52e0
Updated API
p0loskun Sep 15, 2024
3ccaa8f
Updated API
p0loskun Sep 15, 2024
7c16063
Updated Packet API
p0loskun Sep 15, 2024
5fdf98c
Some improvements
p0loskun Sep 15, 2024
e70782f
Fixed CustomInventory#clone
p0loskun Sep 15, 2024
3a5f430
Renamed map builders
p0loskun Sep 15, 2024
f3de87f
Updated docs
p0loskun Sep 18, 2024
9d7aa48
Updated docs
p0loskun Sep 18, 2024
c2ea718
Bump gradle
p0loskun Sep 18, 2024
16cd373
Enable JavaDocs
p0loskun Sep 18, 2024
13f4337
Some restyle
p0loskun Sep 20, 2024
e8f01e3
Language and resource APIs have been moved to the "common" module
p0loskun Sep 20, 2024
fd62bc0
test
p0loskun Sep 25, 2024
2f81f68
test
p0loskun Sep 25, 2024
2a3e048
Bump Gradle
p0loskun Sep 26, 2024
4bd06e5
Added test for common module
p0loskun Sep 26, 2024
a254cc8
Bump APIs
p0loskun Sep 27, 2024
d4468b8
Fixed constants
p0loskun Sep 29, 2024
28a6506
Added example of usage to Resource annotation
p0loskun Oct 2, 2024
6acefdb
Updated APIs
p0loskun Oct 2, 2024
8c9d5c3
Added suppression
p0loskun Oct 2, 2024
0f865b8
Added Order and Ordered interfaces
p0loskun Oct 5, 2024
5ebecad
Moved some methods
p0loskun Oct 5, 2024
780f5fa
Some improvements
p0loskun Oct 5, 2024
1263a97
Fixed status equals
p0loskun Oct 5, 2024
2e9eff0
Added support for different handler parameter types
p0loskun Oct 5, 2024
8c497dd
Added Velocity module
p0loskun Oct 5, 2024
e47b469
bim bim bom bom
p0loskun Oct 5, 2024
9a681c0
Updated structure
p0loskun Oct 5, 2024
c54beb9
Fixed Commodore listener
p0loskun Oct 12, 2024
2064e54
Strong acceleration of the executor's performance
p0loskun Oct 12, 2024
a1775f5
Improve editor config
p0loskun Oct 12, 2024
e0da3ae
Improve handler executor
p0loskun Oct 12, 2024
8e93ca5
Create "build-logic", separate api and implementation
p0loskun Oct 19, 2024
1b25d64
Fixed block breaking
p0loskun Oct 19, 2024
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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
java: [ '17' ]
java: [ '21' ]
steps:
- if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ subprojects {
compileOnly(rootProject.libs.jda)
}

sourceSets {
main {
java.srcDir(project(":common").sourceSets.main.get().java.srcDirs)
}
}

tasks {
compileJava {
options.encoding = utf8
Expand Down
27 changes: 27 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
plugins {
`java-library`
alias(libs.plugins.shadow)
}

dependencies {
api(libs.adventure.api)
api(libs.adventure.ansi)
api(libs.adventure.gson)
api(libs.adventure.legacy)
api(libs.adventure.plain)
api(libs.adventure.minimessage)
api(libs.netty.buffer)
}

tasks {
shadowJar {
destinationDirectory.set(file("$rootDir/build"))

archiveBaseName.set(rootProject.name + "-" + project.name)
archiveVersion.set(project.version.toString())
}

build {
dependsOn(shadowJar)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.minersstudios.whomine.api.annotation;

import com.minersstudios.whomine.api.throwable.InvalidRegexException;
import com.minersstudios.whomine.api.throwable.InvalidResourceException;
import org.intellij.lang.annotations.RegExp;
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.Contract;
Expand All @@ -14,11 +14,11 @@
import static java.lang.annotation.ElementType.*;

/**
* Annotation used to mark the key.
* Annotation used to mark the path.
* <br>
* The key must match the {@link #REGEX regex} pattern.
* The path must match the {@link #REGEX regex} pattern.
*
* @see Key.Validator
* @see Path.Validator
*/
@Documented
@Retention(RetentionPolicy.CLASS)
Expand All @@ -28,14 +28,14 @@
METHOD,
PARAMETER
})
@org.intellij.lang.annotations.Pattern(Key.REGEX)
public @interface Key {
/** The regex pattern that a valid key must match */
@org.intellij.lang.annotations.Pattern(Path.REGEX)
public @interface Path {
/** The regex pattern that a valid path must match */
@RegExp String REGEX = "[a-z0-9/._-]*";

/**
* Validator class for the {@link Key} annotation to check whether the
* key matches the {@link #REGEX regex}
* Validator class for the {@link Path} annotation to check whether the
* path matches the {@link #REGEX regex}
*
* @see #matches(String)
* @see #validate(String)
Expand All @@ -48,18 +48,18 @@ private Validator() throws AssertionError {
}

/**
* Checks whether the key matches the {@link #REGEX regex}
* Checks whether the path matches the {@link #REGEX regex}
*
* @param key The key
* @return Whether the key matches the {@link #REGEX regex}
* @param path The path
* @return Whether the path matches the {@link #REGEX regex}
*/
public static boolean matches(final @Subst("key") @Key @Nullable String key) {
if (key == null) {
public static boolean matches(final @Subst("path") @Path @Nullable String path) {
if (path == null) {
return true;
}

for(int i = 0; i < key.length(); ++i) {
final char character = key.charAt(i);
for(int i = 0; i < path.length(); ++i) {
final char character = path.charAt(i);

switch (character) {
case '_', '-', '.', '/' -> {}
Expand All @@ -77,16 +77,16 @@ public static boolean matches(final @Subst("key") @Key @Nullable String key) {
}

/**
* Validates the key
* Validates the path
*
* @param key The key
* @throws InvalidRegexException If the key does not match the
* {@link #REGEX regex}
* @param path The path
* @throws InvalidResourceException If the path does not match the
* {@link #REGEX regex}
* @see #matches(String)
*/
public static void validate(final @Subst("key") @Key @Nullable String key) throws InvalidRegexException {
if (!matches(key)) {
throw new InvalidRegexException("Key must match regex: " + REGEX);
public static void validate(final @Subst("path") @Path @Nullable String path) throws InvalidResourceException {
if (!matches(path)) {
throw new InvalidResourceException("Path must match regex: " + REGEX);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.minersstudios.whomine.api.annotation;

import com.minersstudios.whomine.api.throwable.InvalidResourceException;
import org.intellij.lang.annotations.RegExp;
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
* Annotation used to mark the resource.
* <br>
* The resource must match the {@link #REGEX regex} pattern.
*
* @see Resource.Validator
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({
FIELD,
LOCAL_VARIABLE,
METHOD,
PARAMETER
})
@org.intellij.lang.annotations.Pattern(Resource.REGEX)
public @interface Resource {
/** The regex pattern that a valid resource must match */
@RegExp String REGEX = "[a-z0-9._-]*";

/** The empty resource */
@Resource String EMPTY = "";
/** The Minecraft resource */
@Resource String MINECRAFT = "minecraft";
/** The Realms resource */
@Resource String REALMS = "realms";
/** The Paper resource */
@Resource String PAPER = "paper";
/** The WhoMine resource */
@Resource String WHOMINE = "whomine";

/**
* Validator class for the {@link Resource} annotation to check whether the
* resource matches the {@link #REGEX regex}
*
* @see #matches(String)
* @see #validate(String)
*/
final class Validator {

@Contract(" -> fail")
private Validator() throws AssertionError {
throw new AssertionError("Utility class");
}

/**
* Checks whether the resource matches the {@link #REGEX regex}
*
* @param resource The resource
* @return Whether the resource matches the {@link #REGEX regex}
*/
public static boolean matches(final @Subst("resource") @Resource @Nullable String resource) {
if (resource == null) {
return false;
}

for(int i = 0; i < resource.length(); ++i) {
final char character = resource.charAt(i);

switch (character) {
case '_', '-', '.' -> {}
default -> {
if (character < 'a' || character > 'z') {
if (character < '0' || character > '9') {
return false;
}
}
}
}
}

return true;
}

/**
* Validates the resource
*
* @param resource The resource
* @throws InvalidResourceException If the resource does not match the
* {@link #REGEX regex}
* @see #matches(String)
*/
public static void validate(final @Subst("resource") @Resource @Nullable String resource) throws InvalidResourceException {
if (!matches(resource)) {
throw new InvalidResourceException("Resource must match regex: " + REGEX);
}
}
}
}
Loading