Moved the APIs to a dedicated repo

They can now be found at https://github.com/GeyserMC/api
This commit is contained in:
Tim203 2023-01-07 14:29:33 +01:00
parent 7905581ec4
commit 3ac931e11b
No known key found for this signature in database
GPG key ID: 064EE9F5BF7C3EE8
46 changed files with 33 additions and 3036 deletions

View file

@ -7,8 +7,8 @@ plugins {
}
dependencies {
api(projects.geyserApi)
api(projects.common)
api(libs.geyser.api)
// Jackson JSON and YAML serialization
api(libs.bundles.jackson)

View file

@ -46,7 +46,7 @@ import lombok.ToString;
import net.kyori.adventure.text.format.NamedTextColor;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent;
import org.geysermc.geyser.api.event.java.ServerDefineCommandsEvent;
import org.geysermc.geyser.command.GeyserCommandManager;
import org.geysermc.geyser.inventory.item.Enchantment;
import org.geysermc.geyser.registry.BlockRegistries;
@ -150,12 +150,20 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
index -> new HashSet<>()).add(node.getName().toLowerCase());
}
ServerDefineCommandsEvent event = new ServerDefineCommandsEvent(session, commands.keySet());
session.getGeyser().eventBus().fire(event);
var eventBus = session.getGeyser().eventBus();
var event = new ServerDefineCommandsEvent(session, commands.keySet());
eventBus.fire(event);
if (event.isCancelled()) {
return;
}
var oldEvent = new org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent(session, commands.keySet());
eventBus.fire(oldEvent);
if (oldEvent.isCancelled()) {
return;
}
// The command flags, not sure what these do apart from break things
List<CommandData.Flag> flags = Collections.emptyList();
@ -258,7 +266,10 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
/**
* Stores the command description and parameter data for best optimizing the Bedrock commands packet.
*/
private record BedrockCommandInfo(String name, String description, CommandParamData[][] paramData) implements ServerDefineCommandsEvent.CommandInfo {
private record BedrockCommandInfo(String name, String description, CommandParamData[][] paramData) implements
org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent.CommandInfo,
ServerDefineCommandsEvent.CommandInfo
{
}
/**