Updated gradle from 7.4 to latest (8.11.1) + required build.gradle.kts changes

Updated minecraft version from 1.20.4 to 1.21.1.
Updated java from 17 to 21.
Bumped up version from 4.4.0-BETA to 4.5.0-BETA.

Added damageSource to botDeathEvent as it is now required for 1.21.
Added boolean (false) to comonListenerCookie.createInitial as this is now required.
Updated addEntityPacket method to take all required arguments.
Updated overridden setListener method to setListenerForServerboundHandshake as it seems this is the new method required (needs to be tested).

Updated imports to use org.bukkit.craftbukkit instead of org.bukkit.craftbukkit .v1_20_r3 (it seems craftbukkit updated and versioning is not required anymore).
This commit is contained in:
Fish
2024-11-30 13:43:15 +01:00
parent 673451779a
commit 9d3db734bc
16 changed files with 77 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
plugins {
`java-library`
id("io.papermc.paperweight.userdev") version "1.3.7"
id("io.papermc.paperweight.userdev") version "1.7.5"
id("net.nuggetmc.java-conventions")
}
@@ -9,11 +9,11 @@ description = "TerminatorPlus"
java {
// Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
dependencies {
paperDevBundle("1.20.4-R0.1-SNAPSHOT")
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
//add the TerminatorPlus-API module
implementation(project(":TerminatorPlus-API"))
@@ -30,7 +30,7 @@ tasks {
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
options.release.set(21)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything

View File

@@ -12,7 +12,7 @@ import java.util.Arrays;
public class TerminatorPlus extends JavaPlugin {
public static final String REQUIRED_VERSION = "1.20.4";
public static final String REQUIRED_VERSION = "1.21.1";
private static TerminatorPlus instance;
private static String version;

View File

@@ -38,11 +38,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_20_R3.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Damageable;
import org.bukkit.entity.Player;
@@ -112,7 +112,7 @@ public class Bot extends ServerPlayer implements Terminator {
Bot bot = new Bot(nmsServer, nmsWorld, profile, addPlayerList);
bot.connection = new ServerGamePacketListenerImpl(nmsServer, new MockConnection(), bot, CommonListenerCookie.createInitial(bot.getGameProfile()));
bot.connection = new ServerGamePacketListenerImpl(nmsServer, new MockConnection(), bot, CommonListenerCookie.createInitial(bot.getGameProfile(), false));
bot.setPos(loc.getX(), loc.getY(), loc.getZ());
bot.setRot(loc.getYaw(), loc.getPitch());
@@ -211,7 +211,7 @@ public class Bot extends ServerPlayer implements Terminator {
private Packet<?>[] getRenderPacketsNoInfo() {
return new Packet[]{
new ClientboundAddEntityPacket(this),
new ClientboundAddEntityPacket(this.getId(), this.getUUID(), this.getX(), this.getY(), this.getZ(), this.getXRot(), this.getYRot(), this.getType(), 0, this.getDeltaMovement(), this.getYHeadRot()),
//new ClientboundSetEntityDataPacket(this.getId(), this.entityData, true),
new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this),
new ClientboundSetEntityDataPacket(this.getId(), this.entityData.packDirty()),

View File

@@ -12,7 +12,7 @@ import net.nuggetmc.tplus.api.event.BotDeathEvent;
import net.nuggetmc.tplus.api.utils.MojangAPI;
import org.bukkit.*;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

View File

@@ -4,7 +4,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
import net.nuggetmc.tplus.api.InternalBridge;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class InternalBridgeImpl implements InternalBridge {

View File

@@ -13,7 +13,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_20_R3.CraftServer;
import org.bukkit.craftbukkit.CraftServer;
import java.lang.reflect.Method;
import java.util.ArrayList;

View File

@@ -57,7 +57,7 @@ public class MockConnection extends Connection {
}
@Override
public void setListener(@NotNull PacketListener packetListener) {
public void setListenerForServerboundHandshake(@NotNull PacketListener packetListener) {
try {
PACKET_LISTENER_FIELD.set(this, packetListener);
DISCONNECT_LISTENER_FIELD.set(this, null);