[Added] 1.20.6 Support

[Updated] Some NMS changes.
[Fixed] LaggSpike on 1.20.6 on start due to a deprecated method.
This commit is contained in:
singh 2024-06-08 00:28:51 +05:30
parent c6c8fd5924
commit b6c575c002
8 changed files with 38 additions and 20 deletions

View File

@ -63,7 +63,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -56,10 +56,10 @@
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
<include>**/third_party/net/kyori/**</include>
</includes>
<excludes>
<exclude>**/third_party/org/apache/**</exclude>
<exclude>**/third_party/net/kyori/**</exclude>
<exclude>**/third_party/com/zaxxer/**</exclude>
<exclude>**/third_party/org/jooq/**</exclude>
<exclude>**/third_party/org/mariadb/**</exclude>
@ -95,6 +95,16 @@
<url>https://repo.songoda.com/repository/public/</url>
</repository>
<repository>
<id>bg-repo</id>
<url>https://repo.bg-software.com/repository/api/</url>
</repository>
<repository>
<id>songoda-public</id>
<url>https://repo.songoda.com/repository/minecraft-plugins/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
@ -119,21 +129,21 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>FabledSkyBlock</artifactId>
<version>3.0.4</version>
<version>3.0.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>EpicFarming</artifactId>
<version>4.1.1</version>
<version>4.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -160,8 +170,8 @@
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>
<version>3.5.1</version>
<artifactId>WildStackerAPI</artifactId>
<version>2024.1</version>
<scope>provided</scope>
</dependency>

View File

@ -1,6 +1,6 @@
package com.craftaro.epichoppers.hopper.levels;
import com.craftaro.core.nms.NmsManager;
import com.craftaro.core.nms.Nms;
import com.craftaro.core.nms.nbt.NBTCore;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.epichoppers.hopper.levels.modules.Module;
@ -45,7 +45,7 @@ public class LevelManagerImpl implements LevelManager {
@Override
public boolean isEpicHopper(ItemStack item) {
NBTCore nbt = NmsManager.getNbt();
NBTCore nbt = Nms.getImplementations().getNbt();
if (nbt.of(item).has("level")) {
return true;

View File

@ -8,7 +8,6 @@ import com.craftaro.core.locale.Locale;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.craftaro.epichoppers.hopper.Hopper;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.settings.Settings;
import com.craftaro.epichoppers.utils.Methods;
import com.craftaro.epichoppers.utils.StorageContainerCache;

View File

@ -1,7 +1,7 @@
package com.craftaro.epichoppers.listeners;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.NmsManager;
import com.craftaro.core.nms.Nms;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.settings.Settings;
import com.craftaro.epichoppers.EpicHoppers;
@ -140,12 +140,12 @@ public class HopperListeners implements Listener {
// we need to instead cancel and manually remove the item to move
source.removeItem(moveInstead);
if (sourceLocation != null) {
NmsManager.getWorld().updateAdjacentComparators(sourceLocation.getBlock());
Nms.getImplementations().getWorld().updateAdjacentComparators(sourceLocation.getBlock());
}
// now add it to the hopper
destination.addItem(moveInstead);
if (destinationLocation != null) {
NmsManager.getWorld().updateAdjacentComparators(destinationLocation.getBlock());
Nms.getImplementations().getWorld().updateAdjacentComparators(destinationLocation.getBlock());
}
}
return;

View File

@ -1,7 +1,7 @@
package com.craftaro.epichoppers.tasks;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.epichoppers.boost.BoostData;
import com.craftaro.epichoppers.boost.BoostDataImpl;
import com.craftaro.epichoppers.containers.CustomContainer;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.hopper.levels.modules.ModuleAutoCrafting;
@ -18,6 +18,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Hopper;
import org.bukkit.block.data.Directional;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Minecart;
@ -81,11 +82,19 @@ public class HopTask extends BukkitRunnable {
int maxToMove = hopper.getLevel().getAmount() * (boostData == null ? 1 : boostData.getMultiplier());
// Get hopper state data.
Hopper hopperState = (Hopper) block.getState();
HopperDirection hopperDirection = HopperDirection.getDirection(hopperState.getRawData());
Location pointingLocation = hopperDirection.getLocation(location);
HopperDirection hopperDirection;
Location pointingLocation;
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_20)){
Hopper hopperState = (Hopper) block.getState();
hopperDirection = HopperDirection.getDirection(hopperState.getRawData());
pointingLocation = hopperDirection.getLocation(location);
}
else{
hopperDirection = HopperDirection.valueOf(((Directional) block.getBlockData()).getFacing().name());
BlockFace blockFace = hopperDirection.getDirectionFacing();
pointingLocation = block.getLocation().getBlock().getRelative(blockFace).getLocation();
}
final StorageContainerCache.Cache hopperCache = StorageContainerCache.getCachedInventory(block);
// Create list to hold blocked materials.
List<Material> blockedMaterials = new ArrayList<>();

View File

@ -39,7 +39,7 @@ public enum HopperDirection {
return location.clone().add(getX(), getY(), getZ());
}
public BlockFace getDirection() {
public BlockFace getDirectionFacing() {
switch (this) {
case NORTH:
return BlockFace.NORTH;

View File

@ -20,7 +20,7 @@
<url>https://craftaro.com/marketplace/product/15</url>
<properties>
<craftaro.coreVersion>3.0.0-SNAPSHOT</craftaro.coreVersion>
<craftaro.coreVersion>3.0.7-SNAPSHOT</craftaro.coreVersion>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.target>1.8</maven.compiler.target>