More update

This commit is contained in:
Brianna 2020-09-01 14:05:37 -05:00
parent a3b99df03d
commit 3231c929c6
169 changed files with 974 additions and 1218 deletions

View File

@ -52,6 +52,7 @@ import net.coreprotect.CoreProtectAPI;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
@ -107,6 +108,22 @@ public class SkyBlock extends SongodaPlugin {
return INSTANCE;
}
// Add ymlFiles to cache
private FileConfiguration biomes;
private FileConfiguration challenges;
private FileConfiguration config;
private FileConfiguration generators;
private FileConfiguration language;
private FileConfiguration levelling;
private FileConfiguration limits;
private FileConfiguration menus;
private FileConfiguration placeholders;
private FileConfiguration rewards;
private FileConfiguration scoreboard;
private FileConfiguration settings;
private FileConfiguration stackables;
private FileConfiguration upgrades;
@Override
public void onPluginLoad() {
INSTANCE = this;
@ -143,6 +160,12 @@ public class SkyBlock extends SongodaPlugin {
com.songoda.core.hooks.HologramManager.load(this);
fileManager = new FileManager(this);
if (!loadConfigs()) {
this.getServer().getPluginManager().disablePlugin(this);
return;
}
permissionManager = new PermissionManager(this);
localizationManager = new LocalizationManager();
worldManager = new WorldManager(this);
@ -163,11 +186,12 @@ public class SkyBlock extends SongodaPlugin {
structureManager = new StructureManager(this);
soundManager = new SoundManager(this);
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Generator.Enable")) {
if (this.config.getBoolean("Island.Generator.Enable")) {
generatorManager = new GeneratorManager(this);
}
if (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.Enable")) {
if (this.config.getBoolean("Island.Stackable.Enable")) {
stackableManager = new StackableManager(this);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> stackableManager.loadSavedStackables(), 5L);
}
@ -184,8 +208,15 @@ public class SkyBlock extends SongodaPlugin {
bankManager = new BankManager(this);
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
if (this.config.getBoolean("Island.Task.PlaytimeTask")) {
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
}
if (this.config.getBoolean("Island.Task.VisitTask")) {
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
}
new ConfirmationTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
// Start Tasks
@ -234,7 +265,7 @@ public class SkyBlock extends SongodaPlugin {
this.vaultPermission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
}
switch (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getString("Economy.Manager", "Default")) {
switch (this.config.getString("Economy.Manager", "Default")) {
case "Vault":
getEconomyManager().setEconomy("Vault");
break;
@ -244,6 +275,8 @@ public class SkyBlock extends SongodaPlugin {
case "Reserve":
getEconomyManager().setEconomy("Reserve");
break;
default:
this.getLogger().warning("EconomyManager is default");
}
this.coreProtectAPI = loadCoreProtect();
@ -287,10 +320,9 @@ public class SkyBlock extends SongodaPlugin {
if (plugin != null) { // Check before loading classes
if (plugin instanceof CoreProtect) { // Check that CoreProtect is loaded
CoreProtectAPI CoreProtect = ((CoreProtect) plugin).getAPI();
if (CoreProtect.isEnabled()) { // Check that the API is enabled
if (CoreProtect.APIVersion() >= 6) { // Check that a compatible version of the API is loaded
return CoreProtect;
}
// Check that the API is enabled and Check that a compatible version of the API is loaded
if (CoreProtect.isEnabled() && CoreProtect.APIVersion() >= 6) {
return CoreProtect;
}
}
}
@ -299,7 +331,8 @@ public class SkyBlock extends SongodaPlugin {
@Override
public void onConfigReload() {
if (!loadConfigs()) this.getLogger().warning("Config are not reload !");
else this.getLogger().info("Configurations Loaded !");
}
@Override
@ -307,7 +340,32 @@ public class SkyBlock extends SongodaPlugin {
return null;
}
private String formatText(String string) {
private boolean loadConfigs() {
try {
biomes = this.getFileManager().getConfig(new File(this.getDataFolder(),"biomes.yml")).getFileConfiguration();
challenges = this.getFileManager().getConfig(new File(this.getDataFolder(),"challenges.yml")).getFileConfiguration();
config = this.getFileManager().getConfig(new File(this.getDataFolder(),"config.yml")).getFileConfiguration();
generators = this.getFileManager().getConfig(new File(this.getDataFolder(),"generators.yml")).getFileConfiguration();
language = this.getFileManager().getConfig(new File(this.getDataFolder(),"language.yml")).getFileConfiguration();
levelling = this.getFileManager().getConfig(new File(this.getDataFolder(),"levelling.yml")).getFileConfiguration();
limits = this.getFileManager().getConfig(new File(this.getDataFolder(),"limits.yml")).getFileConfiguration();
menus = this.getFileManager().getConfig(new File(this.getDataFolder(),"menus.yml")).getFileConfiguration();
placeholders = this.getFileManager().getConfig(new File(this.getDataFolder(),"placeholders.yml")).getFileConfiguration();
rewards = this.getFileManager().getConfig(new File(this.getDataFolder(),"rewards.yml")).getFileConfiguration();
scoreboard = this.getFileManager().getConfig(new File(this.getDataFolder(),"scoreboard.yml")).getFileConfiguration();
settings = this.getFileManager().getConfig(new File(this.getDataFolder(),"settings.yml")).getFileConfiguration();
stackables = this.getFileManager().getConfig(new File(this.getDataFolder(),"stackables.yml")).getFileConfiguration();
upgrades = this.getFileManager().getConfig(new File(this.getDataFolder(),"upgrades.yml")).getFileConfiguration();
return true;
}
catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
public String formatText(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
@ -463,4 +521,34 @@ public class SkyBlock extends SongodaPlugin {
public EconomyManager getEconomyManager() {
return economyManager;
}
public FileConfiguration getBiomes() { return biomes; }
public FileConfiguration getChallenges() { return challenges; }
public FileConfiguration getConfiguration() { return config; }
public FileConfiguration getGenerators() { return generators; }
public FileConfiguration getLanguage() { return language; }
public FileConfiguration getLevelling() { return levelling; }
public FileConfiguration getLimits() { return limits; }
public FileConfiguration getMenus() { return menus; }
public FileConfiguration getPlaceholders() { return placeholders; }
public FileConfiguration getRewards() { return rewards; }
public FileConfiguration getSettings() { return settings; }
public FileConfiguration getStackables() { return stackables; }
public FileConfiguration getUpgrades() { return upgrades; }
public FileConfiguration getScoreboard() { return scoreboard; }
}

View File

@ -4,6 +4,7 @@ import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.bank.Transaction;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.UUID;
@ -15,6 +16,8 @@ public class TransactionLog {
}
public List<Transaction> getLogForPlayer(UUID uuid) {
return getImplementation().getTransactionList(Bukkit.getPlayer(uuid));
Player player = Bukkit.getPlayer(uuid);
if (player == null) return null;
return getImplementation().getTransactionList(player);
}
}

View File

@ -10,7 +10,7 @@ public class IslandUpgradeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Player player;
private IslandUpgrade upgrade;
private final IslandUpgrade upgrade;
public IslandUpgradeEvent(Island island, Player player, IslandUpgrade upgrade) {
super(island);

View File

@ -8,8 +8,8 @@ public class IslandWeatherChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final boolean sync;
private WeatherType weather;
private int time;
private final WeatherType weather;
private final int time;
public IslandWeatherChangeEvent(Island island, WeatherType weather, int time, boolean sync) {
super(island);

View File

@ -8,7 +8,7 @@ public class PlayerIslandChatSwitchEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
private boolean chat;
private final boolean chat;
public PlayerIslandChatSwitchEvent(Player player, Island island, boolean chat) {
super(player, island);

View File

@ -9,7 +9,7 @@ public class PlayerVoteEvent extends PlayerEvent implements Cancellable {
private boolean cancelled = false;
private static HandlerList HANDLERS = new HandlerList();
private static final HandlerList HANDLERS = new HandlerList();
public PlayerVoteEvent(Player player, Island island) {
super(player, island);

View File

@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
public class PlayerVoteRemoveEvent extends PlayerEvent {
private static HandlerList HANDLERS = new HandlerList();
private static final HandlerList HANDLERS = new HandlerList();
public PlayerVoteRemoveEvent(Player player, Island island) {
super(player, island);

View File

@ -8,8 +8,8 @@ public class PlayerWithdrawMoneyEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private Player player;
private double money;
private final Player player;
private final double money;
public PlayerWithdrawMoneyEvent(Player player, double money) {
this.player = player;

View File

@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
public class IslandInvitation {
private final Player invited, inviter;
private int time;
private final int time;
public IslandInvitation(Player invited, Player inviter, int time) {
this.invited = invited;

View File

@ -499,9 +499,7 @@ public class Island {
if (!(object instanceof Island))
return false;
Island other = (Island) object;
if (!other.getIslandUUID().equals(getIslandUUID()))
return false;
return true;
}
return other.getIslandUUID().equals(getIslandUUID());
}
}

View File

@ -5,9 +5,9 @@ import org.bukkit.World;
public class IslandLocation {
private IslandEnvironment environment;
private IslandWorld world;
private Location location;
private final IslandEnvironment environment;
private final IslandWorld world;
private final Location location;
public IslandLocation(IslandEnvironment environment, IslandWorld world, Location location) {
this.environment = environment;

View File

@ -29,12 +29,6 @@ public class StructureManager {
* @return A List of Structures for an Island
*/
public List<Structure> getStructures() {
List<Structure> structures = new ArrayList<>();
for (Structure structureList : structureManager.getStructures()) {
structures.add(structureList);
}
return structures;
return new ArrayList<>(structureManager.getStructures());
}
}

View File

@ -62,15 +62,12 @@ public class Ban {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Bukkit.getServer().getPluginManager().callEvent(islandBanEvent));
if (!islandBanEvent.isCancelled()) {
List<String> islandBans = new ArrayList<>();
FileConfiguration configLoad = plugin.getFileManager()
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
FastUUID.toString(islandOwnerUUID) + ".yml"))
.getFileConfiguration();
for (String islandBanList : configLoad.getStringList("Bans")) {
islandBans.add(islandBanList);
}
List<String> islandBans = new ArrayList<>(configLoad.getStringList("Bans"));
islandBans.add(banned.toString());
configLoad.set("Bans", islandBans);

View File

@ -21,7 +21,7 @@ import java.util.UUID;
public class BanManager {
private final SkyBlock plugin;
private Map<UUID, Ban> banStorage = new HashMap<>();
private final Map<UUID, Ban> banStorage = new HashMap<>();
public BanManager(SkyBlock plugin) {
this.plugin = plugin;
@ -40,7 +40,7 @@ public class BanManager {
public void loadIslands() {
FileManager fileManager = plugin.getFileManager();
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (!this.plugin.getConfiguration()
.getBoolean("Island.Visitor.Unload")) {
File configFile = new File(plugin.getDataFolder().toString() + "/island-data");
@ -76,10 +76,8 @@ public class BanManager {
public void removeVisitor(Island island) {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getLanguage();
for (UUID visitorList : plugin.getIslandManager().getVisitorsAtIsland(island)) {
Player targetPlayer = Bukkit.getServer().getPlayer(visitorList);

View File

@ -20,8 +20,7 @@ public class BankManager {
public BankManager(SkyBlock plugin) {
this.plugin = plugin;
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
lang = config.getFileConfiguration();
lang = this.plugin.getLanguage();
log = new HashMap<>();
loadTransactions();
}
@ -107,7 +106,7 @@ public class BankManager {
}
// If decimals aren't allowed, check for them
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
int intAmt = (int) amt;
if (intAmt != amt) {
return BankResponse.DECIMALS_NOT_ALLOWED;
@ -135,7 +134,6 @@ public class BankManager {
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager fileManager = plugin.getFileManager();
// Make sure the amount is positive
if (amt <= 0) {
@ -143,7 +141,7 @@ public class BankManager {
}
// If decimals aren't allowed, check for them
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
int intAmt = (int) amt;
if (intAmt != amt) {
return BankResponse.DECIMALS_NOT_ALLOWED;

View File

@ -31,7 +31,7 @@ public class BiomeManager {
public BiomeManager(SkyBlock plugin) {
this.plugin = plugin;
this.updatingIslands = new ArrayList<>();
this.language = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration();
this.language = SkyBlock.getInstance().getLanguage();
this.runEveryX = language.getInt("Command.Island.Biome.Progress.Display-Every-X-Updates");
}

View File

@ -77,7 +77,7 @@ public final class BlockScanner extends BukkitRunnable {
this.completedNum = new AtomicInteger();
this.island = island;
FileConfiguration config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml")).getFileConfiguration();
FileConfiguration config = SkyBlock.getInstance().getConfiguration();
int threadCount = 0;

View File

@ -38,9 +38,7 @@ public class ChunkLoader extends BukkitRunnable {
boolean chunkForChunk,
ChunkForChunkScannerTask chunkTask,
CompleteTask complete) {
chunkPerTick = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
chunkPerTick = SkyBlock.getInstance().getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.completeTask = complete;
this.chunkTask = chunkTask;
@ -78,9 +76,7 @@ public class ChunkLoader extends BukkitRunnable {
boolean chunkForChunk,
ChunkScannerTask generalTask,
CompleteTask complete) {
chunkPerTick = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
chunkPerTick = SkyBlock.getInstance().getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.completeTask = complete;
this.generalTask = generalTask;

View File

@ -4,9 +4,12 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -17,9 +20,7 @@ import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.regex.Pattern;
public class Challenge {
@ -208,9 +209,7 @@ public class Challenge {
@Override
public boolean has(Player p, Object obj) {
boolean ignoreLore = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
boolean ignoreLore = SkyBlock.getInstance().getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
if(obj instanceof ItemStack){
// Check if player has specific item in his inventory
ItemStack is = (ItemStack) obj;
@ -224,9 +223,7 @@ public class Challenge {
@Override
public void executeRequire(Player p, Object obj) {
boolean ignoreLore = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
boolean ignoreLore = SkyBlock.getInstance().getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
if(obj instanceof ItemStack){
// Remove specific item in player's inventory
@ -395,7 +392,7 @@ public class Challenge {
},
POTION {
private Pattern space = Pattern.compile(" ");
private final Pattern space = Pattern.compile(" ");
@Override
public Peer<PotionType, Peer<Integer, Integer>> convert(String value) throws IllegalArgumentException {

View File

@ -12,9 +12,9 @@ import java.util.List;
import java.util.Set;
public class ChallengeCategory {
private int id;
private String name;
private HashMap<Integer, Challenge> challenges;
private final int id;
private final String name;
private final HashMap<Integer, Challenge> challenges;
public ChallengeCategory(int id, String name, FileConfiguration config) {
this.id = id;

View File

@ -12,8 +12,8 @@ import java.util.HashMap;
import java.util.logging.Level;
public class ChallengeManager {
private SkyBlock plugin;
private HashMap<Integer, ChallengeCategory> categories;
private final SkyBlock plugin;
private final HashMap<Integer, ChallengeCategory> categories;
public ChallengeManager(SkyBlock plugin) {
this.plugin = plugin;
@ -22,15 +22,14 @@ public class ChallengeManager {
}
private void loadChallenges() {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "challenges.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getChallenges();
try {
ConfigurationSection section = configLoad.getConfigurationSection("challenges");
if (section != null) {
for (String k : section.getKeys(false)) {
int id = configLoad.getInt("challenges." + k + ".id");
String name = ChatColor.translateAlternateColorCodes('&', configLoad.getString("challenges." + k + ".name"));
String name = plugin.formatText(configLoad.getString("challenges." + k + ".name"));
ChallengeCategory cc = new ChallengeCategory(id, name, configLoad);
categories.put(id, cc);
}

View File

@ -14,14 +14,14 @@ import java.util.UUID;
public class ItemChallenge {
private Challenge challenge;
private boolean show;
private int row;
private int col;
private CompatibleMaterial type;
private int amount;
private List<String> lore;
private final boolean show;
private final int row;
private final int col;
private final CompatibleMaterial type;
private final int amount;
private final List<String> lore;
private String itemTitle;
private final String itemTitle;
public ItemChallenge(boolean show, int row, int col, CompatibleMaterial type, int amount, List<String> lore) {
this.show = show;
@ -30,17 +30,12 @@ public class ItemChallenge {
this.type = type;
this.amount = amount;
this.lore = lore;
FileManager.Config langConfig = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"));
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
FileConfiguration langConfigLoad = SkyBlock.getInstance().getLanguage();
itemTitle = langConfigLoad.getString("Challenge.Inventory.Item.Title");
}
public ItemStack createItem(UUID player, int amount) {
FileManager.Config langConfig = SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"));
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
FileConfiguration langConfigLoad = SkyBlock.getInstance().getLanguage();
ItemStack is = type.getItem();
is.setAmount(this.amount);
@ -53,9 +48,8 @@ public class ItemChallenge {
} else {
maxAmount = String.valueOf(challenge.getMaxTimes());
}
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
itemTitle.replace("%challenge", challenge.getName()).replace("%amount", Integer.toString(amount))
.replace("%max", maxAmount)));
im.setDisplayName(SkyBlock.getInstance().formatText( challenge.getName()).replace("%amount", Integer.toString(amount))
.replace("%max", maxAmount));
im.setLore(lore);
is.setItemMeta(im);
}

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.challenge.challenge;
public class Peer<E, F> {
private E key;
private F value;
private final E key;
private final F value;
public Peer(E key, F value) {
this.key = key;

View File

@ -17,12 +17,11 @@ import java.util.List;
public class DefaultInventory {
private final Item defaultItem = new Item(new ItemStack(Material.AIR));
private int size;
private Item[][] items;
private final int size;
private final Item[][] items;
public DefaultInventory(SkyBlock plugin) {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "challenges.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getChallenges();
size = configLoad.getInt("inventory.size");
items = new Item[9][size];
ConfigurationSection section = configLoad.getConfigurationSection("inventory.items");
@ -35,7 +34,7 @@ public class DefaultInventory {
int col = configLoad.getInt(k + ".col");
String strItem = configLoad.getString(k + ".item");
int amount = configLoad.getInt(k + ".amount");
String name = ChatColor.translateAlternateColorCodes('&', configLoad.getString(k + ".name"));
String name = plugin.formatText(configLoad.getString(k + ".name"));
List<String> lore = toColor(configLoad.getStringList(k + ".lore"));
int redirect = configLoad.getInt(k + ".redirect");
CompatibleMaterial material = CompatibleMaterial.getMaterial(strItem);

View File

@ -3,8 +3,8 @@ package com.songoda.skyblock.challenge.defaultinv;
import org.bukkit.inventory.ItemStack;
public class Item {
private ItemStack itemStack;
private int redirect;
private final ItemStack itemStack;
private final int redirect;
public Item(ItemStack itemStack) {
this(itemStack, 0);

View File

@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.function.Consumer;
public class ClickableItem {
private ItemStack item;
private Consumer<InventoryClickEvent> event;
private final ItemStack item;
private final Consumer<InventoryClickEvent> event;
private ClickableItem(ItemStack item, Consumer<InventoryClickEvent> event) {
this.item = item;

View File

@ -14,14 +14,14 @@ import java.util.function.Consumer;
public class Inventory {
public static final String TICK = "tick";
private HashMap<String, Object> values;
private Player player;
private InventoryProvider inventoryProvider;
private int size;
private final HashMap<String, Object> values;
private final Player player;
private final InventoryProvider inventoryProvider;
private final int size;
private List<Integer> excluseCases;
private ClickableItem[] items;
private org.bukkit.inventory.Inventory bukkitInventory;
private final List<Integer> excluseCases;
private final ClickableItem[] items;
private final org.bukkit.inventory.Inventory bukkitInventory;
public Inventory(Player player, InventoryProvider inventoryProvider, Consumer<Inventory> params) {
this.values = new HashMap<>();

View File

@ -20,9 +20,8 @@ import java.util.UUID;
import java.util.function.Consumer;
public class InventoryManager implements Listener {
private SkyBlock plugin;
private HashMap<UUID, Inventory> inventories;
private int task;
private final SkyBlock plugin;
private final HashMap<UUID, Inventory> inventories;
public InventoryManager(SkyBlock plugin) {
this.plugin = plugin;
@ -31,7 +30,7 @@ public class InventoryManager implements Listener {
public void init() {
Bukkit.getPluginManager().registerEvents(this, plugin);
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
if (inventories.size() == 0)
return;
for (Inventory inv : inventories.values()) {

View File

@ -10,18 +10,18 @@ import java.util.List;
public interface InventoryProvider {
public String title(Inventory inv);
String title(Inventory inv);
public int rows(Inventory inv);
int rows(Inventory inv);
public void init(Inventory inv);
void init(Inventory inv);
public void update(Inventory inv);
void update(Inventory inv);
public default List<Integer> excluseCases(Inventory inv) {
default List<Integer> excluseCases(Inventory inv) {
return new ArrayList<>();
}
public default void onClose(InventoryCloseEvent e, Inventory inv) {
default void onClose(InventoryCloseEvent e, Inventory inv) {
}
}

View File

@ -24,7 +24,7 @@ import java.util.logging.Level;
public class ChallengeInventory implements InventoryProvider {
public static final String CATEGORY = "ChallengeCategory";
private FabledChallenge fc;
private final FabledChallenge fc;
public ChallengeInventory(FabledChallenge fc) {
this.fc = fc;

View File

@ -6,8 +6,8 @@ import java.util.HashMap;
import java.util.UUID;
public class PlayerChallenge {
private UUID uuid;
private HashMap<Challenge, Integer> challenges;
private final UUID uuid;
private final HashMap<Challenge, Integer> challenges;
public PlayerChallenge(UUID uuid, HashMap<Challenge, Integer> challenges) {
this.uuid = uuid;

View File

@ -13,6 +13,7 @@ import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.io.File;
@ -23,9 +24,9 @@ import java.util.Set;
import java.util.UUID;
public class PlayerManager {
private SkyBlock plugin;
private HashMap<UUID, HashMap<Challenge, Integer>> islands;
private File playersDirectory;
private final SkyBlock plugin;
private final HashMap<UUID, HashMap<Challenge, Integer>> islands;
private final File playersDirectory;
public PlayerManager(SkyBlock plugin) {
this.plugin = plugin;
@ -35,14 +36,12 @@ public class PlayerManager {
playersDirectory.mkdirs();
Bukkit.getScheduler().runTask(plugin, () -> {
for(Player p : Bukkit.getServer().getOnlinePlayers()){
loadPlayer(p.getUniqueId());
}
Bukkit.getServer().getOnlinePlayers().stream().map(Entity::getUniqueId).forEach(this::loadPlayer);
});
}
public HashMap<Challenge, Integer> getPlayer(UUID uuid) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", false)) {
OfflinePlayer player = Bukkit.getPlayer(uuid);
if(player == null) {
@ -63,7 +62,7 @@ public class PlayerManager {
* The uuid of specific player
*/
public void loadPlayer(UUID uuid) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
@ -104,7 +103,7 @@ public class PlayerManager {
* The uuid of specific player
*/
public void unloadPlayer(UUID uuid) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", false)) {
OfflinePlayer player = Bukkit.getPlayer(uuid);
if(player == null) {
@ -138,7 +137,7 @@ public class PlayerManager {
if (c == null)
return false;
UUID uuid = p.getUniqueId();
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
@ -174,7 +173,7 @@ public class PlayerManager {
if (!canDoChallenge(p, c))
return false;
UUID uuid = p.getUniqueId();
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
@ -193,10 +192,8 @@ public class PlayerManager {
peer.getKey().executeReward(p, peer.getValue());
}
// Ok, send message
String broadcast = ChatColor.translateAlternateColorCodes('&',
SkyBlock.getInstance().getFileManager()
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Challenge.Broadcast"));
SkyBlock instance = SkyBlock.getInstance();
String broadcast = instance.formatText(instance.getLanguage().getString("Challenge.Broadcast"));
if (c.isShowInChat())
Bukkit.broadcastMessage(broadcast.replace("%player", p.getName()).replace("%challenge", c.getName())
.replace("%amount", Integer.toString(count + 1))
@ -205,7 +202,7 @@ public class PlayerManager {
}
public void addChallenge(UUID uuid, Challenge c) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){
@ -244,7 +241,7 @@ public class PlayerManager {
if (challenges != null) {
return challenges.getOrDefault(c, 0);
} else {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if(is != null){

View File

@ -38,11 +38,14 @@ public class CommandManager implements CommandExecutor, TabCompleter {
public CommandManager(SkyBlock plugin) {
this.plugin = plugin;
plugin.getCommand("island").setExecutor(this);
plugin.getCommand("island").setTabCompleter(this);
registerSubCommands();
PluginCommand islandCMD = plugin.getCommand("island");
if (islandCMD != null) {
islandCMD.setExecutor(this);
islandCMD.setTabCompleter(this);
registerSubCommands();
}
}
public void registerSubCommands() {
@ -127,13 +130,9 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (command.getName().equalsIgnoreCase("island")) {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
Config languageConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration languageConfigLoad = languageConfig.getFileConfiguration();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration mainConfig = config.getFileConfiguration();
FileConfiguration languageConfigLoad = plugin.getLanguage();
FileConfiguration mainConfig = plugin.getConfiguration();
Player player = null;
@ -189,7 +188,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (args.length == 2) {
if (args[1].matches("[0-9]+")) {
page = Integer.valueOf(args[1]);
page = Integer.parseInt(args[1]);
} else {
messageManager.sendMessage(player,
languageConfigLoad.getString("Command.Island.Help.Integer.Message"));
@ -221,13 +220,12 @@ public class CommandManager implements CommandExecutor, TabCompleter {
int page = -1;
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Command.Help.List")) {
if (!this.plugin.getConfiguration().getBoolean("Command.Help.List")) {
page = 1;
if (args.length == 3) {
if (args[2].matches("[0-9]+")) {
page = Integer.valueOf(args[2]);
page = Integer.parseInt(args[2]);
} else {
messageManager.sendMessage(player,
languageConfigLoad.getString("Command.Island.Help.Integer.Message"));
@ -493,8 +491,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
player.spigot()
.sendMessage(
new ChatComponent(
ChatColor.translateAlternateColorCodes(
'&', configLoad.getString("Command.Island.Help.Word.Next")),
plugin.formatText(configLoad.getString("Command.Island.Help.Word.Next")),
false, null,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island " + subCommandText + "help " + (page + 1)),
@ -503,8 +500,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
player.spigot()
.sendMessage(
new ChatComponent(
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Command.Island.Help.Word.Previous")),
plugin.formatText(configLoad.getString("Command.Island.Help.Word.Previous")),
false, null,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island " + subCommandText + "help " + (page - 1)),

View File

@ -15,7 +15,7 @@ public abstract class SubCommand {
public SubCommand() {
this.plugin = SkyBlock.getInstance();
this.info = ChatColor.translateAlternateColorCodes('&', this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString(this.getInfoMessagePath()));
this.info = this.plugin.formatText(this.plugin.getLanguage().getString(this.getInfoMessagePath()));
}
public abstract void onCommandByPlayer(Player player, String[] args);

View File

@ -36,7 +36,7 @@ public class AdminBank extends SubCommand {
Island island = islandManager.getIslandAtLocation(player.getLocation());
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
return;

View File

@ -79,8 +79,7 @@ public class SetMaxMembers extends SubCommand {
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
island.setMaxMembers(maxMembers);
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")
if (this.plugin.getConfiguration().getBoolean("Island.WorldBorder.Enable")
&& island.isBorder()) {
islandManager.updateBorder(island);
}

View File

@ -79,8 +79,7 @@ public class SetSizeCommand extends SubCommand {
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
island.setSize(size);
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")
if (this.plugin.getConfiguration().getBoolean("Island.WorldBorder.Enable")
&& island.isBorder()) {
islandManager.updateBorder(island);
}

View File

@ -98,7 +98,7 @@ public class AcceptCommand extends SubCommand {
island.save();
if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()
+ 1) >= island.getMaxMembers()) {
+ 1) >= island.getMaxMembers(player)) {
Map<UUID, Invite> invites = inviteManager.getInvites();
for (UUID inviteList : invites.keySet()) {

View File

@ -41,7 +41,7 @@ public class BanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
} else if (this.plugin.getConfiguration().getBoolean("Island.Visitor.Banning")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && permissionManager.hasPermission(island, "Ban", IslandRole.Operator))) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);

View File

@ -27,7 +27,7 @@ public class BankCommand extends SubCommand {
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;

View File

@ -38,7 +38,7 @@ public class BorderCommand extends SubCommand {
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& permissionManager.hasPermission(island, "Border", IslandRole.Operator))
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.WorldBorder.Enable")) {
Border.getInstance().open(player);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);

View File

@ -30,14 +30,14 @@ public class ChallengeCommand extends SubCommand {
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
// Not loaded
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (!this.plugin.getConfiguration()
.getBoolean("Island.Challenge.Enable")) {
messageManager.sendMessage(player, langConfigLoad.getString("Command.Island.Challenge.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (args.length == 0) {
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland")){
if(islandManager.getIsland(player) == null){
messageManager.sendMessage(player, langConfigLoad.getString("Command.Island.Challenge.NoIsland.Message"));

View File

@ -39,7 +39,7 @@ public class CoopCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
} else if (this.plugin.getConfiguration()
.getBoolean("Island.Coop.Enable")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())

View File

@ -50,7 +50,7 @@ public class InviteCommand extends SubCommand {
Config mainConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()
+ 1) >= island.getMaxMembers()) {
+ 1) >= island.getMaxMembers(player)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Invite.Capacity.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {

View File

@ -28,7 +28,7 @@ public class LeaderboardCommand extends SubCommand {
if (playerDataManager.hasPlayerData(player)) {
if (args.length == 0) {
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Visitor.Vote")) {
playerDataManager.getPlayerData(player)
.setViewer(new Leaderboard.Viewer(Leaderboard.Viewer.Type.Browse));
@ -46,7 +46,7 @@ public class LeaderboardCommand extends SubCommand {
playerDataManager.getPlayerData(player).setViewer(new Leaderboard.Viewer(Leaderboard.Viewer.Type.Bank));
break;
case "votes":
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Vote")) {
if (this.plugin.getConfiguration().getBoolean("Island.Visitor.Vote")) {
playerDataManager.getPlayerData(player).setViewer(new Leaderboard.Viewer(Leaderboard.Viewer.Type.Votes));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Leaderboard.Disabled.Message"));

View File

@ -126,8 +126,7 @@ public class OwnerCommand extends SubCommand {
return;
} else {
int confirmationTime = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
int confirmationTime = this.plugin.getConfiguration().getInt("Island.Confirmation.Timeout");
playerData.setOwnership(targetPlayerUUID);
playerData.setConfirmation(Confirmation.Ownership);

View File

@ -34,105 +34,16 @@ public class SetSpawnCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
IslandEnvironment environment;
if (args[0].equalsIgnoreCase("Main")) {
environment = IslandEnvironment.Main;
setIslandSpawn(IslandEnvironment.Main, island, islandManager, player, configLoad, fileManager, messageManager, soundManager);
} else if (args[0].equalsIgnoreCase("Visitor")) {
environment = IslandEnvironment.Visitor;
setIslandSpawn(IslandEnvironment.Visitor, island, islandManager, player, configLoad, fileManager, messageManager, soundManager);
} else if (args[0].equalsIgnoreCase("All")){
setIslandSpawn(IslandEnvironment.Main, island, islandManager, player, configLoad, fileManager, messageManager, soundManager);
setIslandSpawn(IslandEnvironment.Visitor, island, islandManager, player, configLoad, fileManager, messageManager, soundManager);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Spawn.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}
if (island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& (plugin.getPermissionManager().hasPermission(island,
environment.name() + "Spawn", IslandRole.Operator)))
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (islandManager.isPlayerAtIsland(island, player)) {
IslandWorld world = plugin.getWorldManager().getIslandWorld(player.getWorld());
Location location = player.getLocation();
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
CompatibleMaterial toCompare = CompatibleMaterial.getMaterial(location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType());
if(toCompare == CompatibleMaterial.AIR
|| toCompare == CompatibleMaterial.MOVING_PISTON
|| toCompare == CompatibleMaterial.ICE
|| toCompare == CompatibleMaterial.PISTON_HEAD) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Block.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!player.getLocation().clone().subtract(0, 0.1, 0).getBlock().getType().isSolid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Ground.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (location.getBlock().isLiquid()
|| location.clone().add(0.0D, 1.0D, 0.0D).getBlock().isLiquid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Liquid.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()) == CompatibleMaterial.NETHER_PORTAL
|| CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType()) == CompatibleMaterial.NETHER_PORTAL) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Portal.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else {
CompatibleMaterial type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isSolid() && type.isOccluding()) {
location.getBlock().breakNaturally();
}
CompatibleMaterial typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isSolid() && type.isOccluding()) {
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().breakNaturally();
}
islandManager.removeSpawnProtection(island.getLocation(world, environment));
}
}
Location newSpawnLocation = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
island.setLocation(world, environment, newSpawnLocation);
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Set.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
return;
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Island.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Permission.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Role.Message")
.replace("%spawn", environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
} else {
@ -163,6 +74,97 @@ public class SetSpawnCommand extends SubCommand {
@Override
public String[] getArguments() {
return new String[]{"main", "visitor"};
return new String[]{ "main", "visitor" , "all"};
}
private void setIslandSpawn(IslandEnvironment environment, Island island, IslandManager islandManager, Player player, FileConfiguration configLoad, FileManager fileManager, MessageManager messageManager, SoundManager soundManager) {
if (island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
&& (plugin.getPermissionManager().hasPermission(island,
environment.name() + "Spawn", IslandRole.Operator)))
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (islandManager.isPlayerAtIsland(island, player)) {
IslandWorld world = plugin.getWorldManager().getIslandWorld(player.getWorld());
Location location = player.getLocation();
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
CompatibleMaterial toCompare = CompatibleMaterial.getMaterial(location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType());
if(toCompare == CompatibleMaterial.AIR
|| toCompare == CompatibleMaterial.MOVING_PISTON
|| toCompare == CompatibleMaterial.ICE
|| toCompare == CompatibleMaterial.PISTON_HEAD) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Block.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!player.getLocation().clone().subtract(0, 0.1, 0).getBlock().getType().isSolid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Ground.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (location.getBlock().isLiquid()
|| location.clone().add(0.0D, 1.0D, 0.0D).getBlock().isLiquid()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Liquid.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()) == CompatibleMaterial.NETHER_PORTAL
|| CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType()) == CompatibleMaterial.NETHER_PORTAL) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Portal.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else {
CompatibleMaterial type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isSolid() && type.isOccluding()) {
location.getBlock().breakNaturally();
}
CompatibleMaterial typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isSolid() && type.isOccluding()) {
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().breakNaturally();
}
islandManager.removeSpawnProtection(island.getLocation(world, environment));
}
}
Location newSpawnLocation = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
island.setLocation(world, environment, newSpawnLocation);
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Set.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
return;
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Island.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Permission.Message").replace("%spawn",
environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.SetSpawn.Role.Message")
.replace("%spawn", environment.name().toLowerCase()));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
}
}
}

View File

@ -7,13 +7,15 @@ import com.songoda.skyblock.island.*;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -35,25 +37,22 @@ public class TeleportCommand extends SubCommand {
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 1) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
UUID islandOwnerUUID;
String targetPlayerName;
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(args[0]);
Island island = islandManager.getIsland(offlinePlayer);
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message", "Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
if (targetPlayer == null) {
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
islandOwnerUUID = targetOfflinePlayer.getOwner();
targetPlayerName = targetOfflinePlayer.getName();
} else {
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
targetPlayerName = targetPlayer.getName();
return;
}
UUID islandOwnerUUID = island.getOwnerUUID();
if (islandOwnerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
}
else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
if (visitManager.hasIsland(islandOwnerUUID)) {
Visit visit = visitManager.getIsland(islandOwnerUUID);
boolean isCoopPlayer = false;
@ -63,24 +62,29 @@ public class TeleportCommand extends SubCommand {
if (islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)).isCoopPlayer(player.getUniqueId())) {
isCoopPlayer = true;
}
if (visit.getStatus().equals(IslandStatus.WHITELISTED) && islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)).isPlayerWhitelisted(player.getUniqueId())) {
isWhitelistedPlayer = true;
}
}
if (visit.getStatus().equals(IslandStatus.OPEN) ||
isCoopPlayer ||
isWhitelistedPlayer ||
player.hasPermission("fabledskyblock.bypass") ||
player.hasPermission("fabledskyblock.bypass.*") ||
player.hasPermission("fabledskyblock.*")) {
if (!islandManager.containsIsland(islandOwnerUUID)) {
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
}
islandManager.visitIsland(player, islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Other.Message").replace("%player", targetPlayerName));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Other.Message").replace("%player", args[0]));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
return;
@ -107,18 +111,13 @@ public class TeleportCommand extends SubCommand {
Island island = islandManager.getIsland(player);
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Owner.Message"));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Owner.Message", "Command.Island.Teleport.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message"));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message", "Command.Island.Teleport.Teleported.Yourself.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTask(plugin, () -> {
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
if (loc == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Unsafe.Message"));
return;
}
PaperLib.getChunkAtAsync(loc).thenRun((() -> {
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.RemoveWater", false)) {
@ -131,6 +130,7 @@ public class TeleportCommand extends SubCommand {
player.setFallDistance(0.0F);
}
});
}
}

View File

@ -37,7 +37,7 @@ public class UnbanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unban.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
} else if (this.plugin.getConfiguration()
.getBoolean("Island.Visitor.Banning")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())

View File

@ -45,7 +45,7 @@ public class UnlockCommand extends SubCommand {
return;
}
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World." + type + ".Enable")) {
if (!this.plugin.getConfiguration().getBoolean("Island.World." + type + ".Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Disabled.Message").replace("%type%", type));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;

View File

@ -37,7 +37,7 @@ public class ValueCommand extends SubCommand {
if (materials != null && levellingManager.hasWorth(materials)) {
double worth = levellingManager.getWorth(materials);
double level = worth / (double) fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Levelling.Division");
double level = worth / (double) this.plugin.getConfiguration().getInt("Island.Levelling.Division");
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))

View File

@ -40,7 +40,7 @@ public class VoteCommand extends SubCommand {
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 1) {
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (!this.plugin.getConfiguration()
.getBoolean("Island.Visitor.Vote")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Vote.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);

View File

@ -15,7 +15,7 @@ public class FileChecker {
private final FileManager fileManager;
private Map<File.Type, File> loadedFiles;
private final Map<File.Type, File> loadedFiles;
public FileChecker(SkyBlock plugin, FileManager fileManager, String configurationFileName, boolean applyComments) {
this.fileManager = fileManager;
@ -87,10 +87,10 @@ public class FileChecker {
public static class File {
private java.io.File configFile;
private final java.io.File configFile;
private FileConfiguration configLoad;
private HashMap<String, Object> configKeys;
private final HashMap<String, Object> configKeys;
public File(FileManager fileManager, java.io.File configFile, FileConfiguration configLoad) {
this.configFile = configFile;

View File

@ -333,7 +333,7 @@ public class FileManager {
public static class Config {
private File configFile;
private final File configFile;
private FileConfiguration configLoad;
public Config(FileManager fileManager, java.io.File configPath) {

View File

@ -18,7 +18,7 @@ public class CooldownManager {
private final SkyBlock plugin;
private Map<CooldownType, List<CooldownPlayer>> cooldownStorage = new EnumMap<>(CooldownType.class);
private final Map<CooldownType, List<CooldownPlayer>> cooldownStorage = new EnumMap<>(CooldownType.class);
public CooldownManager(SkyBlock plugin) {
this.plugin = plugin;
@ -95,7 +95,7 @@ public class CooldownManager {
int time = 0;
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
time = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
time = this.plugin.getConfiguration()
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
Config config = fileManager
@ -111,7 +111,7 @@ public class CooldownManager {
e.printStackTrace();
}
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
time = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
time = this.plugin.getConfiguration()
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
Config config = plugin.getFileManager()

View File

@ -20,8 +20,7 @@ public class CooldownTask extends BukkitRunnable {
if (cooldownPlayers == null) return;
for (int i = 0; i < cooldownPlayers.size(); i++) {
CooldownPlayer cooldownPlayer = cooldownPlayers.get(i);
for (CooldownPlayer cooldownPlayer : cooldownPlayers) {
Cooldown cooldown = cooldownPlayer.getCooldown();
cooldown.setTime(cooldown.getTime() - 1);

View File

@ -15,16 +15,14 @@ public class EconomyManager extends Manager {
economy = com.songoda.core.hooks.EconomyManager.getEconomy();
}
public boolean setEconomy(String economyString) {
public void setEconomy(String economyString) {
Hook hook = com.songoda.core.hooks.EconomyManager.getManager().getHook(economyString);
if(hook != null &&
hook.isEnabled() &&
hook instanceof Economy &&
!hook.equals(com.songoda.core.hooks.EconomyManager.getManager().getCurrentHook())) {
this.economy = (Economy) hook;
return true;
}
return false;
}
public Economy getEconomy() {

View File

@ -30,8 +30,7 @@ public class GeneratorManager {
}
public void registerGenerators() {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "generators.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getGenerators();
if (configLoad.getString("Generators") == null)
return;

View File

@ -4,7 +4,7 @@ import com.songoda.core.compatibility.CompatibleMaterial;
public class GeneratorMaterial {
private CompatibleMaterial materials;
private final CompatibleMaterial materials;
private double chance;
public GeneratorMaterial(CompatibleMaterial materials, double chance) {

View File

@ -24,12 +24,11 @@ public class GuiBank extends Gui {
public GuiBank(SkyBlock plugin, Island island, Gui returnGui, boolean admin) {
super(2, returnGui);
this.plugin = plugin;;
this.plugin = plugin;
this.soundManager = plugin.getSoundManager();
this.island = island;
this.admin = admin;
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
this.languageLoad = this.plugin.getLanguage();
if(island != null) {
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setTitle(TextUtils.formatText(languageLoad.getString("Menu.Bank.Title")));

View File

@ -42,8 +42,7 @@ public class GuiBankSelector extends Gui {
this.island = island;
this.returnGui = returnGui;
this.admin = admin;
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
this.languageLoad = this.plugin.getLanguage();
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setTitle(TextUtils.formatText(languageLoad.getString("Menu.Input.Title")));
paint();
@ -92,14 +91,14 @@ public class GuiBankSelector extends Gui {
switch(type){
case DEPOSIT:
amount = economy.getBalance(event.player);
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
amount = Math.floor(amount);
}
response = bankManager.deposit(event.player, island, amount, admin);
break;
case WITHDRAW:
amount = island.getBankBalance();
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
amount = Math.floor(amount);
}
response = bankManager.withdraw(event.player, island, amount, admin);

View File

@ -21,11 +21,8 @@ import java.util.ArrayList;
import java.util.List;
public class GuiBankTransaction extends Gui {
private final SkyBlock plugin;
private final BankManager bankManager;
private final SoundManager soundManager;
private final FileConfiguration languageLoad;
private final FileManager.Config config;
private final Gui returnGui;
private final int transactions;
private final List<Transaction> transactionList;
@ -33,17 +30,13 @@ public class GuiBankTransaction extends Gui {
public GuiBankTransaction(SkyBlock plugin, Island island, Gui returnGui, boolean admin) {
super(returnGui);
this.plugin = plugin;
this.bankManager = plugin.getBankManager();
BankManager bankManager = plugin.getBankManager();
this.soundManager = plugin.getSoundManager();
this.transactionList = bankManager.getTransactions(island.getOwnerUUID());
this.transactions = this.transactionList.size();
this.returnGui = returnGui;
this.admin = admin;
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
this.config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
this.languageLoad = plugin.getLanguage();
if(transactions == 0){
setRows(2);
} else if(transactions > 4*9){

View File

@ -22,8 +22,7 @@ public class BiomeIcon {
public BiomeIcon(SkyBlock plugin, CompatibleBiome biome){
this.biome = biome;
FileConfiguration biomeConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(),"biomes.yml")).getFileConfiguration();
FileConfiguration biomeConfig = plugin.getBiomes();
CompatibleMaterial tempMat = CompatibleMaterial.getMaterial(biomeConfig.getString("Biomes." + biome.name() + ".DisplayItem.Material"));
if(tempMat == null){
tempMat = CompatibleMaterial.STONE;

View File

@ -33,11 +33,8 @@ public class GuiBiome extends Gui {
private final SkyBlock plugin;
private final Island island;
private final FileConfiguration languageLoad;
private final FileConfiguration config;
private final Gui returnGui;
private final Player player;
private final IslandWorld world;
private final boolean admin;
public GuiBiome(SkyBlock plugin, Player player, Island island, IslandWorld world, Gui returnGui, boolean admin) {
super(6, returnGui);
@ -45,9 +42,7 @@ public class GuiBiome extends Gui {
this.island = island;
this.world = world;
this.player = player;
this.returnGui = returnGui;
this.admin = admin;
this.config = plugin.getFileManager()
FileConfiguration config = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration();
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();

View File

@ -48,7 +48,7 @@ public class GuiPermissions extends Gui {
this.returnGui = returnGui;
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
this.configLoad = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration();
this.configLoad = this.plugin.getConfiguration();
setTitle(TextUtils.formatText(languageLoad.getString("Menu.Settings." + role.name() + ".Title")));
setDefaultItem(null);
paint();

View File

@ -51,7 +51,7 @@ public class GuiPermissionsSelector extends Gui {
new GuiAdminPermissions(plugin, IslandRole.Operator, this) :
new GuiPermissions(plugin, player, island, IslandRole.Operator, this)));
boolean isCoop = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
boolean isCoop = plugin.getConfiguration()
.getBoolean("Island.Coop.Enable");
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,

View File

@ -9,8 +9,8 @@ import java.util.List;
public class Hologram {
private HologramType type;
private Location location;
private final HologramType type;
private final Location location;
public Hologram(HologramType type, Location location, List<String> lines) {
this.type = type;

View File

@ -6,10 +6,10 @@ import java.util.UUID;
public class Invite {
private UUID playerUUID;
private UUID senderUUID;
private final UUID playerUUID;
private final UUID senderUUID;
private UUID islandOwnerUUID;
private String senderName;
private final String senderName;
private int time;
public Invite(Player player, Player sender, UUID islandOwnerUUID, int time) {

View File

@ -9,7 +9,7 @@ import java.util.UUID;
public class InviteManager {
private Map<UUID, Invite> inviteStorage = new HashMap<>();
private final Map<UUID, Invite> inviteStorage = new HashMap<>();
public InviteManager(SkyBlock plugin) {
new InviteTask(this, plugin).runTaskTimerAsynchronously(plugin, 0L, 20L);

View File

@ -32,8 +32,7 @@ public class InviteTask extends BukkitRunnable {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getLanguage();
for (Player all : Bukkit.getOnlinePlayers()) {
if (inviteManager.hasInvite(all.getUniqueId())) {

View File

@ -14,7 +14,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;g
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.visit.Visit;
@ -60,10 +60,8 @@ public class Island {
this.islandUUID = UUID.randomUUID();
this.ownerUUID = player.getUniqueId();
this.size = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
.getInt("Island.Size.Minimum");
this.maxMembers = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
.getInt("Island.Member.Capacity", 3);
this.size = this.plugin.getConfiguration().getInt("Island.Size.Minimum");
this.maxMembers = this.plugin.getConfiguration().getInt("Island.Member.Capacity", 3);
if (this.size > 1000) {
this.size = 50;
@ -72,8 +70,7 @@ public class Island {
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(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getConfiguration();
int minimumSize = configLoad.getInt("Island.Size.Minimum");
int maximumSize = configLoad.getInt("Island.Size.Maximum");
@ -101,10 +98,8 @@ public class Island {
File configFile = new File(plugin.getDataFolder().toString() + "/island-data");
Config config = fileManager.getConfig(new File(configFile, ownerUUID + ".yml"));
Config defaultSettingsConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "settings.yml"));
Config mainConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration mainConfigLoad = mainConfig.getFileConfiguration();
FileConfiguration mainConfigLoad = this.plugin.getConfiguration();
if (fileManager.isFileExist(new File(configFile, ownerUUID + ".yml"))) {
FileConfiguration configLoad = config.getFileConfiguration();
@ -136,7 +131,7 @@ public class Island {
}
if (configLoad.getString("Border") == null) {
configLoad.set("Border.Enable", mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Enable", mainConfigLoad.getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Color", WorldBorder.Color.Blue.name());
}
@ -192,7 +187,7 @@ public class Island {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration()
.getString("Settings." + roleList.name() + "." + permission.getName()) == null) {
permissions.add(
new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration()
new IslandPermission(permission, this.plugin.getSettings()
.getBoolean("Settings." + roleList.name() + "." + permission.getName(), true)));
} else {
permissions.add(new IslandPermission(permission, settingsDataConfig.getFileConfiguration()
@ -234,7 +229,7 @@ public class Island {
configLoad.set("UUID", islandUUID.toString());
configLoad.set("Visitor.Status", mainConfigLoad.getString("Island.Visitor.Status").toUpperCase());
configLoad.set("Border.Enable", mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Enable", mainConfigLoad.getBoolean("Island.WorldBorder.Default", false));
configLoad.set("Border.Color", WorldBorder.Color.Blue.name());
configLoad.set("Biome.Type", mainConfigLoad.getString("Island.Biome.Default.Type").toUpperCase());
configLoad.set("Weather.Synchronised", mainConfigLoad.getBoolean("Island.Weather.Default.Synchronised")); // TODO: Synchronized
@ -249,7 +244,7 @@ public class Island {
for (BasicPermission permission : allPermissions) {
permissions.add(
new IslandPermission(permission, defaultSettingsConfig.getFileConfiguration()
new IslandPermission(permission, this.plugin.getSettings()
.getBoolean("Settings." + roleList.name() + "." + permission.getName(), true)));
}
@ -917,8 +912,7 @@ public class Island {
e.printStackTrace();
}
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Coop.Unload")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Coop.Unload")) {
config = fileManager
.getConfig(new File(plugin.getDataFolder().toString() + "/coop-data", ownerUUID.toString() + ".yml"));
configLoad = config.getFileConfiguration();
@ -946,8 +940,7 @@ public class Island {
FileManager fileManager = plugin.getFileManager();
SoundManager soundManager = plugin.getSoundManager();
MessageManager messageManager = plugin.getMessageManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getConfiguration();
Config islandData = fileManager
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"),
ownerUUID.toString() + ".yml"));
@ -962,7 +955,7 @@ public class Island {
if (!unlocked) {
messageManager.sendMessage(player,
fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration()
this.plugin.getLanguage()
.getString("Island.Unlock." + type.name() + ".Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));

View File

@ -65,8 +65,7 @@ public class IslandLevel {
}
public long getPoints() {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "levelling.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getLevelling();
ConfigurationSection materialSection = configLoad.getConfigurationSection("Materials");
@ -104,9 +103,8 @@ public class IslandLevel {
break;
}
}
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "levelling.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getLevelling();
ConfigurationSection materialSection = configLoad.getConfigurationSection("Materials");
@ -131,14 +129,14 @@ public class IslandLevel {
}
public long getLevel() {
long division = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getLong("Island.Levelling.Division");
long division = this.plugin.getConfiguration().getLong("Island.Levelling.Division");
if (division == 0) {
division = 1;
}
long points = getPoints();
long subtract = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getLong("Island.Levelling.Subtract");
long subtract = this.plugin.getConfiguration().getLong("Island.Levelling.Subtract");
if(points >= subtract){
points -= subtract;
} else {
@ -156,8 +154,8 @@ public class IslandLevel {
if (level <= highestLevel)
return;
final FileConfiguration language = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
final FileConfiguration config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration();
final FileConfiguration language = this.plugin.getLanguage();
final FileConfiguration config = this.plugin.getConfiguration();
OfflinePlayer owner = Bukkit.getOfflinePlayer(ownerUUID);

View File

@ -5,8 +5,8 @@ import org.bukkit.Location;
public class IslandLocation {
private IslandWorld world;
private IslandEnvironment environment;
private final IslandWorld world;
private final IslandEnvironment environment;
private double x;
private double y;

View File

@ -80,17 +80,14 @@ public class IslandManager {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "worlds.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
offset = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Creation.Distance", 1200);
offset = plugin.getConfiguration().getInt("Island.Creation.Distance", 1200);
for (IslandWorld worldList : IslandWorld.values()) {
ConfigurationSection configSection = configLoad.getConfigurationSection("World." + worldList.name() + ".nextAvailableLocation");
islandPositions.add(new IslandPosition(worldList, configSection.getDouble("x"), configSection.getDouble("z")));
}
for (Player all : Bukkit.getOnlinePlayers()) {
loadIsland(all);
}
Bukkit.getOnlinePlayers().forEach(this::loadIsland);
for (Island island : getIslands().values()) {
if (island.isAlwaysLoaded())
loadIslandAtLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island));
@ -144,10 +141,9 @@ public class IslandManager {
if (islandPositionList.getWorld() == world) {
Config config_world = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "worlds.yml"));
Config config_config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad_world = config_world.getFileConfiguration();
FileConfiguration configLoad_config = config_config.getFileConfiguration();
FileConfiguration configLoad_config = plugin.getConfiguration();
int x = (int) configLoad_world.get("World." + world.name() + ".nextAvailableLocation.island_number");
int islandHeight = configLoad_config.getInt("Island.World." + world.name() + ".IslandSpawnHeight", 72);
while (true) {
@ -215,13 +211,13 @@ public class IslandManager {
final int highest = PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.create", true, 2);
if ((amt = data.getIslandCreationCount()) >= highest) {
plugin.getMessageManager().sendMessage(player, fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
plugin.getLanguage().getString("Island.Creator.Error.MaxCreationMessage");
return false;
}
}
if (fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
plugin.getMessageManager().sendMessage(player, fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.Message"));
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Creator.Error.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return false;
@ -247,8 +243,7 @@ public class IslandManager {
if (!banManager.hasIsland(island.getOwnerUUID())) banManager.createIsland(island.getOwnerUUID());
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = this.plugin.getConfiguration();
if (configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable") && !player.hasPermission("fabledskyblock.bypass.cooldown") && !player.hasPermission("fabledskyblock.bypass.*")
&& !player.hasPermission("fabledskyblock.*"))
@ -271,7 +266,7 @@ public class IslandManager {
player.setFallDistance(0.0F);
}, configLoad.getInt("Island.Creation.TeleportTimeout") * 20);
String biomeName = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getString("Island.Biome.Default.Type").toUpperCase();
String biomeName = this.plugin.getConfiguration().getString("Island.Biome.Default.Type").toUpperCase();
CompatibleBiome cBiome;
try {
cBiome = CompatibleBiome.valueOf(biomeName);
@ -300,17 +295,15 @@ public class IslandManager {
FileManager fileManager = plugin.getFileManager();
PlayerData data = plugin.getPlayerDataManager().getPlayerData(player);
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLang = config.getFileConfiguration();
config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configMain = config.getFileConfiguration();
FileConfiguration configLang = plugin.getLanguage();
FileConfiguration configMain = plugin.getConfiguration();
if (data != null) {
final int highest = PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.create", true, 2);
if ((data.getIslandCreationCount()) >= highest) {
plugin.getMessageManager().sendMessage(player, fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Creator.Error.MaxCreationMessage"));
return false;
}
@ -427,8 +420,7 @@ public class IslandManager {
level.save();
level.setOwnerUUID(player.getUniqueId());
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Ownership.Password.Reset")) {
island.setPassword(null);
@ -465,7 +457,7 @@ public class IslandManager {
fileManager.unloadConfig(newIslandDataFile);
oldIslandDataFile.renameTo(newIslandDataFile);
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
File oldChallengeDataFile = new File(new File(plugin.getDataFolder().toString() + "/challenge-data"), uuid2.toString() + ".yml");
File newChallengeDataFile = new File(new File(plugin.getDataFolder().toString() + "/challenge-data"), player.getUniqueId().toString() + ".yml");
@ -555,6 +547,8 @@ public class IslandManager {
}
}
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Deletion.DeleteIsland", true)) {
startDeletion(island, worldManager);
}
@ -567,9 +561,6 @@ public class IslandManager {
cooldownManager.removeCooldownPlayer(CooldownType.Levelling, offlinePlayer);
cooldownManager.removeCooldownPlayer(CooldownType.Ownership, offlinePlayer);
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
boolean cooldownCreationEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Creation.Enable");
boolean cooldownDeletionEnabled = configLoad.getBoolean("Island.Creation.Cooldown.Deletion.Enable");
@ -623,7 +614,7 @@ public class IslandManager {
fileManager.deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/level-data"), island.getOwnerUUID().toString() + ".yml"));
fileManager.deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID().toString() + ".yml"));
fileManager.deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), island.getOwnerUUID().toString() + ".yml"));
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/challenge-data"), island.getOwnerUUID().toString() + ".yml"));
}
@ -665,7 +656,7 @@ public class IslandManager {
fileManager.deleteConfig(new File(plugin.getDataFolder().toString() + "/level-data", FastUUID.toString(uuid) + ".yml"));
fileManager.deleteConfig(new File(plugin.getDataFolder().toString() + "/setting-data", FastUUID.toString(uuid) + ".yml"));
fileManager.deleteConfig(new File(plugin.getDataFolder().toString() + "/visit-data", FastUUID.toString(uuid) + ".yml"));
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.deleteConfig(new File(plugin.getDataFolder().toString() + "/challenge-data", FastUUID.toString(uuid) + ".yml"));
}
@ -931,9 +922,6 @@ public class IslandManager {
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
FileManager fileManager = plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (island.isDeleted()) return;
island.save();
@ -960,7 +948,7 @@ public class IslandManager {
return;
}
unloadIsland = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Unload");
unloadIsland = this.plugin.getConfiguration().getBoolean("Island.Visitor.Unload");
if (unloadIsland) {
VisitManager visitManager = plugin.getVisitManager();
@ -987,7 +975,7 @@ public class IslandManager {
fileManager.unloadConfig(new File(new File(plugin.getDataFolder().toString() + "/setting-data"), island.getOwnerUUID() + ".yml"));
fileManager.unloadConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), island.getOwnerUUID() + ".yml"));
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)){
fileManager.unloadConfig(new File(new File(plugin.getDataFolder().toString() + "/challenge-data"), island.getOwnerUUID() + ".yml"));
}
@ -1061,7 +1049,7 @@ public class IslandManager {
}
}
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
Bukkit.getServer().getScheduler().runTask(plugin, () -> islandLocation.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().setType(Material.STONE));
}
@ -1118,7 +1106,7 @@ public class IslandManager {
pasteStructure(island, islandWorld);
// Recalculate island level after 5 seconds
if (fileManager.getConfig(new File(this.plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
if (plugin.getConfiguration().getBoolean("Island.Levelling.ScanAutomatically")) {
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> plugin.getLevellingManager().startScan(null, island), 100L);
}
}
@ -1139,8 +1127,7 @@ public class IslandManager {
boolean unlocked = configLoadIslandData.getBoolean("Unlocked." + islandWorld.name());
if (!unlocked) {
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
double price = configLoad.getDouble("Island.World." + islandWorld.name() + ".UnlockPrice");
if (price == -1) unlocked = true;
}
@ -1170,10 +1157,7 @@ public class IslandManager {
public void visitIsland(Player player, Island island) {
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
FileManager fileManager = plugin.getFileManager();
Config languageConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = languageConfig.getFileConfiguration();
FileConfiguration configLoad = plugin.getLanguage();
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) {
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
@ -1183,9 +1167,7 @@ public class IslandManager {
player.setFallDistance(0.0F);
}
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Teleport.Unsafe.Message")));
player.sendMessage(plugin.formatText(plugin.getLanguage().getString("Island.Teleport.Unsafe.Message")));
}
} else {
int islandVisitors = getVisitorsAtIsland(island).size();
@ -1203,8 +1185,7 @@ public class IslandManager {
}
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor);
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
if(plugin.getConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(loc);
if (safeLoc != null) {
loc = safeLoc;
@ -1217,9 +1198,7 @@ public class IslandManager {
player.setFallDistance(0.0F);
}
} else {
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Teleport.Unsafe.Message")));
player.sendMessage(plugin.formatText(plugin.getLanguage().getString("Command.Island.Teleport.Unsafe.Message")));
}
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
@ -1227,7 +1206,7 @@ public class IslandManager {
List<String> islandWelcomeMessage = island.getMessage(IslandMessage.Welcome);
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Welcome.Enable") && islandWelcomeMessage.size() != 0) {
if (this.plugin.getConfiguration().getBoolean("Island.Visitor.Welcome.Enable") && islandWelcomeMessage.size() != 0) {
for (String islandWelcomeMessageList : islandWelcomeMessage) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', islandWelcomeMessageList));
}
@ -1239,9 +1218,7 @@ public class IslandManager {
public void closeIsland(Island island) {
MessageManager messageManager = plugin.getMessageManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getLanguage();
island.setStatus(IslandStatus.CLOSED);
@ -1266,9 +1243,7 @@ public class IslandManager {
public void whitelistIsland(Island island) {
MessageManager messageManager = plugin.getMessageManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getLanguage();
island.setStatus(IslandStatus.WHITELISTED);
@ -1463,8 +1438,7 @@ public class IslandManager {
Island island = getIslandAtLocation(player.getLocation());
if (island != null) {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(), configLoad.getBoolean("Island.Weather.Time.Cycle"));
@ -1558,8 +1532,7 @@ public class IslandManager {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getLanguage();
boolean coopPlayers = island.hasPermission(IslandRole.Operator, plugin.getPermissionManager().getPermission("CoopPlayers"));
@ -1597,8 +1570,7 @@ public class IslandManager {
}
public int getIslandSafeLevel(Island island) {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
int safeLevel = 0;
@ -1622,7 +1594,7 @@ public class IslandManager {
WorldManager worldManager = plugin.getWorldManager();
if (island.isBorder()) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
if (this.plugin.getConfiguration().getBoolean("Island.WorldBorder.Enable")) {
double increment = island.getSize() % 2 != 0 ? 0.5d : 0.0d;
for (IslandWorld worldList : IslandWorld.getIslandWorlds()) {

View File

@ -2,7 +2,7 @@ package com.songoda.skyblock.island;
public class IslandPosition {
private IslandWorld world;
private final IslandWorld world;
private double x;
private double z;

View File

@ -21,8 +21,7 @@ public class RewardManager {
}
public void loadRewards() {
final Config config = skyBlock.getFileManager().getConfig(new File(skyBlock.getDataFolder(), "rewards.yml"));
final FileConfiguration configLoad = config.getFileConfiguration();
final FileConfiguration configLoad = skyBlock.getRewards();
this.registeredRewards.clear();
this.repeatRewards.clear();
@ -59,7 +58,7 @@ public class RewardManager {
}
private LevelReward loadReward(String path) {
final FileConfiguration config = skyBlock.getFileManager().getConfig(new File(skyBlock.getDataFolder(), "rewards.yml")).getFileConfiguration();
final FileConfiguration config = this.skyBlock.getRewards();
ConfigurationSection section = config.getConfigurationSection(path);

View File

@ -5,8 +5,8 @@ import com.songoda.skyblock.visit.Visit;
public class Leaderboard {
private final Visit visit;
private Type type;
private int position;
private final Type type;
private final int position;
public Leaderboard(Type type, Visit visit, int position) {
this.type = type;

View File

@ -19,13 +19,13 @@ public class LeaderboardManager {
private final SkyBlock plugin;
private List<Leaderboard> leaderboardStorage = new ArrayList<>();
private final List<Leaderboard> leaderboardStorage = new ArrayList<>();
public LeaderboardManager(SkyBlock plugin) {
this.plugin = plugin;
new LeaderboardTask(plugin).runTaskTimerAsynchronously(plugin, 0L,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Leaderboard.Reset.Time") * 20);
this.plugin.getConfiguration().getInt("Island.Leaderboard.Reset.Time") * 20);
resetLeaderboard();
setupLeaderHeads();
@ -43,7 +43,7 @@ public class LeaderboardManager {
List<LeaderboardPlayer> islandBanks = new ArrayList<>(arraySize);
List<LeaderboardPlayer> islandVotes = new ArrayList<>(arraySize);
boolean enableExemptions = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
boolean enableExemptions = this.plugin.getConfiguration()
.getBoolean("Island.Leaderboard.Exemptions.Enable");
for (UUID ownerUUID : new LinkedHashSet<>(visitManager.getIslands().keySet())) {

View File

@ -4,8 +4,8 @@ import java.util.UUID;
public class LeaderboardPlayer {
private UUID uuid;
private long value;
private final UUID uuid;
private final long value;
public LeaderboardPlayer(UUID uuid, long value) {
this.uuid = uuid;

View File

@ -28,8 +28,7 @@ public class TopLevel extends DataCollector {
List<Leaderboard> leaderboards = plugin.getLeaderboardManager().getLeaderboard(Leaderboard.Type.Level);
Map<UUID, Double> topLevels = new HashMap<>(leaderboards.size());
for (int i = 0; i < leaderboards.size(); i++) {
Leaderboard leaderboard = leaderboards.get(i);
for (Leaderboard leaderboard : leaderboards) {
Visit visit = leaderboard.getVisit();
topLevels.put(visit.getOwnerUUID(), (double) visit.getLevel().getLevel());
}

View File

@ -30,9 +30,8 @@ public class TopVotes extends DataCollector {
List<Leaderboard> leaderboards = plugin.getLeaderboardManager().getLeaderboard(Type.Votes);
Map<UUID, Double> topLevels = new HashMap<>(leaderboards.size());
for (int i = 0; i < leaderboards.size(); i++) {
Leaderboard leaderboard = leaderboards.get(i);
for (Leaderboard leaderboard : leaderboards) {
Visit visit = leaderboard.getVisit();
topLevels.put(visit.getOwnerUUID(), (double) visit.getVoters().size());
}

View File

@ -52,7 +52,7 @@ public final class IslandLevelManager {
if (island == null) throw new IllegalArgumentException("island cannot be null");
Configuration config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration();
Configuration config = SkyBlock.getInstance().getLanguage();
MessageManager messageManager = SkyBlock.getInstance().getMessageManager();
if (inScan.containsKey(island)) {
@ -89,7 +89,7 @@ public final class IslandLevelManager {
public void reloadWorth() {
worth.clear();
final Configuration config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "levelling.yml")).getFileConfiguration();
final Configuration config = SkyBlock.getInstance().getLevelling();
final ConfigurationSection materialSection = config.getConfigurationSection("Materials");
if (materialSection == null) return;
@ -102,7 +102,7 @@ public final class IslandLevelManager {
if (material == null) continue;
worth.put(material, current.getDouble("Points"));
worth.put(material, current.getDouble("Points", 0.0));
}
}

View File

@ -46,7 +46,7 @@ public final class IslandScan extends BukkitRunnable {
this.plugin = plugin;
this.island = island;
this.amounts = new EnumMap<>(CompatibleMaterial.class);
this.language = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration();
this.language = this.plugin.getLanguage();
this.runEveryX = language.getInt("Command.Island.Level.Scanning.Progress.Display-Every-X-Scan");
this.doubleBlocks = new HashSet<>();
}
@ -54,7 +54,7 @@ public final class IslandScan extends BukkitRunnable {
public IslandScan start() {
final SkyBlock plugin = SkyBlock.getInstance();
final FileConfiguration config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration();
final FileConfiguration config = this.plugin.getConfiguration();
final FileConfiguration islandData = plugin.getFileManager().getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), this.island.getOwnerUUID().toString() + ".yml")).getFileConfiguration();
final boolean hasNether = config.getBoolean("Island.World.Nether.Enable") && islandData.getBoolean("Unlocked.Nether", false);

View File

@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
public final class LevellingMaterial {
private CompatibleMaterial materials;
private final CompatibleMaterial materials;
private double points;
public LevellingMaterial(CompatibleMaterial materials, double points) {

View File

@ -39,10 +39,9 @@ public final class LimitationInstanceHandler {
public void reloadAll() {
final SkyBlock plugin = SkyBlock.getInstance();
final Configuration config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "limits.yml")).getFileConfiguration();
final Configuration config = plugin.getLimits();
loadChunks = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Limits.LoadChunks");
loadChunks = plugin.getConfiguration().getBoolean("Island.Limits.LoadChunks");
for (Limitation limit : instances.values()) {
limit.reload(config.getConfigurationSection(limit.getSectionName()));

View File

@ -115,8 +115,7 @@ public class Block implements Listener {
stackableManager.removeStack(stackable);
}
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
if (material != null) {
@ -138,8 +137,7 @@ public class Block implements Listener {
}
}
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
@ -147,7 +145,7 @@ public class Block implements Listener {
|| LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
if (configLoad.getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
plugin.getMessageManager().sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.SpawnProtection.Break.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}
@ -238,13 +236,12 @@ public class Block implements Listener {
if (islandLevelManager.isScanning(island)) {
plugin.getMessageManager().sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
plugin.getLanguage().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
event.setCancelled(true);
return;
}
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if(!player.hasPermission("fabledskyblock.bypass.netherplace") && !islandManager.isIslandWorldUnlocked(island, IslandWorld.Nether)){
@ -252,8 +249,7 @@ public class Block implements Listener {
for(String s : configLoad.getConfigurationSection("Island.Restrict.NetherBlocks").getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.NetherBlocks." + s, false)){
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Unlock.NetherBlocksPlace.Message")));
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getLanguage().getString("Island.Unlock.NetherBlocksPlace.Message")));
event.setCancelled(true);
}
}
@ -266,8 +262,7 @@ public class Block implements Listener {
for(String s : configLoad.getConfigurationSection("Island.Restrict.EndBlocks").getKeys(false)){
if(s.equalsIgnoreCase(block.getType().toString())){
if(configLoad.getBoolean("Island.Restrict.EndBlocks." + s)){
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Unlock.EndBlocksPlace.Message")));
plugin.getMessageManager().sendMessage(player, Objects.requireNonNull(plugin.getLanguage().getString("Island.Unlock.EndBlocksPlace.Message")));
event.setCancelled(true);
}
}
@ -298,7 +293,7 @@ public class Block implements Listener {
}
if (isObstructing) {
plugin.getMessageManager().sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.SpawnProtection.Place.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);
@ -324,7 +319,7 @@ public class Block implements Listener {
material = CompatibleMaterial.getMaterial(block);
}
plugin.getMessageManager().sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
@ -337,8 +332,7 @@ public class Block implements Listener {
if (event.getBlock().getType() == CompatibleMaterial.END_PORTAL_FRAME.getMaterial()
&& event.getPlayer().getItemInHand().getType() == CompatibleMaterial.ENDER_EYE.getMaterial()) return;
islandLevelManager.updateLevel(island, blockLoc);
// Not util used 2 islandLevelManager if condition is true
// Sponge level dupe fix
if(ServerVersion.isServerVersionBelow(ServerVersion.V1_13) &&
block.getType().equals(CompatibleMaterial.SPONGE.getBlockMaterial())) {
@ -359,6 +353,8 @@ public class Block implements Listener {
}
}
});
} else {
islandLevelManager.updateLevel(island, blockLoc);
}
}
@ -374,8 +370,7 @@ public class Block implements Listener {
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (island == null) return;
@ -548,8 +543,7 @@ public class Block implements Listener {
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
if (island == null) return;
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (performStackCheck(event.getBlock(), event.getBlocks(), event.getDirection())) {
event.setCancelled(true);
@ -587,7 +581,7 @@ public class Block implements Listener {
}
}
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.Piston.Connected.Extend")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Block.Piston.Connected.Extend")) {
if (block.getType() == CompatibleMaterial.PISTON.getMaterial() || block.getType() == CompatibleMaterial.STICKY_PISTON.getMaterial()) {
event.setCancelled(true);
return;
@ -646,8 +640,7 @@ public class Block implements Listener {
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
if (island == null) return;
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (performStackCheck(event.getBlock(), event.getBlocks(), event.getDirection())) {
event.setCancelled(true);
@ -676,7 +669,7 @@ public class Block implements Listener {
return;
}
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.Piston.Connected.Retract")) {
if (!this.plugin.getConfiguration().getBoolean("Island.Block.Piston.Connected.Retract")) {
if (block.getType() == CompatibleMaterial.PISTON.getMaterial() || block.getType() == CompatibleMaterial.STICKY_PISTON.getMaterial()) {
event.setCancelled(true);
return;
@ -691,7 +684,7 @@ public class Block implements Listener {
WorldManager worldManager = plugin.getWorldManager();
IslandLevelManager islandLevelManager = plugin.getLevellingManager();
FileConfiguration config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration();
FileConfiguration config = this.plugin.getConfiguration();
if (!worldManager.isIslandWorld(block.getWorld())) return;
@ -710,7 +703,7 @@ public class Block implements Listener {
// Check spawn block protection
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
return;
}
@ -775,7 +768,8 @@ public class Block implements Listener {
if(onlineOwner.hasPermission(generator.getPermission())) {
applyGenerator(event.getBlock().getWorld(), block, worldManager, islandLevelManager, island, state, generatorManager, generator);
}
} else {
}
else {
event.setCancelled(true);
org.bukkit.World finalWorld = event.getBlock().getWorld();
this.generatorWaitingLocs.add(LocationUtil.toBlockLocation(block.getLocation().clone()));
@ -851,7 +845,7 @@ public class Block implements Listener {
@EventHandler
public void onPortalCreate(PortalCreateEvent event) {
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
if (!this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection"))
return;
WorldManager worldManager = plugin.getWorldManager();
@ -913,7 +907,7 @@ public class Block implements Listener {
@EventHandler
public void onDispenserDispenseBlock(BlockDispenseEvent event) {
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
if (!this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection"))
return;
WorldManager worldManager = plugin.getWorldManager();
@ -959,8 +953,7 @@ public class Block implements Listener {
&& srcmaterial != CompatibleMaterial.LAVA)
return;
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (!configLoad.getBoolean("Island.Block.Level.Enable"))
return;

View File

@ -59,7 +59,7 @@ public class Bucket implements Listener {
return;
}
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
if (!this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection"))
return;
Island island = islandManager.getIslandAtLocation(block.getLocation());
@ -72,8 +72,7 @@ public class Bucket implements Listener {
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
event.setCancelled(true);
plugin.getMessageManager().sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
plugin.getLanguage().getString("Island.SpawnProtection.Place.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
}
}

View File

@ -49,9 +49,7 @@ public class Chat implements Listener {
if (playerData.isChat() && island != null) {
event.setCancelled(true);
Config language = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration languageLoad = language.getFileConfiguration();
FileConfiguration languageLoad = plugin.getLanguage();
PlayerIslandChatEvent islandChatEvent = new PlayerIslandChatEvent(player, island.getAPIWrapper(),
event.getMessage(), languageLoad.getString("Island.Chat.Format.Message"));
@ -65,13 +63,11 @@ public class Chat implements Listener {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
Island island = event.getIsland().getIsland();
Player player = event.getPlayer();
Config language = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration languageLoad = language.getFileConfiguration();
FileConfiguration languageLoad = plugin.getLanguage();
String islandRole = null;
@ -110,7 +106,7 @@ public class Chat implements Listener {
}
}
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Chat.OutputToConsole")) {
if (this.plugin.getConfiguration().getBoolean("Island.Chat.OutputToConsole")) {
messageManager.sendMessage(Bukkit.getConsoleSender(), event.getFormat().replace("%role", islandRole).replace("%player", player.getName())
.replace("%message", event.getMessage()));
}

View File

@ -25,8 +25,7 @@ public class Death implements Listener {
Player player = event.getEntity();
if (plugin.getWorldManager().isIslandWorld(player.getWorld())) {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
boolean keepInventory = false;

View File

@ -64,8 +64,7 @@ public class Entity implements Listener {
if(event.getEntity() instanceof Blaze){
WorldManager worldManager = plugin.getWorldManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Nether.BlazeImmuneToWaterInNether", false) &&
worldManager.getIslandWorld(event.getEntity().getWorld()).equals(IslandWorld.Nether) &&
@ -92,8 +91,7 @@ public class Entity implements Listener {
@EventHandler(ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
IslandManager islandManager = plugin.getIslandManager();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
org.bukkit.entity.Entity victim = event.getEntity();
Island island = islandManager.getIslandAtLocation(victim.getLocation());
@ -103,9 +101,10 @@ public class Entity implements Listener {
if(attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof org.bukkit.entity.Entity) {
attacker = (org.bukkit.entity.Entity) ((Projectile) attacker).getShooter();
}
// Rework with better config
if(victim instanceof Player && attacker instanceof Player) { // PVP
if(configLoad.getBoolean("Island.PvP.Enable")) {
if (configLoad.getBoolean("Island.Entity_Damage.PVP")) {
if(plugin.getPermissionManager()
.processPermission(event, (Player) attacker, island)) {
plugin.getPermissionManager()
@ -114,15 +113,26 @@ public class Entity implements Listener {
} else {
event.setCancelled(true);
}
} else if(victim instanceof Player) { // EVP
plugin.getPermissionManager()
.processPermission(event, (Player) victim, island, true);
} else if(attacker instanceof Player) { // PVE
plugin.getPermissionManager()
.processPermission(event, (Player) attacker, island);
} else { // EVE
plugin.getPermissionManager()
.processPermission(event, island);
}
else if(victim instanceof Player) { // EVP
if (configLoad.getBoolean("Island.Entity_Damage.EVP")) {
plugin.getPermissionManager()
.processPermission(event, (Player) victim, island, true);
}
}
else if(attacker instanceof Player) { // PVE
if (configLoad.getBoolean("Island.Entity_Damage.PVE")) {
plugin.getPermissionManager()
.processPermission(event, (Player) attacker, island);
}
}
else { // EVE
if (configLoad.getBoolean("Island.Entity_Damage.PVE")) {
plugin.getPermissionManager()
.processPermission(event, island);
}
}
// Fix a bug in minecraft where arrows with flame still apply fire ticks even if
@ -278,8 +288,7 @@ public class Entity implements Listener {
if (event.isCancelled()) return;
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
@ -290,7 +299,7 @@ public class Entity implements Listener {
if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0, 1, 0)))
&& plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
&& this.plugin.getConfiguration()
.getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
return;
@ -323,8 +332,7 @@ public class Entity implements Listener {
if (entity instanceof FallingBlock) return;
// Check entities interacting with spawn
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world) && plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world) && plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
return;
}
@ -333,7 +341,7 @@ public class Entity implements Listener {
plugin.getPermissionManager().processPermission(event, null, island);
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (!this.plugin.getConfiguration()
.getBoolean("Island.Block.Level.Enable"))
return;
@ -342,7 +350,6 @@ public class Entity implements Listener {
if (event.getTo() != Material.AIR) {
materials = CompatibleMaterial.getBlockMaterial(event.getTo());
;
if (materials != null) {
long materialAmount = 0;
@ -379,8 +386,7 @@ public class Entity implements Listener {
while (it.hasNext()){
removed = false;
org.bukkit.block.Block block = it.next();
if (SkyBlock.getInstance().getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Spawn.Protection")) {
if (SkyBlock.getInstance().getConfiguration().getBoolean("Island.Spawn.Protection")) {
IslandWorld world = worldManager.getIslandWorld(event.getEntity().getWorld());
if (LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
@ -408,8 +414,7 @@ public class Entity implements Listener {
stackableManager.removeStack(stackable);
}
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
removeBlockFromLevel(island, block);
@ -425,7 +430,7 @@ public class Entity implements Listener {
}
}
}
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Block.Level.Enable")) {
if(!removed){
removeBlockFromLevel(island, block);
@ -573,9 +578,7 @@ public class Entity implements Listener {
EntityType type = entity.getType();
if (limits.isBeingTracked(type)) {
FileManager fileManager = plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
boolean isSplit = event.getSpawnReason().equals(SpawnReason.SLIME_SPLIT);
boolean splitBypass = configLoad.getBoolean("Island.Challenge.PerIsland", true);

View File

@ -42,8 +42,7 @@ public class EpicSpawners implements Listener {
int amount = event.getSpawner().getFirstStack().getStackSize();
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
CompatibleSpawners materials = CompatibleSpawners.getSpawner(spawnerType);
@ -77,8 +76,7 @@ public class EpicSpawners implements Listener {
int amount = event.getStackSize() - event.getOldStackSize();
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
CompatibleSpawners materials = CompatibleSpawners.getSpawner(spawnerType);
@ -112,8 +110,7 @@ public class EpicSpawners implements Listener {
int amount = event.getSpawner().getFirstStack().getStackSize();
EntityType spawnerType = event.getSpawner().getCreatureSpawner().getSpawnedType();
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
CompatibleSpawners materials = CompatibleSpawners.getSpawner(spawnerType);

View File

@ -37,8 +37,7 @@ public class FallBreak implements Listener {
int counter = 0;
IslandManager islandManager = plugin.getIslandManager();
WorldManager worldManager = plugin.getWorldManager();
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
Iterator<FallingBlock> iterator = fallingBlocks.iterator();
while(iterator.hasNext()) {
FallingBlock ent = iterator.next();
@ -88,7 +87,7 @@ public class FallBreak implements Listener {
WorldManager worldManager = plugin.getWorldManager();
if (worldManager.isIslandWorld(event.getEntity().getLocation().getWorld())) {
if (!event.getTo().equals(CompatibleMaterial.AIR.getMaterial())){
fallingBlocks.remove((FallingBlock) event.getEntity());
fallingBlocks.remove(event.getEntity());
} else if(!event.isCancelled()) {
fallingBlocks.add((FallingBlock) event.getEntity());
}

View File

@ -68,7 +68,6 @@ public class Grow implements Listener {
// The structure is growing from one island to another.
if (!origin.getIslandUUID().equals(growingTo.getIslandUUID())) {
it.remove();
continue;
}
}
}
@ -86,7 +85,7 @@ public class Grow implements Listener {
// Check spawn block protection
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
return;
}
@ -155,7 +154,7 @@ public class Grow implements Listener {
*/
@EventHandler(ignoreCancelled = true)
public void onStructureCreate(StructureGrowEvent event) {
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) return;
if (!this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) return;
List<BlockState> blocks = event.getBlocks();
if (blocks.isEmpty()) return;

View File

@ -178,7 +178,7 @@ public class Interact implements Listener {
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType == heldType
&& !player.isSneaking() && plugin.getPermissionManager().hasPermission(player, island, "Place")
&& (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission")
&& (!this.plugin.getConfiguration().getBoolean("Island.Stackable.RequirePermission")
|| player.hasPermission("fabledskyblock.stackable"))) {
if (levellingManager.isScanning(island)) {

View File

@ -42,7 +42,6 @@ public class Join implements Listener {
UserCacheManager userCacheManager = plugin.getUserCacheManager();
CooldownManager cooldownManager = plugin.getCooldownManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
Player player = event.getPlayer();
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
@ -53,9 +52,8 @@ public class Join implements Listener {
islandManager.loadIsland(player);
Island island = islandManager.getIsland(player);
boolean teleportedToIsland = false;
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Join.Spawn")) {
LocationUtil.teleportPlayerToSpawn(player);

View File

@ -63,9 +63,8 @@ public class Move implements Listener {
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
if (world == IslandWorld.Nether || world == IslandWorld.End) {
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World." + world.name() + ".Enable")) {
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (!this.plugin.getConfiguration().getBoolean("Island.World." + world.name() + ".Enable")) {
FileConfiguration configLoad = plugin.getLanguage();
messageManager.sendMessage(player, configLoad.getString("Island.World.Message").replace(configLoad.getString("Island.World.Word." + world.name()), world.name()));
@ -96,8 +95,7 @@ public class Move implements Listener {
if (island != null) {
if (islandManager.isLocationAtIsland(island, to)) {
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
boolean keepItemsOnDeath;
@ -132,9 +130,7 @@ public class Move implements Listener {
player.setFoodLevel(20);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
player.getActivePotionEffects().stream().map(PotionEffect::getType).forEach(player::removePotionEffect);
}
player.setFallDistance(0.0F);
@ -151,15 +147,14 @@ public class Move implements Listener {
} else {
if(!islandManager.isLocationAtIsland(island, to)) {
teleportPlayerToIslandSpawn(player, world, island);
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
}
messageManager.sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration()
messageManager.sendMessage(player, plugin.getLanguage()
.getString("Island.WorldBorder.Outside.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
}
@ -191,7 +186,7 @@ public class Move implements Listener {
LocationUtil.teleportPlayerToSpawn(player);
messageManager.sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.WorldBorder.Disappeared.Message"));
plugin.getLanguage().getString("Island.WorldBorder.Disappeared.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
});
});
@ -203,8 +198,7 @@ public class Move implements Listener {
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
if(plugin.getConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Main));
if (safeLoc != null) {
loc = safeLoc;
@ -213,15 +207,13 @@ public class Move implements Listener {
} else {
loc = island.getLocation(world, IslandEnvironment.Main);
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.RemoveWater", false)) {
if(plugin.getConfiguration().getBoolean("Island.Teleport.RemoveWater", false)) {
LocationUtil.removeWaterFromLoc(loc);
}
}
} else {
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
if(plugin.getConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Visitor));
if (safeLoc != null) {
loc = safeLoc;
@ -236,9 +228,7 @@ public class Move implements Listener {
PaperLib.teleportAsync(player, finalLoc);
} else {
LocationUtil.teleportPlayerToSpawn(player);
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Command.Island.Teleport.Unsafe.Message")));
player.sendMessage(plugin.formatText(plugin.getLanguage().getString("Command.Island.Teleport.Unsafe.Message")));
}
}
@ -249,9 +239,7 @@ public class Move implements Listener {
private void teleportPlayerToIslandSpawn(Player player, SoundManager soundManager, Island island) {
teleportPlayerToIslandSpawn(player, island);
FileManager fileManager = plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){
player.setFallDistance(0.0F);
@ -272,8 +260,7 @@ public class Move implements Listener {
if(plugin.getIslandManager().getIslandAtLocation(e.getTo()) == null){
e.setCancelled(true);
plugin.getMessageManager().sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.WorldBorder.Disappeared.Message"));
plugin.getLanguage().getString("Island.WorldBorder.Disappeared.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
}
}

View File

@ -38,8 +38,7 @@ public class Piston implements Listener {
if (island == null || CompatibleMaterial.DRAGON_EGG != CompatibleMaterial.getMaterial(block)) return;
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (!configLoad.getBoolean("Island.Block.Level.Enable")) return;

View File

@ -34,7 +34,7 @@ public class Portal implements Listener {
private final SkyBlock plugin;
private Map<UUID, Tick> tickCounter = new HashMap<>();
private final Map<UUID, Tick> tickCounter = new HashMap<>();
public Portal(SkyBlock plugin) {
this.plugin = plugin;
@ -70,7 +70,6 @@ public class Portal implements Listener {
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
WorldManager worldManager = plugin.getWorldManager();
FileManager fileManager = plugin.getFileManager();
if (!worldManager.isIslandWorld(player.getWorld())) return;
@ -78,8 +77,7 @@ public class Portal implements Listener {
if (island == null) return;
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
IslandEnvironment spawnEnvironment;
switch (island.getRole(player)) {
@ -108,7 +106,7 @@ public class Portal implements Listener {
tick.setLast(System.currentTimeMillis());
}
if (tick.getTick() >= 100) {
messageManager.sendMessage(player, fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Portal.Stuck.Message"));
messageManager.sendMessage(player, plugin.getLanguage().getString("Island.Portal.Stuck.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
LocationUtil.teleportPlayerToSpawn(player);
return;
@ -163,8 +161,7 @@ public class Portal implements Listener {
IslandWorld toWorldF = toWorld;
Bukkit.getScheduler().runTaskLater(plugin, () -> {
Location loc = island.getLocation(toWorldF, spawnEnvironment);
if(plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
if(plugin.getConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(loc);
if (safeLoc != null) {
loc = safeLoc;

View File

@ -75,9 +75,7 @@ public class Quit implements Listener {
if (targetPlayerData.isChat()) {
targetPlayerData.setChat(false);
messageManager.sendMessage(targetPlayer,
plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Chat.Untoggled.Message"));
plugin.getLanguage().getString("Island.Chat.Untoggled.Message"));
}
}
}
@ -100,28 +98,19 @@ public class Quit implements Listener {
playerDataManager.unloadPlayerData(player);
boolean offline = true;
if(island != null && plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if(island != null && this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", false)){
if(island.getRole(IslandRole.Member) != null){
for(UUID uuid : island.getRole(IslandRole.Member)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
}
offline = island.getRole(IslandRole.Member).stream().noneMatch(uuid -> Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline());
}
if(offline && island.getRole(IslandRole.Operator) != null){
for(UUID uuid : island.getRole(IslandRole.Operator)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
if (island.getRole(IslandRole.Operator).stream().anyMatch(uuid -> Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline())) {
offline = false;
}
}
if(offline && island.getRole(IslandRole.Owner) != null){
for(UUID uuid : island.getRole(IslandRole.Owner)){
if(Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline()){
offline = false;
}
}
if (offline && island.getRole(IslandRole.Owner) != null &&
island.getRole(IslandRole.Owner).stream().anyMatch(uuid -> Bukkit.getPlayer(uuid) != null && !Bukkit.getPlayer(uuid).isOnline())) {
offline = false;
}
}
@ -130,7 +119,7 @@ public class Quit implements Listener {
}
for (Island islandList : islandManager.getCoopIslands(player)) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
if (this.plugin.getConfiguration()
.getBoolean("Island.Coop.Unload") || islandList.getCoopType(player.getUniqueId()) == IslandCoop.TEMP) {
islandList.removeCoopPlayer(player.getUniqueId());
}
@ -153,8 +142,7 @@ public class Quit implements Listener {
if (targetPlayer != null) {
messageManager.sendMessage(targetPlayer,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration()
plugin.getLanguage()
.getString("Command.Island.Invite.Invited.Sender.Disconnected.Message")
.replace("%player", player.getName()));
plugin.getSoundManager().playSound(targetPlayer, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);

View File

@ -34,8 +34,7 @@ public class Respawn implements Listener {
FileManager fileManager = plugin.getFileManager();
if (worldManager.isIslandWorld(player.getWorld())) {
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration configLoad = plugin.getConfiguration();
if (configLoad.getBoolean("Island.Death.Respawn.Island")) {
Location playerLocation = player.getLocation();
@ -63,7 +62,7 @@ public class Respawn implements Listener {
}
}
config = fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml"));
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml"));
if (config.getFileConfiguration().getString("Location.Spawn") == null) {
Bukkit.getServer().getLogger().log(Level.WARNING, "SkyBlock | Error: A spawn point hasn't been set.");

Some files were not shown because too many files have changed in this diff Show More