Compare commits

...

2 Commits

80 changed files with 63 additions and 232 deletions

View File

@ -9,10 +9,9 @@ that are detailed in their respective Readme file (if any).
- `pandalib-util` General purpose utility and helper classes;
- `pandalib-chat` A chat API working on top of the Adventure API;
- `pandalib-db` An ORM working with a MySQL server through JDBC;
- `pandalib-bungee` Utility and helper classes to use in Bungeecord plugins;
- `pandalib-paper` Utility and helper classes to use in Spigot/Paper plugins;
- `pandalib-bungee` Utility and helper classes to use in Bungeecord plugins. Also provides platform implementation for `pandalib-players` and `pandalib-commands`;
- `pandalib-paper` Utility and helper classes to use in Spigot/Paper plugins. Also provides platform implementation for `pandalib-players` and `pandalib-commands`;
- `pandalib-reflect` A reflection wrapper to make reflective operation easier;
- `pandalib-paper-reflect` A reflection API to ease access to NMS and OBS stuff in Paper server;
- `pandalib-permissions` A general purpose permission system;
- `pandalib-bungee-permissions` Integration of the permission system `pandalib-permissions` into Bungeecord;
- `pandalib-paper-permissions` Integration of the permission system `pandalib-permissions` into Bukkit, Vault and WEPIF permission systems;
@ -21,8 +20,6 @@ that are detailed in their respective Readme file (if any).
- `pandalib-netapi` A poorly designed, but working TCP network library;
- `pandalib-net` A better-designed, packet-based TCP network library (_still in development_);
- `pandalib-commands` An abstract command manager working on top of [Brigadier](https://github.com/Mojang/brigadier);
- `pandalib-bungee-commands` Integrates Brigadier commands into Bungeecord, extending `pandalib-commands`;
- `pandalib-paper-commands` Integrates Brigadier commands into the Paper server, extending `pandalib-commands`;
- `pandalib-cli` Utility and helper classes for a standalone CLI Java application.
- `pandalib-core` A catch-all module for some helper classes that didnt have their own module yet;

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pandalib-parent</artifactId>
<groupId>fr.pandacube.lib</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pandalib-bungee-commands</artifactId>
<packaging>jar</packaging>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-chat</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-commands</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>${bungeecord.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -31,6 +31,11 @@
<artifactId>pandalib-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-chat</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-players</artifactId>
@ -41,6 +46,11 @@
<artifactId>pandalib-reflect</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-commands</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>

View File

@ -28,18 +28,12 @@ public abstract class BungeeBrigadierCommand extends BrigadierCommand<CommandSen
/**
* The command dispatcher.
*/
protected BungeeBrigadierDispatcher dispatcher;
protected BungeeBrigadierDispatcher dispatcher = BungeeBrigadierDispatcher.getInstance();
/**
* Instanciate this command instance.
* @param d the dispatcher in which to register this command.
*/
public BungeeBrigadierCommand(BungeeBrigadierDispatcher d) {
if (d == null) {
throw new IllegalStateException("BungeeBrigadierDispatcher not provided.");
}
dispatcher = d;
public BungeeBrigadierCommand() {
LiteralCommandNode<CommandSender> commandNode;
String[] aliases;

View File

@ -1,5 +1,6 @@
package fr.pandacube.lib.bungee.commands;
import fr.pandacube.lib.bungee.PandaLibBungee;
import fr.pandacube.lib.chat.Chat;
import fr.pandacube.lib.commands.BrigadierDispatcher;
import net.kyori.adventure.text.ComponentLike;
@ -18,6 +19,13 @@ import net.md_5.bungee.event.EventHandler;
public class BungeeBrigadierDispatcher extends BrigadierDispatcher<CommandSender> implements Listener {
private static BungeeBrigadierDispatcher instance = null;
public static synchronized BungeeBrigadierDispatcher getInstance() {
return instance;
}
/* package */ final Plugin plugin;
@ -27,6 +35,9 @@ public class BungeeBrigadierDispatcher extends BrigadierDispatcher<CommandSender
* @param pl the plugin that creates this dispatcher.
*/
public BungeeBrigadierDispatcher(Plugin pl) {
if (instance != null)
throw new IllegalStateException("Cannot instanciante more than one BungeeBrigadierDispatcher");
instance = this;
plugin = pl;
ProxyServer.getInstance().getPluginManager().registerListener(plugin, this);
}

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pandalib-parent</artifactId>
<groupId>fr.pandacube.lib</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pandalib-paper-commands</artifactId>
<packaging>jar</packaging>
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-chat</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
</exclusion>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-plain</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-commands</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-paper-reflect</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-paper-permissions</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Paper -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper.version}-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-mojangapi</artifactId>
<version>${paper.version}-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pandalib-parent</artifactId>
<groupId>fr.pandacube.lib</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pandalib-paper-reflect</artifactId>
<packaging>jar</packaging>
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>fabricmc</id>
<url>https://maven.fabricmc.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-reflect</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-paper</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Paper -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper.version}-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-mojangapi</artifactId>
<version>${paper.version}-SNAPSHOT</version>
</dependency>
<!-- Needed to read obfuscation mapping file. Already included in Paper -->
<dependency>
<groupId>net.fabricmc</groupId>
<artifactId>mapping-io</artifactId>
<version>0.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>fr.pandacube.lib.paper.reflect.wrapper.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -41,6 +41,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-commands</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-reflect</artifactId>
@ -65,6 +71,13 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.pandacube.lib</groupId>
<artifactId>pandalib-paper-permissions</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Paper -->
<dependency>
<groupId>io.papermc.paper</groupId>
@ -76,6 +89,26 @@
<artifactId>paper-mojangapi</artifactId>
<version>${paper.version}-SNAPSHOT</version>
</dependency>
<!-- Needed to read obfuscation mapping file. Already included in Paper -->
<dependency>
<groupId>net.fabricmc</groupId>
<artifactId>mapping-io</artifactId>
<version>0.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>fr.pandacube.lib.paper.reflect.wrapper.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -6,6 +6,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.minecraft.resources.ResourceLocati
import fr.pandacube.lib.reflect.ReflectClass;
import fr.pandacube.lib.reflect.ReflectMethod;
import fr.pandacube.lib.util.ThrowableUtil;
import org.bukkit.NamespacedKey;
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
@ -14,7 +15,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
public class CraftNamespacedKey extends ReflectWrapper {
public static final ReflectClass<?> REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftNamespacedKey"));
public static final ReflectMethod<?> toMinecraft = wrapEx(() -> REFLECT.method("toMinecraft", NamespacedKey.class));
public static final ReflectMethod<?> fromMinecraft = wrapEx(() -> REFLECT.method("fromMinecraft", ResourceLocation.MAPPING.runtimeClass()));
public static final ReflectMethod<?> fromMinecraft = ThrowableUtil.wrapEx(() -> REFLECT.method("fromMinecraft", ResourceLocation.MAPPING.runtimeClass()));
public static ResourceLocation toMinecraft(NamespacedKey key) {
return wrap(wrapReflectEx(() -> toMinecraft.invokeStatic(key)), ResourceLocation.class);

View File

@ -7,6 +7,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3;
import fr.pandacube.lib.reflect.ReflectClass;
import fr.pandacube.lib.reflect.ReflectMethod;
import fr.pandacube.lib.util.ThrowableUtil;
import org.bukkit.util.Vector;
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
@ -14,8 +15,8 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
public class CraftVector extends ReflectWrapper {
public static final ReflectClass<?> REFLECT = wrapEx(() -> OBCReflect.ofClass("util.CraftVector"));
public static final ReflectMethod<?> toBukkit_Vec3 = wrapEx(() -> REFLECT.method("toBukkit", Vec3.MAPPING.runtimeClass()));
public static final ReflectMethod<?> toBukkit_BlockPos = wrapEx(() -> REFLECT.method("toBukkit", BlockPos.MAPPING.runtimeClass()));
public static final ReflectMethod<?> toBukkit_Vec3 = ThrowableUtil.wrapEx(() -> REFLECT.method("toBukkit", Vec3.MAPPING.runtimeClass()));
public static final ReflectMethod<?> toBukkit_BlockPos = ThrowableUtil.wrapEx(() -> REFLECT.method("toBukkit", BlockPos.MAPPING.runtimeClass()));
public static final ReflectMethod<?> toNMS = wrapEx(() -> REFLECT.method("toNMS", Vector.class));
public static final ReflectMethod<?> toBlockPos = wrapEx(() -> REFLECT.method("toNMS", Vector.class));

View File

@ -2,13 +2,8 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.server;
import fr.pandacube.lib.paper.reflect.NMSReflect;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.ChunkStorage;
import fr.pandacube.lib.paper.reflect.wrapper.paper.QueuedChangesMapLong2Object;
import fr.pandacube.lib.reflect.ReflectField;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.LongSet;
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;

View File

@ -62,7 +62,6 @@
<modules>
<module>pandalib-bungee</module>
<module>pandalib-bungee-commands</module>
<module>pandalib-bungee-permissions</module>
<module>pandalib-chat</module>
<module>pandalib-cli</module>
@ -72,9 +71,7 @@
<module>pandalib-net</module>
<module>pandalib-netapi</module>
<module>pandalib-paper</module>
<module>pandalib-paper-commands</module>
<module>pandalib-paper-permissions</module>
<module>pandalib-paper-reflect</module>
<module>pandalib-permissions</module>
<module>pandalib-players</module>
<module>pandalib-players-permissible</module>