mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-09-03 02:20:55 +02:00
Fix version token parsing, spawner & stackable fix, water/lava fix
This commit is contained in:
parent
1b824278ac
commit
b45446d13c
|
@ -37,8 +37,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
filter ReplaceTokens, tokens: ["version": project.property("version")]
|
|
||||||
from (sourceSets.main.resources.srcDirs) {
|
from (sourceSets.main.resources.srcDirs) {
|
||||||
include '**/*.yml'
|
include '**/*.yml'
|
||||||
|
filter ReplaceTokens, tokens: ["version": project.property("version")]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,11 @@ import me.goodandevil.skyblock.utils.version.Materials;
|
||||||
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||||
import me.goodandevil.skyblock.world.WorldManager;
|
import me.goodandevil.skyblock.world.WorldManager;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChunkSnapshot;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
@ -22,7 +26,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class LevellingManager {
|
public class LevellingManager {
|
||||||
|
@ -63,6 +71,13 @@ public class LevellingManager {
|
||||||
|
|
||||||
Map<LevellingData, Long> levellingData = new HashMap<>();
|
Map<LevellingData, Long> levellingData = new HashMap<>();
|
||||||
|
|
||||||
|
List<Material> blacklistedMaterials = new ArrayList<>();
|
||||||
|
blacklistedMaterials.add(Materials.AIR.getPostMaterial());
|
||||||
|
blacklistedMaterials.add(Materials.WATER.getPostMaterial());
|
||||||
|
blacklistedMaterials.add(Materials.LEGACY_STATIONARY_WATER.getPostMaterial());
|
||||||
|
blacklistedMaterials.add(Materials.LAVA.getPostMaterial());
|
||||||
|
blacklistedMaterials.add(Materials.LEGACY_STATIONARY_LAVA.getPostMaterial());
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -118,7 +133,7 @@ public class LevellingManager {
|
||||||
blockData = (int) getBlockTypeDataMethod.invoke(chunkSnapshotList, x, y, z);
|
blockData = (int) getBlockTypeDataMethod.invoke(chunkSnapshotList, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockMaterial == org.bukkit.Material.AIR)
|
if (blacklistedMaterials.contains(blockMaterial))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
long amount = 1;
|
long amount = 1;
|
||||||
|
@ -134,14 +149,18 @@ public class LevellingManager {
|
||||||
amount = spawner.getSpawnerDataCount();
|
amount = spawner.getSpawnerDataCount();
|
||||||
spawnerType = spawner.getCreatureSpawner().getSpawnedType();
|
spawnerType = spawner.getCreatureSpawner().getSpawnedType();
|
||||||
}
|
}
|
||||||
} else if (isWildStackerEnabled) {
|
}
|
||||||
|
|
||||||
|
if (isWildStackerEnabled && spawnerType == null) {
|
||||||
com.bgsoftware.wildstacker.api.handlers.SystemManager wildStacker = com.bgsoftware.wildstacker.api.WildStackerAPI.getWildStacker().getSystemManager();
|
com.bgsoftware.wildstacker.api.handlers.SystemManager wildStacker = com.bgsoftware.wildstacker.api.WildStackerAPI.getWildStacker().getSystemManager();
|
||||||
if (wildStacker.isStackedSpawner(location.getBlock())) {
|
if (wildStacker.isStackedSpawner(location.getBlock())) {
|
||||||
com.bgsoftware.wildstacker.api.objects.StackedSpawner spawner = wildStacker.getStackedSpawner(location);
|
com.bgsoftware.wildstacker.api.objects.StackedSpawner spawner = wildStacker.getStackedSpawner(location);
|
||||||
amount = spawner.getStackAmount();
|
amount = spawner.getStackAmount();
|
||||||
spawnerType = spawner.getSpawnedType();
|
spawnerType = spawner.getSpawnedType();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (spawnerType == null) {
|
||||||
spawnerType = ((CreatureSpawner) location.getBlock().getState()).getSpawnedType();
|
spawnerType = ((CreatureSpawner) location.getBlock().getState()).getSpawnedType();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -159,12 +178,14 @@ public class LevellingManager {
|
||||||
blockData = 0;
|
blockData = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (stackableManager != null && stackableManager.getStackableMaterials().contains(blockMaterial)) {
|
}
|
||||||
|
|
||||||
|
if (stackableManager != null && stackableManager.getStackableMaterials().contains(blockMaterial) && amount == 1) {
|
||||||
World world = Bukkit.getWorld(chunkSnapshotList.getWorldName());
|
World world = Bukkit.getWorld(chunkSnapshotList.getWorldName());
|
||||||
Location location = new Location(world, chunkSnapshotList.getX() * 16 + x, y, chunkSnapshotList.getZ() * 16 + z);
|
Location location = new Location(world, chunkSnapshotList.getX() * 16 + x, y, chunkSnapshotList.getZ() * 16 + z);
|
||||||
if (stackableManager.isStacked(location)) {
|
if (stackableManager.isStacked(location)) {
|
||||||
Stackable stackable = stackableManager.getStack(location, blockMaterial);
|
Stackable stackable = stackableManager.getStack(location, blockMaterial);
|
||||||
amount = stackable.getSize();
|
amount += stackable.getSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,7 +328,8 @@ public class LevellingManager {
|
||||||
if (NMSUtil.getVersionNumber() > 12) {
|
if (NMSUtil.getVersionNumber() > 12) {
|
||||||
try {
|
try {
|
||||||
return Materials.fromString(material.name());
|
return Materials.fromString(material.name());
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Materials.getMaterials(this.material, this.data);
|
return Materials.getMaterials(this.material, this.data);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user