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:
Esophose 2019-05-05 22:02:45 +00:00
commit 15d4d29f9a
10 changed files with 266 additions and 36 deletions

View File

@ -297,11 +297,11 @@ public class Island {
public void setLocation(IslandWorld world, IslandEnvironment environment, Location location) { public void setLocation(IslandWorld world, IslandEnvironment environment, Location location) {
for (IslandLocation islandLocationList : islandLocations) { for (IslandLocation islandLocationList : islandLocations) {
if (islandLocationList.getWorld() == world && islandLocationList.getEnvironment() == environment) { if (islandLocationList.getWorld() == world && islandLocationList.getEnvironment() == environment) {
Bukkit.getServer().getPluginManager() Bukkit.getScheduler().runTaskAsynchronously(skyblock, () ->
.callEvent(new IslandLocationChangeEvent(getAPIWrapper(), Bukkit.getServer().getPluginManager().callEvent(new IslandLocationChangeEvent(getAPIWrapper(),
new me.goodandevil.skyblock.api.island.IslandLocation( new me.goodandevil.skyblock.api.island.IslandLocation(
APIUtil.fromImplementation(environment), APIUtil.fromImplementation(world), APIUtil.fromImplementation(environment), APIUtil.fromImplementation(world),
location))); location))));
FileManager fileManager = skyblock.getFileManager(); FileManager fileManager = skyblock.getFileManager();

View File

@ -185,7 +185,7 @@ public class LevellingManager {
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();
} }
} }
} }
@ -322,12 +322,12 @@ public class LevellingManager {
private Materials getMaterials() { private Materials getMaterials() {
if (this.spawnerType != null) { if (this.spawnerType != null) {
return Materials.fromString("SPAWNER_" + this.spawnerType.name()); return Materials.getSpawner(this.spawnerType);
} }
if (NMSUtil.getVersionNumber() > 12) { if (NMSUtil.getVersionNumber() > 12) {
try { try {
return Materials.fromString(material.name()); return Materials.fromString(this.material.name());
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }

View File

@ -17,9 +17,12 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
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.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityCreatePortalEvent; 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) { public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
org.bukkit.block.Block block = event.getBlock(); 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") @SuppressWarnings("deprecation")
Materials materials = Materials.getMaterials(block.getType(), block.getData()); 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; long materialAmount = 0;
IslandLevel level = island.getLevel(); IslandLevel level = island.getLevel();

View File

@ -13,6 +13,7 @@ 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.utils.world.LocationUtil; import me.goodandevil.skyblock.utils.world.LocationUtil;
import me.goodandevil.skyblock.world.WorldManager; import me.goodandevil.skyblock.world.WorldManager;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; 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.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.event.player.PlayerShearEntityEvent;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -563,9 +565,10 @@ public class Entity implements Listener {
LivingEntity livingEntity = event.getEntity(); LivingEntity livingEntity = event.getEntity();
// Certain entities shouldn't drop twice the amount // Certain entities shouldn't drop twice the amount
if (livingEntity instanceof Player || if (livingEntity instanceof Player
livingEntity instanceof ArmorStand || || livingEntity instanceof ArmorStand
livingEntity instanceof Horse) { || livingEntity instanceof Horse
|| livingEntity instanceof ElderGuardian) {
return; return;
} }
@ -573,11 +576,20 @@ public class Entity implements Listener {
if (livingEntity instanceof Donkey || livingEntity instanceof Mule) if (livingEntity instanceof Donkey || livingEntity instanceof Mule)
return; return;
} }
if (livingEntity.hasMetadata("SkyBlock")) { if (NMSUtil.getVersionNumber() > 10) {
return; 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(); IslandManager islandManager = skyblock.getIslandManager();
if (skyblock.getWorldManager().isIslandWorld(livingEntity.getWorld())) { if (skyblock.getWorldManager().isIslandWorld(livingEntity.getWorld())) {
@ -586,15 +598,34 @@ public class Entity implements Listener {
if (island != null) { if (island != null) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Drops); List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Drops);
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled() if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.Drops)) {
&& island.isUpgrade(Upgrade.Type.Drops)) { Set<ItemStack> dontMultiply = new HashSet<>();
List<ItemStack> entityDrops = event.getDrops();
if (entityDrops != null) { if (NMSUtil.getVersionNumber() > 8) {
for (ItemStack is : entityDrops) { EntityEquipment equipment = livingEntity.getEquipment();
is.setAmount(is.getAmount() * 2); 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);
} }
} }
} }

View File

@ -1,6 +1,7 @@
package me.goodandevil.skyblock.listeners; package me.goodandevil.skyblock.listeners;
import com.songoda.epicspawners.api.events.SpawnerBreakEvent; import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
import com.songoda.epicspawners.api.events.SpawnerChangeEvent;
import com.songoda.epicspawners.api.events.SpawnerPlaceEvent; import com.songoda.epicspawners.api.events.SpawnerPlaceEvent;
import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager; 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.island.IslandManager;
import me.goodandevil.skyblock.utils.version.Materials; import me.goodandevil.skyblock.utils.version.Materials;
import me.goodandevil.skyblock.world.WorldManager; import me.goodandevil.skyblock.world.WorldManager;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import java.io.File; import java.io.File;
@ -25,8 +28,44 @@ public class EpicSpawners implements Listener {
this.skyblock = skyblock; this.skyblock = skyblock;
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpawnerPlace(SpawnerPlaceEvent event) { 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(); IslandManager islandManager = skyblock.getIslandManager();
WorldManager worldManager = skyblock.getWorldManager(); WorldManager worldManager = skyblock.getWorldManager();
@ -35,7 +74,7 @@ public class EpicSpawners implements Listener {
Island island = islandManager.getIslandAtLocation(location); Island island = islandManager.getIslandAtLocation(location);
int amount = event.getSpawner().getFirstStack().getStackSize(); int amount = event.getStackSize() - event.getOldStackSize();
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType(); EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")); 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()); 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) { public void onSpawnerBreak(SpawnerBreakEvent event) {
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
WorldManager worldManager = skyblock.getWorldManager(); WorldManager worldManager = skyblock.getWorldManager();

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.Horse;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent; import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
@ -47,7 +48,7 @@ public class Interact implements Listener {
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
org.bukkit.block.Block block = event.getClickedBlock(); 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 if (event.getItem().getType() == Material.BUCKET || event.getItem().getType() == Material.WATER_BUCKET
|| event.getItem().getType() == Material.LAVA_BUCKET) { || event.getItem().getType() == Material.LAVA_BUCKET) {
if (!islandManager.hasPermission(player, block.getLocation(), "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 (player.getTargetBlock((Set<Material>) null, 5).getType() == Material.FIRE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Fire")) { if (!islandManager.hasPermission(player, block.getLocation(), "Fire")) {
event.setCancelled(true); event.setCancelled(true);
@ -817,7 +816,7 @@ public class Interact implements Listener {
@EventHandler(ignoreCancelled = true) @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())) { if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(event.getRightClicked().getLocation().getBlock().getLocation())) {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -1,6 +1,10 @@
package me.goodandevil.skyblock.listeners; 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.BarrelUnstackEvent;
import com.bgsoftware.wildstacker.api.events.SpawnerPlaceEvent;
import com.bgsoftware.wildstacker.api.events.SpawnerStackEvent;
import com.bgsoftware.wildstacker.api.events.SpawnerUnstackEvent; import com.bgsoftware.wildstacker.api.events.SpawnerUnstackEvent;
import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager; 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.Materials;
import me.goodandevil.skyblock.utils.version.NMSUtil; import me.goodandevil.skyblock.utils.version.NMSUtil;
import me.goodandevil.skyblock.world.WorldManager; import me.goodandevil.skyblock.world.WorldManager;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import java.io.File; import java.io.File;
@ -27,7 +33,79 @@ public class WildStacker implements Listener {
this.skyblock = skyblock; 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) { public void onBarrelUnstack(BarrelUnstackEvent event) {
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
WorldManager worldManager = skyblock.getWorldManager(); 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) { public void onSpawnerUnstack(SpawnerUnstackEvent event) {
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
WorldManager worldManager = skyblock.getWorldManager(); WorldManager worldManager = skyblock.getWorldManager();

View File

@ -1243,8 +1243,11 @@ public enum Materials {
if (mat != null) if (mat != null)
return mat; return mat;
if (old13Mat != null) if (old13Mat != null) {
return Material.matchMaterial(old13Mat); mat = Material.matchMaterial(old13Mat);
if (mat != null)
return mat;
}
return Material.matchMaterial(old12Mat); return Material.matchMaterial(old12Mat);
} }

View File

@ -388,6 +388,7 @@ public final class BlockUtil {
} else { } else {
skull.setOwner(blockData.getSkullOwner()); skull.setOwner(blockData.getSkullOwner());
} }
skull.update();
} else { } else {
if (NMSVersion > 8) { if (NMSVersion > 8) {
if (blockTypeState == BlockStateType.ENDGATEWAY) { if (blockTypeState == BlockStateType.ENDGATEWAY) {

View File

@ -4,7 +4,7 @@ version: @version@
api-version: 1.13 api-version: 1.13
description: A unique SkyBlock plugin description: A unique SkyBlock plugin
author: Songoda author: Songoda
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault, LeaderHeads, WildStacker] softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault, LeaderHeads, EpicSpawners, WildStacker]
loadbefore: [Multiverse-Core] loadbefore: [Multiverse-Core]
commands: commands:
island: island: