mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 02:35:25 +01:00
Fixed blocklevel issue.
Added EpicSpawners support.
This commit is contained in:
parent
2ce9e1d187
commit
8e929906df
5
pom.xml
5
pom.xml
@ -49,6 +49,11 @@
|
||||
<artifactId>leaderheads</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>epicspawners</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
|
@ -1,21 +1,5 @@
|
||||
package me.goodandevil.skyblock.levelling;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.api.event.island.IslandLevelChangeEvent;
|
||||
import me.goodandevil.skyblock.config.FileManager.Config;
|
||||
@ -26,6 +10,23 @@ import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class LevellingManager {
|
||||
|
||||
@ -51,7 +52,7 @@ public class LevellingManager {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
if (chunk.isComplete()) {
|
||||
if (!chunk.isComplete()) return;
|
||||
cancel();
|
||||
|
||||
Map<String, Integer> materials = new HashMap<>();
|
||||
@ -109,25 +110,37 @@ public class LevellingManager {
|
||||
blockData = (int) getBlockTypeDataMethod.invoke(chunkSnapshotList, x, y, z);
|
||||
}
|
||||
|
||||
if (blockMaterial != org.bukkit.Material.AIR) {
|
||||
if (blockMaterial == org.bukkit.Material.AIR) continue;
|
||||
|
||||
for (Material materialList : materialStorage) {
|
||||
if (materialList == null) continue;
|
||||
ItemStack is = materialList.getItemStack();
|
||||
|
||||
if (blockMaterial == materialList.getItemStack().getType()) {
|
||||
if (blockMaterial != materialList.getItemStack().getType()) continue;
|
||||
if (NMSVersion < 13) {
|
||||
if (!(blockData == is.getDurability())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int amount = 1;
|
||||
if (blockMaterial == Materials.SPAWNER.parseMaterial()
|
||||
&& Bukkit.getPluginManager().isPluginEnabled("EpicSpawners")) {
|
||||
World world = Bukkit.getWorld(chunkSnapshotList.getWorldName());
|
||||
com.songoda.epicspawners.api.EpicSpawners epicSpawners =
|
||||
com.songoda.epicspawners.api.EpicSpawnersAPI.getImplementation();
|
||||
Location location = new Location(world, chunkSnapshotList.getX() * 16 + x, y, chunkSnapshotList.getZ() * 16 + z);
|
||||
if (epicSpawners.getSpawnerManager().isSpawner(location)) {
|
||||
amount = epicSpawners.getSpawnerManager()
|
||||
.getSpawnerFromWorld(location).getSpawnerDataCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (materials.containsKey(materialList.getMaterials().name())) {
|
||||
materials.put(materialList.getMaterials().name(),
|
||||
materials.get(materialList.getMaterials().name()) + 1);
|
||||
materials.get(materialList.getMaterials().name()) + amount);
|
||||
} else {
|
||||
materials.put(materialList.getMaterials().name(), 1);
|
||||
}
|
||||
}
|
||||
materials.put(materialList.getMaterials().name(), amount);
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException | IllegalArgumentException
|
||||
@ -160,7 +173,6 @@ public class LevellingManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(skyblock, 0L, 1L);
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,8 @@ public class Block implements Listener {
|
||||
@SuppressWarnings("deprecation")
|
||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
Bukkit.broadcastMessage("testt");
|
||||
|
||||
if (materials == null) return;
|
||||
|
||||
IslandLevel level = island.getLevel();
|
||||
@ -169,7 +171,8 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.isCancelled() || configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||
if (event.isCancelled() || !configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
|
@ -198,7 +198,7 @@ Island:
|
||||
Level:
|
||||
# When enabled, any changes to a block will be made to the levelling materials
|
||||
# calculated for an island.
|
||||
Enable: false
|
||||
Enable: true
|
||||
Piston:
|
||||
# Prevent Piston blocks being retracted or extended when connected to a circuit
|
||||
# [!] Prevents Pistons extending out of Island border bug
|
||||
|
Loading…
Reference in New Issue
Block a user