mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-07-08 20:54:46 +02:00
Cleanup.
This commit is contained in:
parent
33aacdcd9c
commit
37c76fe134
|
@ -49,7 +49,7 @@ public class Block implements Listener {
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||||
Island island = islandManager.getIslandAtLocation(block.getLocation());
|
Island island = islandManager.getIslandAtLocation(block.getLocation());
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -211,17 +211,17 @@ public class Block implements Listener {
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld())) return;
|
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld())) return;
|
||||||
|
|
||||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||||
.getFileConfiguration().getBoolean("Island.Block.Piston.Connected.Retract")) {
|
.getFileConfiguration().getBoolean("Island.Block.Piston.Connected.Retract")) {
|
||||||
for (org.bukkit.block.Block blockList : event.getBlocks()) {
|
for (org.bukkit.block.Block blockList : event.getBlocks()) {
|
||||||
if (blockList.getType() == Materials.PISTON.parseMaterial()
|
if (blockList.getType() == Materials.PISTON.parseMaterial()
|
||||||
|| blockList.getType() == Materials.STICKY_PISTON.parseMaterial()) {
|
|| blockList.getType() == Materials.STICKY_PISTON.parseMaterial()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -232,34 +232,35 @@ public class Block implements Listener {
|
||||||
GeneratorManager generatorManager = skyblock.getGeneratorManager();
|
GeneratorManager generatorManager = skyblock.getGeneratorManager();
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
|
|
||||||
if (worldManager.isIslandWorld(block.getWorld())) {
|
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||||
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
|
|
||||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
|
||||||
.getFileConfiguration().getBoolean("Island.Weather.IceAndSnow")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (generatorManager != null && generatorManager.getGenerators().size() > 0) {
|
|
||||||
org.bukkit.Location location = event.getBlock().getLocation();
|
|
||||||
|
|
||||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
|
||||||
if (playerDataManager.hasPlayerData(all)) {
|
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||||
PlayerData playerData = playerDataManager.getPlayerData(all);
|
.getFileConfiguration().getBoolean("Island.Weather.IceAndSnow")) {
|
||||||
if (playerData.getGenerator() != null) {
|
event.setCancelled(true);
|
||||||
GeneratorLocation generatorLocation = playerData.getGenerator();
|
}
|
||||||
if (generatorLocation.getWorld() == worldManager.getIslandWorld(block.getWorld())) {
|
return;
|
||||||
if (location.getBlockX() == generatorLocation.getBlockX()
|
}
|
||||||
&& location.getBlockY() == generatorLocation.getBlockY()
|
|
||||||
&& location.getBlockZ() == generatorLocation.getBlockZ()) {
|
if (generatorManager != null && generatorManager.getGenerators().size() > 0) {
|
||||||
event.setCancelled(true);
|
org.bukkit.Location location = event.getBlock().getLocation();
|
||||||
generatorManager.generateBlock(all, block);
|
|
||||||
playerData.setGenerator(null);
|
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||||
return;
|
if (!playerDataManager.hasPlayerData(all)) continue;
|
||||||
}
|
PlayerData playerData = playerDataManager.getPlayerData(all);
|
||||||
}
|
|
||||||
}
|
if (playerData.getGenerator() == null) continue;
|
||||||
}
|
GeneratorLocation generatorLocation = playerData.getGenerator();
|
||||||
}
|
|
||||||
|
if (generatorLocation.getWorld() != worldManager.getIslandWorld(block.getWorld())) continue;
|
||||||
|
|
||||||
|
if (location.getBlockX() == generatorLocation.getBlockX()
|
||||||
|
&& location.getBlockY() == generatorLocation.getBlockY()
|
||||||
|
&& location.getBlockZ() == generatorLocation.getBlockZ()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
generatorManager.generateBlock(all, block);
|
||||||
|
playerData.setGenerator(null);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user