forked from chipmunkmc/chipmunkbot
Update to 1.21.1 & some more stuff
This commit is contained in:
parent
8d81084f8d
commit
22c736c67d
29 changed files with 224 additions and 180 deletions
|
@ -6,11 +6,31 @@
|
|||
<option name="name" value="Minecraft Libraries" />
|
||||
<option name="url" value="https://libraries.minecraft.net" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="CollabNet" />
|
||||
<option name="name" value="CollabNet" />
|
||||
<option name="url" value="https://repo.opencollab.dev/main/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="opencollab" />
|
||||
<option name="name" value="opencollab" />
|
||||
<option name="url" value="https://repo.opencollab.dev/main" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="opencollab" />
|
||||
<option name="name" value="opencollab" />
|
||||
<option name="url" value="https://repo.opencollab.dev/main/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="CollabNetSnapshots" />
|
||||
<option name="name" value="CollabNetSnapshots" />
|
||||
<option name="url" value="https://repo.opencollab.dev/maven-snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="opencollab" />
|
||||
<option name="name" value="opencollab" />
|
||||
|
@ -21,6 +41,11 @@
|
|||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="CollabNetReleases" />
|
||||
<option name="name" value="CollabNetReleases" />
|
||||
<option name="url" value="https://repo.opencollab.dev/maven-releases/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
|
|
26
pom.xml
26
pom.xml
|
@ -13,23 +13,31 @@
|
|||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>opencollab</id>
|
||||
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>minecraft-libraries</id>
|
||||
<name>Minecraft Libraries</name>
|
||||
<url>https://libraries.minecraft.net</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>CollabNet</id>
|
||||
<url>https://repo.opencollab.dev/main/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>CollabNetSnapshots</id>
|
||||
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>CollabNetReleases</id>
|
||||
<url>https://repo.opencollab.dev/maven-releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
<artifactId>mcprotocollib</artifactId>
|
||||
<version>1.20-1-SNAPSHOT</version>
|
||||
<groupId>org.geysermc.mcprotocollib</groupId>
|
||||
<artifactId>protocol</artifactId>
|
||||
<version>1.21-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -48,7 +56,7 @@
|
|||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>brigadier</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.0.18</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package land.chipmunk.chipmunkbot;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import lombok.Getter;
|
||||
import land.chipmunk.chipmunkbot.plugins.*;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChipmunkBot extends Client {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package land.chipmunk.chipmunkbot;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.packetlib.ProxyInfo;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.tcp.TcpClientSession;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.event.session.*;
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||
import land.chipmunk.chipmunkbot.util.ComponentUtilities;
|
||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.tcp.TcpClientSession;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.event.session.*;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.List;
|
||||
|
|
|
@ -3,7 +3,6 @@ package land.chipmunk.chipmunkbot.command;
|
|||
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
|
||||
import land.chipmunk.chipmunkbot.util.UUIDUtilities;
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
@ -12,6 +11,8 @@ import net.kyori.adventure.text.format.Style;
|
|||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerCommandSource extends CommandSource {
|
||||
|
|
|
@ -16,7 +16,6 @@ public class EchoCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("echo")
|
||||
.describe(ComponentMessage.wrap(Component.text("Echoes a message")))
|
||||
.then(
|
||||
argument("text", greedyString())
|
||||
.executes(instance::echo)
|
||||
|
|
|
@ -27,7 +27,6 @@ public class HelpCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("help")
|
||||
.describe(ComponentMessage.wrap(Component.text("Shows the help")))
|
||||
.executes(instance::sendCommandList)
|
||||
.then(
|
||||
argument("command", greedyString())
|
||||
|
@ -106,13 +105,10 @@ public class HelpCommand {
|
|||
);
|
||||
}
|
||||
|
||||
final Message description = node.getDescription();
|
||||
|
||||
components.add(
|
||||
Component.translatable(
|
||||
"%s - %s",
|
||||
Component.text(node.getName()).color(TextColor.fromHexString(config.color().primary())),
|
||||
Component.text(description == null ? "No description" : description.getString()).color(NamedTextColor.GRAY)
|
||||
"%s",
|
||||
Component.text(node.getName()).color(TextColor.fromHexString(config.color().primary()))
|
||||
).color(NamedTextColor.DARK_GRAY)
|
||||
);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ public class InfoCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("info")
|
||||
.describe(ComponentMessage.wrap(Component.text("Shows the info about the bot")))
|
||||
.executes(instance::sendBotInfo)
|
||||
.then(
|
||||
literal("server")
|
||||
|
@ -42,7 +41,7 @@ public class InfoCommand {
|
|||
client = source.client();
|
||||
|
||||
final Component component = Component.empty()
|
||||
.append(Component.text("Chipmunk(Sex)Bot", TextColor.fromHexString(client.config().color().primary())))
|
||||
.append(Component.text("ChipmunkBot", TextColor.fromHexString(client.config().color().primary())))
|
||||
.append(Component.text(" - A utility bot for free-operator servers with minimal or no restrictions", NamedTextColor.GRAY))
|
||||
.append(Component.newline())
|
||||
.append(Component.text("Made by ", NamedTextColor.GRAY))
|
||||
|
|
|
@ -38,7 +38,6 @@ public class LogQueryCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("logquery")
|
||||
.describe(ComponentMessage.wrap(Component.text("Queries the bots log files")))
|
||||
.then(
|
||||
literal("abort")
|
||||
.executes(instance::abortCommand)
|
||||
|
|
|
@ -43,7 +43,6 @@ public class MusicCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("music")
|
||||
.describe(ComponentMessage.wrap(Component.text("Play musics")))
|
||||
.then(
|
||||
literal("play")
|
||||
.then(
|
||||
|
|
|
@ -9,9 +9,9 @@ import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
|||
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.ProtocolState;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
import org.geysermc.mcprotocollib.protocol.data.ProtocolState;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
@ -22,7 +22,6 @@ public class NetMsgCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("netmsg")
|
||||
.describe(ComponentMessage.wrap(Component.text("Broadcasts a message to every server")))
|
||||
.then(
|
||||
argument("message", greedyString())
|
||||
.executes(instance::netmsg)
|
||||
|
@ -47,7 +46,7 @@ public class NetMsgCommand {
|
|||
|
||||
final Session session = remote.session();
|
||||
final MinecraftProtocol protocol = (MinecraftProtocol) session.getPacketProtocol();
|
||||
if (!session.isConnected() || protocol.getState() != ProtocolState.GAME) continue;
|
||||
if (!session.isConnected() || protocol.getOutboundState() != ProtocolState.GAME) continue;
|
||||
|
||||
((ChipmunkBot) remote).chat().tellraw(message);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ public class ReconnectCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("reconnect")
|
||||
.describe(ComponentMessage.wrap(Component.text("Reconnects the bot")))
|
||||
.executes(instance::reconnect)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import com.mojang.brigadier.CommandDispatcher;
|
|||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class RunCommand {
|
||||
|
@ -20,7 +20,6 @@ public class RunCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("run")
|
||||
.describe(ComponentMessage.wrap(Component.text("Runs a command in the command core and return its output")))
|
||||
.then(
|
||||
argument("command", greedyString())
|
||||
.executes(instance::run)
|
||||
|
@ -32,11 +31,11 @@ public class RunCommand {
|
|||
final CommandSource source = context.getSource();
|
||||
final ChipmunkBot client = source.client();
|
||||
|
||||
final CompletableFuture<CompoundTag> future = client.core().runTracked(getString(context, "command"));
|
||||
final CompletableFuture<NbtMap> future = client.core().runTracked(getString(context, "command"));
|
||||
|
||||
future.thenApply(tag -> {
|
||||
if (!tag.contains("LastOutput") || !(tag.get("LastOutput") instanceof StringTag)) return tag;
|
||||
final String outputJson = ((StringTag) tag.get("LastOutput")).getValue();
|
||||
if (!tag.containsKey("LastOutput") || !(tag.get("LastOutput") instanceof String)) return tag;
|
||||
final String outputJson = tag.getString("LastOutput");
|
||||
|
||||
try {
|
||||
final Component output = GsonComponentSerializer.gson().deserialize(outputJson);
|
||||
|
|
|
@ -18,7 +18,6 @@ public class SayCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("say")
|
||||
.describe(ComponentMessage.wrap(Component.text("Makes the bot say a message")))
|
||||
.then(
|
||||
argument("message", greedyString())
|
||||
.executes(instance::say)
|
||||
|
|
|
@ -12,7 +12,6 @@ public class TestCommand {
|
|||
|
||||
dispatcher.register(
|
||||
literal("test")
|
||||
.describe(ComponentMessage.wrap(Component.text("Tests if the bot is online/working")))
|
||||
.executes(instance::helloWorld)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package land.chipmunk.chipmunkbot.data;
|
||||
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntry;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
|
@ -5,28 +5,28 @@ import land.chipmunk.chipmunkbot.data.chat.PlayerMessage;
|
|||
import land.chipmunk.chipmunkbot.data.chat.SystemChatParser;
|
||||
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
|
||||
import land.chipmunk.chipmunkbot.util.UUIDUtilities;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundPlayerChatPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import lombok.Getter;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.Instant;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class ChatPlugin extends SessionAdapter {
|
|||
public void command (String command) {
|
||||
if (command.length() > 256) return;
|
||||
|
||||
final ServerboundChatCommandPacket packet = new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0, Collections.emptyList(), 0, new BitSet());
|
||||
final ServerboundChatCommandPacket packet = new ServerboundChatCommandPacket(command);
|
||||
client.session().send(packet);
|
||||
}
|
||||
|
||||
|
@ -147,12 +147,19 @@ public class ChatPlugin extends SessionAdapter {
|
|||
|
||||
if (tagString.getBytes(StandardCharsets.UTF_8).length > 65535) return;
|
||||
|
||||
CompoundTag itemTag = new CompoundTag("");
|
||||
itemTag.put(new StringTag("m", tagString));
|
||||
final NbtMapBuilder blockEntityTagBuilder = NbtMap.builder();
|
||||
|
||||
final NbtMap itemTag = blockEntityTagBuilder.putString("m", tagString).build();
|
||||
|
||||
final Map<DataComponentType<?>, DataComponent<?, ?>> map = new HashMap<>();
|
||||
|
||||
map.put(DataComponentType.BLOCK_ENTITY_DATA, DataComponentType.BLOCK_ENTITY_DATA.getDataComponentFactory().create(DataComponentType.BLOCK_ENTITY_DATA, itemTag));
|
||||
|
||||
final DataComponents dataComponents = new DataComponents(map);
|
||||
|
||||
final Session session = client.session();
|
||||
|
||||
session.send(new ServerboundSetCreativeModeSlotPacket(26, new ItemStack(1 /* stone */, 1, itemTag)));
|
||||
session.send(new ServerboundSetCreativeModeSlotPacket((short) 26, new ItemStack(1 /* stone */, 1, dataComponents)));
|
||||
client.core().run("minecraft:tellraw " + targets + " {\"nbt\":\"Inventory[0].tag.m\",\"entity\":\"" + client.profile().getIdAsString() + "\",\"interpret\":" + interpret + "}"); // TODO: Use GSON instead of concatenating strings, and hardcode less of this (it shouldn't matter here but yes)
|
||||
|
||||
return;
|
||||
|
|
|
@ -4,30 +4,30 @@ import land.chipmunk.chipmunkbot.ChipmunkBot;
|
|||
import land.chipmunk.chipmunkbot.Configuration;
|
||||
import land.chipmunk.chipmunkbot.data.BlockArea;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectedEvent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.PlayerAction;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.block.CommandBlockMode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class CommandCore extends SessionAdapter {
|
||||
|
@ -95,11 +95,19 @@ public class CommandCore extends SessionAdapter {
|
|||
relEnd.getZ() + origin.getZ()
|
||||
);
|
||||
|
||||
CompoundTag itemTag = new CompoundTag("");
|
||||
CompoundTag blockEntityTag = new CompoundTag("BlockEntityTag");
|
||||
blockEntityTag.put(new StringTag("Command", command));
|
||||
blockEntityTag.put(new ByteTag("auto", (byte) 1));
|
||||
itemTag.put(blockEntityTag);
|
||||
final NbtMapBuilder blockEntityTagBuilder = NbtMap.builder();
|
||||
|
||||
blockEntityTagBuilder.putString("id", "minecraft:command_block");
|
||||
blockEntityTagBuilder.putString("Command", command);
|
||||
blockEntityTagBuilder.putByte("auto", (byte) 1);
|
||||
|
||||
final NbtMap blockEntityTag = blockEntityTagBuilder.build();
|
||||
|
||||
final Map<DataComponentType<?>, DataComponent<?, ?>> map = new HashMap<>();
|
||||
|
||||
map.put(DataComponentType.BLOCK_ENTITY_DATA, DataComponentType.BLOCK_ENTITY_DATA.getDataComponentFactory().create(DataComponentType.BLOCK_ENTITY_DATA, blockEntityTag));
|
||||
|
||||
final DataComponents dataComponents = new DataComponents(map);
|
||||
|
||||
final PositionManager position = client.position();
|
||||
|
||||
|
@ -108,7 +116,7 @@ public class CommandCore extends SessionAdapter {
|
|||
// client.chat().command(command);
|
||||
|
||||
final Session session = client.session();
|
||||
session.send(new ServerboundSetCreativeModeSlotPacket(45, new ItemStack(373 /* command_block */, 1, itemTag)));
|
||||
session.send(new ServerboundSetCreativeModeSlotPacket((short) 45, new ItemStack(395 /* command_block */, 1, dataComponents)));
|
||||
session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0));
|
||||
session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.NORTH, Hand.OFF_HAND, 0.5f, 0.5f, 0.5f, false, 0));
|
||||
}
|
||||
|
@ -169,13 +177,13 @@ public class CommandCore extends SessionAdapter {
|
|||
incrementCurrentBlock();
|
||||
}
|
||||
|
||||
public CompletableFuture<CompoundTag> runTracked (String command) {
|
||||
if (command.length() > maxCommandLength()) return emptyCompoundTagFuture();
|
||||
public CompletableFuture<NbtMap> runTracked (String command) {
|
||||
if (command.length() > maxCommandLength()) return emptyNbtMapFuture();
|
||||
|
||||
if (!enabled) {
|
||||
client.chat().command(command); // fall back to chat
|
||||
|
||||
return emptyCompoundTagFuture();
|
||||
return emptyNbtMapFuture();
|
||||
}
|
||||
|
||||
final Session session = client.session();
|
||||
|
@ -187,7 +195,7 @@ public class CommandCore extends SessionAdapter {
|
|||
|
||||
incrementCurrentBlock();
|
||||
|
||||
CompletableFuture<CompoundTag> future = new CompletableFuture<CompoundTag>();
|
||||
CompletableFuture<NbtMap> future = new CompletableFuture<NbtMap>();
|
||||
|
||||
final Timer timer = new Timer();
|
||||
final TimerTask queryTask = new TimerTask() {
|
||||
|
@ -204,9 +212,9 @@ public class CommandCore extends SessionAdapter {
|
|||
return future;
|
||||
}
|
||||
|
||||
private CompletableFuture<CompoundTag> emptyCompoundTagFuture () {
|
||||
CompletableFuture<CompoundTag> future = new CompletableFuture<CompoundTag>();
|
||||
future.complete(new CompoundTag(""));
|
||||
private CompletableFuture<NbtMap> emptyNbtMapFuture () {
|
||||
CompletableFuture<NbtMap> future = new CompletableFuture<NbtMap>();
|
||||
future.complete(NbtMap.EMPTY);
|
||||
return future;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,16 @@ public class CommandSpyPlugin extends ChatPlugin.Listener {
|
|||
private static final Style ENABLED_STYLE = Style.style(NamedTextColor.YELLOW);
|
||||
private static final Style DISABLED_STYLE = Style.style(NamedTextColor.AQUA);
|
||||
|
||||
private static final Component COMMANDSPY_ENABLED_COMPONENT = Component.text("Successfully enabled CommandSpy");
|
||||
private static final Component COMMANDSPY_DISABLED_COMPONENT = Component.text("Successfully disabled CommandSpy");
|
||||
private static final Component COMMANDSPY_ENABLED_COMPONENT = Component
|
||||
.empty()
|
||||
.append(Component.text("Successfully "))
|
||||
.append(Component.text("enabled"))
|
||||
.append(Component.text(" CommandSpy"));
|
||||
private static final Component COMMANDSPY_DISABLED_COMPONENT = Component
|
||||
.empty()
|
||||
.append(Component.text("Successfully "))
|
||||
.append(Component.text("disabled"))
|
||||
.append(Component.text(" CommandSpy"));
|
||||
private static final Component COMMAND_SEPARATOR_COMPONENT = Component.text(": ");
|
||||
private static final Component SIGN_CREATED_TEXT_COMPONENT = Component.text(" created a sign with contents:");
|
||||
private static final Component SIGN_LINE_SEPARATOR_COMPONENT = Component.text("\n ");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package land.chipmunk.chipmunkbot.plugins;
|
||||
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntry;
|
||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntryAction;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class PlayerListPlugin extends SessionAdapter {
|
|||
}
|
||||
|
||||
private final MutablePlayerListEntry getEntry (PlayerListEntry other) {
|
||||
return getEntry(other.getProfile().getId());
|
||||
return getEntry(other.getProfileId());
|
||||
}
|
||||
|
||||
private void addPlayer (PlayerListEntry newEntry) {
|
||||
|
|
|
@ -2,12 +2,12 @@ package land.chipmunk.chipmunkbot.plugins;
|
|||
|
||||
import land.chipmunk.chipmunkbot.Client;
|
||||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import lombok.Getter;
|
||||
|
|
|
@ -2,14 +2,14 @@ package land.chipmunk.chipmunkbot.plugins;
|
|||
|
||||
import land.chipmunk.chipmunkbot.Client;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundEntityTagQuery;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundTagQueryPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQueryPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundEntityTagQuery;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundTagQueryPacket;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
@ -17,29 +17,29 @@ import java.util.HashMap;
|
|||
public class QueryPlugin extends SessionAdapter {
|
||||
private Client client;
|
||||
private int nextTransactionId = 0;
|
||||
private Map<Integer, CompletableFuture<CompoundTag>> transactions = new HashMap<>();
|
||||
private Map<Integer, CompletableFuture<NbtMap>> transactions = new HashMap<>();
|
||||
|
||||
public QueryPlugin (Client client) {
|
||||
this.client = client;
|
||||
client.addListener((SessionListener) this);
|
||||
}
|
||||
|
||||
public CompletableFuture<CompoundTag> block (Vector3i position) {
|
||||
public CompletableFuture<NbtMap> block (Vector3i position) {
|
||||
final int transactionId = nextTransactionId++;
|
||||
if (nextTransactionId > Integer.MAX_VALUE) nextTransactionId = 0; // ? Can and should I use negative numbers too?
|
||||
client.session().send(new ServerboundBlockEntityTagQuery(transactionId, position));
|
||||
client.session().send(new ServerboundBlockEntityTagQueryPacket(transactionId, position));
|
||||
|
||||
final CompletableFuture<CompoundTag> future = new CompletableFuture<CompoundTag>();
|
||||
final CompletableFuture<NbtMap> future = new CompletableFuture<NbtMap>();
|
||||
transactions.put(transactionId, future);
|
||||
return future;
|
||||
}
|
||||
|
||||
public CompletableFuture<CompoundTag> entity (int entityId) {
|
||||
public CompletableFuture<NbtMap> entity (int entityId) {
|
||||
final int transactionId = nextTransactionId++;
|
||||
if (nextTransactionId > Integer.MAX_VALUE) nextTransactionId = 0; // ? Can and should I use negative numbers too?
|
||||
client.session().send(new ServerboundEntityTagQuery(transactionId, entityId));
|
||||
|
||||
final CompletableFuture<CompoundTag> future = new CompletableFuture<CompoundTag>();
|
||||
final CompletableFuture<NbtMap> future = new CompletableFuture<NbtMap>();
|
||||
transactions.put(transactionId, future);
|
||||
return future;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class QueryPlugin extends SessionAdapter {
|
|||
}
|
||||
|
||||
public void packetReceived (Session session, ClientboundTagQueryPacket packet) {
|
||||
final CompletableFuture<CompoundTag> future = transactions.get(packet.getTransactionId());
|
||||
final CompletableFuture<NbtMap> future = transactions.get(packet.getTransactionId());
|
||||
if (future == null) return;
|
||||
future.complete(packet.getNbt());
|
||||
transactions.remove(future);
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package land.chipmunk.chipmunkbot.plugins;
|
||||
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.packet.PacketProtocol;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.ProtocolState;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.notify.GameEvent;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.notify.GameEventValue;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.EntityEvent;
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.protocol.data.ProtocolState;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.notify.GameEvent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.level.notify.GameEventValue;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.EntityEvent;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.ClientCommand;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectedEvent;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
|
||||
import land.chipmunk.chipmunkbot.Configuration;
|
||||
import land.chipmunk.chipmunkbot.util.ComponentUtilities;
|
||||
import lombok.Getter;
|
||||
|
@ -62,7 +62,7 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
public void run () {
|
||||
final Session session = client.session();
|
||||
final PacketProtocol protocol = session.getPacketProtocol();
|
||||
if (!session.isConnected() || (protocol instanceof MinecraftProtocol && ((MinecraftProtocol) protocol).getState() != ProtocolState.GAME)) return;
|
||||
if (!session.isConnected() || (protocol instanceof MinecraftProtocol && ((MinecraftProtocol) protocol).getOutboundState() != ProtocolState.GAME)) return;
|
||||
|
||||
// TODO: Maybe make it possible for other stuff to listen for ticks
|
||||
tick();
|
||||
|
@ -97,7 +97,7 @@ public class SelfCarePlugin extends SessionAdapter {
|
|||
|
||||
public void packetReceived (Session session, ClientboundLoginPacket packet) {
|
||||
entityId = packet.getEntityId(); // TODO: Move entity id handling somewhere else
|
||||
gamemode = packet.getGameMode();
|
||||
gamemode = packet.getCommonPlayerSpawnInfo().getGameMode();
|
||||
}
|
||||
|
||||
public void packetReceived (Session session, ClientboundEntityEventPacket packet) {
|
||||
|
|
|
@ -2,11 +2,11 @@ package land.chipmunk.chipmunkbot.plugins;
|
|||
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import land.chipmunk.chipmunkbot.song.*;
|
||||
// import com.github.steveice10.packetlib.packet.Packet;
|
||||
// import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||
// import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
// import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectedEvent;
|
||||
import land.chipmunk.chipmunkbot.util.MathUtilities;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
|
|
|
@ -2,12 +2,12 @@ package land.chipmunk.chipmunkbot.plugins;
|
|||
|
||||
import land.chipmunk.chipmunkbot.Client;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandSuggestionsPacket;
|
||||
import org.geysermc.mcprotocollib.network.packet.Packet;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundCommandSuggestionsPacket;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package land.chipmunk.chipmunkbot.plugins;
|
||||
|
||||
import land.chipmunk.chipmunkbot.Client;
|
||||
import com.github.steveice10.packetlib.event.session.SessionListener;
|
||||
import com.github.steveice10.packetlib.event.session.SessionAdapter;
|
||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.ProtocolState;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionListener;
|
||||
import org.geysermc.mcprotocollib.network.event.session.SessionAdapter;
|
||||
import org.geysermc.mcprotocollib.network.event.session.DisconnectedEvent;
|
||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||
import org.geysermc.mcprotocollib.protocol.data.ProtocolState;
|
||||
import lombok.Getter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -26,7 +26,7 @@ public class TickLoop extends SessionAdapter {
|
|||
public void run () {
|
||||
for (Listener listener : listeners) {
|
||||
listener.onTick(tick);
|
||||
if (((MinecraftProtocol) client.session().getPacketProtocol()).getState() == ProtocolState.GAME) listener.onGameTick(tick);
|
||||
if (((MinecraftProtocol) client.session().getPacketProtocol()).getOutboundState() == ProtocolState.GAME) listener.onGameTick(tick);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package land.chipmunk.chipmunkbot.systemChat;
|
||||
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
|
||||
import land.chipmunk.chipmunkbot.data.chat.PlayerMessage;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package land.chipmunk.chipmunkbot.systemChat;
|
||||
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import land.chipmunk.chipmunkbot.ChipmunkBot;
|
||||
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
|
||||
import land.chipmunk.chipmunkbot.data.chat.PlayerMessage;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package land.chipmunk.chipmunkbot.util;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntArrayTag;
|
||||
import java.util.UUID;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
@ -19,9 +18,9 @@ public class UUIDUtilities {
|
|||
return intArray;
|
||||
}
|
||||
|
||||
public static IntArrayTag tag (UUID uuid) {
|
||||
return new IntArrayTag("", intArray(uuid));
|
||||
}
|
||||
// public static IntArrayTag tag (UUID uuid) {
|
||||
// return new IntArrayTag("", intArray(uuid));
|
||||
// }
|
||||
|
||||
public static String snbt (UUID uuid) {
|
||||
int[] array = intArray(uuid);
|
||||
|
|
Loading…
Reference in a new issue