Merge branch 'development'

This commit is contained in:
Brianna 2020-04-27 20:01:33 -04:00
commit 36bda4a409
16 changed files with 219 additions and 418 deletions

View File

@ -1,214 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.1.1</version>
<build>
<defaultGoal>clean install</defaultGoal>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<finalName>FabledSkyblock-${project.version}</finalName>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>mvdw-software</id>
<name>MVdW Public Repositories</name>
<url>http://repo.mvdw-software.be/content/groups/public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>reserve-repo</id>
<url>https://dl.bintray.com/theneweconomy/java/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>private</id>
<url>https://repo.songoda.com/artifactory/private/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>bungeecord-chat</artifactId>
<groupId>net.md-5</groupId>
</exclusion>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
<groupId>org.bukkit</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>Reserve</artifactId>
<version>0.1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.robin</groupId>
<artifactId>leaderheads</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>epicspawners</artifactId>
<version>6-pre4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>EpicAnchors</artifactId>
<version>1.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>ultimatestacker</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.OmerBenGera</groupId>
<artifactId>WildStackerAPI</artifactId>
<version>b15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.3</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -5,7 +5,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.2.9</version>
<version>2.2.19</version>
<packaging>jar</packaging>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName>
@ -119,10 +120,6 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>private</id>
<url>https://repo.songoda.com/artifactory/private/</url>
</repository>
<repository>
<id>public</id>
<url>http://repo.songoda.com/artifactory/public/</url>
@ -172,7 +169,7 @@
</dependency>
<dependency>
<groupId>me.robin</groupId>
<artifactId>leaderheads</artifactId>
<artifactId>LeaderHeadsAPI</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.OmerBenGera:WildStackerAPI:b15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:ultimatestacker:1.3.1" level="project" />
<orderEntry type="library" name="Maven: be.maximvdw:MVdWPlaceholderAPI:2.1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.robin:leaderheads:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:epicspawners:6-pre4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:EpicAnchors:1.4.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:worldedit:7.0.0" level="project" />
<orderEntry type="library" name="Maven: com.songoda:SongodaCore:2.3.4" level="project" />
</component>
</module>

View File

@ -192,12 +192,6 @@ public class SkyBlock extends SongodaPlugin {
@Override
public void onPluginDisable() {
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(formatText("&a============================="));
console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
console.sendMessage(formatText("&7Action: &cDisabling&7..."));
console.sendMessage(formatText("&a============================="));
if (this.userCacheManager != null) {
this.userCacheManager.onDisable();
}

View File

@ -0,0 +1,36 @@
package com.songoda.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
public class PlayerVoteEvent extends PlayerEvent implements Cancellable {
private boolean cancelled = false;
private static HandlerList HANDLERS = new HandlerList();
public PlayerVoteEvent(Player player, Island island) {
super(player, island);
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
}

View File

@ -0,0 +1,22 @@
package com.songoda.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
public class PlayerVoteRemoveEvent extends PlayerEvent {
private static HandlerList HANDLERS = new HandlerList();
public PlayerVoteRemoveEvent(Player player, Island island) {
super(player, island);
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,6 +1,8 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.api.event.player.PlayerVoteEvent;
import com.songoda.skyblock.api.event.player.PlayerVoteRemoveEvent;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -85,6 +87,7 @@ public class VoteCommand extends SubCommand {
if (playerData.getIsland() != null && playerData.getIsland().equals(island.getOwnerUUID())) {
if (visit.getVoters().contains(player.getUniqueId())) {
Bukkit.getPluginManager().callEvent(new PlayerVoteRemoveEvent(player, island.getAPIWrapper()));
visit.removeVoter(player.getUniqueId());
messageManager.sendMessage(player,
@ -92,6 +95,11 @@ public class VoteCommand extends SubCommand {
.replace("%player", targetPlayerName));
soundManager.playSound(player, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 1.0F, 1.0F);
} else {
PlayerVoteEvent playerVoteEvent = new PlayerVoteEvent(player, island.getAPIWrapper());
Bukkit.getServer().getPluginManager().callEvent(playerVoteEvent);
if (playerVoteEvent.isCancelled())
return;
visit.addVoter(player.getUniqueId());
messageManager.sendMessage(player,

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.island;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.utils.PlayerUtils;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.api.utils.APIUtil;
@ -59,6 +60,24 @@ public class Island {
this.size = 50;
}
if (player.isOnline()) {
int customSize = PlayerUtils.getNumberFromPermission(player.getPlayer(), "fabledskyblock.size", 0);
if (customSize > 0 || player.getPlayer().hasPermission("fabledskyblock.*")) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
int minimumSize = configLoad.getInt("Island.Size.Minimum");
int maximumSize = configLoad.getInt("Island.Size.Maximum");
if (minimumSize < 0 || minimumSize > 1000)
minimumSize = 50;
if (maximumSize < 0 || maximumSize > 1000)
maximumSize = 100;
size = Math.max(minimumSize, Math.min(customSize, maximumSize));
}
}
level = new IslandLevel(getOwnerUUID(), skyblock);
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");

View File

@ -3,11 +3,13 @@ package com.songoda.skyblock.island;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.utils.PlayerUtils;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.confirmation.Confirmation;
import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.invite.Invite;
@ -35,6 +37,10 @@ import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.utils.world.block.BlockDegreesType;
import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.world.WorldManager;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
@ -43,11 +49,6 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.IllegalPluginAccessException;
import com.songoda.skyblock.confirmation.Confirmation;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import java.io.File;
import java.io.IOException;
@ -63,7 +64,7 @@ public class IslandManager {
private Map<UUID, Island> islandStorage = new HashMap<>();
private int offset = 1200;
private HashMap<IslandWorld, Integer> oldSystemIslands;
private HashMap<IslandWorld, Integer> oldSystemIslands;
public IslandManager(SkyBlock skyblock) {
this.skyblock = skyblock;
@ -80,9 +81,10 @@ public class IslandManager {
loadIsland(all);
}
for (Island island : getIslands().values()) {
if (island.isAlwaysLoaded()) loadIslandAtLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island));
if (island.isAlwaysLoaded())
loadIslandAtLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island));
}
loadIslandPositions();
}
@ -126,7 +128,6 @@ public class IslandManager {
}
public org.bukkit.Location prepareNextAvailableLocation(IslandWorld world) {
for (IslandPosition islandPositionList : islandPositions) {
if (islandPositionList.getWorld() == world) {
@ -140,15 +141,15 @@ public class IslandManager {
int islandHeight = configLoad_config.getInt("Island.World." + world.name() + ".IslandSpawnHeight", 72);
while (true) {
double r = Math.floor((Math.sqrt(x + 1) - 1) / 2) + 1;
double p = (8 * r * (r -1)) / 2;
double p = (8 * r * (r - 1)) / 2;
double en = r * 2;
double a = (x - p) % (r * 8);
int posX = 0;
int posY = 0;
int loc = (int) Math.floor(a / (r * 2));
switch (loc) {
case 0 :
posX = (int) (a-r);
case 0:
posX = (int) (a - r);
posY = (int) (-r);
break;
case 1:
@ -174,13 +175,13 @@ public class IslandManager {
// Check if there was an island at this position
int oldFormatPos = oldSystemIslands.get(world);
Location islandLocation = new org.bukkit.Location(skyblock.getWorldManager().getWorld(world), islandPositionList.getX(), islandHeight, islandPositionList.getZ());
if (posX == 1200 && posY >= 0 && posY <= oldFormatPos) {
// We have to save to avoid having two islands at same location
if (posX == 1200 && posY >= 0 && posY <= oldFormatPos) {
// We have to save to avoid having two islands at same location
setNextAvailableLocation(world, islandLocation);
saveNextAvailableLocation(world);
x++;
continue;
}
x++;
continue;
}
return islandLocation;
}
}
@ -226,36 +227,14 @@ public class IslandManager {
if (!visitManager.hasIsland(island.getOwnerUUID())) {
visitManager.createIsland(island.getOwnerUUID(),
new IslandLocation[] { island.getIslandLocation(IslandWorld.Normal, IslandEnvironment.Island), island.getIslandLocation(IslandWorld.Nether, IslandEnvironment.Island),
island.getIslandLocation(IslandWorld.End, IslandEnvironment.Island) },
new IslandLocation[]{island.getIslandLocation(IslandWorld.Normal, IslandEnvironment.Island), island.getIslandLocation(IslandWorld.Nether, IslandEnvironment.Island),
island.getIslandLocation(IslandWorld.End, IslandEnvironment.Island)},
island.getSize(), island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size() + 1, island.getBankBalance(), visitManager.getIslandSafeLevel(island.getOwnerUUID()), island.getLevel(),
island.getMessage(IslandMessage.Signature), island.isOpen());
}
if (!banManager.hasIsland(island.getOwnerUUID())) banManager.createIsland(island.getOwnerUUID());
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
if (PlayerUtil.getNumberFromPermission(player, "fabledskyblock.size", false, 0) > 0 || player.hasPermission("fabledskyblock.*")) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
int minimumSize = configLoad.getInt("Island.Size.Minimum");
int maximumSize = configLoad.getInt("Island.Size.Maximum");
if (minimumSize < 0 || minimumSize > 1000) {
minimumSize = 50;
}
if (maximumSize < 0 || maximumSize > 1000) {
maximumSize = 100;
}
for (int i = maximumSize; i > minimumSize; i--) {
island.setSize(i);
}
}
});
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
@ -301,7 +280,8 @@ public class IslandManager {
}, 20L);
// Recalculate island level after 5 seconds
if (configLoad.getBoolean("Island.Levelling.ScanAutomatically")) Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> skyblock.getLevellingManager().startScan(null, island), 100L);
if (configLoad.getBoolean("Island.Levelling.ScanAutomatically"))
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> skyblock.getLevellingManager().startScan(null, island), 100L);
return true;
}
@ -350,7 +330,7 @@ public class IslandManager {
});
Bukkit.getScheduler().runTaskLater(skyblock, () -> {
if(data.isPreview()) {
if (data.isPreview()) {
Location spawn = fileManager.getLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), "Location.Spawn", true);
player.teleport(spawn);
player.setGameMode(GameMode.SURVIVAL);
@ -360,8 +340,7 @@ public class IslandManager {
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Preview.Timeout.Message"));
data.setPreview(false);
}
}, configMain.getInt("Island.Preview.Time")*20);
}, configMain.getInt("Island.Preview.Time") * 20);
String defaultMessage = configLang.getString("Command.Island.Preview.Confirmation.Message")
@ -372,7 +351,7 @@ public class IslandManager {
for (String message : defaultMessage.split("\n")) {
ChatComponent confirmation = null, cancelation = null;
if(message.contains("%confirm")) {
if (message.contains("%confirm")) {
message = message.replace("%confirm", "");
confirmation = new ChatComponent(configLang.getString("Command.Island.Preview.Confirmation.Word.Confirm").toUpperCase() + " ",
true, net.md_5.bungee.api.ChatColor.GREEN,
@ -386,7 +365,7 @@ public class IslandManager {
));
}
if(message.contains("%cancel")) {
if (message.contains("%cancel")) {
message = message.replace("%cancel", "");
cancelation = new ChatComponent(configLang.getString("Command.Island.Preview.Confirmation.Word.Cancel").toUpperCase(),
true, net.md_5.bungee.api.ChatColor.GREEN,
@ -401,10 +380,10 @@ public class IslandManager {
}
TextComponent confirmationMessage = new TextComponent(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', message));
if(confirmation != null) {
if (confirmation != null) {
confirmationMessage.addExtra(confirmation.getTextComponent());
}
if(cancelation != null) {
if (cancelation != null) {
confirmationMessage.addExtra(cancelation.getTextComponent());
}
@ -696,8 +675,8 @@ public class IslandManager {
if (!visitManager.hasIsland(island.getOwnerUUID())) {
visitManager.createIsland(island.getOwnerUUID(),
new IslandLocation[] { island.getIslandLocation(IslandWorld.Normal, IslandEnvironment.Island), island.getIslandLocation(IslandWorld.Nether, IslandEnvironment.Island),
island.getIslandLocation(IslandWorld.End, IslandEnvironment.Island) },
new IslandLocation[]{island.getIslandLocation(IslandWorld.Normal, IslandEnvironment.Island), island.getIslandLocation(IslandWorld.Nether, IslandEnvironment.Island),
island.getIslandLocation(IslandWorld.End, IslandEnvironment.Island)},
island.getSize(), island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size() + 1, island.getBankBalance(), visitManager.getIslandSafeLevel(island.getOwnerUUID()),
island.getLevel(), island.getMessage(IslandMessage.Signature), island.isOpen());
}
@ -720,48 +699,48 @@ public class IslandManager {
* This method will get the nextAvailableLocation for normal, nether and end islands in worlds.yml file
* to avoid creating island where an existing island was
*/
public void loadIslandPositions() {
oldSystemIslands = new HashMap<>();
public void loadIslandPositions() {
oldSystemIslands = new HashMap<>();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
Config config2 = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.oldformat.yml"));
FileConfiguration fileConfig2 = config2.getFileConfiguration();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
Config config2 = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/worlds.oldformat.yml"));
FileConfiguration fileConfig2 = config2.getFileConfiguration();
// TODO Find a way to automatically
int normalZ = 0;
int netherZ = 0;
int endZ = 0;
if (!config2.getFile().exists()) {
// Old data
Bukkit.getLogger().info("[FabledSkyblock] Old format detected, please wait ...");
if (fileConfig.contains("World.Normal.nextAvailableLocation"))
normalZ = fileConfig.getInt("World.Normal.nextAvailableLocation.z");
if (fileConfig.contains("World.Nether.nextAvailableLocation"))
netherZ = fileConfig.getInt("World.Nether.nextAvailableLocation.z");
if (fileConfig.contains("World.End.nextAvailableLocation"))
endZ = fileConfig.getInt("World.End.nextAvailableLocation.z");
// Save
fileConfig2.set("Normal", normalZ);
fileConfig2.set("Nether", netherZ);
fileConfig2.set("End", endZ);
try {
fileConfig2.save(config2.getFile());
} catch (IOException ex) {
ex.printStackTrace();
}
Bukkit.getLogger().info("[FabledSkyblock] Done ! Got normalZ = " + normalZ + ", netherZ = " + netherZ + ", endZ = " + endZ);
} else {
// Load datas
normalZ = fileConfig2.getInt("Normal");
netherZ = fileConfig2.getInt("Nether");
endZ = fileConfig2.getInt("End");
}
oldSystemIslands.put(IslandWorld.Normal, normalZ);
oldSystemIslands.put(IslandWorld.Nether, netherZ);
oldSystemIslands.put(IslandWorld.End, endZ);
}
// TODO Find a way to automatically
int normalZ = 0;
int netherZ = 0;
int endZ = 0;
if (!config2.getFile().exists()) {
// Old data
Bukkit.getLogger().info("[FabledSkyblock] Old format detected, please wait ...");
if (fileConfig.contains("World.Normal.nextAvailableLocation"))
normalZ = fileConfig.getInt("World.Normal.nextAvailableLocation.z");
if (fileConfig.contains("World.Nether.nextAvailableLocation"))
netherZ = fileConfig.getInt("World.Nether.nextAvailableLocation.z");
if (fileConfig.contains("World.End.nextAvailableLocation"))
endZ = fileConfig.getInt("World.End.nextAvailableLocation.z");
// Save
fileConfig2.set("Normal", normalZ);
fileConfig2.set("Nether", netherZ);
fileConfig2.set("End", endZ);
try {
fileConfig2.save(config2.getFile());
} catch (IOException ex) {
ex.printStackTrace();
}
Bukkit.getLogger().info("[FabledSkyblock] Done ! Got normalZ = " + normalZ + ", netherZ = " + netherZ + ", endZ = " + endZ);
} else {
// Load datas
normalZ = fileConfig2.getInt("Normal");
netherZ = fileConfig2.getInt("Nether");
endZ = fileConfig2.getInt("End");
}
oldSystemIslands.put(IslandWorld.Normal, normalZ);
oldSystemIslands.put(IslandWorld.Nether, netherZ);
oldSystemIslands.put(IslandWorld.End, endZ);
}
public Island loadIslandAtLocation(Location location) {
FileManager fileManager = skyblock.getFileManager();
@ -944,15 +923,15 @@ public class IslandManager {
try {
String structureFileName = null;
switch (world) {
case Normal:
structureFileName = structure.getOverworldFile();
break;
case Nether:
structureFileName = structure.getNetherFile();
break;
case End:
structureFileName = structure.getEndFile();
break;
case Normal:
structureFileName = structure.getOverworldFile();
break;
case Nether:
structureFileName = structure.getNetherFile();
break;
case End:
structureFileName = structure.getEndFile();
break;
}
boolean isStructureFile = structureFileName.endsWith(".structure");
@ -1217,7 +1196,8 @@ public class IslandManager {
if (island.getSetting(island.getRole(player), setting).getStatus()) return true;
if (island.isCoopPlayer(player.getUniqueId()) && island.getSetting(IslandRole.Coop, setting).getStatus()) return true;
if (island.isCoopPlayer(player.getUniqueId()) && island.getSetting(IslandRole.Coop, setting).getStatus())
return true;
return island.getSetting(IslandRole.Visitor, setting).getStatus();
}
@ -1355,7 +1335,8 @@ public class IslandManager {
public void updateFlight(Player player) {
// The player can fly in other worlds if they are in creative or have another
// plugin's fly permission.
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly")) return;
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly"))
return;
Island island = getIslandAtLocation(player.getLocation());

View File

@ -17,7 +17,6 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.InventoryUtil;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.world.WorldManager;
@ -42,7 +41,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo;
@ -153,11 +151,6 @@ public class Interact implements Listener {
.hasPermission(player, block.getLocation(), "Place")
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission")
|| player.hasPermission("fabledskyblock.stackable"))) {
if (NMSUtil.getVersionNumber() > 8) {
if (event.getHand() == EquipmentSlot.OFF_HAND) {
return;
}
}
if (levellingManager.isScanning(island)) {
skyblock.getMessageManager().sendMessage(player,
@ -223,7 +216,8 @@ public class Interact implements Listener {
event.setCancelled(true);
}
InventoryUtil.takeItem(player, itemAmount);
if (player.getGameMode() != GameMode.CREATIVE)
ItemUtils.takeActiveItem(player, CompatibleHand.getHand(event), itemAmount);
if (!configLoad.getBoolean("Island.Block.Level.Enable")) {
return;
@ -706,8 +700,8 @@ public class Interact implements Listener {
SoundManager soundManager = skyblock.getSoundManager();
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
if ((is != null) && (CompatibleMaterial.getMaterial(is.getType()) != CompatibleMaterial.AIR)) {
if (CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.LEAD) {
if ((is != null) && (CompatibleMaterial.getMaterial(is) != CompatibleMaterial.AIR)) {
if (CompatibleMaterial.getMaterial(is) == CompatibleMaterial.LEAD) {
if (!islandManager.hasPermission(player, entity.getLocation(), "Leash")) {
event.setCancelled(true);
@ -771,7 +765,7 @@ public class Interact implements Listener {
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else if (entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
if (CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BUCKET) {
if (CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BUCKET) {
if (!islandManager.hasPermission(player, entity.getLocation(), "Milking")) {
event.setCancelled(true);
@ -825,27 +819,27 @@ public class Interact implements Listener {
}
if (entity.getType() == EntityType.HORSE) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_APPLE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_CARROT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SUGAR
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.APPLE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.HAY_BLOCK)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_APPLE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_CARROT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SUGAR
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.APPLE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.HAY_BLOCK)) {
return;
}
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT)) {
return;
}
} else if (entity.getType() == EntityType.PIG) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CARROT || CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.POTATO)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CARROT || CompatibleMaterial.getMaterial(is) == CompatibleMaterial.POTATO)) {
return;
}
} else if (entity.getType() == EntityType.CHICKEN) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT_SEEDS
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PUMPKIN_SEEDS || CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.MELON_SEEDS)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT_SEEDS
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PUMPKIN_SEEDS || CompatibleMaterial.getMaterial(is) == CompatibleMaterial.MELON_SEEDS)) {
if (NMSUtil.getVersionNumber() > 8) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BEETROOT_SEEDS)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BEETROOT_SEEDS)) {
return;
}
} else {
@ -853,31 +847,31 @@ public class Interact implements Listener {
}
}
} else if (entity.getType() == EntityType.WOLF) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BONE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PORKCHOP
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BEEF
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CHICKEN
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.RABBIT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.MUTTON
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.ROTTEN_FLESH
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_PORKCHOP
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_BEEF
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_CHICKEN
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_RABBIT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_MUTTON)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BONE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PORKCHOP
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BEEF
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CHICKEN
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.RABBIT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.MUTTON
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.ROTTEN_FLESH
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_PORKCHOP
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_BEEF
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_CHICKEN
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_RABBIT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_MUTTON)) {
return;
}
} else if (entity.getType() == EntityType.OCELOT) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COD
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SALMON
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.TROPICAL_FISH
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PUFFERFISH)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COD
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SALMON
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.TROPICAL_FISH
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PUFFERFISH)) {
return;
}
} else if (entity.getType() == EntityType.RABBIT) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.DANDELION
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CARROTS
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_CARROT)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.DANDELION
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CARROTS
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_CARROT)) {
return;
}
} else {
@ -885,12 +879,12 @@ public class Interact implements Listener {
if (NMSVersion > 10) {
if (entity.getType() == EntityType.LLAMA) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.HAY_BLOCK)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.HAY_BLOCK)) {
return;
}
} else if (NMSVersion > 12) {
if (entity.getType() == EntityType.TURTLE) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SEAGRASS)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SEAGRASS)) {
return;
}
} else {

View File

@ -198,7 +198,7 @@ public class Levelling {
if (is == null || is.getItemMeta() == null) continue;
is.setAmount(Math.min(Math.toIntExact(value), 64));
is.setType(CompatibleMaterial.getMaterial(is.getType()).getMaterial());
is.setType(CompatibleMaterial.getMaterial(is).getMaterial());
testInventory.clear();
testInventory.setItem(0, is);
@ -269,7 +269,7 @@ public class Levelling {
ItemStack is = materials.getItem();
is.setAmount(Math.min(Math.toIntExact(materialAmount), 64));
is.setType(CompatibleMaterial.getMaterial(is.getType()).getMaterial());
is.setType(CompatibleMaterial.getMaterial(is).getMaterial());
List<String> lore = configLoad.getStringList("Menu.Levelling.Item.Material.Lore");
lore.replaceAll(x -> x.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned)).replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name));

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.player.PlayerVoteEvent;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -179,6 +180,11 @@ public class Visit {
soundManager.playSound(player, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 1.0F,
1.0F);
} else {
PlayerVoteEvent playerVoteEvent = new PlayerVoteEvent(player, island.getAPIWrapper());
Bukkit.getServer().getPluginManager().callEvent(playerVoteEvent);
if (playerVoteEvent.isCancelled())
return;
visit.addVoter(player.getUniqueId());
messageManager.sendMessage(player,

View File

@ -38,7 +38,7 @@ public class StackableManager {
FileConfiguration configLoad = config.getFileConfiguration();
List<String> stackableList = configLoad.getStringList("Stackables");
if (stackableList == null) return;
if (stackableList.isEmpty()) return;
for (String stackableStr : stackableList) {
try {

View File

@ -59,7 +59,6 @@ public class HologramTask extends BukkitRunnable {
}
public void onDisable() {
removeHolograms();
}
public void spawnHologram(HologramType type, Location location, List<String> lines) {
@ -151,12 +150,6 @@ public class HologramTask extends BukkitRunnable {
return hologramLines;
}
public void removeHolograms() {
for (Hologram hologramList : hologramStorage) {
hologramList.remove();
}
}
public Hologram getHologram(HologramType type) {
for (Hologram hologramList : hologramStorage) {
if (hologramList.getType() == type) {

View File

@ -173,9 +173,7 @@ public class Visit {
islandOwnerUUID.toString() + ".yml"))
.getFileConfiguration();
for (String islandVoterList : configLoad.getStringList("Voters")) {
islandVoters.add(islandVoterList);
}
islandVoters.addAll(configLoad.getStringList("Voters"));
islandVoters.add(uuid.toString());
configLoad.set("Voters", islandVoters);

View File

@ -15,7 +15,7 @@ Island:
# [!] Do not go over the maximum.
# [!] Even numbers WILL create world border issues.
Minimum: 100
# The maximum size of an Island based on the permission node 'skyblock.size.<size>'.
# The maximum size of an Island based on the permission node 'fabledskyblock.size.<size>'.
Maximum: 200
Creation:
# Rather than opening the 'Island Creator' menu. Create an island