Skip to content

Commit

Permalink
Changed minimum supported MC version to 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelli committed Nov 5, 2024
1 parent 011865d commit 2654562
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 251 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<version>1.21.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
32 changes: 22 additions & 10 deletions src/main/java/net/coreprotect/bukkit/BukkitAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.FaceAttachable;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
Expand Down Expand Up @@ -49,10 +50,8 @@ public static void loadAdapter() {
case BUKKIT_V1_13:
case BUKKIT_V1_14:
case BUKKIT_V1_15:
BukkitAdapter.ADAPTER = new BukkitAdapter();
break;
case BUKKIT_V1_16:
BukkitAdapter.ADAPTER = new Bukkit_v1_16();
BukkitAdapter.ADAPTER = new BukkitAdapter();
break;
case BUKKIT_V1_17:
BukkitAdapter.ADAPTER = new Bukkit_v1_17();
Expand Down Expand Up @@ -105,18 +104,31 @@ public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<Strin

@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof Directional) {
return (scanMin < 5 && scanBlock.getRelative(((Directional) blockData).getFacing().getOppositeFace()).getLocation().equals(block.getLocation()));
if (blockData instanceof Directional && blockData instanceof FaceAttachable) {
Directional directional = (Directional) blockData;
FaceAttachable faceAttachable = (FaceAttachable) blockData;

boolean scanButton = false;
switch (faceAttachable.getAttachedFace()) {
case WALL:
scanButton = (scanMin < 5 && scanBlock.getRelative(directional.getFacing().getOppositeFace()).getLocation().equals(block.getLocation()));
break;
case FLOOR:
scanButton = (scanMin == 5);
break;
case CEILING:
scanButton = (scanMin == 6);
break;
default:
break;
}

return scanButton;
}

return true; // unvalidated attachments default to true
}

@Override
public boolean isWall(BlockData blockData) {
return false;
}

@Override
public int getMinHeight(World world) {
return 0;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/coreprotect/bukkit/BukkitInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public interface BukkitInterface {

public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin);

public boolean isWall(BlockData blockData);

public boolean isItemFrame(Material material);

public boolean isGlowing(Sign sign, boolean isFront);
Expand Down
118 changes: 0 additions & 118 deletions src/main/java/net/coreprotect/bukkit/Bukkit_v1_16.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/net/coreprotect/bukkit/Bukkit_v1_17.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Util;

public class Bukkit_v1_17 extends Bukkit_v1_16 implements BukkitInterface {
public class Bukkit_v1_17 extends BukkitAdapter implements BukkitInterface {

public Bukkit_v1_17() {
BlockGroup.TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.GLOW_LICHEN));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/coreprotect/config/ConfigHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ConfigHandler extends Queue {
public static final String EDITION_NAME = Util.getPluginName();
public static final String COMMUNITY_EDITION = "Community Edition";
public static final String JAVA_VERSION = "11.0";
public static final String MINECRAFT_VERSION = "1.15";
public static final String MINECRAFT_VERSION = "1.16";
public static final String LATEST_VERSION = "1.21";
public static String path = "plugins/CoreProtect/";
public static String sqlite = "database.db";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Piglin;
import org.bukkit.entity.Player;
import org.bukkit.entity.Raider;
import org.bukkit.entity.Sheep;
Expand All @@ -50,6 +51,7 @@
import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zoglin;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.ZombieVillager;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -509,12 +511,20 @@ else if (entity instanceof ChestedHorse) {
}
}
}
if (entity instanceof Bee) {
else if (entity instanceof Bee) {
Bee bee = (Bee) entity;
info.add(bee.getAnger());
info.add(bee.hasNectar());
info.add(bee.hasStung());
}
else if (entity instanceof Piglin) {
Piglin piglin = (Piglin) entity;
info.add(piglin.isBaby());
}
else if (entity instanceof Zoglin) {
Zoglin zoglin = (Zoglin) entity;
info.add(zoglin.isBaby());
}
else {
BukkitAdapter.ADAPTER.getEntityMeta(entity, info);
}
Expand Down
Loading

0 comments on commit 2654562

Please sign in to comment.