fix all compile errors

This commit is contained in:
Badbird5907
2023-02-12 12:53:30 -05:00
parent de67b313ff
commit d5a4ffb45d
6 changed files with 48 additions and 41 deletions

View File

@@ -126,4 +126,6 @@ public interface Terminator {
boolean isInPlayerList();
World.Environment getDimension();
void setShield(boolean b);
}

View File

@@ -35,11 +35,11 @@ import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.v1_19_R1.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_19_R2.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Damageable;
import org.bukkit.entity.Player;
@@ -49,11 +49,7 @@ import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
public class Bot extends ServerPlayer implements Terminator {
@@ -79,7 +75,7 @@ public class Bot extends ServerPlayer implements Terminator {
private boolean inPlayerList;
private Bot(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile profile, boolean addToPlayerList) {
super(minecraftServer, worldServer, profile, null);
super(minecraftServer, worldServer, profile);
this.plugin = TerminatorPlus.getInstance();
this.scheduler = Bukkit.getScheduler();
@@ -126,7 +122,7 @@ public class Bot extends ServerPlayer implements Terminator {
bot.setRot(loc.getYaw(), loc.getPitch());
bot.getBukkitEntity().setNoDamageTicks(0);
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().connection.send(
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, bot)));
new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, bot)));
if (addPlayerList)
nmsWorld.addNewPlayer(bot);
else
@@ -205,9 +201,10 @@ public class Bot extends ServerPlayer implements Terminator {
private Packet<?>[] getRenderPackets() {
return new Packet[]{
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, this),
new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this),
new ClientboundAddPlayerPacket(this),
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
//new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
new ClientboundSetEntityDataPacket(this.getId(), this.entityData.packDirty()),
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
};
}
@@ -215,7 +212,8 @@ public class Bot extends ServerPlayer implements Terminator {
private Packet<?>[] getRenderPacketsNoInfo() {
return new Packet[]{
new ClientboundAddPlayerPacket(this),
new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
//new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
new ClientboundSetEntityDataPacket(this.getId(), this.entityData.packDirty()),
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
};
}
@@ -411,14 +409,16 @@ public class Bot extends ServerPlayer implements Terminator {
this.blocking = true;
this.blockUse = true;
startUsingItem(InteractionHand.OFF_HAND);
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
//sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData.packDirty()));
}
private void stopBlocking(int cooldown) {
this.blocking = false;
stopUsingItem();
scheduler.runTaskLater(plugin, () -> this.blockUse = false, cooldown);
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
//sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData, true));
sendPacket(new ClientboundSetEntityDataPacket(getId(), entityData.packDirty()));
}
@Override
@@ -426,6 +426,7 @@ public class Bot extends ServerPlayer implements Terminator {
return isBlocking();
}
@Override
public void setShield(boolean enabled) {
this.shield = enabled;
@@ -621,7 +622,7 @@ public class Bot extends ServerPlayer implements Terminator {
}
private void removeTab() {
sendPacket(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, this));
sendPacket(new ClientboundPlayerInfoRemovePacket(Arrays.asList(this.getUUID())));
}
public void setRemoveOnDeath(boolean enabled) {

View File

@@ -10,7 +10,7 @@ import net.nuggetmc.tplus.api.agent.legacyagent.ai.NeuralNetwork;
import net.nuggetmc.tplus.api.event.BotDeathEvent;
import net.nuggetmc.tplus.api.utils.MojangAPI;
import org.bukkit.*;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

@@ -9,8 +9,8 @@ import net.nuggetmc.tplus.api.InternalBridge;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class InternalBridgeImpl implements InternalBridge {

View File

@@ -12,7 +12,7 @@ import net.nuggetmc.tplus.command.commands.MainCommand;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
import java.lang.reflect.Method;
import java.util.ArrayList;

View File

@@ -237,6 +237,10 @@ public class Debugger {
TerminatorPlus.getInstance().getManager().fetch().forEach(bot -> bot.block(10, 10));
}
public void shield() {
TerminatorPlus.getInstance().getManager().fetch().forEach(bot -> bot.setShield(true));
}
public void offsets(boolean b) {
Agent agent = TerminatorPlus.getInstance().getManager().getAgent();
if (!(agent instanceof LegacyAgent)) {