Skip to content

Conversation

@EinJOJO
Copy link
Contributor

@EinJOJO EinJOJO commented Dec 7, 2024

Open for discussion

What has changed

This update prevents users with axiom permissions (e.g. axiom.*) to modify worlds in which they normally do not have permission.

Therefore I refactored the listeners in order to reduce code duplication and have a central way of dealing with World-Manipulation.
I introduce the WorldManipulationEvent which can be fired with the EventDispatcher.
I tried to document those classes as precise as possible. It would be a duplicate to talk about them here. Please take a look at modified files.

⚠️ Nice to know when choosing settings.
An axiom manipulation is considered as an Interaction, because it's not possible to differentiate axiom-manipulation between placing/breaking.

What needs to change

Library management

Sadly there is no maven-repo for AxiomPaper as far as I have seen, thus I used a jar placed in libs/.

Question: Should the jar be put there or stay referenced in libs/libs.txt
The problem I have in mind is the CI-Server, which won't have the file during compile time when not included.

Easiest solution would be to include the jar file, but I don't know if it is wished.
Second solution would be to host the src on a repo (e.g https://repo.eintosti.de/#/).

I encourage everyone who feels like it to think of other test cases or think about some deeper integration of axiom


Test Results

Environment:
Purpur 1.21.3
Bukkit plugins (3):

  • AxiomPaper (4.0.2),
  • Modified BuildSystem (2.25.3-SNAPSHOT),
  • LuckPerms (5.4.149)
    Player A has * permissions
    Player B only has axiom.* permissions

When trying to test if axiom works, I make a selection of blocks and I try to move or delete them.
Further actions like free draw were not tested, because I expect that any axiom action triggers AxiomModifyWorldEvent

Test 1: Builder Test (3/3)✅

  1. A creates a public world, with Builders only setting.
    B can not use Axiom ✅

  2. B gets added to the world as builder
    B can use Axiom and the world status changes from Not started to In Progress

  3. A archives the world
    B can no longer modify the world. ✅

Test 2: partial setting test (3/3)✅

A turns Builder only off, Block Placement, Breaking and Interactions are on
B can normally interact with the world and axiom can be used.

In the following test, a single setting will be turned off, the other 2 are on

  1. Interactions off:
  • Can no longer manually break/place blocks ✅
  • Axiom can not be used ✅ (considered as an interaction. see above)
    (Attention when using Tinker (Change blockstate with rightclick)! Eventough the server cancels it, the client renders it differently)
    image
  1. Block Placement off:
  • B can not place blocks and can break ✅
  • Axiom can be used. ✅ (see above)
  1. Block Breaking off .
  • Breaking manually not possible but place ✅
  • Using axiom is possible ✅ (see above)

@EinJOJO EinJOJO mentioned this pull request Dec 7, 2024
@TWME-TW
Copy link

TWME-TW commented Dec 7, 2024

I'm not sure, but maybe you can get it from here

https://support.modrinth.com/en/articles/8801191-modrinth-maven

@thomasmny
Copy link
Owner

thomasmny commented Dec 7, 2024

Very cool, thank you very much <3
Will have a look as soon as I can find some spare time

Regarding the repo: You can try using this

fun RepositoryHandler.modrinthMavenWorkaround(nameOrId: String, version: String, fileName: String) {
    val url = "https://api.modrinth.com/maven/maven/modrinth/$nameOrId/$version/$fileName"
    val group = "maven.modrinth.workaround"
    ivy(url.substringBeforeLast('/')) {
        name = "Modrinth Maven Workaround for $nameOrId"
        patternLayout { artifact(url.substringAfterLast('/')) }
        metadataSources { artifact() }
        content { includeModule(group, nameOrId) }
    }
}

and then in repositiories:

modrinthMavenWorkaround(
    "axiom-paper-plugin",
    "4.0.1-1.21.1",
    "AxiomPaper-4.0.1-for-MC1.21.1.jar"
)

Unless of course the workaround is no longer needed

@EinJOJO
Copy link
Contributor Author

EinJOJO commented Dec 7, 2024

lgtm

Copy link
Owner

@thomasmny thomasmny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested, but LGTM after having a quick skim over

@thomasmny
Copy link
Owner

Could you please move the listener initialisation to registerExpansions()?

@EinJOJO
Copy link
Contributor Author

EinJOJO commented Dec 11, 2024

np

@thomasmny
Copy link
Owner

Thanks!

@thomasmny thomasmny merged commit c310a54 into thomasmny:master Dec 11, 2024
1 check passed
@EinJOJO EinJOJO deleted the feat/axiom-support-try-nb-2-after-i-nuked-my-harddrive branch December 11, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants