-
Notifications
You must be signed in to change notification settings - Fork 2
feat: possible second implementation of the new structure system #24
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
Open
noone-075
wants to merge
14
commits into
WebMCDevelopment:main
Choose a base branch
from
noone-075:wait-for-it
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
771a550
feat: possible second implementation of the new structure system
noone-075 5419c65
chore: fix issues
colbster937 c58e3b6
feat: made blocks not final + rename Block to PlaceableBlock
noone-075 c885b6e
fix: fixed everything that wasnt fixed
noone-075 54aeaba
feat: redesign structure API and add instance management
noone-075 aaa796b
feat: add chunk generation helpers
noone-075 32b7165
Merge branch 'main' into wait-for-it
colbster937 8b5fcac
Merge remote-tracking branch 'upstream/main' into wait-for-it
noone-075 8f9a11a
fix: remove useless SuppressWarnings
noone-075 e2ad7e7
feat: new workflow to test build
noone-075 457f676
fix: make it executable
noone-075 42be90d
feat: added canGenerate(BuilderChunk)
noone-075 d0c64e5
feat: moved to Absolute and other things
noone-075 4db647e
chore: auto-format code
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| on: | ||
| push: | ||
| paths: | ||
| - 'src/**' | ||
| - 'pom.xml' | ||
| pull_request: | ||
| paths: | ||
| - 'src/**' | ||
| - 'pom.xml' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - id: vars | ||
| run: | | ||
| echo "JAVA=$(mvn help:evaluate -Dexpression=maven.compiler.release -q -DforceStdout)" >> "$GITHUB_OUTPUT" | ||
| echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_OUTPUT" | ||
| - uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: liberica | ||
| java-version: ${{ steps.vars.outputs.JAVA }} | ||
| - run: ./src/build/scripts/TestCode.sh | ||
| - run: mvn -B package -DskipTests | ||
| - uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: wlib-${{ steps.vars.outputs.VERSION }} | ||
| path: target/wlib-${{ steps.vars.outputs.VERSION }}.jar | ||
| if-no-files-found: error | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,6 @@ | |
|
|
||
| **/.DS_Store | ||
|
|
||
| /dependency-reduced-pom.xml | ||
| /dependency-reduced-pom.xml | ||
|
|
||
| .vscode | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .vscode should be with the existing directory ignores at the top |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @echo off | ||
| mvn test %* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mvn test $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,11 +67,11 @@ public final void sendPermissionMessage(CommandSender sender, String alias) { | |
| } | ||
|
|
||
| public final void sendUsageMessage(CommandSender sender) { | ||
| sendUsageMessage(sender, ""); | ||
| this.sendUsageMessage(sender, ""); | ||
| } | ||
|
|
||
| public final void sendPermissionMessage(CommandSender sender) { | ||
| sendPermissionMessage(sender, ""); | ||
| this.sendPermissionMessage(sender, ""); | ||
| } | ||
|
|
||
| protected final boolean checkIsPlayer(CommandSender sender) { | ||
|
|
@@ -92,6 +92,27 @@ protected final boolean checkHasPermission(CommandSender sender, String perm) { | |
| } | ||
| } | ||
|
|
||
| public static void sendUnknownCommandMessage(CommandSender sender) { | ||
| boolean bool = true; | ||
|
|
||
| final Class<?> clazz = MirrorSafe.getClass("org.spigotmc.SpigotConfig"); | ||
| if (clazz != null) { | ||
| final String msg = MirrorSafe.getFieldValue(clazz, "unknownCommandMessage"); | ||
| if (msg != null) { | ||
| sender.sendMessage(msg); | ||
| bool = false; | ||
| } | ||
| } | ||
|
|
||
| if (bool) { | ||
| sender.sendMessage(ChatColor.RED + "Unknown command."); | ||
| } | ||
| } | ||
|
|
||
| public static void sendOnlyPlayersMessage(CommandSender sender) { | ||
| sender.sendMessage(ChatColor.RED + "This command can only be used by players."); | ||
| } | ||
|
Comment on lines
+95
to
+114
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. static methods go under instance methods |
||
|
|
||
| private void showStack(CommandSender sender, Throwable t) { | ||
| final String stack = ExceptionStacker.getFullStackString(t); | ||
|
|
||
|
|
@@ -121,25 +142,4 @@ private String replaceUsedAlias(String str, String alias) { | |
| return str; | ||
| } | ||
| } | ||
|
|
||
| public static void sendUnknownCommandMessage(CommandSender sender) { | ||
| boolean bool = true; | ||
|
|
||
| final Class<?> clazz = MirrorSafe.getClass("org.spigotmc.SpigotConfig"); | ||
| if (clazz != null) { | ||
| final String msg = MirrorSafe.getFieldValue(clazz, "unknownCommandMessage"); | ||
| if (msg != null) { | ||
| sender.sendMessage(msg); | ||
| bool = false; | ||
| } | ||
| } | ||
|
|
||
| if (bool) { | ||
| sender.sendMessage(ChatColor.RED + "Unknown command."); | ||
| } | ||
| } | ||
|
|
||
| public static void sendOnlyPlayersMessage(CommandSender sender) { | ||
| sender.sendMessage(ChatColor.RED + "This command can only be used by players."); | ||
| } | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
src/main/java/xyz/webmc/wlib/api/structure/AbsoluteStructure.java
|
noone-075 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright (C) 2026 Colbster937 | ||
| * | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published | ||
| * by the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * See the LICENSE file for details. | ||
| */ | ||
|
|
||
| package xyz.webmc.wlib.api.structure; | ||
|
|
||
| import xyz.webmc.wlib.api.structure.placeable.AbsolutePlaceableStructure; | ||
|
|
||
| import org.bukkit.Location; | ||
|
|
||
| public abstract class AbsoluteStructure implements BaseStructure { | ||
| public abstract AbsolutePlaceableStructure build(Location loc); | ||
|
|
||
| @Override | ||
| public final void place(Location loc, Object... chunks) { | ||
| if (chunks.length > 0) { | ||
| final AbsolutePlaceableStructure builder = this.build(loc); | ||
| for (Object chk: chunks){ | ||
| builder.place(chk); | ||
| } | ||
| } else { | ||
| this.build(loc).place(); | ||
| } | ||
| } | ||
|
noone-075 marked this conversation as resolved.
noone-075 marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "VERS", not "VERSION"