Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 1.20.6 & 1.21 #89

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ repositories {
}

dependencies {
implementation("plugily.projects:MiniGamesBox-Classic:1.3.12") { isTransitive = false }
implementation("plugily.projects:MiniGamesBox-Classic:1.3.13") { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("net.citizensnpcs:citizensapi:2.0.31-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}

group = "plugily.projects"
version = "5.0.10"
version = "5.0.10-SNAPSHOT1"
description = "BuildBattle"

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void onNPCClick(PlugilyPlayerInteractEntityEvent event) {
if(playerPlot != null) {

// Prevent "Legacy material support initialisation"
playerPlot.changeFloor(material, ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1) ? hand.getData().getData() : 0);
playerPlot.changeFloor(material, ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12) ? hand.getData().getData() : 0);
new MessageBuilder("MENU_OPTION_CONTENT_FLOOR_CHANGED").asKey().player(event.getPlayer()).sendPlayer();
}
}
Expand Down Expand Up @@ -340,7 +340,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
plot.addEntity();
event.setCancelled(false);

if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_9_R1)) {
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_9)) {
event.getEntity().setAI(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre
World minWorld = minPoint.getWorld();

if(minWorld != null) {
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15_R1) ?
Biome biome = ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15) ?
minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockY(), minPoint.getBlockZ())
: minWorld.getBiome(minPoint.getBlockX(), minPoint.getBlockZ());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void resetPlot() {
}

for(Chunk chunk : cuboid.chunkList()) {
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15_R1)) {
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
continue;
}
Expand All @@ -235,7 +235,7 @@ public void resetPlot() {
changeFloor(defaultFloor.parseMaterial());

if(centerWorld != null) {
if(ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15_R1)) {
if(ServerVersion.Version.isCurrentHigher(ServerVersion.Version.v1_15)) {
Location min = cuboid.getMinPoint();
Location max = cuboid.getMaxPoint();

Expand Down Expand Up @@ -307,7 +307,7 @@ public void changeFloor(Material material, byte data) {
Block block = maxWorld.getBlockAt(x, y, z);
block.setType(material);

if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
try {
Block.class.getMethod("setData", byte.class).invoke(block, data);
} catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public ItemStack buildBanner() {
ItemStack item = XMaterial.WHITE_BANNER.parseItem();
BannerMeta meta = (BannerMeta) item.getItemMeta();

if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
meta.setBaseColor(color);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void prepareBaseStageGui() {
for(DyeColor color : DyeColor.values()) {
ItemStack item;

if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12_R1)) {
if(ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_12)) {
item = XMaterial.WHITE_BANNER.parseItem();
BannerMeta meta = (BannerMeta) item.getItemMeta();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void onClick(InventoryClickEvent event) {
}

for(Chunk chunk : plot.getCuboid().chunkList()) {
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15_R1)) {
if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_15)) {
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public class ChunkManager {
private static Constructor<?> mapChunkConstructor;

static {
if (ServerVersion.Version.isCurrentLower(ServerVersion.Version.v1_18_R1)) {
if (ServerVersion.Version.isCurrentLower(ServerVersion.Version.v1_18)) {
packetPlayOutMapChunk = PacketUtils.classByName("net.minecraft.network.protocol.game", "PacketPlayOutMapChunk");
chunkClass = PacketUtils.classByName("net.minecraft.world.level.chunk", "Chunk");

if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17_R1)) {
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17)) {
try {
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(PacketUtils.classByName("net.minecraft.world.level.chunk", "LevelChunk"));
} catch (NoSuchMethodException e) {
Expand All @@ -58,26 +58,26 @@ public class ChunkManager {
}

public static void sendMapChunk(Player player, Chunk chunk) {
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_18_R1)) {
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_18)) {
return; // Should just use World#refreshChunk instead
}

try {
Method chunkHandleMethod = chunk.getClass().getMethod("getHandle");
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17_R1)) {
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_17)) {
PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk)));
return;
}

if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_16_R1)) {
if (ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_16)) {
if (mapChunkConstructor == null)
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass, int.class, boolean.class);

PacketUtils.sendPacket(player, mapChunkConstructor.newInstance(chunkHandleMethod.invoke(chunk), 65535, false));
return;
}

if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_10_R2)) {
if (ServerVersion.Version.isCurrentEqualOrLower(ServerVersion.Version.v1_10)) {
if (mapChunkConstructor == null)
mapChunkConstructor = packetPlayOutMapChunk.getConstructor(chunkClass, boolean.class, int.class);

Expand Down