Various bugfixes

This commit is contained in:
Denyk 2020-03-23 20:34:12 +01:00 committed by Brianna
parent fec32fd8ea
commit d25678ec5b
8 changed files with 42 additions and 9 deletions

View File

@ -91,8 +91,6 @@ public final class BlockScanner extends BukkitRunnable {
final ConfigurationSection liquidSection = config.getConfigurationSection("Island.World." + env + ".Liquid");
System.out.println("LiquidSection: " + liquidSection);
for (List<ChunkSnapshot> sub : parts) {
queueWork(world, liquidSection.getBoolean("Enable") ? liquidSection.getInt("Height") + 1 : 0, sub);
}

View File

@ -75,6 +75,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
new MembersCommand(),
new OpenCommand(),
new OwnerCommand(),
new PreviewCommand(),
new PromoteCommand(),
new PublicCommand(),
new SetSpawnCommand(),

View File

@ -244,10 +244,10 @@ public class StructureCommand extends SubCommand {
}
return;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
}

View File

@ -96,7 +96,7 @@ public class FileManager {
}
if (configFile.exists()) {
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml")) {
if (fileName.equals("config.yml") || fileName.equals("language.yml") || fileName.equals("settings.yml") || fileName.equals("worlds.yml")) {
FileChecker fileChecker;
if (fileName.equals("config.yml")) {

View File

@ -14,6 +14,7 @@ import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.world.WorldManager;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -350,6 +351,25 @@ public class Island {
.getFileConfiguration().set("Border.Color", color.name());
}
public boolean isInBorder(Location blockLocation) {
WorldManager worldManager = skyblock.getWorldManager();
if(!isBorder()) {
return true;
}
Location islandLocation = getLocation(worldManager.getIslandWorld(blockLocation.getWorld()), IslandEnvironment.Island);
double halfSize = Math.floor(getRadius());
if(blockLocation.getBlockX() > (islandLocation.getBlockX()+halfSize)
|| blockLocation.getBlockX() < (islandLocation.getBlockX()-halfSize-1)
|| blockLocation.getBlockZ() > (islandLocation.getBlockZ()+halfSize)
|| blockLocation.getBlockZ() < (islandLocation.getBlockZ()-halfSize-1)) {
return false;
}
return true;
}
public Biome getBiome() {
return Biome.valueOf(skyblock.getFileManager().getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"))

View File

@ -403,6 +403,11 @@ public class Block implements Listener {
return;
}
if(!island.isInBorder(block.getRelative(event.getDirection()).getLocation())) {
event.setCancelled(true);
return;
}
if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(block.getLocation())) {
event.setCancelled(true);
return;
@ -496,6 +501,11 @@ public class Block implements Listener {
return;
}
if(!island.isInBorder(block.getLocation())) {
event.setCancelled(true);
return;
}
if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(block.getLocation())) {
event.setCancelled(true);
return;

View File

@ -53,6 +53,13 @@ public class Grow implements Listener {
Island growingTo = islandManager.getIslandAtLocation(state.getLocation());
// This block is ok to continue as it's not related to Skyblock islands.
if (origin == null && growingTo == null) continue;
//Is in border of island
if(origin != null && !origin.isInBorder(state.getLocation())) {
it.remove();
continue;
}
// A block from the structure is outside/inside that it's not suppose to.
if (origin == null || growingTo == null) {
it.remove();

View File

@ -206,7 +206,6 @@ public class Interact implements Listener {
stackable.setMaxSize(maxStackSize);
stackable.setSize(stackable.getSize() + itemAmount);
if(stackable.isMaxSize()){
System.out.println(stackable.getMaxSize() + ":" + stackable.getSize());
stackable.setSize(stackable.getMaxSize());
event.setCancelled(true);
return;
@ -658,13 +657,11 @@ public class Interact implements Listener {
private int getStackLimit(Player player, Materials materials) {
String maxSizePermission = "fabledskyblock.stackable." + materials.name().toLowerCase() + ".maxsize.";
System.out.println(maxSizePermission);
for (PermissionAttachmentInfo attachmentInfo : player.getEffectivePermissions()) {
if (attachmentInfo.getPermission().startsWith(maxSizePermission)) {
String permission = attachmentInfo.getPermission();
int i = Integer.parseInt(permission.substring(permission.lastIndexOf(".") + 1));
System.out.println(i);
return i;
}
}