mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-26 12:16:30 +01:00
Merge branch 'development' into 'master'
Fix island setspawn issue, better support for epicspawners and wildstacker in island level See merge request Songoda/fabledskyblock!13
This commit is contained in:
commit
15d4d29f9a
@ -297,11 +297,11 @@ public class Island {
|
||||
public void setLocation(IslandWorld world, IslandEnvironment environment, Location location) {
|
||||
for (IslandLocation islandLocationList : islandLocations) {
|
||||
if (islandLocationList.getWorld() == world && islandLocationList.getEnvironment() == environment) {
|
||||
Bukkit.getServer().getPluginManager()
|
||||
.callEvent(new IslandLocationChangeEvent(getAPIWrapper(),
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () ->
|
||||
Bukkit.getServer().getPluginManager().callEvent(new IslandLocationChangeEvent(getAPIWrapper(),
|
||||
new me.goodandevil.skyblock.api.island.IslandLocation(
|
||||
APIUtil.fromImplementation(environment), APIUtil.fromImplementation(world),
|
||||
location)));
|
||||
location))));
|
||||
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class LevellingManager {
|
||||
Location location = new Location(world, chunkSnapshotList.getX() * 16 + x, y, chunkSnapshotList.getZ() * 16 + z);
|
||||
if (stackableManager.isStacked(location)) {
|
||||
Stackable stackable = stackableManager.getStack(location, blockMaterial);
|
||||
amount += stackable.getSize();
|
||||
amount = stackable.getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -322,12 +322,12 @@ public class LevellingManager {
|
||||
|
||||
private Materials getMaterials() {
|
||||
if (this.spawnerType != null) {
|
||||
return Materials.fromString("SPAWNER_" + this.spawnerType.name());
|
||||
return Materials.getSpawner(this.spawnerType);
|
||||
}
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 12) {
|
||||
try {
|
||||
return Materials.fromString(material.name());
|
||||
return Materials.fromString(this.material.name());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,12 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||
@ -157,7 +160,7 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
org.bukkit.block.Block block = event.getBlock();
|
||||
@ -223,12 +226,24 @@ public class Block implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.isCancelled() || !configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||
if (!configLoad.getBoolean("Island.Block.Level.Enable"))
|
||||
return;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||
|
||||
if (materials == null) return;
|
||||
if (materials.equals(Materials.SPAWNER)) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") || Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
|
||||
return;
|
||||
|
||||
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
|
||||
EntityType spawnerType = creatureSpawner.getSpawnedType();
|
||||
materials = Materials.getSpawner(spawnerType);
|
||||
}
|
||||
|
||||
if (materials == null)
|
||||
return;
|
||||
|
||||
long materialAmount = 0;
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
|
@ -13,6 +13,7 @@ import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
import me.goodandevil.skyblock.utils.world.LocationUtil;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -31,6 +32,7 @@ import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@ -563,9 +565,10 @@ public class Entity implements Listener {
|
||||
LivingEntity livingEntity = event.getEntity();
|
||||
|
||||
// Certain entities shouldn't drop twice the amount
|
||||
if (livingEntity instanceof Player ||
|
||||
livingEntity instanceof ArmorStand ||
|
||||
livingEntity instanceof Horse) {
|
||||
if (livingEntity instanceof Player
|
||||
|| livingEntity instanceof ArmorStand
|
||||
|| livingEntity instanceof Horse
|
||||
|| livingEntity instanceof ElderGuardian) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -573,11 +576,20 @@ public class Entity implements Listener {
|
||||
if (livingEntity instanceof Donkey || livingEntity instanceof Mule)
|
||||
return;
|
||||
}
|
||||
|
||||
if (livingEntity.hasMetadata("SkyBlock")) {
|
||||
return;
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 10) {
|
||||
if (livingEntity instanceof Evoker)
|
||||
return;
|
||||
}
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 13) {
|
||||
if (livingEntity instanceof Ravager || livingEntity instanceof Illager)
|
||||
return;
|
||||
}
|
||||
|
||||
if (livingEntity.hasMetadata("SkyBlock"))
|
||||
return;
|
||||
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
|
||||
if (skyblock.getWorldManager().isIslandWorld(livingEntity.getWorld())) {
|
||||
@ -586,15 +598,34 @@ public class Entity implements Listener {
|
||||
if (island != null) {
|
||||
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Drops);
|
||||
|
||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
|
||||
&& island.isUpgrade(Upgrade.Type.Drops)) {
|
||||
List<ItemStack> entityDrops = event.getDrops();
|
||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.Drops)) {
|
||||
Set<ItemStack> dontMultiply = new HashSet<>();
|
||||
|
||||
if (entityDrops != null) {
|
||||
for (ItemStack is : entityDrops) {
|
||||
is.setAmount(is.getAmount() * 2);
|
||||
if (NMSUtil.getVersionNumber() > 8) {
|
||||
EntityEquipment equipment = livingEntity.getEquipment();
|
||||
if (equipment != null) {
|
||||
for (ItemStack item : event.getDrops()) {
|
||||
if (item.equals(equipment.getHelmet())
|
||||
|| item.equals(equipment.getChestplate())
|
||||
|| item.equals(equipment.getLeggings())
|
||||
|| item.equals(equipment.getBoots())
|
||||
|| item.equals(equipment.getItemInMainHand())
|
||||
|| item.equals(equipment.getItemInOffHand())) {
|
||||
dontMultiply.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (livingEntity instanceof Pig) {
|
||||
Pig pig = (Pig) livingEntity;
|
||||
if (pig.hasSaddle())
|
||||
dontMultiply.add(new ItemStack(Material.SADDLE, 1));
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack is : event.getDrops())
|
||||
if (!dontMultiply.contains(is))
|
||||
is.setAmount(is.getAmount() * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.goodandevil.skyblock.listeners;
|
||||
|
||||
import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
|
||||
import com.songoda.epicspawners.api.events.SpawnerChangeEvent;
|
||||
import com.songoda.epicspawners.api.events.SpawnerPlaceEvent;
|
||||
import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.config.FileManager;
|
||||
@ -9,10 +10,12 @@ import me.goodandevil.skyblock.island.IslandLevel;
|
||||
import me.goodandevil.skyblock.island.IslandManager;
|
||||
import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.io.File;
|
||||
@ -25,8 +28,44 @@ public class EpicSpawners implements Listener {
|
||||
this.skyblock = skyblock;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerPlace(SpawnerPlaceEvent event) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), () -> {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Location location = event.getSpawner().getLocation();
|
||||
if (!worldManager.isIslandWorld(location.getWorld())) return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
int amount = event.getSpawner().getFirstStack().getStackSize();
|
||||
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
Materials materials = Materials.getSpawner(spawnerType);
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
long materialAmount = 0;
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + amount);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerChange(SpawnerChangeEvent event) {
|
||||
if (event.getChange() != SpawnerChangeEvent.ChangeType.STACK_SIZE)
|
||||
return;
|
||||
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
@ -35,7 +74,7 @@ public class EpicSpawners implements Listener {
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
int amount = event.getSpawner().getFirstStack().getStackSize();
|
||||
int amount = event.getStackSize() - event.getOldStackSize();
|
||||
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
@ -51,12 +90,16 @@ public class EpicSpawners implements Listener {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + amount);
|
||||
if (materialAmount + amount <= 0) {
|
||||
level.removeMaterial(materials.name());
|
||||
} else {
|
||||
level.setMaterialAmount(materials.name(), materialAmount + amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerBreak(SpawnerBreakEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
@ -47,7 +48,7 @@ public class Interact implements Listener {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
org.bukkit.block.Block block = event.getClickedBlock();
|
||||
@ -409,7 +410,7 @@ public class Interact implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if ((event.getItem() != null) && (event.getItem().getType() != Material.AIR)) {
|
||||
if ((event.getItem() != null) && (event.getItem().getType() != Material.AIR) && !event.isCancelled()) {
|
||||
if (event.getItem().getType() == Material.BUCKET || event.getItem().getType() == Material.WATER_BUCKET
|
||||
|| event.getItem().getType() == Material.LAVA_BUCKET) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||
@ -462,9 +463,7 @@ public class Interact implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
|
||||
{
|
||||
} else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
if (player.getTargetBlock((Set<Material>) null, 5).getType() == Material.FIRE) {
|
||||
if (!islandManager.hasPermission(player, block.getLocation(), "Fire")) {
|
||||
event.setCancelled(true);
|
||||
@ -817,7 +816,7 @@ public class Interact implements Listener {
|
||||
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void PlayerInteractEvent(PlayerArmorStandManipulateEvent event) {
|
||||
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
|
||||
if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(event.getRightClicked().getLocation().getBlock().getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package me.goodandevil.skyblock.listeners;
|
||||
|
||||
import com.bgsoftware.wildstacker.api.events.BarrelPlaceEvent;
|
||||
import com.bgsoftware.wildstacker.api.events.BarrelStackEvent;
|
||||
import com.bgsoftware.wildstacker.api.events.BarrelUnstackEvent;
|
||||
import com.bgsoftware.wildstacker.api.events.SpawnerPlaceEvent;
|
||||
import com.bgsoftware.wildstacker.api.events.SpawnerStackEvent;
|
||||
import com.bgsoftware.wildstacker.api.events.SpawnerUnstackEvent;
|
||||
import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.config.FileManager;
|
||||
@ -10,11 +14,13 @@ import me.goodandevil.skyblock.island.IslandManager;
|
||||
import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,7 +33,79 @@ public class WildStacker implements Listener {
|
||||
this.skyblock = skyblock;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBarrelPlace(BarrelPlaceEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Location location = event.getBarrel().getLocation();
|
||||
if (!worldManager.isIslandWorld(location.getWorld())) return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
Material material = event.getBarrel().getType();
|
||||
byte data = (byte) event.getBarrel().getData();
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 12 && material.name().startsWith("LEGACY_")) {
|
||||
material = Material.matchMaterial(material.name().replace("LEGACY_", ""));
|
||||
data = 0;
|
||||
}
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
Materials materials = Materials.getMaterials(material, data);
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
long materialAmount = 0;
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + event.getBarrel().getStackAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBarrelStack(BarrelStackEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Location location = event.getBarrel().getLocation();
|
||||
if (!worldManager.isIslandWorld(location.getWorld())) return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
Material material = event.getBarrel().getType();
|
||||
byte data = (byte) event.getBarrel().getData();
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 12 && material.name().startsWith("LEGACY_")) {
|
||||
material = Material.matchMaterial(material.name().replace("LEGACY_", ""));
|
||||
data = 0;
|
||||
}
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
Materials materials = Materials.getMaterials(material, data);
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
long materialAmount = 0;
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + event.getTarget().getStackAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBarrelUnstack(BarrelUnstackEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
@ -66,7 +144,67 @@ public class WildStacker implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerPlace(SpawnerPlaceEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Location location = event.getSpawner().getLocation();
|
||||
if (!worldManager.isIslandWorld(location.getWorld())) return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
EntityType spawnerType = event.getSpawner().getSpawnedType();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
Materials materials = Materials.getSpawner(spawnerType);
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
long materialAmount = 0;
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + event.getSpawner().getStackAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerStack(SpawnerStackEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Location location = event.getSpawner().getLocation();
|
||||
if (!worldManager.isIslandWorld(location.getWorld())) return;
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(location);
|
||||
|
||||
EntityType spawnerType = event.getSpawner().getSpawnedType();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
|
||||
Materials materials = Materials.getSpawner(spawnerType);
|
||||
if (materials != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
long materialAmount = 0;
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
materialAmount = level.getMaterialAmount(materials.name());
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + event.getTarget().getStackAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSpawnerUnstack(SpawnerUnstackEvent event) {
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
@ -1243,8 +1243,11 @@ public enum Materials {
|
||||
if (mat != null)
|
||||
return mat;
|
||||
|
||||
if (old13Mat != null)
|
||||
return Material.matchMaterial(old13Mat);
|
||||
if (old13Mat != null) {
|
||||
mat = Material.matchMaterial(old13Mat);
|
||||
if (mat != null)
|
||||
return mat;
|
||||
}
|
||||
|
||||
return Material.matchMaterial(old12Mat);
|
||||
}
|
||||
|
@ -388,6 +388,7 @@ public final class BlockUtil {
|
||||
} else {
|
||||
skull.setOwner(blockData.getSkullOwner());
|
||||
}
|
||||
skull.update();
|
||||
} else {
|
||||
if (NMSVersion > 8) {
|
||||
if (blockTypeState == BlockStateType.ENDGATEWAY) {
|
||||
|
@ -4,7 +4,7 @@ version: @version@
|
||||
api-version: 1.13
|
||||
description: A unique SkyBlock plugin
|
||||
author: Songoda
|
||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault, LeaderHeads, WildStacker]
|
||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault, LeaderHeads, EpicSpawners, WildStacker]
|
||||
loadbefore: [Multiverse-Core]
|
||||
commands:
|
||||
island:
|
||||
|
Loading…
Reference in New Issue
Block a user