Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 35872c0

Browse files
authored
Merge pull request #1 from MinestomPlugins/master
lots of stuff
2 parents b6ec5b4 + 4afe1c9 commit 35872c0

File tree

13 files changed

+74
-80
lines changed

13 files changed

+74
-80
lines changed

.github/workflows/gradle.yml

-46
This file was deleted.

.gitpod.Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM gitpod/workspace-full
2+
3+
USER gitpod
4+
5+
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
6+
sdk install java 18.0.1.fx-zulu && \
7+
sdk default java 18.0.1.fx-zulu"

.gitpod.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
tasks:
6+
- init: gradle build
7+
8+
9+
image:
10+
file: .gitpod.Dockerfile

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"java.compile.nullAnalysis.mode": "automatic",
3+
"java.configuration.updateBuildConfiguration": "automatic"
4+
}

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# MinestomWorldEdit
22
WorldEdit Platform implementation for Minestom server software
33

4-
Get the artifact from the latest actions workflow
4+
## Known issues:
5+
The permission for //wand does not work, i have no idea why.

build.gradle

+3-24
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ dependencies {
6262
compileOnly 'com.github.Minestom:Minestom:-SNAPSHOT'
6363
//compileOnly("net.pixelravens:PixelLib:b114")
6464
implementation('com.google.guava:guava:31.1-jre')
65-
implementation("com.sk89q.worldedit:worldedit-core:7.2.12")
66-
implementation('org.spongepowered:configurate-yaml:4.1.2');
65+
compileOnly("com.sk89q.worldedit:worldedit-core:7.2.12")
66+
compileOnly('org.spongepowered:configurate-yaml:4.1.2');
6767
}
6868

6969
shadowJar {
@@ -77,25 +77,4 @@ java {
7777
toolchain {
7878
languageVersion = JavaLanguageVersion.of(18)
7979
}
80-
}
81-
82-
publishing {
83-
repositories {
84-
maven {
85-
name = "GitHubPackages"
86-
url = uri("https://maven.pkg.github.com/MinestomPlugins/World-Edit")
87-
credentials {
88-
username = "Window5000"
89-
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
90-
}
91-
}
92-
}
93-
publications {
94-
gpr(MavenPublication) {
95-
groupId 'me.window'
96-
artifactId 'worldedit'
97-
version '1.1'
98-
artifact jarArtifact
99-
}
100-
}
101-
}
80+
}

gradle/wrapper/gradle-wrapper.jar

818 Bytes
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

+8-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac

gradlew.bat

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
2828
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

src/main/java/io/github/openminigameserver/worldedit/platform/adapters/MinestomPermissionProvider.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
public class MinestomPermissionProvider {
66
public static boolean hasPermission(Player player, String permission) {
7-
if (player.hasPermission("*") || player.hasPermission("worldedit.*"))
7+
if (player.hasPermission("*") || player.hasPermission("worldedit.*") || player.getPermissionLevel() >= 4)
88
return true;
99
return player.hasPermission(permission);
1010
}
1111

12+
public static boolean hasWorldEditPermission(Player player) {
13+
return player.hasPermission("*") || player.hasPermission("worldedit") || player.getPermissionLevel() >= 4;
14+
}
15+
1216
}

src/main/java/io/github/openminigameserver/worldedit/platform/misc/WorldEditCommand.java

+20-2
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,37 @@
33
import com.sk89q.worldedit.WorldEdit;
44
import com.sk89q.worldedit.event.platform.CommandEvent;
55
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
6+
import com.sk89q.worldedit.extension.platform.Actor;
67
import com.sk89q.worldedit.internal.command.CommandUtil;
8+
import io.github.openminigameserver.worldedit.MinestomWorldEdit;
9+
import io.github.openminigameserver.worldedit.platform.MinestomPlatform;
10+
import io.github.openminigameserver.worldedit.platform.actors.MinestomPlayer;
711
import io.github.openminigameserver.worldedit.platform.adapters.MinestomAdapter;
12+
import net.kyori.adventure.text.Component;
13+
import net.minestom.server.MinecraftServer;
814
import net.minestom.server.command.CommandSender;
15+
import net.minestom.server.command.ConsoleSender;
916
import net.minestom.server.command.builder.Command;
1017
import net.minestom.server.command.builder.CommandContext;
1118
import net.minestom.server.command.builder.arguments.ArgumentStringArray;
1219
import net.minestom.server.command.builder.arguments.ArgumentType;
1320
import net.minestom.server.command.builder.suggestion.SuggestionEntry;
1421
import net.minestom.server.entity.Player;
22+
import org.enginehub.piston.inject.InjectedValueStore;
23+
import org.enginehub.piston.inject.Key;
24+
import org.enginehub.piston.inject.MapBackedValueStore;
1525
import org.jetbrains.annotations.NotNull;
26+
import io.github.openminigameserver.worldedit.platform.adapters.MinestomPermissionProvider;
1627

1728
import java.util.List;
29+
import java.util.Optional;
1830

1931
public class WorldEditCommand extends Command {
32+
33+
org.enginehub.piston.Command cmd;
2034
public WorldEditCommand(org.enginehub.piston.Command command) {
2135
super(command.getName(), toPrimitiveArray(command.getAliases()));
36+
cmd = command;
2237

2338
setCondition((this::condition));
2439

@@ -42,8 +57,11 @@ public WorldEditCommand(org.enginehub.piston.Command command) {
4257
}
4358

4459
private boolean condition(final CommandSender sender, final String command) {
45-
//TODO: Permission Check
46-
return true;
60+
if(sender instanceof ConsoleSender) return true;
61+
InjectedValueStore store = MapBackedValueStore.create();
62+
store.injectValue(Key.of(Actor.class), context ->
63+
Optional.of(new MinestomPlayer(MinestomAdapter.platform, (Player) sender)));
64+
return cmd.getCondition().satisfied(store);
4765
}
4866

4967
@Override

src/main/resources/extension.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44
"NickAc",
55
"Moulberry",
66
"Window5",
7+
"MinestomPlugins",
78
"HEROOSTECH",
89
"CityWideMC"
910
],
1011
"version": "1.0.0",
11-
"entrypoint": "io.github.openminigameserver.worldedit.MinestomWorldEdit"
12+
"entrypoint": "io.github.openminigameserver.worldedit.MinestomWorldEdit",
13+
"externalDependencies": {
14+
"repositories": [
15+
{"name": "sponge", "url": "https://repo.spongepowered.org/repository/maven-public/" },
16+
{"name": "enginehub", "url": "https://maven.enginehub.org/repo/" }
17+
],
18+
"artifacts": [
19+
"org.spongepowered:configurate-yaml:4.1.2",
20+
"com.sk89q.worldedit:worldedit-core:7.2.12"
21+
]
22+
}
1223
}

0 commit comments

Comments
 (0)