mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 10:15:54 +01:00
Merge branch 'development' into 'master'
Build 77_1 See merge request Songoda/fabledskyblock!17
This commit is contained in:
commit
536c6d3703
@ -258,7 +258,7 @@ public class IslandManager {
|
||||
.setBiome(island, biome), 20L);
|
||||
|
||||
// Recalculate island level after 5 seconds
|
||||
if (fileManager.getConfig(new File(this.skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
|
||||
if (fileManager.getConfig(new File(this.skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> skyblock.getLevellingManager().calculatePoints(null, island), 100L);
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ public class IslandManager {
|
||||
pasteStructure(island, islandWorld);
|
||||
|
||||
// Recalculate island level after 5 seconds
|
||||
if (fileManager.getConfig(new File(this.skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
|
||||
if (fileManager.getConfig(new File(this.skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
|
||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> skyblock.getLevellingManager().calculatePoints(null, island), 100L);
|
||||
}
|
||||
}
|
||||
|
@ -94,15 +94,17 @@ public class Chunk {
|
||||
int x = chunkPosition.getX();
|
||||
int z = chunkPosition.getZ();
|
||||
if (!world.isChunkLoaded(x, z)) {
|
||||
world.loadChunk(x, z);
|
||||
org.bukkit.Chunk chunk = world.getChunkAt(x, z);
|
||||
ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot();
|
||||
if (isWildStackerEnabled) {
|
||||
this.chunkSnapshots.add(new WildStackerChunkSnapshotWrapper(chunkSnapshot, com.bgsoftware.wildstacker.api.WildStackerAPI.getWildStacker().getSystemManager().getStackedSnapshot(chunk, true)));
|
||||
} else {
|
||||
this.chunkSnapshots.add(new ChunkSnapshotWrapper(chunkSnapshot));
|
||||
// Try to load the chunk, but don't generate anything and ignore if we couldn't get it
|
||||
if (world.loadChunk(x, z, false)) {
|
||||
org.bukkit.Chunk chunk = world.getChunkAt(x, z);
|
||||
ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot();
|
||||
if (isWildStackerEnabled) {
|
||||
this.chunkSnapshots.add(new WildStackerChunkSnapshotWrapper(chunkSnapshot, com.bgsoftware.wildstacker.api.WildStackerAPI.getWildStacker().getSystemManager().getStackedSnapshot(chunk, true)));
|
||||
} else {
|
||||
this.chunkSnapshots.add(new ChunkSnapshotWrapper(chunkSnapshot));
|
||||
}
|
||||
world.unloadChunk(x, z);
|
||||
}
|
||||
world.unloadChunk(x, z);
|
||||
} else {
|
||||
org.bukkit.Chunk chunk = world.getChunkAt(x, z);
|
||||
ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot();
|
||||
|
@ -54,12 +54,17 @@ public class LimitManager {
|
||||
* @return The max number of the type of block the player can place
|
||||
*/
|
||||
public long getBlockLimit(Player player, Block block) {
|
||||
if (player == null || block == null)
|
||||
return -1;
|
||||
|
||||
if (player.hasPermission("fabledskyblock.limit.block.*"))
|
||||
return -1;
|
||||
|
||||
long limit = -1;
|
||||
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
||||
if (material == null)
|
||||
return -1;
|
||||
|
||||
long limit = -1;
|
||||
if (this.blockLimits.containsKey(material))
|
||||
limit = Math.max(limit, this.blockLimits.get(material));
|
||||
|
||||
|
@ -4,14 +4,18 @@ import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.config.FileManager.Config;
|
||||
import me.goodandevil.skyblock.generator.Generator;
|
||||
import me.goodandevil.skyblock.generator.GeneratorManager;
|
||||
import me.goodandevil.skyblock.island.*;
|
||||
import me.goodandevil.skyblock.island.Island;
|
||||
import me.goodandevil.skyblock.island.IslandEnvironment;
|
||||
import me.goodandevil.skyblock.island.IslandLevel;
|
||||
import me.goodandevil.skyblock.island.IslandManager;
|
||||
import me.goodandevil.skyblock.island.IslandRole;
|
||||
import me.goodandevil.skyblock.island.IslandWorld;
|
||||
import me.goodandevil.skyblock.levelling.LevellingManager;
|
||||
import me.goodandevil.skyblock.limit.LimitManager;
|
||||
import me.goodandevil.skyblock.stackable.Stackable;
|
||||
import me.goodandevil.skyblock.stackable.StackableManager;
|
||||
import me.goodandevil.skyblock.upgrade.Upgrade;
|
||||
import me.goodandevil.skyblock.utils.NumberUtil;
|
||||
import me.goodandevil.skyblock.utils.StringUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
@ -30,8 +34,17 @@ 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;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockGrowEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -39,7 +52,11 @@ import org.bukkit.material.Crops;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Block implements Listener {
|
||||
|
||||
@ -596,11 +613,13 @@ public class Block implements Listener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (block.getState().getData() instanceof Crops) {
|
||||
if (block.getState().getData() instanceof Crops
|
||||
|| block.getType().name().equals("BEETROOT_BLOCK")
|
||||
|| block.getType().name().equals("CARROT")
|
||||
|| block.getType().name().equals("POTATO")
|
||||
|| block.getType().name().equals("CROPS")) {
|
||||
try {
|
||||
block.getClass().getMethod("setData", byte.class).invoke(block,
|
||||
(byte) (block.getData() + 1));
|
||||
block.getState().update();
|
||||
block.getClass().getMethod("setData", byte.class).invoke(block, (byte) (block.getData() + 1));
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -575,7 +575,7 @@ public class Entity implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 8) {
|
||||
if (NMSUtil.getVersionNumber() > 9) {
|
||||
if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian)
|
||||
return;
|
||||
}
|
||||
|
@ -473,31 +473,8 @@ public class Interact implements Listener {
|
||||
.getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")
|
||||
&& islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("EpicAnchors")) {
|
||||
if (com.songoda.epicanchors.EpicAnchorsPlugin.getInstance().getAnchorManager().getAnchor(block.getLocation()) != null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack is = event.getPlayer().getItemInHand();
|
||||
|
||||
if (is == null || is.getType() == Material.AIR) {
|
||||
block.setType(Material.AIR);
|
||||
player.getInventory().addItem(new ItemStack(Materials.END_PORTAL_FRAME.parseMaterial(), 1));
|
||||
player.updateInventory();
|
||||
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 10.0F, 10.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 8 && event.getHand() == EquipmentSlot.OFF_HAND)
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (block.getType() == Material.TNT) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")
|
||||
&& islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("EpicAnchors")) {
|
||||
if (com.songoda.epicanchors.EpicAnchorsPlugin.getInstance().getAnchorManager().getAnchor(block.getLocation()) != null) {
|
||||
@ -509,14 +486,41 @@ public class Interact implements Listener {
|
||||
ItemStack is = event.getPlayer().getItemInHand();
|
||||
|
||||
if (is == null || is.getType() == Material.AIR) {
|
||||
block.setType(Material.AIR);
|
||||
if (stackableManager != null && stackableManager.isStacked(block.getLocation())) {
|
||||
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.END_PORTAL_FRAME.parseMaterial());
|
||||
stackable.takeOne();
|
||||
|
||||
if (stackable.getSize() <= 1) {
|
||||
stackableManager.removeStack(stackable);
|
||||
}
|
||||
} else {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
player.getInventory().addItem(new ItemStack(Materials.END_PORTAL_FRAME.parseMaterial(), 1));
|
||||
player.updateInventory();
|
||||
|
||||
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.END_PORTAL_FRAME;
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
if (level.hasMaterial(materials.name())) {
|
||||
long materialAmount = level.getMaterialAmount(materials.name());
|
||||
|
||||
if (materialAmount - 1 <= 0) {
|
||||
level.removeMaterial(materials.name());
|
||||
} else {
|
||||
level.setMaterialAmount(materials.name(), materialAmount - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 10.0F, 10.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user