fix all compile errors
This commit is contained in:
@@ -34,7 +34,7 @@ public interface Terminator {
|
|||||||
boolean hasNeuralNetwork();
|
boolean hasNeuralNetwork();
|
||||||
|
|
||||||
Location getLocation();
|
Location getLocation();
|
||||||
|
|
||||||
BoundingBox getBotBoundingBox();
|
BoundingBox getBotBoundingBox();
|
||||||
|
|
||||||
boolean isBotAlive(); //Has to be named like this because paper re-obfuscates it
|
boolean isBotAlive(); //Has to be named like this because paper re-obfuscates it
|
||||||
@@ -54,7 +54,7 @@ public interface Terminator {
|
|||||||
boolean isBotInWater();
|
boolean isBotInWater();
|
||||||
|
|
||||||
boolean isBotOnGround();
|
boolean isBotOnGround();
|
||||||
|
|
||||||
List<Block> getStandingOn();
|
List<Block> getStandingOn();
|
||||||
|
|
||||||
void setBotPitch(float pitch);
|
void setBotPitch(float pitch);
|
||||||
@@ -112,7 +112,7 @@ public interface Terminator {
|
|||||||
void addVelocity(Vector velocity);
|
void addVelocity(Vector velocity);
|
||||||
|
|
||||||
int getAliveTicks();
|
int getAliveTicks();
|
||||||
|
|
||||||
int getNoFallTicks();
|
int getNoFallTicks();
|
||||||
|
|
||||||
boolean tickDelay(int ticks);
|
boolean tickDelay(int ticks);
|
||||||
@@ -122,8 +122,10 @@ public interface Terminator {
|
|||||||
UUID getTargetPlayer();
|
UUID getTargetPlayer();
|
||||||
|
|
||||||
void setTargetPlayer(UUID target);
|
void setTargetPlayer(UUID target);
|
||||||
|
|
||||||
boolean isInPlayerList();
|
boolean isInPlayerList();
|
||||||
|
|
||||||
World.Environment getDimension();
|
World.Environment getDimension();
|
||||||
|
|
||||||
|
void setShield(boolean b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ import org.bukkit.*;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftEquipmentSlot;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftEquipmentSlot;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Damageable;
|
import org.bukkit.entity.Damageable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -49,11 +49,7 @@ import org.bukkit.util.BoundingBox;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Bot extends ServerPlayer implements Terminator {
|
public class Bot extends ServerPlayer implements Terminator {
|
||||||
|
|
||||||
@@ -77,9 +73,9 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
private List<Block> standingOn = new ArrayList<>();
|
private List<Block> standingOn = new ArrayList<>();
|
||||||
private UUID targetPlayer = null;
|
private UUID targetPlayer = null;
|
||||||
private boolean inPlayerList;
|
private boolean inPlayerList;
|
||||||
|
|
||||||
private Bot(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile profile, boolean addToPlayerList) {
|
private Bot(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile profile, boolean addToPlayerList) {
|
||||||
super(minecraftServer, worldServer, profile, null);
|
super(minecraftServer, worldServer, profile);
|
||||||
|
|
||||||
this.plugin = TerminatorPlus.getInstance();
|
this.plugin = TerminatorPlus.getInstance();
|
||||||
this.scheduler = Bukkit.getScheduler();
|
this.scheduler = Bukkit.getScheduler();
|
||||||
@@ -109,7 +105,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
UUID uuid = BotUtils.randomSteveUUID();
|
UUID uuid = BotUtils.randomSteveUUID();
|
||||||
|
|
||||||
CustomGameProfile profile = new CustomGameProfile(uuid, ChatUtils.trim16(name), skin);
|
CustomGameProfile profile = new CustomGameProfile(uuid, ChatUtils.trim16(name), skin);
|
||||||
|
|
||||||
boolean addPlayerList = TerminatorPlus.getInstance().getManager().addToPlayerList();
|
boolean addPlayerList = TerminatorPlus.getInstance().getManager().addToPlayerList();
|
||||||
|
|
||||||
Bot bot = new Bot(nmsServer, nmsWorld, profile, addPlayerList);
|
Bot bot = new Bot(nmsServer, nmsWorld, profile, addPlayerList);
|
||||||
@@ -126,7 +122,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
bot.setRot(loc.getYaw(), loc.getPitch());
|
bot.setRot(loc.getYaw(), loc.getPitch());
|
||||||
bot.getBukkitEntity().setNoDamageTicks(0);
|
bot.getBukkitEntity().setNoDamageTicks(0);
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().connection.send(
|
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)
|
if (addPlayerList)
|
||||||
nmsWorld.addNewPlayer(bot);
|
nmsWorld.addNewPlayer(bot);
|
||||||
else
|
else
|
||||||
@@ -205,9 +201,10 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
|
|
||||||
private Packet<?>[] getRenderPackets() {
|
private Packet<?>[] getRenderPackets() {
|
||||||
return new Packet[]{
|
return new Packet[]{
|
||||||
new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, this),
|
new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this),
|
||||||
new ClientboundAddPlayerPacket(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))
|
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -215,7 +212,8 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
private Packet<?>[] getRenderPacketsNoInfo() {
|
private Packet<?>[] getRenderPacketsNoInfo() {
|
||||||
return new Packet[]{
|
return new Packet[]{
|
||||||
new ClientboundAddPlayerPacket(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))
|
new ClientboundRotateHeadPacket(this, (byte) ((this.yHeadRot * 256f) / 360f))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -254,7 +252,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
public int getAliveTicks() {
|
public int getAliveTicks() {
|
||||||
return aliveTicks;
|
return aliveTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNoFallTicks() {
|
public int getNoFallTicks() {
|
||||||
return noFallTicks;
|
return noFallTicks;
|
||||||
@@ -304,7 +302,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLocation();
|
updateLocation();
|
||||||
|
|
||||||
if (!isAlive()) return;
|
if (!isAlive()) return;
|
||||||
|
|
||||||
float health = getHealth();
|
float health = getHealth();
|
||||||
@@ -323,7 +321,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
fallDamageCheck();
|
fallDamageCheck();
|
||||||
|
|
||||||
oldVelocity = velocity.clone();
|
oldVelocity = velocity.clone();
|
||||||
|
|
||||||
doTick();
|
doTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +365,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFallBlocked() {
|
private boolean isFallBlocked() {
|
||||||
AABB box = getBoundingBox();
|
AABB box = getBoundingBox();
|
||||||
double[] xVals = new double[]{
|
double[] xVals = new double[]{
|
||||||
@@ -411,14 +409,16 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
this.blocking = true;
|
this.blocking = true;
|
||||||
this.blockUse = true;
|
this.blockUse = true;
|
||||||
startUsingItem(InteractionHand.OFF_HAND);
|
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) {
|
private void stopBlocking(int cooldown) {
|
||||||
this.blocking = false;
|
this.blocking = false;
|
||||||
stopUsingItem();
|
stopUsingItem();
|
||||||
scheduler.runTaskLater(plugin, () -> this.blockUse = false, cooldown);
|
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
|
@Override
|
||||||
@@ -426,6 +426,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
return isBlocking();
|
return isBlocking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShield(boolean enabled) {
|
public void setShield(boolean enabled) {
|
||||||
this.shield = enabled;
|
this.shield = enabled;
|
||||||
|
|
||||||
@@ -521,7 +522,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
|
|
||||||
return checkStandingOn();
|
return checkStandingOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkStandingOn() {
|
public boolean checkStandingOn() {
|
||||||
World world = getBukkitEntity().getWorld();
|
World world = getBukkitEntity().getWorld();
|
||||||
AABB box = getBoundingBox();
|
AABB box = getBoundingBox();
|
||||||
@@ -553,7 +554,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fence/wall check
|
//Fence/wall check
|
||||||
for (double x : xVals) {
|
for (double x : xVals) {
|
||||||
for (double z : zVals) {
|
for (double z : zVals) {
|
||||||
@@ -562,7 +563,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
BoundingBox blockBox = loc.getBlock().getBoundingBox();
|
BoundingBox blockBox = loc.getBlock().getBoundingBox();
|
||||||
BoundingBox modifiedBox = new BoundingBox(blockBox.getMinX(), blockBox.getMinY(), blockBox.getMinZ(), blockBox.getMaxX(),
|
BoundingBox modifiedBox = new BoundingBox(blockBox.getMinX(), blockBox.getMinY(), blockBox.getMinZ(), blockBox.getMaxX(),
|
||||||
blockBox.getMinY() + 1.5, blockBox.getMaxZ());
|
blockBox.getMinY() + 1.5, blockBox.getMaxZ());
|
||||||
|
|
||||||
if ((LegacyMats.FENCE.contains(block.getType()) || LegacyMats.GATES.contains(block.getType()))
|
if ((LegacyMats.FENCE.contains(block.getType()) || LegacyMats.GATES.contains(block.getType()))
|
||||||
&& block.getType().isSolid() && BotUtils.overlaps(playerBox, modifiedBox)) {
|
&& block.getType().isSolid() && BotUtils.overlaps(playerBox, modifiedBox)) {
|
||||||
if (!locations.contains(block.getLocation())) {
|
if (!locations.contains(block.getLocation())) {
|
||||||
@@ -576,11 +577,11 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
//Closest block comes first
|
//Closest block comes first
|
||||||
Collections.sort(standingOn, (a, b) ->
|
Collections.sort(standingOn, (a, b) ->
|
||||||
Double.compare(BotUtils.getHorizSqDist(a.getLocation(), getLocation()), BotUtils.getHorizSqDist(b.getLocation(), getLocation())));
|
Double.compare(BotUtils.getHorizSqDist(a.getLocation(), getLocation()), BotUtils.getHorizSqDist(b.getLocation(), getLocation())));
|
||||||
|
|
||||||
this.standingOn = standingOn;
|
this.standingOn = standingOn;
|
||||||
return !standingOn.isEmpty();
|
return !standingOn.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getStandingOn() {
|
public List<Block> getStandingOn() {
|
||||||
return standingOn;
|
return standingOn;
|
||||||
@@ -621,7 +622,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeTab() {
|
private void removeTab() {
|
||||||
sendPacket(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, this));
|
sendPacket(new ClientboundPlayerInfoRemovePacket(Arrays.asList(this.getUUID())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemoveOnDeath(boolean enabled) {
|
public void setRemoveOnDeath(boolean enabled) {
|
||||||
@@ -764,7 +765,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return getBukkitEntity().getLocation();
|
return getBukkitEntity().getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BoundingBox getBotBoundingBox() {
|
public BoundingBox getBotBoundingBox() {
|
||||||
return getBukkitEntity().getBoundingBox();
|
return getBukkitEntity().getBoundingBox();
|
||||||
@@ -885,12 +886,12 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
public void doTick() {
|
public void doTick() {
|
||||||
baseTick();
|
baseTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInPlayerList() {
|
public boolean isInPlayerList() {
|
||||||
return inPlayerList;
|
return inPlayerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World.Environment getDimension() {
|
public World.Environment getDimension() {
|
||||||
return getBukkitEntity().getWorld().getEnvironment();
|
return getBukkitEntity().getWorld().getEnvironment();
|
||||||
|
|||||||
@@ -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.event.BotDeathEvent;
|
||||||
import net.nuggetmc.tplus.api.utils.MojangAPI;
|
import net.nuggetmc.tplus.api.utils.MojangAPI;
|
||||||
import org.bukkit.*;
|
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.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import net.nuggetmc.tplus.api.InternalBridge;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class InternalBridgeImpl implements InternalBridge {
|
public class InternalBridgeImpl implements InternalBridge {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import net.nuggetmc.tplus.command.commands.MainCommand;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.SimpleCommandMap;
|
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.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -237,6 +237,10 @@ public class Debugger {
|
|||||||
TerminatorPlus.getInstance().getManager().fetch().forEach(bot -> bot.block(10, 10));
|
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) {
|
public void offsets(boolean b) {
|
||||||
Agent agent = TerminatorPlus.getInstance().getManager().getAgent();
|
Agent agent = TerminatorPlus.getInstance().getManager().getAgent();
|
||||||
if (!(agent instanceof LegacyAgent)) {
|
if (!(agent instanceof LegacyAgent)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user