-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from CamperSamu/v4
Fabric: use Lucko's Fabric Permssion API
- Loading branch information
Showing
13 changed files
with
193 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -27,3 +27,5 @@ hs_err_pid* | |
/.gradle | ||
/gradle.properties | ||
/copier.bat | ||
run | ||
/examples/fabric-mod/run/ |
This file contains 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,45 @@ | ||
buildscript { | ||
repositories { | ||
maven("https://maven.fabricmc.net/") | ||
} | ||
} | ||
|
||
plugins { | ||
id("java") | ||
id("fabric-loom") version "1.8-SNAPSHOT" | ||
} | ||
|
||
repositories { | ||
maven("https://libraries.minecraft.net") | ||
maven("https://maven.fabricmc.net/") | ||
} | ||
|
||
val minecraft_version = "1.21" | ||
val yarn_mappings = "1.21+build.9" | ||
val loader_version = "0.16.7" | ||
val fabric_version = "0.102.0+1.21" | ||
val permissions_version = "0.3.1" | ||
|
||
dependencies { | ||
implementation(project(":common")) | ||
implementation(project(":brigadier")) | ||
modImplementation(project(":fabric")) | ||
mappings("net.fabricmc:yarn:${yarn_mappings}:v2") | ||
minecraft("com.mojang:minecraft:${minecraft_version}") | ||
modImplementation("net.fabricmc:fabric-loader:${loader_version}") | ||
include("me.lucko:fabric-permissions-api:${permissions_version}")?.let { modImplementation(it) } | ||
} | ||
|
||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(21)) | ||
|
||
tasks { | ||
processResources { | ||
filesMatching("fabric.mod.json") { | ||
expand(mapOf( | ||
"version" to project.version, | ||
"loader_version" to loader_version, | ||
"minecraft_version" to minecraft_version | ||
)) | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/fabric-mod/src/main/java/com/example/mod/FabricTestMod.java
This file contains 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,11 @@ | ||
package com.example.mod; | ||
|
||
import net.fabricmc.api.DedicatedServerModInitializer; | ||
import revxrsal.commands.fabric.FabricLamp; | ||
|
||
public class FabricTestMod implements DedicatedServerModInitializer { | ||
@Override public void onInitializeServer() { | ||
var lamp = FabricLamp.builder().build(); | ||
lamp.register(new GreetCommand()); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
examples/fabric-mod/src/main/java/com/example/mod/GreetCommand.java
This file contains 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,41 @@ | ||
/* | ||
* This file is part of lamp, licensed under the MIT License. | ||
* | ||
* Copyright (c) Revxrsal <[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package com.example.mod; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import revxrsal.commands.annotation.Command; | ||
import revxrsal.commands.annotation.Default; | ||
import revxrsal.commands.annotation.Description; | ||
import revxrsal.commands.fabric.actor.FabricCommandActor; | ||
import revxrsal.commands.fabric.annotation.CommandPermission; | ||
|
||
public class GreetCommand { | ||
|
||
@Command("greet") | ||
@Description("Sends a greet to the user") | ||
@CommandPermission("lampexample.command.greet") | ||
public void greet(@NotNull FabricCommandActor actor, @Default("world") String who) { | ||
actor.reply("Hello, " + who + "!"); | ||
} | ||
} |
This file contains 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,23 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "lampexample", | ||
"version": "${version}", | ||
"name": "Lamp Example Mod", | ||
"description": "", | ||
"authors": [ | ||
"Camper_Samu", | ||
"Revxrsal" | ||
], | ||
"contact": {}, | ||
"license": "MIT", | ||
"environment": "server", | ||
"entrypoints": { | ||
"server": [ | ||
"com.example.mod.FabricTestMod" | ||
] | ||
}, | ||
"depends": { | ||
"fabricloader": ">=${loader_version}", | ||
"minecraft": "${minecraft_version}" | ||
} | ||
} |
This file contains 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 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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,32 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "lamp", | ||
"version": "${version}", | ||
"name": "Lamp", | ||
"description": "A modern annotations-driven commands framework for Java and Kotlin", | ||
"authors": [ | ||
"Revxrsal", | ||
"Camper_Samu" | ||
], | ||
"contact": { | ||
"homepage": "https://foxhut.gitbook.io/lamp-docs", | ||
"sources": "https://github.com/Revxrsal/Lamp", | ||
"issues": "https://github.com/Revxrsal/Lamp/issues" | ||
}, | ||
"license": "GPLv3", | ||
"icon": "assets/lamp/icon.png", | ||
"environment": "*", | ||
"depends": { | ||
"fabricloader": ">=${loader_version}", | ||
"fabric": ">=${fabric_version}", | ||
"minecraft": ">=${minecraft_version}", | ||
"java": ">=${java_version}" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"links": { | ||
"modmenu.discord": "https://discord.gg/pEGGF785zp" | ||
} | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Jun 15 14:39:35 EET 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains 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