feat: Commands

This commit is contained in:
Alexander Medvedev 2026-01-30 18:28:07 +01:00
parent 0158a8e764
commit 0bf2697c25
25 changed files with 6011 additions and 260 deletions

5
build.sh Executable file
View File

@ -0,0 +1,5 @@
cd java
./gradlew build
cd ..
cd rust
cargo build

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

9
java/gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@ -205,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.

3
java/gradlew.bat vendored
View File

@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell

View File

@ -3,8 +3,12 @@ package org.patchbukkit;
import io.papermc.paper.plugin.PermissionManager;
import io.papermc.paper.plugin.configuration.PluginMeta;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Server;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
@ -18,43 +22,39 @@ import org.jspecify.annotations.NonNull;
@SuppressWarnings("removal")
public class PatchBukkitPluginManager implements PluginManager {
final PatchBukkitEventManager patchBukkitEventManager;
private final Server server;
private final PatchBukkitEventManager eventManager;
private final Map<String, Plugin> plugins = new ConcurrentHashMap<>();
private final Map<String, Permission> permissions = new HashMap<>();
public PatchBukkitPluginManager(Server server) {
this.patchBukkitEventManager = new PatchBukkitEventManager(server);
this.server = server;
this.eventManager = new PatchBukkitEventManager(server);
}
@Override
public void registerInterface(@NotNull Class<? extends PluginLoader> loader)
throws IllegalArgumentException {}
@Override
@Override
public @Nullable Plugin getPlugin(@NotNull String name) {
throw new UnsupportedOperationException(
"Unimplemented method 'getPlugin'"
);
return plugins.get(name);
}
@Override
@Override
public @NotNull Plugin[] getPlugins() {
throw new UnsupportedOperationException(
"Unimplemented method 'getPlugins'"
);
return plugins.values().toArray(new Plugin[0]);
}
@Override
public boolean isPluginEnabled(@NotNull String name) {
throw new UnsupportedOperationException(
"Unimplemented method 'isPluginEnabled'"
);
Plugin plugin = getPlugin(name);
return plugin != null && plugin.isEnabled();
}
@Override
public boolean isPluginEnabled(@Nullable Plugin plugin) {
throw new UnsupportedOperationException(
"Unimplemented method 'isPluginEnabled'"
);
return plugin != null && plugins.containsValue(plugin) && plugin.isEnabled();
}
@Override
@ -95,15 +95,12 @@ public class PatchBukkitPluginManager implements PluginManager {
@Override
public void callEvent(@NotNull Event event) throws IllegalStateException {
this.patchBukkitEventManager.callEvent(event);
this.eventManager.callEvent(event);
}
@Override
public void registerEvents(
@NotNull Listener listener,
@NotNull Plugin plugin
) {
this.patchBukkitEventManager.registerEvents(listener, plugin);
public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) {
this.eventManager.registerEvents(listener, plugin);
}
@Override
@ -114,7 +111,7 @@ public class PatchBukkitPluginManager implements PluginManager {
@NotNull EventExecutor executor,
@NotNull Plugin plugin
) {
this.patchBukkitEventManager.registerEvent(
this.eventManager.registerEvent(
event,
listener,
priority,
@ -132,7 +129,7 @@ public class PatchBukkitPluginManager implements PluginManager {
@NotNull Plugin plugin,
boolean ignoreCancelled
) {
this.patchBukkitEventManager.registerEvent(
this.eventManager.registerEvent(
event,
listener,
priority,
@ -144,30 +141,30 @@ public class PatchBukkitPluginManager implements PluginManager {
@Override
public void enablePlugin(@NotNull Plugin plugin) {
throw new UnsupportedOperationException(
"Unimplemented method 'enablePlugin'"
);
if (!plugin.isEnabled()) {
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
server.getLogger().severe("Error enabling " + plugin.getName() + ": " + ex.getMessage());
}
}
}
@Override
public void disablePlugin(@NotNull Plugin plugin) {
throw new UnsupportedOperationException(
"Unimplemented method 'disablePlugin'"
);
if (plugin.isEnabled()) {
plugin.getPluginLoader().disablePlugin(plugin);
}
}
@Override
public @Nullable Permission getPermission(@NotNull String name) {
throw new UnsupportedOperationException(
"Unimplemented method 'getPermission'"
);
return permissions.get(name);
}
@Override
public void addPermission(@NotNull Permission perm) {
throw new UnsupportedOperationException(
"Unimplemented method 'addPermission'"
);
permissions.put(perm.getName(), perm);
}
@Override

View File

@ -12,6 +12,7 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.net.InetAddress;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -47,6 +48,7 @@ import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.boss.KeyedBossBar;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
@ -83,6 +85,8 @@ import org.bukkit.structure.StructureManager;
import org.bukkit.util.CachedServerIcon;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.patchbukkit.command.PatchBukkitCommandMap;
import org.patchbukkit.command.PatchBukkitConsoleCommandSender;
@SuppressWarnings("removal")
public class PatchBukkitServer implements Server {
@ -90,9 +94,31 @@ public class PatchBukkitServer implements Server {
private final String serverName =
io.papermc.paper.ServerBuildInfo.buildInfo().brandName();
private final String bukkitVersion = Versioning.getBukkitVersion();
private final CommandMap commandMap = new PatchBukkitCommandMap();
private final Map<UUID, Player> onlinePlayers = new java.util.concurrent.ConcurrentHashMap<>();
private final Map<String, Player> onlinePlayersByName = new java.util.concurrent.ConcurrentHashMap<>();
private final Logger logger = Logger.getLogger("Minecraft");
/**
* Called from Rust when a player joins the Pumpkin server
*/
public void registerPlayer(Player player) {
this.onlinePlayers.put(player.getUniqueId(), player);
this.onlinePlayersByName.put(player.getName().toLowerCase(), player);
}
/**
* Called from Rust when a player leaves
*/
public void unregisterPlayer(UUID uuid) {
Player p = this.onlinePlayers.remove(uuid);
if (p != null) {
this.onlinePlayersByName.remove(p.getName().toLowerCase());
}
}
@Override
public void sendPluginMessage(
@NotNull Plugin source,
@ -157,10 +183,7 @@ public class PatchBukkitServer implements Server {
@Override
public @NotNull Collection<? extends Player> getOnlinePlayers() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getOnlinePlayers'"
);
return Collections.unmodifiableCollection(onlinePlayers.values());
}
@Override
@ -403,18 +426,12 @@ public class PatchBukkitServer implements Server {
@Override
public @Nullable Player getPlayer(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getPlayer'"
);
return onlinePlayersByName.get(name.toLowerCase());
}
@Override
public @Nullable Player getPlayerExact(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getPlayerExact'"
);
return onlinePlayersByName.get(name.toLowerCase());
}
@Override
@ -425,12 +442,9 @@ public class PatchBukkitServer implements Server {
);
}
@Override
@Override
public @Nullable Player getPlayer(@NotNull UUID id) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getPlayer'"
);
return onlinePlayers.get(id);
}
@Override
@ -634,10 +648,8 @@ public class PatchBukkitServer implements Server {
@Override
public @Nullable PluginCommand getPluginCommand(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getPluginCommand'"
);
Command cmd = this.commandMap.getCommand(name);
return (cmd instanceof PluginCommand) ? (PluginCommand) cmd : null;
}
@Override
@ -1002,10 +1014,7 @@ public class PatchBukkitServer implements Server {
@Override
public @NotNull ConsoleCommandSender getConsoleSender() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getConsoleSender'"
);
return new PatchBukkitConsoleCommandSender();
}
@Override
@ -1412,10 +1421,7 @@ public class PatchBukkitServer implements Server {
@Override
public @NotNull CommandMap getCommandMap() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"Unimplemented method 'getCommandMap'"
);
return commandMap;
}
@Override

View File

@ -0,0 +1,18 @@
package org.patchbukkit.command;
import java.lang.reflect.Constructor;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.Plugin;
public class CommandFactory {
public static PluginCommand create(String name, Plugin plugin) {
try {
Constructor<PluginCommand> constructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
constructor.setAccessible(true);
return constructor.newInstance(name, plugin);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,128 @@
package org.patchbukkit.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PatchBukkitCommandMap implements CommandMap {
// We use Command as the value to support both PluginCommand and vanilla commands
private final Map<String, Command> knownCommands = new HashMap<>();
@Override
public void registerAll(@NotNull String fallbackPrefix, @NotNull List<Command> commands) {
for (Command command : commands) {
register(fallbackPrefix, command);
}
}
@Override
public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) {
label = label.toLowerCase().trim();
fallbackPrefix = fallbackPrefix.toLowerCase().trim();
// 1. Register under the direct label if not taken
boolean registeredDirectly = false;
if (!knownCommands.containsKey(label)) {
knownCommands.put(label, command);
registeredDirectly = true;
}
// 2. Always register under the fallback prefix (pluginname:label)
knownCommands.put(fallbackPrefix + ":" + label, command);
// 3. Register aliases
for (String alias : command.getAliases()) {
alias = alias.toLowerCase().trim();
if (!knownCommands.containsKey(alias)) {
knownCommands.put(alias, command);
}
knownCommands.put(fallbackPrefix + ":" + alias, command);
}
return registeredDirectly;
}
@Override
public boolean register(@NotNull String fallbackPrefix, @NotNull Command command) {
return register(command.getName(), fallbackPrefix, command);
}
@Override
public boolean dispatch(@NotNull CommandSender sender, @NotNull String cmdLine) throws CommandException {
// Remove leading slash if present and split arguments
String[] split = (cmdLine.startsWith("/") ? cmdLine.substring(1) : cmdLine).split(" ");
if (split.length == 0) return false;
String sentLabel = split[0].toLowerCase();
Command command = knownCommands.get(sentLabel);
if (command == null) {
return false; // Command not found
}
try {
// Extract arguments (everything after the label)
String[] args = Arrays.copyOfRange(split, 1, split.length);
// This triggers the PluginCommand.execute() method you implemented earlier
return command.execute(sender, sentLabel, args);
} catch (Exception ex) {
throw new CommandException("Unhandled exception executing '" + cmdLine + "'", ex);
}
}
@Override
public void clearCommands() {
knownCommands.clear();
}
@Override
public @Nullable Command getCommand(@NotNull String name) {
return knownCommands.get(name.toLowerCase());
}
@Override
public @NotNull Map<String, Command> getKnownCommands() {
return Collections.unmodifiableMap(knownCommands);
}
@Override
public @Nullable List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine) {
return tabComplete(sender, cmdLine, null);
}
@Override
public @Nullable List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) {
String[] split = cmdLine.split(" ", -1);
if (split.length == 0) return new ArrayList<>();
String label = split[0].toLowerCase();
Command command = knownCommands.get(label);
// If typing the first word, return matching command names
if (split.length == 1) {
List<String> completions = new ArrayList<>();
for (String key : knownCommands.keySet()) {
if (key.startsWith(label)) completions.add(key);
}
return completions;
}
// Otherwise, delegate to the specific command's tab completer
if (command != null) {
String[] args = Arrays.copyOfRange(split, 1, split.length);
return command.tabComplete(sender, label, args, location);
}
return null;
}
}

View File

@ -0,0 +1,145 @@
package org.patchbukkit.command;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import net.kyori.adventure.text.Component;
public class PatchBukkitCommandSender implements CommandSender {
@Override
public boolean isPermissionSet(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean isPermissionSet(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean hasPermission(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public boolean hasPermission(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value,
int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public void removeAttachment(@NotNull PermissionAttachment attachment) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removeAttachment'");
}
@Override
public void recalculatePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'recalculatePermissions'");
}
@Override
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEffectivePermissions'");
}
@Override
public boolean isOp() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isOp'");
}
@Override
public void setOp(boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setOp'");
}
@Override
public void sendMessage(@NotNull String message) {
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@NotNull String... messages) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String... messages) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public @NotNull Server getServer() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getServer'");
}
@Override
public @NotNull String getName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getName'");
}
@Override
public @NotNull Spigot spigot() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'spigot'");
}
@Override
public @NotNull Component name() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'name'");
}
}

View File

@ -0,0 +1,187 @@
package org.patchbukkit.command;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.checkerframework.checker.units.qual.m;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import net.kyori.adventure.text.Component;
public class PatchBukkitConsoleCommandSender implements ConsoleCommandSender {
@Override
public void sendMessage(@NotNull String message) {
System.out.println(message);
}
@Override
public void sendMessage(@NotNull String... messages) {
System.out.println(messages);
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String... messages) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public @NotNull Server getServer() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getServer'");
}
@Override
public @NotNull String getName() {
return "CONSOLE";
}
@Override
public @NotNull Spigot spigot() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'spigot'");
}
@Override
public @NotNull Component name() {
return Component.text("CONSOLE");
}
@Override
public boolean isPermissionSet(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean isPermissionSet(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean hasPermission(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public boolean hasPermission(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value,
int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public void removeAttachment(@NotNull PermissionAttachment attachment) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removeAttachment'");
}
@Override
public void recalculatePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'recalculatePermissions'");
}
@Override
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEffectivePermissions'");
}
@Override
public boolean isOp() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isOp'");
}
@Override
public void setOp(boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setOp'");
}
@Override
public boolean isConversing() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isConversing'");
}
@Override
public void acceptConversationInput(@NotNull String input) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'acceptConversationInput'");
}
@Override
public boolean beginConversation(@NotNull Conversation conversation) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'beginConversation'");
}
@Override
public void abandonConversation(@NotNull Conversation conversation) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'abandonConversation'");
}
@Override
public void abandonConversation(@NotNull Conversation conversation, @NotNull ConversationAbandonedEvent details) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'abandonConversation'");
}
@Override
public void sendRawMessage(@NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendRawMessage'");
}
@Override
public void sendRawMessage(@Nullable UUID sender, @NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendRawMessage'");
}
}

View File

@ -1,21 +1,966 @@
package org.patchbukkit.entity;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntitySnapshot;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Pose;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.patchbukkit.PatchBukkitServer;
import io.papermc.paper.datacomponent.DataComponentType;
import io.papermc.paper.datacomponent.DataComponentType.Valued;
import io.papermc.paper.entity.LookAnchor;
import io.papermc.paper.entity.TeleportFlag;
import io.papermc.paper.threadedregions.scheduler.EntityScheduler;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.util.TriState;
public class PatchBukkitEntity implements Entity {
protected final PatchBukkitServer server;
protected Entity entity;
private final EntityType entityType;
protected final UUID uuid;
private final String name;
public PatchBukkitEntity(
final PatchBukkitServer server,
final Entity entity
UUID uuid,
String name
) {
this.server = server;
this.entity = entity;
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
this.uuid = uuid;
this.name = name;
}
@Override
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setMetadata'");
}
@Override
public @NotNull List<MetadataValue> getMetadata(@NotNull String metadataKey) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMetadata'");
}
@Override
public boolean hasMetadata(@NotNull String metadataKey) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasMetadata'");
}
@Override
public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removeMetadata'");
}
@Override
public void sendMessage(@NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@NotNull String... messages) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String message) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public void sendMessage(@Nullable UUID sender, @NotNull String... messages) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'sendMessage'");
}
@Override
public @NotNull String getName() {
return this.name;
}
@Override
public @NotNull Component name() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'name'");
}
@Override
public boolean isPermissionSet(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean isPermissionSet(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPermissionSet'");
}
@Override
public boolean hasPermission(@NotNull String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public boolean hasPermission(@NotNull Permission perm) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPermission'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value,
int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addAttachment'");
}
@Override
public void removeAttachment(@NotNull PermissionAttachment attachment) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removeAttachment'");
}
@Override
public void recalculatePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'recalculatePermissions'");
}
@Override
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEffectivePermissions'");
}
@Override
public boolean isOp() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isOp'");
}
@Override
public void setOp(boolean value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setOp'");
}
@Override
public @Nullable Component customName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'customName'");
}
@Override
public void customName(@Nullable Component customName) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'customName'");
}
@Override
public @Nullable String getCustomName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getCustomName'");
}
@Override
public void setCustomName(@Nullable String name) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setCustomName'");
}
@Override
public @NotNull PersistentDataContainer getPersistentDataContainer() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPersistentDataContainer'");
}
@Override
public <T> @org.jspecify.annotations.Nullable T getData(Valued<T> type) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getData'");
}
@Override
public <T> @org.jspecify.annotations.Nullable T getDataOrDefault(Valued<? extends T> type,
@org.jspecify.annotations.Nullable T fallback) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getDataOrDefault'");
}
@Override
public boolean hasData(DataComponentType type) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasData'");
}
@Override
public @NotNull Location getLocation() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLocation'");
}
@Override
public @Nullable Location getLocation(@Nullable Location loc) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLocation'");
}
@Override
public void setVelocity(@NotNull Vector velocity) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setVelocity'");
}
@Override
public @NotNull Vector getVelocity() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getVelocity'");
}
@Override
public double getHeight() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getHeight'");
}
@Override
public double getWidth() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getWidth'");
}
@Override
public @NotNull BoundingBox getBoundingBox() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getBoundingBox'");
}
@Override
public boolean isOnGround() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isOnGround'");
}
@Override
public boolean isInWater() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInWater'");
}
@Override
public @NotNull World getWorld() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getWorld'");
}
@Override
public void setRotation(float yaw, float pitch) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setRotation'");
}
@Override
public boolean teleport(@NotNull Location location, @NotNull TeleportCause cause,
@NotNull TeleportFlag @NotNull... teleportFlags) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleport'");
}
@Override
public void lookAt(double x, double y, double z, @NotNull LookAnchor entityAnchor) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'lookAt'");
}
@Override
public boolean teleport(@NotNull Location location) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleport'");
}
@Override
public boolean teleport(@NotNull Location location, @NotNull TeleportCause cause) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleport'");
}
@Override
public boolean teleport(@NotNull Entity destination) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleport'");
}
@Override
public boolean teleport(@NotNull Entity destination, @NotNull TeleportCause cause) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleport'");
}
@Override
public @NotNull CompletableFuture<Boolean> teleportAsync(@NotNull Location loc, @NotNull TeleportCause cause,
@NotNull TeleportFlag @NotNull... teleportFlags) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teleportAsync'");
}
@Override
public @NotNull List<Entity> getNearbyEntities(double x, double y, double z) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getNearbyEntities'");
}
@Override
public int getEntityId() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEntityId'");
}
@Override
public int getFireTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFireTicks'");
}
@Override
public int getMaxFireTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMaxFireTicks'");
}
@Override
public void setFireTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setFireTicks'");
}
@Override
public void setVisualFire(boolean fire) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setVisualFire'");
}
@Override
public void setVisualFire(@NotNull TriState fire) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setVisualFire'");
}
@Override
public boolean isVisualFire() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isVisualFire'");
}
@Override
public @NotNull TriState getVisualFire() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getVisualFire'");
}
@Override
public int getFreezeTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFreezeTicks'");
}
@Override
public int getMaxFreezeTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMaxFreezeTicks'");
}
@Override
public void setFreezeTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setFreezeTicks'");
}
@Override
public boolean isFrozen() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isFrozen'");
}
@Override
public void setInvisible(boolean invisible) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setInvisible'");
}
@Override
public boolean isInvisible() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInvisible'");
}
@Override
public void setNoPhysics(boolean noPhysics) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setNoPhysics'");
}
@Override
public boolean hasNoPhysics() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasNoPhysics'");
}
@Override
public boolean isFreezeTickingLocked() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isFreezeTickingLocked'");
}
@Override
public void lockFreezeTicks(boolean locked) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'lockFreezeTicks'");
}
@Override
public void remove() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'remove'");
}
@Override
public boolean isDead() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isDead'");
}
@Override
public boolean isValid() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isValid'");
}
@Override
public @NotNull Server getServer() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getServer'");
}
@Override
public boolean isPersistent() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isPersistent'");
}
@Override
public void setPersistent(boolean persistent) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setPersistent'");
}
@Override
public @Nullable Entity getPassenger() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPassenger'");
}
@Override
public boolean setPassenger(@NotNull Entity passenger) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setPassenger'");
}
@Override
public @NotNull List<Entity> getPassengers() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPassengers'");
}
@Override
public boolean addPassenger(@NotNull Entity passenger) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addPassenger'");
}
@Override
public boolean removePassenger(@NotNull Entity passenger) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removePassenger'");
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isEmpty'");
}
@Override
public boolean eject() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'eject'");
}
@Override
public @NotNull ItemStack getPickItemStack() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPickItemStack'");
}
@Override
public float getFallDistance() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFallDistance'");
}
@Override
public void setFallDistance(float distance) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setFallDistance'");
}
@Override
public void setLastDamageCause(@Nullable EntityDamageEvent event) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setLastDamageCause'");
}
@Override
public @Nullable EntityDamageEvent getLastDamageCause() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLastDamageCause'");
}
@Override
public @NotNull UUID getUniqueId() {
return this.uuid;
}
@Override
public int getTicksLived() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTicksLived'");
}
@Override
public void setTicksLived(int value) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setTicksLived'");
}
@Override
public void playEffect(@NotNull EntityEffect effect) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'playEffect'");
}
@Override
public @NotNull EntityType getType() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getType'");
}
@Override
public @NotNull Sound getSwimSound() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getSwimSound'");
}
@Override
public @NotNull Sound getSwimSplashSound() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getSwimSplashSound'");
}
@Override
public @NotNull Sound getSwimHighSpeedSplashSound() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getSwimHighSpeedSplashSound'");
}
@Override
public boolean isInsideVehicle() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInsideVehicle'");
}
@Override
public boolean leaveVehicle() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'leaveVehicle'");
}
@Override
public @Nullable Entity getVehicle() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getVehicle'");
}
@Override
public void setCustomNameVisible(boolean flag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setCustomNameVisible'");
}
@Override
public boolean isCustomNameVisible() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isCustomNameVisible'");
}
@Override
public void setVisibleByDefault(boolean visible) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setVisibleByDefault'");
}
@Override
public boolean isVisibleByDefault() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isVisibleByDefault'");
}
@Override
public @NotNull Set<Player> getTrackedBy() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTrackedBy'");
}
@Override
public boolean isTrackedBy(@NotNull Player player) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isTrackedBy'");
}
@Override
public void setGlowing(boolean flag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setGlowing'");
}
@Override
public boolean isGlowing() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isGlowing'");
}
@Override
public void setInvulnerable(boolean flag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setInvulnerable'");
}
@Override
public boolean isInvulnerable() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInvulnerable'");
}
@Override
public boolean isSilent() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isSilent'");
}
@Override
public void setSilent(boolean flag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setSilent'");
}
@Override
public boolean hasGravity() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasGravity'");
}
@Override
public void setGravity(boolean gravity) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setGravity'");
}
@Override
public int getPortalCooldown() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPortalCooldown'");
}
@Override
public void setPortalCooldown(int cooldown) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setPortalCooldown'");
}
@Override
public @NotNull Set<String> getScoreboardTags() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getScoreboardTags'");
}
@Override
public boolean addScoreboardTag(@NotNull String tag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addScoreboardTag'");
}
@Override
public boolean removeScoreboardTag(@NotNull String tag) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removeScoreboardTag'");
}
@Override
public @NotNull PistonMoveReaction getPistonMoveReaction() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPistonMoveReaction'");
}
@Override
public @NotNull BlockFace getFacing() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFacing'");
}
@Override
public @NotNull Pose getPose() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPose'");
}
@Override
public boolean isSneaking() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isSneaking'");
}
@Override
public void setSneaking(boolean sneak) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setSneaking'");
}
@Override
public void setPose(@NotNull Pose pose, boolean fixed) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setPose'");
}
@Override
public boolean hasFixedPose() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasFixedPose'");
}
@Override
public @NotNull SpawnCategory getSpawnCategory() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getSpawnCategory'");
}
@Override
public boolean isInWorld() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInWorld'");
}
@Override
public @Nullable String getAsString() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getAsString'");
}
@Override
public @Nullable EntitySnapshot createSnapshot() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'createSnapshot'");
}
@Override
public @NotNull Entity copy() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'copy'");
}
@Override
public @NotNull Entity copy(@NotNull Location to) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'copy'");
}
@Override
public @NotNull Spigot spigot() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'spigot'");
}
@Override
public @NotNull Component teamDisplayName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'teamDisplayName'");
}
@Override
public @Nullable Location getOrigin() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getOrigin'");
}
@Override
public boolean fromMobSpawner() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'fromMobSpawner'");
}
@Override
public @NotNull SpawnReason getEntitySpawnReason() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEntitySpawnReason'");
}
@Override
public boolean isUnderWater() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isUnderWater'");
}
@Override
public boolean isInRain() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInRain'");
}
@Override
public boolean isInLava() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInLava'");
}
@Override
public boolean isTicking() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isTicking'");
}
@Override
public @NotNull Set<Player> getTrackedPlayers() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTrackedPlayers'");
}
@Override
public boolean spawnAt(@NotNull Location location, @NotNull SpawnReason reason) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'spawnAt'");
}
@Override
public boolean isInPowderedSnow() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isInPowderedSnow'");
}
@Override
public double getX() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getX'");
}
@Override
public double getY() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getY'");
}
@Override
public double getZ() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getZ'");
}
@Override
public float getPitch() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPitch'");
}
@Override
public float getYaw() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getYaw'");
}
@Override
public boolean collidesAt(@NotNull Location location) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'collidesAt'");
}
@Override
public boolean wouldCollideUsing(@NotNull BoundingBox boundingBox) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'wouldCollideUsing'");
}
@Override
public @NotNull EntityScheduler getScheduler() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getScheduler'");
}
@Override
public @NotNull String getScoreboardEntryName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getScoreboardEntryName'");
}
@Override
public void broadcastHurtAnimation(@NotNull Collection<Player> players) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'broadcastHurtAnimation'");
}
}

View File

@ -1,7 +1,841 @@
package org.patchbukkit.entity;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import org.bukkit.Color;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.damage.DamageSource;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityCategory;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.memory.MemoryKey;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.checkerframework.checker.index.qual.NonNegative;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
import org.patchbukkit.PatchBukkitServer;
import com.destroystokyo.paper.block.TargetBlockInfo;
import com.destroystokyo.paper.block.TargetBlockInfo.FluidMode;
import com.destroystokyo.paper.entity.TargetEntityInfo;
import io.papermc.paper.world.damagesource.CombatTracker;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.util.TriState;
public class PatchBukkitLivingEntity
extends PatchBukkitEntity
implements LivingEntity {}
implements LivingEntity {
public PatchBukkitLivingEntity(UUID uuid,
String name) {
super(uuid, name);
}
@Override
public @Nullable AttributeInstance getAttribute(@NotNull Attribute attribute) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getAttribute'");
}
@Override
public void registerAttribute(@NotNull Attribute attribute) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'registerAttribute'");
}
@Override
public void damage(double amount) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'damage'");
}
@Override
public void damage(double amount, @Nullable Entity source) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'damage'");
}
@Override
public void damage(double amount, @NotNull DamageSource damageSource) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'damage'");
}
@Override
public double getHealth() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getHealth'");
}
@Override
public void setHealth(double health) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setHealth'");
}
@Override
public void heal(double amount, @NotNull RegainReason reason) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'heal'");
}
@Override
public double getAbsorptionAmount() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getAbsorptionAmount'");
}
@Override
public void setAbsorptionAmount(double amount) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setAbsorptionAmount'");
}
@Override
public double getMaxHealth() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMaxHealth'");
}
@Override
public void setMaxHealth(double health) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setMaxHealth'");
}
@Override
public void resetMaxHealth() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'resetMaxHealth'");
}
@Override
public <T extends Projectile> @NotNull T launchProjectile(@NotNull Class<? extends T> projectile,
@Nullable Vector velocity, @Nullable Consumer<? super T> function) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'launchProjectile'");
}
@Override
public TriState getFrictionState() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFrictionState'");
}
@Override
public void setFrictionState(TriState state) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setFrictionState'");
}
@Override
public double getEyeHeight() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEyeHeight'");
}
@Override
public double getEyeHeight(boolean ignorePose) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEyeHeight'");
}
@Override
public @NotNull Location getEyeLocation() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEyeLocation'");
}
@Override
public @NotNull List<Block> getLineOfSight(@Nullable Set<Material> transparent, int maxDistance) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLineOfSight'");
}
@Override
public @NotNull Block getTargetBlock(@Nullable Set<Material> transparent, int maxDistance) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlock'");
}
@Override
public @Nullable Block getTargetBlock(int maxDistance, @NotNull FluidMode fluidMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlock'");
}
@Override
public @Nullable BlockFace getTargetBlockFace(int maxDistance, @NotNull FluidMode fluidMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlockFace'");
}
@Override
public @Nullable BlockFace getTargetBlockFace(int maxDistance, @NotNull FluidCollisionMode fluidMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlockFace'");
}
@Override
public @Nullable TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull FluidMode fluidMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlockInfo'");
}
@Override
public @Nullable Entity getTargetEntity(int maxDistance, boolean ignoreBlocks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetEntity'");
}
@Override
public @Nullable TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetEntityInfo'");
}
@Override
public @Nullable RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'rayTraceEntities'");
}
@Override
public @NotNull List<Block> getLastTwoTargetBlocks(@Nullable Set<Material> transparent, int maxDistance) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLastTwoTargetBlocks'");
}
@Override
public @Nullable Block getTargetBlockExact(int maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getTargetBlockExact'");
}
@Override
public @Nullable RayTraceResult rayTraceBlocks(double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'rayTraceBlocks'");
}
@Override
public int getRemainingAir() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getRemainingAir'");
}
@Override
public void setRemainingAir(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setRemainingAir'");
}
@Override
public int getMaximumAir() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMaximumAir'");
}
@Override
public void setMaximumAir(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setMaximumAir'");
}
@Override
public @Nullable ItemStack getItemInUse() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getItemInUse'");
}
@Override
public int getItemInUseTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getItemInUseTicks'");
}
@Override
public void setItemInUseTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setItemInUseTicks'");
}
@Override
public @NonNegative int getArrowCooldown() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getArrowCooldown'");
}
@Override
public void setArrowCooldown(@NonNegative int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setArrowCooldown'");
}
@Override
public @NonNegative int getArrowsInBody() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getArrowsInBody'");
}
@Override
public void setArrowsInBody(@NonNegative int count, boolean fireEvent) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setArrowsInBody'");
}
@Override
public @NonNegative int getBeeStingerCooldown() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getBeeStingerCooldown'");
}
@Override
public void setBeeStingerCooldown(@NonNegative int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setBeeStingerCooldown'");
}
@Override
public @NonNegative int getBeeStingersInBody() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getBeeStingersInBody'");
}
@Override
public void setBeeStingersInBody(@NonNegative int count) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setBeeStingersInBody'");
}
@Override
public int getMaximumNoDamageTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMaximumNoDamageTicks'");
}
@Override
public void setMaximumNoDamageTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setMaximumNoDamageTicks'");
}
@Override
public double getLastDamage() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLastDamage'");
}
@Override
public void setLastDamage(double damage) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setLastDamage'");
}
@Override
public int getNoDamageTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getNoDamageTicks'");
}
@Override
public void setNoDamageTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setNoDamageTicks'");
}
@Override
public int getNoActionTicks() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getNoActionTicks'");
}
@Override
public void setNoActionTicks(int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setNoActionTicks'");
}
@Override
public @Nullable Player getKiller() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getKiller'");
}
@Override
public void setKiller(@Nullable Player killer) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setKiller'");
}
@Override
public boolean addPotionEffect(@NotNull PotionEffect effect, boolean force) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addPotionEffect'");
}
@Override
public boolean addPotionEffects(@NotNull Collection<PotionEffect> effects) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'addPotionEffects'");
}
@Override
public boolean hasPotionEffect(@NotNull PotionEffectType type) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasPotionEffect'");
}
@Override
public @Nullable PotionEffect getPotionEffect(@NotNull PotionEffectType type) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getPotionEffect'");
}
@Override
public void removePotionEffect(@NotNull PotionEffectType type) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'removePotionEffect'");
}
@Override
public @NotNull Collection<PotionEffect> getActivePotionEffects() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getActivePotionEffects'");
}
@Override
public boolean clearActivePotionEffects() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'clearActivePotionEffects'");
}
@Override
public boolean hasLineOfSight(@NotNull Entity other) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasLineOfSight'");
}
@Override
public boolean hasLineOfSight(@NotNull Location location) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasLineOfSight'");
}
@Override
public boolean getRemoveWhenFarAway() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getRemoveWhenFarAway'");
}
@Override
public void setRemoveWhenFarAway(boolean remove) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setRemoveWhenFarAway'");
}
@Override
public @Nullable EntityEquipment getEquipment() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEquipment'");
}
@Override
public void setCanPickupItems(boolean pickup) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setCanPickupItems'");
}
@Override
public boolean getCanPickupItems() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getCanPickupItems'");
}
@Override
public boolean isLeashed() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isLeashed'");
}
@Override
public @NotNull Entity getLeashHolder() throws IllegalStateException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getLeashHolder'");
}
@Override
public boolean setLeashHolder(@Nullable Entity holder) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setLeashHolder'");
}
@Override
public boolean isGliding() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isGliding'");
}
@Override
public void setGliding(boolean gliding) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setGliding'");
}
@Override
public boolean isSwimming() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isSwimming'");
}
@Override
public void setSwimming(boolean swimming) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setSwimming'");
}
@Override
public boolean isRiptiding() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isRiptiding'");
}
@Override
public void setRiptiding(boolean riptiding) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setRiptiding'");
}
@Override
public boolean isSleeping() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isSleeping'");
}
@Override
public boolean isClimbing() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isClimbing'");
}
@Override
public void setAI(boolean ai) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setAI'");
}
@Override
public boolean hasAI() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasAI'");
}
@Override
public void attack(@NotNull Entity target) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'attack'");
}
@Override
public void swingMainHand() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'swingMainHand'");
}
@Override
public void swingOffHand() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'swingOffHand'");
}
@Override
public void playHurtAnimation(float yaw) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'playHurtAnimation'");
}
@Override
public void setCollidable(boolean collidable) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setCollidable'");
}
@Override
public boolean isCollidable() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isCollidable'");
}
@Override
public @NotNull Set<UUID> getCollidableExemptions() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getCollidableExemptions'");
}
@Override
public <T> @Nullable T getMemory(@NotNull MemoryKey<T> memoryKey) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getMemory'");
}
@Override
public <T> void setMemory(@NotNull MemoryKey<T> memoryKey, @Nullable T memoryValue) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setMemory'");
}
@Override
public @Nullable Sound getHurtSound() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getHurtSound'");
}
@Override
public @Nullable Sound getDeathSound() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getDeathSound'");
}
@Override
public @NotNull Sound getFallDamageSound(int fallHeight) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFallDamageSound'");
}
@Override
public @NotNull Sound getFallDamageSoundSmall() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFallDamageSoundSmall'");
}
@Override
public @NotNull Sound getFallDamageSoundBig() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFallDamageSoundBig'");
}
@Override
public @NotNull Sound getDrinkingSound(@NotNull ItemStack itemStack) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getDrinkingSound'");
}
@Override
public @NotNull Sound getEatingSound(@NotNull ItemStack itemStack) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getEatingSound'");
}
@Override
public boolean canBreatheUnderwater() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'canBreatheUnderwater'");
}
@Override
public @NotNull EntityCategory getCategory() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getCategory'");
}
@Override
public float getSidewaysMovement() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getSidewaysMovement'");
}
@Override
public float getUpwardsMovement() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getUpwardsMovement'");
}
@Override
public float getForwardsMovement() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getForwardsMovement'");
}
@Override
public void startUsingItem(@NotNull EquipmentSlot hand) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'startUsingItem'");
}
@Override
public void completeUsingActiveItem() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'completeUsingActiveItem'");
}
@Override
public @NotNull ItemStack getActiveItem() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getActiveItem'");
}
@Override
public void clearActiveItem() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'clearActiveItem'");
}
@Override
public int getActiveItemRemainingTime() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getActiveItemRemainingTime'");
}
@Override
public void setActiveItemRemainingTime(@Range(from = 0, to = 2147483647) int ticks) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setActiveItemRemainingTime'");
}
@Override
public boolean hasActiveItem() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'hasActiveItem'");
}
@Override
public int getActiveItemUsedTime() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getActiveItemUsedTime'");
}
@Override
public @NotNull EquipmentSlot getActiveItemHand() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getActiveItemHand'");
}
@Override
public boolean isJumping() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'isJumping'");
}
@Override
public void setJumping(boolean jumping) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setJumping'");
}
@Override
public void playPickupItemAnimation(@NotNull Item item, int quantity) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'playPickupItemAnimation'");
}
@Override
public float getHurtDirection() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getHurtDirection'");
}
@Override
public void setHurtDirection(float hurtDirection) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setHurtDirection'");
}
@Override
public void knockback(double strength, double directionX, double directionZ) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'knockback'");
}
@Override
public void broadcastSlotBreak(@NotNull EquipmentSlot slot) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'broadcastSlotBreak'");
}
@Override
public void broadcastSlotBreak(@NotNull EquipmentSlot slot, @NotNull Collection<Player> players) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'broadcastSlotBreak'");
}
@Override
public @NotNull ItemStack damageItemStack(@NotNull ItemStack stack, int amount) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'damageItemStack'");
}
@Override
public void damageItemStack(@NotNull EquipmentSlot slot, int amount) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'damageItemStack'");
}
@Override
public float getBodyYaw() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getBodyYaw'");
}
@Override
public void setBodyYaw(float bodyYaw) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setBodyYaw'");
}
@Override
public boolean canUseEquipmentSlot(@NotNull EquipmentSlot slot) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'canUseEquipmentSlot'");
}
@Override
public @NotNull CombatTracker getCombatTracker() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getCombatTracker'");
}
@Override
public void setWaypointStyle(@Nullable Key key) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setWaypointStyle'");
}
@Override
public void setWaypointColor(@Nullable Color color) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setWaypointColor'");
}
@Override
public @NotNull Key getWaypointStyle() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getWaypointStyle'");
}
@Override
public @Nullable Color getWaypointColor() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getWaypointColor'");
}}

445
rust/Cargo.lock generated
View File

@ -49,9 +49,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "annotate-snippets"
version = "0.12.10"
version = "0.12.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15580ece6ea97cbf832d60ba19c021113469480852c6a2a6beb0db28f097bf1f"
checksum = "16e4850548ff4a25a77ce3bda7241874e17fb702ea551f0cc62a2dbe052f1272"
dependencies = [
"anstyle",
"unicode-width",
@ -122,6 +122,15 @@ version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "arc-swap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d03449bb8ca2cc2ef70869af31463d1ae5ccc8fa3e334b307203fbf815207e"
dependencies = [
"rustversion",
]
[[package]]
name = "arraydeque"
version = "0.5.1"
@ -140,17 +149,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "async-trait"
version = "0.1.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "autocfg"
version = "1.5.0"
@ -228,9 +226,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.53"
version = "1.2.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932"
checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
dependencies = [
"find-msvc-tools",
"jobserver",
@ -267,13 +265,13 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chacha20"
version = "0.10.0-rc.6"
version = "0.10.0-rc.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f895fb33c1ad22da4bc79d37c0bddff8aee2ba4575705345eb73b8ffbc386074"
checksum = "c81d916c6ae06736ec667b51f95ee5ff660a75f4ea6ce1bd932c942365c0ea43"
dependencies = [
"cfg-if",
"cpufeatures",
"rand_core 0.10.0-rc-3",
"rand_core 0.10.0-rc-6",
]
[[package]]
@ -297,9 +295,9 @@ dependencies = [
[[package]]
name = "cmov"
version = "0.5.0-pre.0"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5417da527aa9bf6a1e10a781231effd1edd3ee82f27d5f8529ac9b279babce96"
checksum = "de0758edba32d61d1fd9f4d69491b47604b91ee2f7e6b33de7e54ca4ebe55dc3"
[[package]]
name = "colorchoice"
@ -480,15 +478,14 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "crossfire"
version = "2.1.10"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd901251b9b46c1752c85edfee0aee718c03a85a065f4126d32e5d6d419edf48"
checksum = "cf9c756fd351d7bc1f95698a33a90ce39c8f7458335cc7e95132d3d36124902a"
dependencies = [
"crossbeam-queue",
"crossbeam-utils",
"enum_dispatch",
"futures-core",
"parking_lot",
"smallvec 1.15.1",
]
[[package]]
@ -505,13 +502,13 @@ dependencies = [
[[package]]
name = "crypto-bigint"
version = "0.7.0-rc.18"
version = "0.7.0-rc.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37387ceb32048ff590f2cbd24d8b05fffe63c3f69a5cfa089d4f722ca4385a19"
checksum = "053c3561863ce55e3226ecc48b08679f4b66cb1b92b9afb42c2c402dfe8b9b51"
dependencies = [
"ctutils",
"num-traits",
"rand_core 0.10.0-rc-3",
"rand_core 0.10.0-rc-6",
"serdect",
"zeroize",
]
@ -528,29 +525,29 @@ dependencies = [
[[package]]
name = "crypto-common"
version = "0.2.0-rc.9"
version = "0.2.0-rc.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41b8986f836d4aeb30ccf4c9d3bd562fd716074cfd7fc4a2948359fbd21ed809"
checksum = "c7722afd27468475c9b6063dc03a57ef2ca833816981619f8ebe64d38d207eef"
dependencies = [
"hybrid-array",
]
[[package]]
name = "crypto-primes"
version = "0.7.0-pre.6"
version = "0.7.0-pre.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e79c98a281f9441200b24e3151407a629bfbe720399186e50516da939195e482"
checksum = "334a79c97c0b7fa536716dc132fd417d0afbf471440a41fc25a5d9f66d8771cd"
dependencies = [
"crypto-bigint 0.7.0-rc.18",
"crypto-bigint 0.7.0-rc.22",
"libm",
"rand_core 0.10.0-rc-3",
"rand_core 0.10.0-rc-6",
]
[[package]]
name = "ctutils"
version = "0.3.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "758e5ed90be3c8abff7f9a6f37ab7f6d8c59c2210d448b81f3f508134aec84e4"
checksum = "1005a6d4446f5120ef475ad3d2af2b30c49c2c9c6904258e3bb30219bebed5e4"
dependencies = [
"cmov",
]
@ -620,13 +617,13 @@ dependencies = [
[[package]]
name = "digest"
version = "0.11.0-rc.5"
version = "0.11.0-rc.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebf9423bafb058e4142194330c52273c343f8a5beb7176d052f0e73b17dd35b9"
checksum = "bff8de092798697546237a3a701e4174fe021579faec9b854379af9bf1e31962"
dependencies = [
"block-buffer 0.11.0",
"const-oid 0.10.2",
"crypto-common 0.2.0-rc.9",
"crypto-common 0.2.0-rc.13",
"subtle",
]
@ -828,9 +825,9 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]]
name = "flate2"
@ -843,6 +840,12 @@ dependencies = [
"zlib-rs",
]
[[package]]
name = "foldhash"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "foldhash"
version = "0.2.0"
@ -991,15 +994,16 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.4.0-rc.0"
version = "0.4.0-rc.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b99f0d993a2b9b97b9a201193aa8ad21305cde06a3be9a7e1f8f4201e5cc27e"
checksum = "74f70a332ddf75e5e5e43284304179ba02f391f82f692f030b08a8378adf3c99"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"rand_core 0.10.0-rc-3",
"rand_core 0.10.0-rc-6",
"wasip2",
"wasip3",
]
[[package]]
@ -1025,6 +1029,15 @@ version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]]
name = "hashbrown"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"foldhash 0.1.5",
]
[[package]]
name = "hashbrown"
version = "0.16.1"
@ -1033,7 +1046,7 @@ checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
"foldhash 0.2.0",
]
[[package]]
@ -1068,11 +1081,11 @@ dependencies = [
[[package]]
name = "hmac"
version = "0.13.0-rc.3"
version = "0.13.0-rc.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1c597ac7d6cc8143e30e83ef70915e7f883b18d8bec2e2b2bce47f5bbb06d57"
checksum = "d9956e202a691c5c86c60303a421f66f93f44b29433407b7c43cf2bebadc750e"
dependencies = [
"digest 0.11.0-rc.5",
"digest 0.11.0-rc.9",
]
[[package]]
@ -1102,9 +1115,9 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "hybrid-array"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f471e0a81b2f90ffc0cb2f951ae04da57de8baa46fa99112b062a5173a5088d0"
checksum = "b41fb3dc24fe72c2e3a4685eed55917c2fb228851257f4a8f2d985da9443c3e5"
dependencies = [
"typenum",
]
@ -1190,6 +1203,12 @@ dependencies = [
"zerovec",
]
[[package]]
name = "id-arena"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]]
name = "idna"
version = "1.1.0"
@ -1266,7 +1285,7 @@ dependencies = [
"java-locator",
"jni-sys",
"libc",
"libloading",
"libloading 0.8.9",
"log",
"serde",
"serde_json",
@ -1355,6 +1374,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "leb128fmt"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "libbz2-rs-sys"
version = "0.2.2"
@ -1378,10 +1403,20 @@ dependencies = [
]
[[package]]
name = "libm"
version = "0.2.15"
name = "libloading"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
dependencies = [
"cfg-if",
"windows-link",
]
[[package]]
name = "libm"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "libredox"
@ -1543,9 +1578,9 @@ dependencies = [
[[package]]
name = "num-conv"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
[[package]]
name = "num-derive"
@ -1653,8 +1688,8 @@ name = "patchbukkit"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"env_logger",
"futures",
"glob",
"j4rs",
"j4rs_derive",
@ -1824,9 +1859,9 @@ dependencies = [
[[package]]
name = "pkcs8"
version = "0.11.0-rc.8"
version = "0.11.0-rc.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77089aec8290d0b7bb01b671b091095cf1937670725af4fd73d47249f03b12c0"
checksum = "b226d2cc389763951db8869584fd800cbbe2962bf454e2edeb5172b31ee99774"
dependencies = [
"der 0.8.0-rc.10",
"spki 0.8.0-rc.4",
@ -1870,9 +1905,19 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppmd-rust"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d558c559f0450f16f2a27a1f017ef38468c1090c9ce63c8e51366232d53717b4"
checksum = "efca4c95a19a79d1c98f791f10aebd5c1363b473244630bb7dbde1dc98455a24"
[[package]]
name = "prettyplease"
version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
"syn",
]
[[package]]
name = "primeorder"
@ -1907,9 +1952,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.105"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
@ -1917,18 +1962,20 @@ dependencies = [
[[package]]
name = "pumpkin"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"arc-swap",
"base64",
"bytes",
"crossbeam",
"dashmap",
"flate2",
"futures",
"hmac 0.13.0-rc.3",
"libloading",
"hmac 0.13.0-rc.4",
"libloading 0.9.0",
"log",
"num-bigint",
"pkcs8 0.11.0-rc.8",
"pkcs8 0.11.0-rc.10",
"pumpkin-config",
"pumpkin-data",
"pumpkin-inventory",
@ -1943,8 +1990,8 @@ dependencies = [
"rustyline",
"serde",
"serde_json",
"sha1 0.11.0-rc.3",
"sha2 0.11.0-rc.3",
"sha1 0.11.0-rc.4",
"sha2 0.11.0-rc.4",
"signature 2.2.0",
"simplelog",
"thiserror",
@ -1958,7 +2005,7 @@ dependencies = [
[[package]]
name = "pumpkin-api-macros"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"proc-macro-error2",
"proc-macro2",
@ -1969,7 +2016,7 @@ dependencies = [
[[package]]
name = "pumpkin-config"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"log",
"pumpkin-util",
@ -1981,7 +2028,7 @@ dependencies = [
[[package]]
name = "pumpkin-data"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"crc-fast",
"heck",
@ -2001,7 +2048,7 @@ dependencies = [
[[package]]
name = "pumpkin-inventory"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"crossbeam-utils",
"log",
@ -2016,10 +2063,11 @@ dependencies = [
[[package]]
name = "pumpkin-macros"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"proc-macro-error2",
"proc-macro2",
"pumpkin-data",
"quote",
"syn",
]
@ -2027,7 +2075,7 @@ dependencies = [
[[package]]
name = "pumpkin-nbt"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"bytes",
"cesu8",
@ -2039,7 +2087,7 @@ dependencies = [
[[package]]
name = "pumpkin-protocol"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"aes",
"async-compression",
@ -2061,7 +2109,7 @@ dependencies = [
[[package]]
name = "pumpkin-util"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"base64",
"bytes",
@ -2086,7 +2134,7 @@ dependencies = [
[[package]]
name = "pumpkin-world"
version = "0.1.0-dev+1.21.11"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#bcdde4526fc8a96380d5aed72b6c002778cce697"
source = "git+https://github.com/Pumpkin-MC/Pumpkin.git?branch=master#d64f538138b4c2595215849daaf881fc666410e3"
dependencies = [
"bitflags",
"bytes",
@ -2112,7 +2160,7 @@ dependencies = [
"ruzstd",
"serde",
"serde_json",
"sha2 0.11.0-rc.3",
"sha2 0.11.0-rc.4",
"slotmap",
"thiserror",
"thread_local",
@ -2123,9 +2171,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.43"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
dependencies = [
"proc-macro2",
]
@ -2148,12 +2196,12 @@ dependencies = [
[[package]]
name = "rand"
version = "0.10.0-rc.6"
source = "git+https://github.com/rust-random/rand#f356bbae5817f382b19ac5741b549c4d2cd49b50"
version = "0.10.0-rc.8"
source = "git+https://github.com/rust-random/rand#a4c9a8e565fa310de423e3ba89593b647b721e8c"
dependencies = [
"chacha20",
"getrandom 0.4.0-rc.0",
"rand_core 0.10.0-rc-3",
"getrandom 0.4.0-rc.1",
"rand_core 0.10.0-rc-6",
]
[[package]]
@ -2167,9 +2215,9 @@ dependencies = [
[[package]]
name = "rand_core"
version = "0.10.0-rc-3"
version = "0.10.0-rc-6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f66ee92bc15280519ef199a274fe0cafff4245d31bc39aaa31c011ad56cb1f05"
checksum = "70765ff7112b0fb2d272d24d9a2f907fc206211304328fe58b2db15a5649ef28"
[[package]]
name = "rayon"
@ -2266,19 +2314,19 @@ dependencies = [
[[package]]
name = "rsa"
version = "0.10.0-rc.12"
version = "0.10.0-rc.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9a2b1eacbc34fbaf77f6f1db1385518446008d49b9f9f59dc9d1340fce4ca9e"
checksum = "6ef381dd6f207f81aff2ee3a8264eddd68ba475bbfcdb44ca445e5906bce381b"
dependencies = [
"const-oid 0.10.2",
"crypto-bigint 0.7.0-rc.18",
"crypto-bigint 0.7.0-rc.22",
"crypto-primes",
"digest 0.11.0-rc.5",
"digest 0.11.0-rc.9",
"pkcs1",
"pkcs8 0.11.0-rc.8",
"rand_core 0.10.0-rc-3",
"sha1 0.11.0-rc.3",
"signature 3.0.0-rc.6",
"pkcs8 0.11.0-rc.10",
"rand_core 0.10.0-rc-6",
"sha1 0.11.0-rc.4",
"signature 3.0.0-rc.9",
"spki 0.8.0-rc.4",
"zeroize",
]
@ -2449,6 +2497,12 @@ dependencies = [
"zeroize",
]
[[package]]
name = "semver"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
[[package]]
name = "serde"
version = "1.0.228"
@ -2556,13 +2610,13 @@ dependencies = [
[[package]]
name = "sha1"
version = "0.11.0-rc.3"
version = "0.11.0-rc.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa1ae819b9870cadc959a052363de870944a1646932d274a4e270f64bf79e5ef"
checksum = "9c777f0a122a53fddb0beb6e706771197000b8eb5c9f42b5b850f450ef48c788"
dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.11.0-rc.5",
"digest 0.11.0-rc.9",
]
[[package]]
@ -2578,13 +2632,13 @@ dependencies = [
[[package]]
name = "sha2"
version = "0.11.0-rc.3"
version = "0.11.0-rc.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d43dc0354d88b791216bb5c1bfbb60c0814460cc653ae0ebd71f286d0bd927"
checksum = "7535f94fa3339fe9e5e9be6260a909e62af97f6e14b32345ccf79b92b8b81233"
dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.11.0-rc.5",
"digest 0.11.0-rc.9",
]
[[package]]
@ -2624,12 +2678,12 @@ dependencies = [
[[package]]
name = "signature"
version = "3.0.0-rc.6"
version = "3.0.0-rc.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a96996ccff7dfa16f052bd995b4cecc72af22c35138738dc029f0ead6608d"
checksum = "0ad0ce3b3f8efd7406f22e2ca5d02be21cdf3b3d1d53ab141f784de8965c7c7e"
dependencies = [
"digest 0.11.0-rc.5",
"rand_core 0.10.0-rc-3",
"digest 0.11.0-rc.9",
"rand_core 0.10.0-rc-6",
]
[[package]]
@ -2652,9 +2706,9 @@ dependencies = [
[[package]]
name = "siphasher"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
[[package]]
name = "slab"
@ -2685,9 +2739,9 @@ checksum = "ef784004ca8777809dcdad6ac37629f0a97caee4c685fcea805278d81dd8b857"
[[package]]
name = "socket2"
version = "0.6.1"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"
dependencies = [
"libc",
"windows-sys 0.60.2",
@ -2776,18 +2830,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.17"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "2.0.17"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
@ -2805,9 +2859,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.45"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd"
checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5"
dependencies = [
"deranged",
"itoa",
@ -2823,15 +2877,15 @@ dependencies = [
[[package]]
name = "time-core"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca"
checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
[[package]]
name = "time-macros"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd"
checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4"
dependencies = [
"num-conv",
"time-core",
@ -2979,6 +3033,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "untrusted"
version = "0.9.0"
@ -3049,9 +3109,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.19.0"
version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f"
dependencies = [
"getrandom 0.3.4",
"js-sys",
@ -3088,7 +3148,16 @@ version = "1.0.2+wasi-0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
dependencies = [
"wit-bindgen",
"wit-bindgen 0.51.0",
]
[[package]]
name = "wasip3"
version = "0.3.1+wasi-0.3.0-rc-2025-09-16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba4be47b1d11244670d11857eee0758a8f2c39aea64d80b78c1ce29b4642cd"
dependencies = [
"wit-bindgen 0.48.1",
]
[[package]]
@ -3136,6 +3205,40 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-encoder"
version = "0.241.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01164c9dda68301e34fdae536c23ed6fe90ce6d97213ccc171eebbd3d02d6b8"
dependencies = [
"leb128fmt",
"wasmparser",
]
[[package]]
name = "wasm-metadata"
version = "0.241.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876fe286f2fa416386deedebe8407e6f19e0b5aeaef3d03161e77a15fa80f167"
dependencies = [
"anyhow",
"indexmap",
"wasm-encoder",
"wasmparser",
]
[[package]]
name = "wasmparser"
version = "0.241.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46d90019b1afd4b808c263e428de644f3003691f243387d30d673211ee0cb8e8"
dependencies = [
"bitflags",
"hashbrown 0.15.5",
"indexmap",
"semver",
]
[[package]]
name = "webpki-roots"
version = "1.0.5"
@ -3353,12 +3456,100 @@ version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
[[package]]
name = "wit-bindgen"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f8c2adb5f74ac9395bc3121c99a1254bf9310482c27b13f97167aedb5887138"
dependencies = [
"wit-bindgen-rust-macro",
]
[[package]]
name = "wit-bindgen"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
[[package]]
name = "wit-bindgen-core"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b881a098cae03686d7a0587f8f306f8a58102ad8da8b5599100fbe0e7f5800b"
dependencies = [
"anyhow",
"heck",
"wit-parser",
]
[[package]]
name = "wit-bindgen-rust"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69667efa439a453e1d50dac939c6cab6d2c3ac724a9d232b6631dad2472a5b70"
dependencies = [
"anyhow",
"heck",
"indexmap",
"prettyplease",
"syn",
"wasm-metadata",
"wit-bindgen-core",
"wit-component",
]
[[package]]
name = "wit-bindgen-rust-macro"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae2e22cceb5d105d52326c07e3e67603a861cc7add70fc467f7cc7ec5265017"
dependencies = [
"anyhow",
"prettyplease",
"proc-macro2",
"quote",
"syn",
"wit-bindgen-core",
"wit-bindgen-rust",
]
[[package]]
name = "wit-component"
version = "0.241.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0c57df25e7ee612d946d3b7646c1ddb2310f8280aa2c17e543b66e0812241"
dependencies = [
"anyhow",
"bitflags",
"indexmap",
"log",
"serde",
"serde_derive",
"serde_json",
"wasm-encoder",
"wasm-metadata",
"wasmparser",
"wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.241.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ef1c6ad67f35c831abd4039c02894de97034100899614d1c44e2268ad01c91"
dependencies = [
"anyhow",
"id-arena",
"indexmap",
"log",
"semver",
"serde",
"serde_derive",
"serde_json",
"unicode-xid",
"wasmparser",
]
[[package]]
name = "writeable"
version = "0.6.2"
@ -3390,18 +3581,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.33"
version = "0.8.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd"
checksum = "dafd85c832c1b68bbb4ec0c72c7f6f4fc5179627d2bc7c26b30e4c0cc11e76cc"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.33"
version = "0.8.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
checksum = "7cb7e4e8436d9db52fbd6625dbf2f45243ab84994a72882ec8227b99e72b439a"
dependencies = [
"proc-macro2",
"quote",
@ -3518,9 +3709,9 @@ checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3"
[[package]]
name = "zmij"
version = "1.0.14"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd8f3f50b848df28f887acb68e41201b5aea6bc8a8dacc00fb40635ff9a72fea"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
[[package]]
name = "zopfli"

View File

@ -11,7 +11,7 @@ pumpkin = { git = "https://github.com/Pumpkin-MC/Pumpkin.git", branch = "master"
pumpkin-util = { git = "https://github.com/Pumpkin-MC/Pumpkin.git", branch = "master", package = "pumpkin-util" }
pumpkin-api-macros = { git = "https://github.com/Pumpkin-MC/Pumpkin.git", branch = "master", package = "pumpkin-api-macros" }
async-trait = "0.1"
futures = "0.3"
tokio = "1"
log = "0.4"
glob = "0.3.3"

View File

@ -76,7 +76,7 @@ impl StringOrList {
}
/// The main plugin.yml configuration structure
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, Clone)]
pub struct SpigotPluginYml {
// Required fields
/// The name of your plugin

View File

@ -17,25 +17,27 @@ pub struct PatchBukkitJoinHandler {
impl EventHandler<PlayerJoinEvent> for PatchBukkitJoinHandler {
fn handle_blocking<'a>(
&self,
_server: &Arc<Server>,
server: &Arc<Server>,
event: &'a mut PlayerJoinEvent,
) -> BoxFuture<'a, ()> {
let event: &mut PlayerJoinEvent = event;
let command_tx = self.command_tx.clone();
Box::pin(async move {
let event: &mut PlayerJoinEvent = event;
let (tx, rx) = oneshot::channel();
let sent_event = event.clone();
self.command_tx
.blocking_send(JvmCommand::TriggerEvent {
event: Event::PlayerJoinEvent(sent_event),
respond_to: tx,
})
.unwrap();
let (tx, rx) = oneshot::channel();
let sent_event = event.clone();
command_tx
.send(JvmCommand::TriggerEvent {
event: Event::PlayerJoinEvent(sent_event),
respond_to: tx,
})
.await
.unwrap();
match rx.await.unwrap().unwrap() {
Event::PlayerJoinEvent(player_join_event) => *event = player_join_event,
_ => unreachable!(),
};
Box::pin(async {})
// match rx.await.unwrap().unwrap() {
// Event::PlayerJoinEvent(player_join_event) => *event = player_join_event,
// _ => unreachable!(),
// };
})
}
}

View File

@ -0,0 +1,54 @@
use std::sync::{Arc, Mutex};
use j4rs::{Instance, InvocationArg, Jvm};
use pumpkin::command::CommandExecutor;
use tokio::sync::{mpsc, oneshot};
use crate::java::jvm::commands::JvmCommand;
pub struct JavaCommandExecutor {
pub cmd_name: String,
pub command_tx: mpsc::Sender<JvmCommand>,
pub command: Arc<Mutex<Instance>>,
}
#[derive(Clone)]
pub enum SimpleCommandSender {
Console,
// UUID
Player(String),
}
impl CommandExecutor for JavaCommandExecutor {
fn execute<'a>(
&'a self,
sender: &'a pumpkin::command::CommandSender,
server: &'a pumpkin::server::Server,
args: &'a pumpkin::command::args::ConsumedArgs<'a>,
) -> pumpkin::command::CommandResult<'a> {
Box::pin(async move {
let (tx, rx) = oneshot::channel();
let sender = match sender {
pumpkin::command::CommandSender::Rcon(mutex) => todo!(),
pumpkin::command::CommandSender::Console => SimpleCommandSender::Console,
pumpkin::command::CommandSender::Player(player) => SimpleCommandSender::Player(player.gameprofile.id.to_string()),
pumpkin::command::CommandSender::CommandBlock(block_entity, world) => todo!(),
};
self.command_tx
.send(JvmCommand::TriggerCommand {
cmd_name: self.cmd_name.clone(),
respond_to: tx,
command_sender: sender.clone(),
command: self.command.clone(),
})
.await
.unwrap();
// match rx.await.unwrap().unwrap() {
// Event::PlayerJoinEvent(player_join_event) => *event = player_join_event,
// _ => unreachable!(),
// };
Ok(())
})
}
}

View File

@ -1,10 +1,14 @@
use std::path::PathBuf;
use std::{
path::PathBuf,
sync::{Arc, Mutex},
};
use anyhow::Result;
use j4rs::Instance;
use tokio::sync::oneshot;
use pumpkin::{command::CommandSender, plugin::Context, server::Server};
use tokio::sync::{mpsc, oneshot};
use crate::events::Event;
use crate::{events::Event, java::jvm::command_executor::SimpleCommandSender};
pub enum LoadPluginResult {
SuccessfullyLoadedSpigot,
@ -30,6 +34,8 @@ pub enum JvmCommand {
},
InstantiateAllPlugins {
respond_to: oneshot::Sender<Result<()>>,
server: Arc<Context>,
command_tx: mpsc::Sender<JvmCommand>,
},
EnableAllPlugins {
respond_to: oneshot::Sender<Result<()>>,
@ -44,4 +50,10 @@ pub enum JvmCommand {
event: Event,
respond_to: oneshot::Sender<Result<Event>>,
},
TriggerCommand {
cmd_name: String,
command_sender: SimpleCommandSender,
respond_to: oneshot::Sender<Result<Event>>,
command: Arc<Mutex<Instance>>,
},
}

View File

@ -1,2 +1,3 @@
pub mod command_executor;
pub mod commands;
pub mod worker;

View File

@ -1,7 +1,8 @@
use std::path::PathBuf;
use std::{path::PathBuf, sync::Arc};
use anyhow::bail;
use j4rs::{Instance, InvocationArg, Jvm, JvmBuilder};
use pumpkin::{net::bedrock::play, server::Server};
use tokio::sync::{mpsc, oneshot};
use crate::{
@ -92,13 +93,20 @@ impl JvmWorker {
}
};
}
JvmCommand::InstantiateAllPlugins { respond_to } => {
JvmCommand::InstantiateAllPlugins {
respond_to,
server,
command_tx,
} => {
let jvm = match self.jvm {
Some(ref jvm) => jvm,
None => &Jvm::attach_thread().unwrap(),
};
let _ = respond_to.send(self.plugin_manager.instantiate_all_plugins(jvm));
let _ = respond_to.send(
self.plugin_manager
.instantiate_all_plugins(jvm, &server, command_tx),
);
}
JvmCommand::EnableAllPlugins { respond_to } => {
let jvm = match self.jvm {
@ -128,11 +136,87 @@ impl JvmWorker {
match event {
Event::PlayerJoinEvent(player_join_event) => {
// let player = jvm.create_instance("org.bukkit.entity.Player", &[]);
let server_instance = jvm
.invoke_static(
"org.bukkit.Bukkit",
"getServer",
InvocationArg::empty(),
)
.map_err(|e| format!("Failed to get server: {}", e))
.unwrap();
// let cloned_server_instance =
// jvm.clone_instance(&server_instance).unwrap();
// let j_entity = jvm
// .create_instance(
// "org.patchbukkit.entity.PatchBukkitEntity",
// &[
// InvocationArg::from(cloned_server_instance),
// // InvocationArg::from(InvocationArg::empty()), // Placeholder for the actual NMS entity
// ],
// )
// .unwrap();
// let cloned_server_instance =
// jvm.clone_instance(&server_instance).unwrap();
let player = player_join_event.player;
let j_uuid = jvm
.invoke_static(
"java.util.UUID",
"fromString",
&[InvocationArg::try_from(player.gameprofile.id.to_string())
.unwrap()],
)
.map_err(|e| format!("Failed to create Java UUID: {}", e))
.unwrap();
let j_player = jvm
.create_instance(
"org.patchbukkit.entity.PatchBukkitPlayer",
&[
InvocationArg::from(j_uuid),
InvocationArg::try_from(player.gameprofile.name.clone())
.unwrap(),
],
)
.map_err(|e| format!("Failed to create player instance: {}", e))
.unwrap();
let patch_server = jvm
.cast(&server_instance, "org.patchbukkit.PatchBukkitServer")
.unwrap();
jvm.invoke(
&patch_server,
"registerPlayer",
&[InvocationArg::from(j_player)],
)
.unwrap();
// self.event_manager.call_event(&jvm, event)
}
}
}
JvmCommand::TriggerCommand {
cmd_name,
command_sender,
respond_to,
command,
} => {
let jvm = match self.jvm {
Some(ref jvm) => jvm,
None => &Jvm::attach_thread().unwrap(),
};
self.plugin_manager
.trigger_command(
jvm,
&cmd_name,
command,
command_sender,
vec![cmd_name.clone()],
)
.unwrap();
}
}
}

View File

@ -1,6 +1,6 @@
use std::sync::Arc;
use pumpkin::plugin::Context;
use pumpkin::{plugin::Context, server::Server};
use pumpkin_api_macros::{plugin_impl, plugin_method};
pub mod config;
@ -120,7 +120,11 @@ async fn on_load_inner(plugin: &mut PatchBukkitPlugin, server: Arc<Context>) ->
let (tx, rx) = oneshot::channel();
plugin
.command_tx
.send(JvmCommand::InstantiateAllPlugins { respond_to: tx })
.send(JvmCommand::InstantiateAllPlugins {
respond_to: tx,
server: server.clone(),
command_tx: plugin.command_tx.clone(),
})
.await
.map_err(|e| format!("Failed to send command to instantiate plugins: {}", e))?;
rx.await

View File

@ -1,12 +1,25 @@
use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::{Arc, Mutex},
};
use anyhow::Result;
use j4rs::{Instance, InvocationArg, Jvm};
use pumpkin::{command::tree::CommandTree, plugin::Context, server::Server};
use pumpkin_util::permission::{Permission, PermissionDefault};
use tokio::{runtime::Handle, sync::mpsc};
use crate::config::{paper::PaperPluginYml, spigot::SpigotPluginYml};
use crate::{
config::{
paper::PaperPluginYml,
spigot::{Command, SpigotPluginYml},
},
java::jvm::{
command_executor::{JavaCommandExecutor, SimpleCommandSender},
commands::JvmCommand,
},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PluginState {
@ -55,6 +68,9 @@ pub struct Plugin {
/// Data folder for this plugin
pub data_folder: PathBuf,
pub instance: Option<Instance>,
// The registered commands
pub commands: HashMap<String, Command>,
pub listeners: HashMap<String, Instance>,
}
@ -97,6 +113,7 @@ impl PluginManager {
data_folder: jar_path.as_ref().parent().unwrap().join("data"),
path: jar_path.as_ref().to_path_buf(),
instance: None,
commands: HashMap::new(),
listeners: HashMap::new(),
};
@ -116,12 +133,13 @@ impl PluginManager {
version: parsed_spigot_plugin.version.clone(),
main_class: parsed_spigot_plugin.main.clone(),
plugin_type: PluginType::Spigot(SpigotPluginData {
spigot_config: parsed_spigot_plugin,
spigot_config: parsed_spigot_plugin.clone(),
}),
state: PluginState::Registered,
data_folder: jar_path.as_ref().parent().unwrap().join("data"),
path: jar_path.as_ref().to_path_buf(),
instance: None,
commands: parsed_spigot_plugin.commands.unwrap_or(HashMap::new()),
listeners: HashMap::new(),
};
@ -130,11 +148,20 @@ impl PluginManager {
}
pub fn enable_all_plugins(&mut self, jvm: &Jvm) -> Result<()> {
// IMPORANT: enable trough PluginManager not manually
let plugin_manager = jvm.invoke_static(
"org.bukkit.Bukkit",
"getPluginManager",
InvocationArg::empty(),
)?;
for (_plugin_name, plugin) in &mut self.plugins {
let plugin_instance = plugin.instance.as_ref().unwrap();
let plugin_instance = jvm.clone_instance(&plugin_instance).unwrap();
let result = jvm.invoke(
plugin.instance.as_ref().unwrap(),
"onEnable",
InvocationArg::empty(),
&plugin_manager,
"enablePlugin",
&[InvocationArg::from(plugin_instance)],
);
match result {
@ -156,11 +183,19 @@ impl PluginManager {
}
pub fn disable_all_plugins(&mut self, jvm: &Jvm) -> Result<()> {
let plugin_manager = jvm.invoke_static(
"org.bukkit.Bukkit",
"getPluginManager",
InvocationArg::empty(),
)?;
for (_plugin_name, plugin) in &mut self.plugins {
let plugin_instance = plugin.instance.as_ref().unwrap();
let plugin_instance = jvm.clone_instance(&plugin_instance).unwrap();
let result = jvm.invoke(
plugin.instance.as_ref().unwrap(),
"onDisable",
InvocationArg::empty(),
&plugin_manager,
"disablePlugin",
&[InvocationArg::from(plugin_instance)],
);
match result {
@ -181,28 +216,151 @@ impl PluginManager {
Ok(())
}
pub fn instantiate_all_plugins(&mut self, jvm: &Jvm) -> Result<()> {
pub fn trigger_command(
&self,
jvm: &Jvm,
cmd_name: &str,
command: Arc<Mutex<Instance>>,
sender: SimpleCommandSender,
args: Vec<String>,
) -> Result<(), String> {
let j_sender = match sender {
SimpleCommandSender::Console => jvm
.invoke_static(
"org.bukkit.Bukkit",
"getConsoleSender",
InvocationArg::empty(),
)
.map_err(|e| e.to_string())?,
SimpleCommandSender::Player(uuid_str) => {
// Get the server and cast it to your implementation
let server = jvm
.invoke_static("org.bukkit.Bukkit", "getServer", InvocationArg::empty())
.map_err(|e| e.to_string())?;
let patch_server = jvm
.cast(&server, "org.patchbukkit.PatchBukkitServer")
.map_err(|e| e.to_string())?;
// Create Java UUID object
let j_uuid = jvm
.invoke_static(
"java.util.UUID",
"fromString",
&[InvocationArg::try_from(uuid_str).map_err(|e| e.to_string())?],
)
.map_err(|e| e.to_string())?;
// Call your getPlayer(UUID) method on the server
jvm.invoke(&patch_server, "getPlayer", &[InvocationArg::from(j_uuid)])
.map_err(|e| e.to_string())?
}
};
let server_instance = jvm
.invoke_static("org.bukkit.Bukkit", "getServer", InvocationArg::empty())
.unwrap();
let command_map = jvm
.invoke(&server_instance, "getCommandMap", InvocationArg::empty())
.unwrap();
let dispatch_result = jvm
.invoke(
&command_map,
"dispatch",
&[
InvocationArg::from(j_sender),
InvocationArg::try_from(cmd_name).unwrap(),
],
)
.unwrap();
let handled: bool = jvm.to_rust(dispatch_result).unwrap();
if !handled {
//log::warn!("Command was not handled by any Java plugin: {}", cmd_name);
}
Ok(())
}
pub fn instantiate_all_plugins(
&mut self,
jvm: &Jvm,
server: &Arc<Context>,
command_tx: mpsc::Sender<JvmCommand>,
) -> Result<()> {
let server_instance =
jvm.invoke_static("org.bukkit.Bukkit", "getServer", InvocationArg::empty())?;
for (_plugin_name, plugin) in &mut self.plugins {
let result = jvm.invoke_static(
let plugin_instance = jvm.invoke_static(
"org.patchbukkit.loader.PatchBukkitPluginLoader",
"createPlugin",
&[
InvocationArg::try_from(&plugin.path.to_string_lossy().to_string())?,
InvocationArg::try_from(&plugin.main_class)?,
],
);
)?;
match result {
Ok(instance) => {
plugin.instance = Some(instance);
plugin.state = PluginState::Loaded;
log::info!("Loaded PatchBukkit plugin: {}", plugin.name);
}
Err(e) => {
plugin.state = PluginState::Errored;
log::error!("Failed to load PatchBukkit plugin {}: {:?}", plugin.name, e);
plugin.instance = Some(plugin_instance);
let instance_ref = plugin.instance.as_ref().unwrap();
let command_map =
jvm.invoke(&server_instance, "getCommandMap", InvocationArg::empty())?;
for (cmd_name, cmd_data) in &plugin.commands {
let cloned_plugin_instance = jvm.clone_instance(instance_ref)?;
let j_plugin_arg = InvocationArg::from(cloned_plugin_instance);
let j_plugin_cmd = Arc::new(Mutex::new(jvm.invoke_static(
"org.patchbukkit.command.CommandFactory",
"create",
&[InvocationArg::try_from(cmd_name)?, j_plugin_arg],
)?));
log::info!("Registering Bukkit command: {}", cmd_name);
{
let cmd_lock = j_plugin_cmd.lock().unwrap();
let j_plugin_cmd_owned = jvm.clone_instance(&*cmd_lock)?;
jvm.invoke(
&command_map,
"register",
&[
InvocationArg::try_from(cmd_name)?,
InvocationArg::try_from(&plugin.name)?,
InvocationArg::from(j_plugin_cmd_owned),
],
)?;
}
let node =
CommandTree::new([cmd_name], cmd_data.description.clone().unwrap_or_default())
.execute(JavaCommandExecutor {
cmd_name: cmd_name.clone(),
command_tx: command_tx.clone(),
command: j_plugin_cmd.clone(),
});
let permission = if let Some(perm) = cmd_data.permission.clone() {
perm
} else {
format!("patchbukkit:{}", cmd_name) // TODO
};
futures::executor::block_on(async {
server
.register_permission(Permission::new(
&permission,
&permission,
PermissionDefault::Allow,
))
.await
.unwrap();
server.register_command(node, permission).await
});
}
plugin.state = PluginState::Loaded;
log::info!("Loaded and registered commands for: {}", plugin.name);
}
Ok(())
}