[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> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version> <version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

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

View File

@ -1,6 +1,6 @@
package com.craftaro.epichoppers.hopper.levels; 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.nms.nbt.NBTCore;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.epichoppers.hopper.levels.modules.Module; import com.craftaro.epichoppers.hopper.levels.modules.Module;
@ -45,7 +45,7 @@ public class LevelManagerImpl implements LevelManager {
@Override @Override
public boolean isEpicHopper(ItemStack item) { public boolean isEpicHopper(ItemStack item) {
NBTCore nbt = NmsManager.getNbt(); NBTCore nbt = Nms.getImplementations().getNbt();
if (nbt.of(item).has("level")) { if (nbt.of(item).has("level")) {
return true; 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.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.craftaro.epichoppers.hopper.Hopper; import com.craftaro.epichoppers.hopper.Hopper;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.settings.Settings; import com.craftaro.epichoppers.settings.Settings;
import com.craftaro.epichoppers.utils.Methods; import com.craftaro.epichoppers.utils.Methods;
import com.craftaro.epichoppers.utils.StorageContainerCache; import com.craftaro.epichoppers.utils.StorageContainerCache;

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
<url>https://craftaro.com/marketplace/product/15</url> <url>https://craftaro.com/marketplace/product/15</url>
<properties> <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.release>8</maven.compiler.release>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>