This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
123 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: 404Setup <153366651+404Setup@users.noreply.github.com> | ||
Date: Sun, 8 Sep 2024 21:38:31 +0800 | ||
Subject: [PATCH] EventManager | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 4d9438c2c351058eba536fc05d84f1751226754c..8368aeaf37fe5b89e92fcde429a5ed778aab9af6 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -1145,6 +1145,7 @@ public final class CraftServer implements Server { | ||
this.enablePlugins(PluginLoadOrder.STARTUP); | ||
this.enablePlugins(PluginLoadOrder.POSTWORLD); | ||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins | ||
+ one.tranic.vine.event.EventManager.INSTANCE.register(); // Vine | ||
// Paper start - brigadier command API | ||
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // to clear invalid state for event fire below | ||
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD); // call commands event for regular plugins | ||
diff --git a/src/main/kotlin/one/tranic/vine/event/EventManager.kt b/src/main/kotlin/one/tranic/vine/event/EventManager.kt | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..30072eb1bf44aafd95ea7397916aa6dfe0c96d76 | ||
--- /dev/null | ||
+++ b/src/main/kotlin/one/tranic/vine/event/EventManager.kt | ||
@@ -0,0 +1,14 @@ | ||
+package one.tranic.vine.event | ||
+ | ||
+import one.tranic.vine.util.Reflect | ||
+import org.bukkit.Bukkit | ||
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin | ||
+import org.bukkit.event.Listener | ||
+ | ||
+object EventManager { | ||
+ fun register() { | ||
+ Reflect.findAllClass<Listener>("one.tranic.event.module").forEach { | ||
+ Bukkit.getPluginManager().registerEvents(it, MinecraftInternalPlugin()) | ||
+ } | ||
+ } | ||
+} | ||
\ No newline at end of file |
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,79 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: 404Setup <153366651+404Setup@users.noreply.github.com> | ||
Date: Sun, 8 Sep 2024 22:12:01 +0800 | ||
Subject: [PATCH] PermissionManager | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 8368aeaf37fe5b89e92fcde429a5ed778aab9af6..0aa23076acd87ae5d9b5c079831ce2619c1acb6f 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -611,6 +611,7 @@ public final class CraftServer implements Server { | ||
DefaultPermissions.registerCorePermissions(); | ||
CraftDefaultPermissions.registerCorePermissions(); | ||
ShreddedPaperPermissions.registerCorePermissions(); // ShreddedPaper | ||
+ one.tranic.vine.permission.PermissionManager.INSTANCE.registerCorePermissions(); // Vine | ||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper | ||
this.helpMap.initializeCommands(); | ||
this.syncCommands(); | ||
@@ -3278,6 +3279,8 @@ public final class CraftServer implements Server { | ||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) loadCustomPermissions(); | ||
DefaultPermissions.registerCorePermissions(); | ||
CraftDefaultPermissions.registerCorePermissions(); | ||
+ ShreddedPaperPermissions.registerCorePermissions(); // Vine - ShreddedPaper | ||
+ one.tranic.vine.permission.PermissionManager.INSTANCE.registerCorePermissions(); // Vine | ||
} | ||
|
||
@Override | ||
diff --git a/src/main/kotlin/one/tranic/vine/permission/PermissionManager.kt b/src/main/kotlin/one/tranic/vine/permission/PermissionManager.kt | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..c714ed520954fd4f16b3a57dfd43946ecabd8ea4 | ||
--- /dev/null | ||
+++ b/src/main/kotlin/one/tranic/vine/permission/PermissionManager.kt | ||
@@ -0,0 +1,45 @@ | ||
+package one.tranic.vine.permission | ||
+ | ||
+import org.bukkit.permissions.Permission | ||
+import org.bukkit.permissions.PermissionDefault | ||
+import org.bukkit.util.permissions.DefaultPermissions | ||
+ | ||
+object PermissionManager { | ||
+ const val ROOT: String = "vine." | ||
+ | ||
+ fun registerCorePermissions() { | ||
+ val parent = DefaultPermissions.registerPermission( | ||
+ ROOT, | ||
+ "Gives the user the ability to use all Vine utilities and commands" | ||
+ ) | ||
+ syncPermissions(parent) | ||
+ parent.recalculatePermissibles() | ||
+ } | ||
+ | ||
+ private fun syncPermissions(parent: Permission) { | ||
+ val commands = DefaultPermissions.registerPermission( | ||
+ "vine", | ||
+ "Gives the user the ability to use all Vine commands", | ||
+ parent | ||
+ ) | ||
+ | ||
+ setPermission( | ||
+ "commands.cfg", | ||
+ "Vine Config Command", | ||
+ PermissionDefault.OP, | ||
+ commands | ||
+ ) | ||
+ setPermission( | ||
+ "commands.threads", | ||
+ "Vine Threads Command", | ||
+ PermissionDefault.OP, | ||
+ commands | ||
+ ) | ||
+ | ||
+ commands.recalculatePermissibles() | ||
+ } | ||
+ | ||
+ private fun setPermission(permission: String, desc: String, def: PermissionDefault, parent: Permission) { | ||
+ DefaultPermissions.registerPermission(ROOT + permission, desc, def, parent) | ||
+ } | ||
+} | ||
\ No newline at end of file |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.