mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-25 17:01:28 +01:00
Some code optimizations
This commit is contained in:
parent
dc315106bf
commit
4e7d84933b
@ -15,7 +15,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Island {
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.api.structure.Structure;
|
||||
import com.songoda.skyblock.api.utils.APIUtil;
|
||||
import com.songoda.skyblock.island.IslandPermission;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -32,12 +32,12 @@ public class Ban {
|
||||
}
|
||||
|
||||
public Set<UUID> getBans() {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
|
||||
Set<UUID> islandBans = new HashSet<>();
|
||||
|
||||
for (String islandBanList : skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
for (String islandBanList : plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
islandOwnerUUID.toString() + ".yml"))
|
||||
.getFileConfiguration().getStringList("Bans")) {
|
||||
|
||||
@ -52,18 +52,18 @@ public class Ban {
|
||||
}
|
||||
|
||||
public void addBan(UUID issuer, UUID banned) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
|
||||
IslandBanEvent islandBanEvent = new IslandBanEvent(
|
||||
skyblock.getIslandManager().getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
|
||||
plugin.getIslandManager().getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
|
||||
.getAPIWrapper(),
|
||||
Bukkit.getServer().getOfflinePlayer(issuer), Bukkit.getServer().getOfflinePlayer(banned));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandBanEvent));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Bukkit.getServer().getPluginManager().callEvent(islandBanEvent));
|
||||
|
||||
if (!islandBanEvent.isCancelled()) {
|
||||
List<String> islandBans = new ArrayList<>();
|
||||
FileConfiguration configLoad = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
FileConfiguration configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
islandOwnerUUID.toString() + ".yml"))
|
||||
.getFileConfiguration();
|
||||
|
||||
@ -77,11 +77,11 @@ public class Ban {
|
||||
}
|
||||
|
||||
public void removeBan(UUID uuid) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
|
||||
List<String> islandBans = new ArrayList<>();
|
||||
FileConfiguration configLoad = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
FileConfiguration configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
islandOwnerUUID.toString() + ".yml"))
|
||||
.getFileConfiguration();
|
||||
|
||||
@ -94,16 +94,16 @@ public class Ban {
|
||||
configLoad.set("Bans", islandBans);
|
||||
|
||||
Bukkit.getServer().getPluginManager()
|
||||
.callEvent(new IslandUnbanEvent(skyblock.getIslandManager()
|
||||
.callEvent(new IslandUnbanEvent(plugin.getIslandManager()
|
||||
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)).getAPIWrapper(),
|
||||
Bukkit.getServer().getOfflinePlayer(uuid)));
|
||||
}
|
||||
|
||||
public void save() {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(
|
||||
new File(skyblock.getDataFolder().toString() + "/ban-data"), islandOwnerUUID.toString() + ".yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(
|
||||
new File(plugin.getDataFolder().toString() + "/ban-data"), islandOwnerUUID.toString() + ".yml"));
|
||||
|
||||
try {
|
||||
config.getFileConfiguration().save(config.getFile());
|
||||
|
@ -19,11 +19,11 @@ import java.util.UUID;
|
||||
|
||||
public class BanManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
private Map<UUID, Ban> banStorage = new HashMap<>();
|
||||
|
||||
public BanManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public BanManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
loadIslands();
|
||||
}
|
||||
@ -37,11 +37,11 @@ public class BanManager {
|
||||
}
|
||||
|
||||
public void loadIslands() {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Visitor.Unload")) {
|
||||
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
||||
File configFile = new File(plugin.getDataFolder().toString() + "/island-data");
|
||||
|
||||
if (configFile.exists()) {
|
||||
for (File fileList : configFile.listFiles()) {
|
||||
@ -53,14 +53,14 @@ public class BanManager {
|
||||
}
|
||||
|
||||
public void transfer(UUID uuid1, UUID uuid2) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Ban ban = getIsland(uuid1);
|
||||
ban.save();
|
||||
|
||||
File oldBanDataFile = new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
File oldBanDataFile = new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
uuid1.toString() + ".yml");
|
||||
File newBanDataFile = new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
File newBanDataFile = new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
uuid2.toString() + ".yml");
|
||||
|
||||
fileManager.unloadConfig(oldBanDataFile);
|
||||
@ -73,14 +73,14 @@ public class BanManager {
|
||||
}
|
||||
|
||||
public void removeVisitor(Island island) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
for (UUID visitorList : skyblock.getIslandManager().getVisitorsAtIsland(island)) {
|
||||
for (UUID visitorList : plugin.getIslandManager().getVisitorsAtIsland(island)) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(visitorList);
|
||||
|
||||
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
||||
@ -116,7 +116,7 @@ public class BanManager {
|
||||
|
||||
public void unloadIsland(UUID islandOwnerUUID) {
|
||||
if (hasIsland(islandOwnerUUID)) {
|
||||
skyblock.getFileManager().unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
plugin.getFileManager().unloadConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
islandOwnerUUID.toString() + ".yml"));
|
||||
banStorage.remove(islandOwnerUUID);
|
||||
}
|
||||
@ -124,7 +124,7 @@ public class BanManager {
|
||||
|
||||
public void deleteIsland(UUID islandOwnerUUID) {
|
||||
if (hasIsland(islandOwnerUUID)) {
|
||||
skyblock.getFileManager().deleteConfig(new File(new File(skyblock.getDataFolder().toString() + "/ban-data"),
|
||||
plugin.getFileManager().deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
|
||||
islandOwnerUUID.toString() + ".yml"));
|
||||
banStorage.remove(islandOwnerUUID);
|
||||
}
|
||||
|
@ -1,21 +1,13 @@
|
||||
package com.songoda.skyblock.bank;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.hooks.EconomyManager;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class BankManager {
|
||||
@ -28,8 +20,8 @@ public class BankManager {
|
||||
public FileConfiguration lang;
|
||||
|
||||
public BankManager() {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
lang = config.getFileConfiguration();
|
||||
log = new HashMap<>();
|
||||
loadTransactions();
|
||||
@ -105,8 +97,8 @@ public class BankManager {
|
||||
}
|
||||
|
||||
public BankResponse deposit(Player player, Island island, double amt, boolean admin) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
// Make sure the amount is positive
|
||||
if (amt <= 0) {
|
||||
@ -114,7 +106,7 @@ public class BankManager {
|
||||
}
|
||||
|
||||
// If decimals aren't allowed, check for them
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
|
||||
int intAmt = (int) amt;
|
||||
if (intAmt != amt) {
|
||||
return BankResponse.DECIMALS_NOT_ALLOWED;
|
||||
@ -141,8 +133,8 @@ public class BankManager {
|
||||
}
|
||||
|
||||
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
|
||||
SkyBlock skyblock = SkyBlock.getInstance();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SkyBlock plugin = SkyBlock.getInstance();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
// Make sure the amount is positive
|
||||
if (amt <= 0) {
|
||||
@ -150,7 +142,7 @@ public class BankManager {
|
||||
}
|
||||
|
||||
// If decimals aren't allowed, check for them
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
|
||||
int intAmt = (int) amt;
|
||||
if (intAmt != amt) {
|
||||
return BankResponse.DECIMALS_NOT_ALLOWED;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.songoda.skyblock.bank;
|
||||
|
||||
import com.songoda.skyblock.menus.Ownership;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -22,13 +22,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class BiomeManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
private final List<Island> updatingIslands;
|
||||
private final FileConfiguration language;
|
||||
private final int runEveryX;
|
||||
|
||||
public BiomeManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
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.runEveryX = language.getInt("Command.Island.Biome.Progress.Display-Every-X-Updates");
|
||||
@ -51,12 +51,12 @@ public class BiomeManager {
|
||||
|
||||
if (island.getLocation(IslandWorld.Normal, IslandEnvironment.Island) == null) return;
|
||||
|
||||
if(skyblock.isPaperAsync()){
|
||||
if(plugin.isPaperAsync()){
|
||||
// We keep it sequentially in order to use less RAM
|
||||
int chunkAmount = (int) Math.ceil(Math.pow(island.getSize()/16d, 2d));
|
||||
AtomicInteger progress = new AtomicInteger();
|
||||
|
||||
ChunkLoader.startChunkLoadingPerChunk(island, IslandWorld.Normal, skyblock.isPaperAsync(), (asyncChunk, syncChunk) -> {
|
||||
ChunkLoader.startChunkLoadingPerChunk(island, IslandWorld.Normal, plugin.isPaperAsync(), (asyncChunk, syncChunk) -> {
|
||||
Chunk chunk = asyncChunk.join();
|
||||
if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)){ // TODO Should be 1.15 but it works fine there
|
||||
setChunkBiome3D(island, biome, chunk); // 2D for the moment
|
||||
@ -77,7 +77,7 @@ public class BiomeManager {
|
||||
message = message.replace("%percent%", NumberFormat.getInstance().format(percent));
|
||||
|
||||
for (Player player : SkyBlock.getInstance().getIslandManager().getPlayersAtIsland(island)) {
|
||||
skyblock.getMessageManager().sendMessage(player, message);
|
||||
plugin.getMessageManager().sendMessage(player, message);
|
||||
}
|
||||
}
|
||||
}, (island1 -> {
|
||||
@ -87,8 +87,8 @@ public class BiomeManager {
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
ChunkLoader.startChunkLoading(island, IslandWorld.Normal, skyblock.isPaperAsync(), (asyncChunks, syncChunks) -> {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
ChunkLoader.startChunkLoading(island, IslandWorld.Normal, plugin.isPaperAsync(), (asyncChunks, syncChunks) -> {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
int progress = 0;
|
||||
for(Chunk chunk : syncChunks){
|
||||
if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)){ // TODO Should be 1.15 but it works fine there
|
||||
@ -109,7 +109,7 @@ public class BiomeManager {
|
||||
message = message.replace("%percent%", NumberFormat.getInstance().format(percent));
|
||||
|
||||
for (Player player : SkyBlock.getInstance().getIslandManager().getPlayersAtIsland(island)) {
|
||||
skyblock.getMessageManager().sendMessage(player, message);
|
||||
plugin.getMessageManager().sendMessage(player, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class BiomeManager {
|
||||
packetPlayOutMapChunkClass = NMSUtil.getNMSClass("PacketPlayOutMapChunk");
|
||||
chunkClass = NMSUtil.getNMSClass("Chunk");
|
||||
|
||||
for (Player player : skyblock.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
|
||||
for (Player player : plugin.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
|
||||
try {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) {
|
||||
|
@ -1,5 +1,16 @@
|
||||
package com.songoda.skyblock.blockscanner;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -9,19 +20,6 @@ import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
|
||||
public final class BlockScanner extends BukkitRunnable {
|
||||
|
||||
private static final Method ID_FIELD;
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.skyblock.blockscanner;
|
||||
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class MaterialIDHelper {
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.songoda.skyblock.challenge;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeManager;
|
||||
@ -10,9 +7,11 @@ import com.songoda.skyblock.challenge.defaultinv.DefaultInventory;
|
||||
import com.songoda.skyblock.challenge.inventory.InventoryManager;
|
||||
import com.songoda.skyblock.challenge.inventory.inv.ChallengeInventory;
|
||||
import com.songoda.skyblock.challenge.player.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FabledChallenge {
|
||||
private SkyBlock skyblock;
|
||||
private SkyBlock plugin;
|
||||
private ChallengeManager challengeManager;
|
||||
private PlayerManager playerManager;
|
||||
// I use my own inventory api bc it's hard to implement inventories with the
|
||||
@ -20,13 +19,13 @@ public class FabledChallenge {
|
||||
private DefaultInventory defaultInventory;
|
||||
private ChallengeInventory challengeInventory;
|
||||
|
||||
public FabledChallenge(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
this.defaultInventory = new DefaultInventory(skyblock);
|
||||
this.challengeManager = new ChallengeManager(skyblock);
|
||||
this.playerManager = new PlayerManager(skyblock);
|
||||
public FabledChallenge(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
this.defaultInventory = new DefaultInventory(plugin);
|
||||
this.challengeManager = new ChallengeManager(plugin);
|
||||
this.playerManager = new PlayerManager(plugin);
|
||||
this.challengeInventory = new ChallengeInventory(this);
|
||||
this.inventoryManager = new InventoryManager(skyblock);
|
||||
this.inventoryManager = new InventoryManager(plugin);
|
||||
this.inventoryManager.init();
|
||||
}
|
||||
|
||||
@ -37,7 +36,7 @@ public class FabledChallenge {
|
||||
public void openChallengeInventory(Player p, ChallengeCategory category) {
|
||||
if (category == null)
|
||||
return;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
inventoryManager.openInventory(challengeInventory, p, params -> {
|
||||
params.put(ChallengeInventory.CATEGORY, category);
|
||||
});
|
||||
|
@ -1,12 +1,10 @@
|
||||
package com.songoda.skyblock.challenge.challenge;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.hooks.EconomyManager;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.bank.BankManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.utils.item.ItemStackUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -1,17 +1,16 @@
|
||||
package com.songoda.skyblock.challenge.challenge;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class ChallengeCategory {
|
||||
private int id;
|
||||
private String name;
|
||||
|
@ -1,30 +1,28 @@
|
||||
package com.songoda.skyblock.challenge.challenge;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ChallengeManager {
|
||||
private SkyBlock skyblock;
|
||||
private SkyBlock plugin;
|
||||
private HashMap<Integer, ChallengeCategory> categories;
|
||||
|
||||
public ChallengeManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public ChallengeManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
categories = new HashMap<>();
|
||||
loadChallenges();
|
||||
}
|
||||
|
||||
private void loadChallenges() {
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "challenges.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "challenges.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
try {
|
||||
|
@ -1,18 +1,16 @@
|
||||
package com.songoda.skyblock.challenge.challenge;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemChallenge {
|
||||
private Challenge challenge;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.songoda.skyblock.challenge.defaultinv;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -13,16 +11,17 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultInventory {
|
||||
private final Item defaultItem = new Item(new ItemStack(Material.AIR));
|
||||
private int size;
|
||||
private Item[][] items;
|
||||
|
||||
public DefaultInventory(SkyBlock skyblock) {
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "challenges.yml"));
|
||||
public DefaultInventory(SkyBlock plugin) {
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "challenges.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
size = configLoad.getInt("inventory.size");
|
||||
items = new Item[9][size];
|
||||
|
@ -3,11 +3,11 @@
|
||||
*/
|
||||
package com.songoda.skyblock.challenge.inventory;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ClickableItem {
|
||||
private ItemStack item;
|
||||
private Consumer<InventoryClickEvent> event;
|
||||
|
@ -3,15 +3,15 @@
|
||||
*/
|
||||
package com.songoda.skyblock.challenge.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Inventory {
|
||||
public static final String TICK = "tick";
|
||||
private HashMap<String, Object> values;
|
||||
|
@ -3,11 +3,7 @@
|
||||
*/
|
||||
package com.songoda.skyblock.challenge.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -18,21 +14,24 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class InventoryManager implements Listener {
|
||||
private SkyBlock skyblock;
|
||||
private SkyBlock plugin;
|
||||
private HashMap<UUID, Inventory> inventories;
|
||||
private int task;
|
||||
|
||||
public InventoryManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public InventoryManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
this.inventories = new HashMap<>();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Bukkit.getPluginManager().registerEvents(this, skyblock);
|
||||
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(skyblock, () -> {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
|
||||
if (inventories.size() == 0)
|
||||
return;
|
||||
for (Inventory inv : inventories.values()) {
|
||||
|
@ -3,11 +3,11 @@
|
||||
*/
|
||||
package com.songoda.skyblock.challenge.inventory;
|
||||
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
public interface InventoryProvider {
|
||||
|
||||
public String title(Inventory inv);
|
||||
|
@ -3,11 +3,8 @@
|
||||
*/
|
||||
package com.songoda.skyblock.challenge.inventory;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -15,8 +12,10 @@ import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ItemBuilder {
|
||||
private Material m;
|
||||
|
@ -1,18 +1,6 @@
|
||||
package com.songoda.skyblock.challenge.inventory.inv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.songoda.skyblock.challenge.FabledChallenge;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
|
||||
@ -22,8 +10,18 @@ import com.songoda.skyblock.challenge.defaultinv.Item;
|
||||
import com.songoda.skyblock.challenge.inventory.ClickableItem;
|
||||
import com.songoda.skyblock.challenge.inventory.Inventory;
|
||||
import com.songoda.skyblock.challenge.inventory.InventoryProvider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ChallengeInventory implements InventoryProvider {
|
||||
public static final String CATEGORY = "ChallengeCategory";
|
||||
private FabledChallenge fc;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.songoda.skyblock.challenge.player;
|
||||
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
|
||||
public class PlayerChallenge {
|
||||
private UUID uuid;
|
||||
private HashMap<Challenge, Integer> challenges;
|
||||
|
@ -1,5 +1,18 @@
|
||||
package com.songoda.skyblock.challenge.player;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge.Type;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
|
||||
import com.songoda.skyblock.challenge.challenge.Peer;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -7,33 +20,19 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge.Type;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
|
||||
import com.songoda.skyblock.challenge.challenge.Peer;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
|
||||
public class PlayerManager {
|
||||
private SkyBlock skyblock;
|
||||
private SkyBlock plugin;
|
||||
private HashMap<UUID, HashMap<Challenge, Integer>> islands;
|
||||
private File playersDirectory;
|
||||
|
||||
public PlayerManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public PlayerManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
islands = new HashMap<>();
|
||||
playersDirectory = new File(skyblock.getDataFolder(), "challenge-data");
|
||||
playersDirectory = new File(plugin.getDataFolder(), "challenge-data");
|
||||
if (!playersDirectory.exists())
|
||||
playersDirectory.mkdirs();
|
||||
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
for(Player p : Bukkit.getServer().getOnlinePlayers()){
|
||||
loadPlayer(p.getUniqueId());
|
||||
}
|
||||
@ -41,9 +40,9 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public HashMap<Challenge, Integer> getPlayer(UUID uuid) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
@ -58,14 +57,14 @@ public class PlayerManager {
|
||||
* The uuid of specific player
|
||||
*/
|
||||
public void loadPlayer(UUID uuid) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
}
|
||||
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
|
||||
Config config = plugin.getFileManager().getConfig(new File(playersDirectory,
|
||||
uuid.toString() + ".yml"));
|
||||
FileConfiguration fileConfig = config.getFileConfiguration();
|
||||
HashMap<Challenge, Integer> challenges = new HashMap<>();
|
||||
@ -73,7 +72,7 @@ public class PlayerManager {
|
||||
Set<String> strs = (section != null) ? section.getKeys(false) : new HashSet<>();
|
||||
for (String k : strs) {
|
||||
int id = fileConfig.getInt("challenges." + k + ".id");
|
||||
ChallengeCategory cc = skyblock.getFabledChallenge().getChallengeManager().getChallenge(id);
|
||||
ChallengeCategory cc = plugin.getFabledChallenge().getChallengeManager().getChallenge(id);
|
||||
// WTF
|
||||
if (cc == null)
|
||||
continue;
|
||||
@ -99,15 +98,15 @@ public class PlayerManager {
|
||||
* The uuid of specific player
|
||||
*/
|
||||
public void unloadPlayer(UUID uuid) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
}
|
||||
islands.remove(uuid);
|
||||
skyblock.getFileManager().unloadConfig(new File(playersDirectory,
|
||||
plugin.getFileManager().unloadConfig(new File(playersDirectory,
|
||||
uuid.toString() + ".yml"));
|
||||
|
||||
}
|
||||
@ -125,9 +124,9 @@ public class PlayerManager {
|
||||
if (c == null)
|
||||
return false;
|
||||
UUID uuid = p.getUniqueId();
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
@ -161,9 +160,9 @@ public class PlayerManager {
|
||||
if (!canDoChallenge(p, c))
|
||||
return false;
|
||||
UUID uuid = p.getUniqueId();
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
@ -192,14 +191,14 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public void addChallenge(UUID uuid, Challenge c) {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
}
|
||||
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
|
||||
Config config = plugin.getFileManager().getConfig(new File(playersDirectory,
|
||||
uuid.toString() + ".yml"));
|
||||
FileConfiguration fileConfig = config.getFileConfiguration();
|
||||
int ccId = c.getCategory().getId();
|
||||
@ -231,16 +230,16 @@ public class PlayerManager {
|
||||
if (challenges != null) {
|
||||
return challenges.getOrDefault(c, 0);
|
||||
} else {
|
||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland", true)) {
|
||||
Island is = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
Island is = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
|
||||
if(is != null){
|
||||
uuid = is.getOwnerUUID();
|
||||
}
|
||||
}
|
||||
|
||||
// Not connected, check in file
|
||||
Config config = skyblock.getFileManager().getConfig(new File(playersDirectory,
|
||||
Config config = plugin.getFileManager().getConfig(new File(playersDirectory,
|
||||
uuid.toString() + ".yml"));
|
||||
FileConfiguration fileConfig = config.getFileConfiguration();
|
||||
int ccId = c.getCategory().getId();
|
||||
|
@ -33,15 +33,15 @@ import java.util.List;
|
||||
|
||||
public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
private List<SubCommand> islandCommands;
|
||||
private List<SubCommand> adminCommands;
|
||||
|
||||
public CommandManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
|
||||
skyblock.getCommand("island").setExecutor(this);
|
||||
skyblock.getCommand("island").setTabCompleter(this);
|
||||
public CommandManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
plugin.getCommand("island").setExecutor(this);
|
||||
plugin.getCommand("island").setTabCompleter(this);
|
||||
|
||||
registerSubCommands();
|
||||
}
|
||||
@ -125,11 +125,11 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("island")) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Player player = null;
|
||||
@ -142,8 +142,8 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
if (player == null) {
|
||||
sendConsoleHelpCommands(sender);
|
||||
} else {
|
||||
if (skyblock.getIslandManager().getIsland(player) == null) {
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> Bukkit.getServer().dispatchCommand(sender, "island create"));
|
||||
if (plugin.getIslandManager().getIsland(player) == null) {
|
||||
Bukkit.getServer().getScheduler().runTask(plugin, () -> Bukkit.getServer().dispatchCommand(sender, "island create"));
|
||||
} else {
|
||||
boolean canUseControlPanel = player.hasPermission("fabledskyblock.*")
|
||||
|| player.hasPermission("fabledskyblock.island.*")
|
||||
@ -182,7 +182,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
|
||||
int page = -1;
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Command.Help.List")) {
|
||||
page = 1;
|
||||
|
||||
@ -220,7 +220,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
|
||||
int page = -1;
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Command.Help.List")) {
|
||||
page = 1;
|
||||
|
||||
@ -395,21 +395,21 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
public void sendPlayerHelpCommands(Player player, List<SubCommand> subCommands, int page, boolean isAdmin) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
int pageSize = 7;
|
||||
|
||||
int nextEndIndex = subCommands.size() - page * pageSize, index = page * pageSize - pageSize,
|
||||
endIndex = index >= subCommands.size() ? subCommands.size() - 1 : index + pageSize;
|
||||
boolean showAlises = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
boolean showAlises = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Command.Help.Aliases.Enable");
|
||||
|
||||
if (nextEndIndex <= -7) {
|
||||
skyblock.getMessageManager().sendMessage(player, configLoad.getString("Command.Island.Help.Page.Message"));
|
||||
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||
plugin.getMessageManager().sendMessage(player, configLoad.getString("Command.Island.Help.Page.Message"));
|
||||
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -482,7 +482,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
skyblock.getMessageManager().sendMessage(player, helpLines);
|
||||
plugin.getMessageManager().sendMessage(player, helpLines);
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
}
|
||||
|
||||
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
|
||||
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void sendConsoleHelpCommands(CommandSender sender) {
|
||||
|
@ -10,12 +10,12 @@ import java.io.File;
|
||||
|
||||
public abstract class SubCommand {
|
||||
|
||||
protected final SkyBlock skyblock;
|
||||
protected final SkyBlock plugin;
|
||||
protected final String info;
|
||||
|
||||
public SubCommand() {
|
||||
this.skyblock = SkyBlock.getInstance();
|
||||
this.info = ChatColor.translateAlternateColorCodes('&', this.skyblock.getFileManager().getConfig(new File(this.skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString(this.getInfoMessagePath()));
|
||||
this.plugin = SkyBlock.getInstance();
|
||||
this.info = ChatColor.translateAlternateColorCodes('&', this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString(this.getInfoMessagePath()));
|
||||
}
|
||||
|
||||
public abstract void onCommandByPlayer(Player player, String[] args);
|
||||
|
@ -35,13 +35,13 @@ public class AddUpgradeCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 2) {
|
||||
@ -88,7 +88,7 @@ public class AddUpgradeCommand extends SubCommand {
|
||||
|
||||
island.setUpgrade(null, upgrade, true);
|
||||
} else {
|
||||
File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data",
|
||||
File islandDataFile = new File(plugin.getDataFolder().toString() + "/island-data",
|
||||
islandOwnerUUID.toString() + ".yml");
|
||||
|
||||
if (!fileManager.isFileExist(islandDataFile)) {
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AdminBank extends SubCommand {
|
||||
@ -25,25 +24,25 @@ public class AdminBank extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(player.getLocation());
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")) {
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().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;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
skyblock.getGuiManager().showGUI(player, new GuiBank(skyblock, island, null, true));
|
||||
plugin.getGuiManager().showGUI(player, new GuiBank(plugin, island, null, true));
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "balance":
|
||||
@ -84,7 +83,7 @@ public class AdminBank extends SubCommand {
|
||||
island = islandManager.getIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
|
||||
}
|
||||
if (island != null){
|
||||
skyblock.getGuiManager().showGUI(player, new GuiBank(skyblock, island, null, true));
|
||||
plugin.getGuiManager().showGUI(player, new GuiBank(plugin, island, null, true));
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.NullIsland.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
|
||||
@ -99,11 +98,11 @@ public class AdminBank extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length < 2) {
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.hooks.EconomyManager;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.gui.bank.GuiBank;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
@ -12,7 +10,6 @@ import com.songoda.skyblock.playerdata.PlayerData;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -25,13 +22,13 @@ public class ChatSpyCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
FileManager.Config language = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config language = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration languageLoad = language.getFileConfiguration();
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
@ -12,8 +12,8 @@ public class CreateCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
playerDataManager.getPlayerData(player).setViewer(null);
|
||||
|
@ -35,12 +35,12 @@ public class DeleteCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Player player = null;
|
||||
|
@ -18,15 +18,15 @@ public class GeneratorCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (skyblock.getGeneratorManager() == null) {
|
||||
if (plugin.getGeneratorManager() == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Generator.Disabled.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
|
@ -11,7 +11,7 @@ public class LevelCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Levelling.getInstance().open(player);
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
|
@ -30,13 +30,13 @@ public class LevelScanCommand extends SubCommand {
|
||||
}
|
||||
|
||||
private void onCommand(CommandSender sender, String[] args) {
|
||||
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
IslandLevelManager levellingManager = plugin.getLevellingManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 0) {
|
||||
|
@ -30,12 +30,12 @@ public class OwnerCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -30,12 +30,12 @@ public class ProxyCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -28,20 +28,20 @@ public class RefreshHologramsCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
LeaderboardManager leaderboardManager = skyblock.getLeaderboardManager();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
LeaderboardManager leaderboardManager = plugin.getLeaderboardManager();
|
||||
leaderboardManager.clearLeaderboard();
|
||||
leaderboardManager.resetLeaderboard();
|
||||
leaderboardManager.setupLeaderHeads();
|
||||
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> skyblock.getHologramTask().updateHologram());
|
||||
Bukkit.getScheduler().runTask(plugin, () -> plugin.getHologramTask().updateHologram());
|
||||
});
|
||||
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RefreshHolograms.Refreshed.Message"));
|
||||
|
@ -1,20 +1,11 @@
|
||||
package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.island.reward.RewardManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.generator.GeneratorManager;
|
||||
import com.songoda.skyblock.island.reward.RewardManager;
|
||||
import com.songoda.skyblock.leaderboard.LeaderboardManager;
|
||||
import com.songoda.skyblock.levelling.IslandLevelManager;
|
||||
import com.songoda.skyblock.limit.LimitationInstanceHandler;
|
||||
@ -22,6 +13,14 @@ import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.scoreboard.ScoreboardManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.item.MenuClickRegistry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReloadCommand extends SubCommand {
|
||||
|
||||
@ -36,17 +35,17 @@ public class ReloadCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
LeaderboardManager leaderboardManager = skyblock.getLeaderboardManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
LimitationInstanceHandler limitHandler = skyblock.getLimitationHandler();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
LeaderboardManager leaderboardManager = plugin.getLeaderboardManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
LimitationInstanceHandler limitHandler = plugin.getLimitationHandler();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
messageManager.sendMessage(sender,
|
||||
"&cPlease note that this command is not supported and may " + "cause issues that could put the plugin in an unstable state. " + "If you encounter any issues please stop your server, edit the configuration files, "
|
||||
+ "and then start your server again. This command does NOT reload all the plugin files, only " + "the config.yml, language.yml, generators.yml, levelling.yml, and limits.yml.");
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Map<String, Config> configs = fileManager.getConfigs();
|
||||
@ -56,48 +55,48 @@ public class ReloadCommand extends SubCommand {
|
||||
Config configFileConfig = configs.get(configFileName);
|
||||
String configFilePath = configFileName.replace(configFileConfig.getFile().getName(), "");
|
||||
|
||||
if (configFilePath.equals(skyblock.getDataFolder().toString() + "\\") || configFilePath.equals(skyblock.getDataFolder().toString() + "/")) {
|
||||
if (configFilePath.equals(plugin.getDataFolder().toString() + "\\") || configFilePath.equals(plugin.getDataFolder().toString() + "/")) {
|
||||
configFileConfig.loadFile();
|
||||
}
|
||||
}
|
||||
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
Config mainConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
FileConfiguration mainConfigLoad = mainConfig.getFileConfiguration();
|
||||
|
||||
if (skyblock.getScoreboardManager() == null) {
|
||||
if (plugin.getScoreboardManager() == null) {
|
||||
if (mainConfigLoad.getBoolean("Island.Scoreboard.Enable")) {
|
||||
skyblock.setScoreboardManager(new ScoreboardManager(skyblock));
|
||||
plugin.setScoreboardManager(new ScoreboardManager(plugin));
|
||||
}
|
||||
} else {
|
||||
skyblock.getScoreboardManager().updateScoreboards(false);
|
||||
plugin.getScoreboardManager().updateScoreboards(false);
|
||||
}
|
||||
|
||||
if (skyblock.getGeneratorManager() == null) {
|
||||
if (plugin.getGeneratorManager() == null) {
|
||||
if (mainConfigLoad.getBoolean("Island.Generator.Enable")) {
|
||||
skyblock.setGeneratorManager(new GeneratorManager(skyblock));
|
||||
plugin.setGeneratorManager(new GeneratorManager(plugin));
|
||||
}
|
||||
} else {
|
||||
GeneratorManager generatorManager = skyblock.getGeneratorManager();
|
||||
GeneratorManager generatorManager = plugin.getGeneratorManager();
|
||||
generatorManager.unregisterGenerators();
|
||||
generatorManager.registerGenerators();
|
||||
}
|
||||
|
||||
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
||||
IslandLevelManager levellingManager = plugin.getLevellingManager();
|
||||
levellingManager.reloadWorth();
|
||||
|
||||
RewardManager rewardManager = skyblock.getRewardManager();
|
||||
RewardManager rewardManager = plugin.getRewardManager();
|
||||
rewardManager.loadRewards();
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
leaderboardManager.clearLeaderboard();
|
||||
leaderboardManager.resetLeaderboard();
|
||||
leaderboardManager.setupLeaderHeads();
|
||||
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> skyblock.getHologramTask().updateHologram());
|
||||
Bukkit.getScheduler().runTask(plugin, () -> plugin.getHologramTask().updateHologram());
|
||||
});
|
||||
|
||||
limitHandler.reloadAll();
|
||||
skyblock.getLocalizationManager().reloadAll();
|
||||
plugin.getLocalizationManager().reloadAll();
|
||||
MenuClickRegistry.getInstance().reloadAll();
|
||||
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message"));
|
||||
|
@ -5,11 +5,10 @@ import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.hologram.Hologram;
|
||||
import com.songoda.skyblock.tasks.HologramTask;
|
||||
import com.songoda.skyblock.hologram.HologramType;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
|
||||
import com.songoda.skyblock.tasks.HologramTask;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -33,12 +32,12 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
HologramTask hologramManager = skyblock.getHologramTask();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
HologramTask hologramManager = plugin.getHologramTask();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -57,7 +56,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
}
|
||||
|
||||
if (hologramType != null) {
|
||||
Config locationsConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml"));
|
||||
Config locationsConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml"));
|
||||
FileConfiguration locationsConfigLoad = locationsConfig.getFileConfiguration();
|
||||
|
||||
if (locationsConfigLoad.getString("Location.Hologram.Leaderboard." + hologramType.name()) == null) {
|
||||
@ -72,7 +71,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
Bukkit.getServer().getScheduler().runTask(plugin, () -> {
|
||||
HologramType hologramType1 = HologramType.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
|
@ -35,13 +35,13 @@ public class RemoveUpgradeCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 2) {
|
||||
@ -88,7 +88,7 @@ public class RemoveUpgradeCommand extends SubCommand {
|
||||
|
||||
island.removeUpgrade(upgrade);
|
||||
} else {
|
||||
File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data",
|
||||
File islandDataFile = new File(plugin.getDataFolder().toString() + "/island-data",
|
||||
islandOwnerUUID.toString() + ".yml");
|
||||
|
||||
if (!fileManager.isFileExist(islandDataFile)) {
|
||||
|
@ -1,15 +1,6 @@
|
||||
package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
@ -19,6 +10,14 @@ 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 org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SetAlwaysLoadedCommand extends SubCommand {
|
||||
|
||||
@ -34,10 +33,10 @@ public class SetAlwaysLoadedCommand extends SubCommand {
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
|
||||
if (args.length == 0) {
|
||||
messageManager.sendMessage(sender,
|
||||
@ -45,9 +44,9 @@ public class SetAlwaysLoadedCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
if (args.length == 1) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
|
@ -2,7 +2,6 @@ package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleBiome;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.skyblock.biome.BiomeManager;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
@ -14,7 +13,6 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.StringUtil;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import com.songoda.skyblock.utils.version.SBiome;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@ -37,14 +35,14 @@ public class SetBiomeCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
BiomeManager biomeManager = skyblock.getBiomeManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
BiomeManager biomeManager = plugin.getBiomeManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 2) {
|
||||
|
@ -21,12 +21,12 @@ public class SetHologramCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
HologramTask hologramManager = skyblock.getHologramTask();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
HologramTask hologramManager = plugin.getHologramTask();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -46,11 +46,11 @@ public class SetHologramCommand extends SubCommand {
|
||||
|
||||
if (hologramType != null) {
|
||||
fileManager.setLocation(
|
||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")),
|
||||
fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml")),
|
||||
"Location.Hologram.Leaderboard." + hologramType.name(), player.getLocation(), true);
|
||||
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
Bukkit.getServer().getScheduler().runTask(plugin, () -> {
|
||||
HologramType hologramType1 = HologramType.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
|
@ -35,13 +35,13 @@ public class SetMaxMembers extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 2) {
|
||||
@ -79,13 +79,13 @@ public class SetMaxMembers extends SubCommand {
|
||||
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
||||
island.setMaxMembers(maxMembers);
|
||||
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")
|
||||
&& island.isBorder()) {
|
||||
islandManager.updateBorder(island);
|
||||
}
|
||||
} else {
|
||||
File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data",
|
||||
File islandDataFile = new File(plugin.getDataFolder().toString() + "/island-data",
|
||||
islandOwnerUUID.toString() + ".yml");
|
||||
|
||||
if (!fileManager.isFileExist(islandDataFile)) {
|
||||
|
@ -35,13 +35,13 @@ public class SetSizeCommand extends SubCommand {
|
||||
}
|
||||
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 2) {
|
||||
@ -79,13 +79,13 @@ public class SetSizeCommand extends SubCommand {
|
||||
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
||||
island.setSize(size);
|
||||
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")
|
||||
&& island.isBorder()) {
|
||||
islandManager.updateBorder(island);
|
||||
}
|
||||
} else {
|
||||
File islandDataFile = new File(skyblock.getDataFolder().toString() + "/island-data",
|
||||
File islandDataFile = new File(plugin.getDataFolder().toString() + "/island-data",
|
||||
islandOwnerUUID.toString() + ".yml");
|
||||
|
||||
if (!fileManager.isFileExist(islandDataFile)) {
|
||||
|
@ -16,14 +16,14 @@ public class SetSpawnCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
fileManager.setLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")),
|
||||
fileManager.setLocation(fileManager.getConfig(new File(plugin.getDataFolder(), "locations.yml")),
|
||||
"Location.Spawn", player.getLocation(), true);
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.SetSpawn.Set.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
||||
|
@ -11,9 +11,9 @@ public class SettingsCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
skyblock.getGuiManager().showGUI(player, new GuiPermissionsSelector(skyblock, null, null));
|
||||
plugin.getGuiManager().showGUI(player, new GuiPermissionsSelector(plugin, null, null));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,18 @@
|
||||
package com.songoda.skyblock.command.commands.admin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.skyblock.utils.StringUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class StackableCommand extends SubCommand {
|
||||
@ -22,14 +20,14 @@ public class StackableCommand extends SubCommand {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
final MessageManager messageManager = skyblock.getMessageManager();
|
||||
final MessageManager messageManager = plugin.getMessageManager();
|
||||
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(StringUtil.color("&e/island admin stackable setsize <size> &7- &f&osets the target block's stack size if applicable"));
|
||||
return;
|
||||
}
|
||||
|
||||
final FileConfiguration messageConfig = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
final FileConfiguration messageConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
|
||||
if (args[0].equalsIgnoreCase("setsize")) {
|
||||
|
||||
@ -54,7 +52,7 @@ public class StackableCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final StackableManager stackableManager = skyblock.getStackableManager();
|
||||
final StackableManager stackableManager = plugin.getStackableManager();
|
||||
final CompatibleMaterial type = CompatibleMaterial.getMaterial(block.getType());
|
||||
|
||||
if (!stackableManager.isStackableMaterial(type)) {
|
||||
|
@ -10,8 +10,6 @@ import com.songoda.skyblock.utils.ChatComponent;
|
||||
import com.songoda.skyblock.utils.Compression;
|
||||
import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import java.io.*;
|
||||
import java.util.Base64;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
@ -22,16 +20,21 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class StructureCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
|
||||
@ -140,7 +143,7 @@ public class StructureCommand extends SubCommand {
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("save")) {
|
||||
if (args.length == 2) {
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
Location position1Location = playerData.getArea().getPosition(1);
|
||||
Location position2Location = playerData.getArea().getPosition(2);
|
||||
@ -171,7 +174,7 @@ public class StructureCommand extends SubCommand {
|
||||
} else {
|
||||
try {
|
||||
File configFile = new File(
|
||||
skyblock.getDataFolder().toString() + "/structures/" + args[1] + ".structure");
|
||||
plugin.getDataFolder().toString() + "/structures/" + args[1] + ".structure");
|
||||
StructureUtil.saveStructure(configFile, player.getLocation(),
|
||||
StructureUtil.getFixedLocations(position1Location, position2Location));
|
||||
|
||||
@ -198,7 +201,7 @@ public class StructureCommand extends SubCommand {
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("convert")) {
|
||||
if (args.length == 2) {
|
||||
File structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"), args[1]);
|
||||
File structureFile = new File(new File(plugin.getDataFolder().toString() + "/structures"), args[1]);
|
||||
if (!structureFile.exists()) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Admin.Structure.Convert.Invalid.Message")
|
||||
|
@ -18,15 +18,15 @@ public class UpgradeCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (skyblock.getUpgradeManager() == null) {
|
||||
if (plugin.getUpgradeManager() == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Upgrade.Disabled.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
|
@ -32,20 +32,20 @@ public class AcceptCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
InviteManager inviteManager = skyblock.getInviteManager();
|
||||
InviteManager inviteManager = plugin.getInviteManager();
|
||||
|
||||
if (inviteManager.hasInvite(player.getUniqueId())) {
|
||||
Invite invite = inviteManager.getInvite(player.getUniqueId());
|
||||
@ -99,7 +99,7 @@ public class AcceptCommand extends SubCommand {
|
||||
island.save();
|
||||
|
||||
if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()
|
||||
+ 1) >= fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
+ 1) >= fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Member.Capacity")) {
|
||||
Map<UUID, Invite> invites = inviteManager.getInvites();
|
||||
|
||||
@ -123,8 +123,8 @@ public class AcceptCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
skyblock.getVisitManager().getIsland(invite.getOwnerUUID())
|
||||
|
||||
plugin.getVisitManager().getIsland(invite.getOwnerUUID())
|
||||
.removeVoter(player.getUniqueId());
|
||||
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
|
@ -1,15 +1,6 @@
|
||||
package com.songoda.skyblock.command.commands.island;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.ban.Ban;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
@ -18,22 +9,30 @@ import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BanCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -42,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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
|
||||
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().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]);
|
||||
|
@ -19,15 +19,15 @@ public class BankCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.Enable")) {
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().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;
|
||||
@ -37,12 +37,12 @@ public class BankCommand extends SubCommand {
|
||||
island = islandManager.getIsland(player);
|
||||
|
||||
if (island == null) {
|
||||
skyblock.getSoundManager().playSound(player, CompatibleSound.BLOCK_GLASS_BREAK.getSound(), 1.0F, 1.0F);
|
||||
skyblock.getMessageManager().sendMessage(player, configLoad.getString("Command.Bank.Unknown"));
|
||||
plugin.getSoundManager().playSound(player, CompatibleSound.BLOCK_GLASS_BREAK.getSound(), 1.0F, 1.0F);
|
||||
plugin.getMessageManager().sendMessage(player, configLoad.getString("Command.Bank.Unknown"));
|
||||
return;
|
||||
}
|
||||
|
||||
skyblock.getGuiManager().showGUI(player, new GuiBank(skyblock, island, null, false));
|
||||
|
||||
plugin.getGuiManager().showGUI(player, new GuiBank(plugin, island, null, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,19 +18,19 @@ public class BansCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = skyblock.getIslandManager().getIsland(player);
|
||||
Island island = plugin.getIslandManager().getIsland(player);
|
||||
|
||||
if (island == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bans.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Unban", IslandRole.Operator))
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Unban", IslandRole.Operator))
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
if (island.getBan().getBans().size() == 0) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bans.Bans.Message"));
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.songoda.skyblock.command.commands.island;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.skyblock.biome.BiomeManager;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
@ -22,12 +21,12 @@ public class BiomeCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
BiomeManager biomeManager = skyblock.getBiomeManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
BiomeManager biomeManager = plugin.getBiomeManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -36,13 +35,13 @@ public class BiomeCommand extends SubCommand {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Biome.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island,"Biome", IslandRole.Operator))
|
||||
&& plugin.getPermissionManager().hasPermission(island,"Biome", IslandRole.Operator))
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
if(biomeManager.isUpdating(island)){
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Biome.InProgress.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
skyblock.getGuiManager().showGUI(player, new GuiBiome(skyblock, player, island, IslandWorld.Normal, null, false)); // TODO Nether and End support
|
||||
plugin.getGuiManager().showGUI(player, new GuiBiome(plugin, player, island, IslandWorld.Normal, null, false)); // TODO Nether and End support
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
|
@ -21,13 +21,13 @@ public class BorderCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.WorldBorder.Enable")) {
|
||||
Border.getInstance().open(player);
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
|
@ -21,12 +21,12 @@ public class CancelCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
InviteManager inviteManager = skyblock.getInviteManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
InviteManager inviteManager = plugin.getInviteManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -1,44 +1,43 @@
|
||||
package com.songoda.skyblock.command.commands.island;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.challenge.FabledChallenge;
|
||||
import com.songoda.skyblock.challenge.challenge.Challenge;
|
||||
import com.songoda.skyblock.challenge.challenge.ChallengeCategory;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ChallengeCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FabledChallenge fabledChallenge = skyblock.getFabledChallenge();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
FabledChallenge fabledChallenge = plugin.getFabledChallenge();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
|
||||
Config langConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config langConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration langConfigLoad = langConfig.getFileConfiguration();
|
||||
|
||||
// Not loaded
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Challenge.PerIsland")){
|
||||
if(islandManager.getIsland(player) == null){
|
||||
messageManager.sendMessage(player, langConfigLoad.getString("Command.Island.Challenge.NoIsland.Message"));
|
||||
|
@ -23,12 +23,12 @@ public class ChatCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -65,11 +65,11 @@ public class ChatCommand extends SubCommand {
|
||||
} else {
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
if (playerData.getOwner() != null) {
|
||||
island = skyblock.getIslandManager().getIsland(player);
|
||||
island = plugin.getIslandManager().getIsland(player);
|
||||
}
|
||||
|
||||
Island finalIsland = island;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
PlayerIslandChatEvent islandChatEvent = new PlayerIslandChatEvent(player, finalIsland.getAPIWrapper(),
|
||||
String.join(" ", args), configLoad.getString("Island.Chat.Format.Message"));
|
||||
Bukkit.getServer().getPluginManager().callEvent(islandChatEvent);
|
||||
|
@ -19,11 +19,11 @@ public class CloseCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -33,7 +33,7 @@ public class CloseCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island,"Visitor", IslandRole.Operator))) {
|
||||
&& plugin.getPermissionManager().hasPermission(island,"Visitor", IslandRole.Operator))) {
|
||||
if (island.getStatus().equals(IslandStatus.OPEN) || island.getStatus().equals(IslandStatus.WHITELISTED)) {
|
||||
islandManager.closeIsland(island);
|
||||
|
||||
|
@ -33,17 +33,17 @@ public class ConfirmCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
StructureManager structureManager = skyblock.getStructureManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
StructureManager structureManager = plugin.getStructureManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (playerData.getConfirmationTime() > 0) {
|
||||
@ -100,7 +100,7 @@ public class ConfirmCommand extends SubCommand {
|
||||
islandManager.giveOwnership(island,
|
||||
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
|
||||
|
||||
skyblock.getCooldownManager().createPlayer(CooldownType.Ownership,
|
||||
plugin.getCooldownManager().createPlayer(CooldownType.Ownership,
|
||||
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad
|
||||
|
@ -15,13 +15,13 @@ public class ControlPanelCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (skyblock.getIslandManager().getIsland(player) == null) {
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
if (plugin.getIslandManager().getIsland(player) == null) {
|
||||
plugin.getMessageManager().sendMessage(player,
|
||||
configLoad.getString("Command.Island.ControlPanel.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
|
@ -23,13 +23,13 @@ public class CoopCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Coop.Enable")) {
|
||||
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
|
@ -25,19 +25,19 @@ public class CreateCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
CooldownManager cooldownManager = plugin.getCooldownManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
if (islandManager.getIsland(player) == null) {
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
Config mainConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
|
||||
if (args.length == 1) {
|
||||
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
|
||||
Structure structure = plugin.getStructureManager().getStructure(args[0]);
|
||||
|
||||
if (structure != null && islandManager.createIsland(player, structure)) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
|
||||
@ -50,7 +50,7 @@ public class CreateCommand extends SubCommand {
|
||||
Creator.getInstance().open(player);
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
List<Structure> structures = skyblock.getStructureManager().getStructures();
|
||||
List<Structure> structures = plugin.getStructureManager().getStructures();
|
||||
|
||||
if (structures.size() == 0) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.None.Message"));
|
||||
@ -58,7 +58,7 @@ public class CreateCommand extends SubCommand {
|
||||
|
||||
return;
|
||||
} else if (!fileManager
|
||||
.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"),
|
||||
.isFileExist(new File(new File(plugin.getDataFolder().toString() + "/structures"),
|
||||
structures.get(0).getOverworldFile()))) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Creator.Selector.File.Overworld.Message"));
|
||||
@ -66,14 +66,14 @@ public class CreateCommand extends SubCommand {
|
||||
|
||||
return;
|
||||
} else if (!fileManager
|
||||
.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"),
|
||||
.isFileExist(new File(new File(plugin.getDataFolder().toString() + "/structures"),
|
||||
structures.get(0).getNetherFile()))) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Creator.Selector.File.Nether.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable")
|
||||
&& cooldownManager.hasPlayer(CooldownType.Creation, player)) {
|
||||
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Creation, player);
|
||||
|
@ -19,11 +19,11 @@ public class CurrentCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length > 0) {
|
||||
|
@ -33,15 +33,15 @@ public class DeleteCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
CooldownManager cooldownManager = plugin.getCooldownManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -50,7 +50,7 @@ public class DeleteCommand extends SubCommand {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Delete.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable")
|
||||
&& cooldownManager.hasPlayer(CooldownType.Deletion, player)) {
|
||||
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Deletion, player);
|
||||
@ -81,7 +81,7 @@ public class DeleteCommand extends SubCommand {
|
||||
configLoad.getString("Command.Island.Delete.Confirmation.Pending.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
int confirmationTime = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
int confirmationTime = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
|
||||
|
||||
playerData.setConfirmation(Confirmation.Deletion);
|
||||
|
@ -22,11 +22,11 @@ public class DemoteCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -18,11 +18,11 @@ public class DenyCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
InviteManager inviteManager = skyblock.getInviteManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
InviteManager inviteManager = plugin.getInviteManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -22,13 +22,13 @@ public class InformationCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
UUID islandOwnerUUID = null;
|
||||
@ -57,7 +57,7 @@ public class InformationCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
if (islandManager.getIsland(player) == null) {
|
||||
|
@ -30,12 +30,12 @@ public class InviteCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -46,8 +46,8 @@ public class InviteCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Invite", IslandRole.Operator))) {
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Invite", IslandRole.Operator))) {
|
||||
Config mainConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
|
||||
|
||||
if ((island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size()
|
||||
+ 1) >= mainConfig.getFileConfiguration().getInt("Island.Member.Capacity")) {
|
||||
@ -77,8 +77,8 @@ public class InviteCommand extends SubCommand {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Invite.Member.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (skyblock.getInviteManager().hasInvite(targetPlayer.getUniqueId())) {
|
||||
Invite invite = skyblock.getInviteManager().getInvite(targetPlayer.getUniqueId());
|
||||
} else if (plugin.getInviteManager().hasInvite(targetPlayer.getUniqueId())) {
|
||||
Invite invite = plugin.getInviteManager().getInvite(targetPlayer.getUniqueId());
|
||||
|
||||
if (invite.getOwnerUUID().equals(island.getOwnerUUID())) {
|
||||
messageManager.sendMessage(player,
|
||||
@ -213,7 +213,7 @@ public class InviteCommand extends SubCommand {
|
||||
|
||||
targetPlayer.spigot().sendMessage(chatComponent.getTextComponent());
|
||||
|
||||
Invite invite = skyblock.getInviteManager().createInvite(targetPlayer, player,
|
||||
Invite invite = plugin.getInviteManager().createInvite(targetPlayer, player,
|
||||
island.getOwnerUUID(), respondTime);
|
||||
|
||||
Bukkit.getServer().getPluginManager()
|
||||
|
@ -25,11 +25,11 @@ public class KickAllCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -39,7 +39,7 @@ public class KickAllCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Kick", IslandRole.Operator))) {
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Kick", IslandRole.Operator))) {
|
||||
if (!island.getStatus().equals(IslandStatus.CLOSED)) {
|
||||
Set<UUID> islandVisitors = islandManager.getVisitorsAtIsland(island);
|
||||
|
||||
|
@ -1,19 +1,6 @@
|
||||
package com.songoda.skyblock.command.commands.island;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.island.IslandStatus;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.songoda.skyblock.api.event.island.IslandKickEvent;
|
||||
import com.songoda.skyblock.api.utils.APIUtil;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
@ -22,7 +9,9 @@ import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.island.IslandStatus;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import com.songoda.skyblock.playerdata.PlayerData;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.scoreboard.Scoreboard;
|
||||
@ -30,23 +19,33 @@ import com.songoda.skyblock.scoreboard.ScoreboardManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class KickCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
||||
Config languageConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config languageConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
|
||||
if (args.length == 1) {
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -93,7 +92,7 @@ public class KickCommand extends SubCommand {
|
||||
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), APIUtil.fromImplementation(IslandRole.Visitor),
|
||||
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
||||
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||
Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||
|
||||
if (!islandKickEvent.isCancelled()) {
|
||||
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
||||
@ -117,7 +116,7 @@ public class KickCommand extends SubCommand {
|
||||
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), APIUtil.fromImplementation(islandRole),
|
||||
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
||||
|
||||
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||
Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||
|
||||
if (!islandKickEvent.isCancelled()) {
|
||||
messageManager.sendMessage(player,
|
||||
@ -125,7 +124,7 @@ public class KickCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
|
||||
|
||||
if (targetPlayer == null) {
|
||||
Config config = fileManager.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), targetPlayerUUID.toString() + ".yml"));
|
||||
Config config = fileManager.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"), targetPlayerUUID.toString() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
configLoad.set("Statistics.Island.Playtime", null);
|
||||
@ -182,7 +181,7 @@ public class KickCommand extends SubCommand {
|
||||
|
||||
if (targetPlayerData.isChat()) {
|
||||
targetPlayerData.setChat(false);
|
||||
messageManager.sendMessage(targetPlayer, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
messageManager.sendMessage(targetPlayer, fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||
.getString("Island.Chat.Untoggled.Message"));
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,17 @@ public class LeaderboardCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
if (args.length == 0) {
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Vote")) {
|
||||
if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().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"));
|
||||
|
@ -28,16 +28,16 @@ public class LeaveCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
||||
Config languageConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config languageConfig = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
|
||||
@ -83,7 +83,7 @@ public class LeaveCommand extends SubCommand {
|
||||
if (targetPlayerData.isChat()) {
|
||||
targetPlayerData.setChat(false);
|
||||
messageManager.sendMessage(targetPlayer,
|
||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Island.Chat.Untoggled.Message"));
|
||||
}
|
||||
}
|
||||
|
@ -30,15 +30,15 @@ public class LevelCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
VisitManager visitManager = skyblock.getVisitManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
IslandLevelManager levellingManager = plugin.getLevellingManager();
|
||||
CooldownManager cooldownManager = plugin.getCooldownManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
VisitManager visitManager = plugin.getVisitManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
|
@ -14,15 +14,15 @@ public class MembersCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
if (skyblock.getIslandManager().getIsland(player) == null) {
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
if (plugin.getIslandManager().getIsland(player) == null) {
|
||||
plugin.getMessageManager().sendMessage(player,
|
||||
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Command.Island.Settings.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
playerData.setType(Members.Type.Default);
|
||||
playerData.setSort(Members.Sort.Default);
|
||||
|
||||
|
@ -20,12 +20,12 @@ public class OpenCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
|
@ -37,15 +37,15 @@ public class OwnerCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
CooldownManager cooldownManager = plugin.getCooldownManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -126,7 +126,7 @@ public class OwnerCommand extends SubCommand {
|
||||
|
||||
return;
|
||||
} else {
|
||||
int confirmationTime = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
int confirmationTime = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
|
||||
|
||||
playerData.setOwnership(targetPlayerUUID);
|
||||
|
@ -19,40 +19,40 @@ public class PreviewCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FileManager.Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLang = config.getFileConfiguration();
|
||||
|
||||
if(args.length != 1) {
|
||||
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Argument.Count.Message"));
|
||||
plugin.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Argument.Count.Message"));
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerData data = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
Island island = skyblock.getIslandManager().getIsland(Bukkit.getOfflinePlayer(player.getUniqueId()));
|
||||
PlayerData data = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
Island island = plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(player.getUniqueId()));
|
||||
|
||||
if (args[0].equals("confirm")) {
|
||||
if(data.getConfirmation() == Confirmation.Preview && data.getConfirmationTime() > 0) {
|
||||
Structure islandStructure = skyblock.getStructureManager().getStructure(island.getStructure());
|
||||
Structure islandStructure = plugin.getStructureManager().getStructure(island.getStructure());
|
||||
|
||||
if(skyblock.getIslandManager().deleteIsland(island, true)) {
|
||||
if(plugin.getIslandManager().deleteIsland(island, true)) {
|
||||
island.setDeleted(true);
|
||||
data.setPreview(false);
|
||||
if(player.getGameMode() == GameMode.SPECTATOR) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(skyblock, () -> {
|
||||
if(skyblock.getIslandManager().createIsland(player, islandStructure)) {
|
||||
skyblock.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.Selector.Created.Message"));
|
||||
skyblock.getSoundManager().playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
if(plugin.getIslandManager().createIsland(player, islandStructure)) {
|
||||
plugin.getMessageManager().sendMessage(player, configLang.getString("Island.Creator.Selector.Created.Message"));
|
||||
plugin.getSoundManager().playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
}, 30L);
|
||||
}
|
||||
}
|
||||
} else if (args[0].equals("cancel")) {
|
||||
if(data.getConfirmation() == Confirmation.Preview && data.getConfirmationTime() > 0) {
|
||||
if(skyblock.getIslandManager().deleteIsland(island, true)) {
|
||||
if(plugin.getIslandManager().deleteIsland(island, true)) {
|
||||
island.setDeleted(true);
|
||||
data.setPreview(false);
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) {
|
||||
@ -63,15 +63,15 @@ public class PreviewCommand extends SubCommand {
|
||||
} else {
|
||||
// Do not preview if user has an island
|
||||
if (island != null) {
|
||||
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Island.Message"));
|
||||
plugin.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.Island.Message"));
|
||||
return;
|
||||
}
|
||||
Structure structure = skyblock.getStructureManager().getStructure(args[0]);
|
||||
Structure structure = plugin.getStructureManager().getStructure(args[0]);
|
||||
if(structure == null) {
|
||||
skyblock.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.File.Message"));
|
||||
plugin.getMessageManager().sendMessage(player, configLang.getString("Command.Island.Preview.File.Message"));
|
||||
return;
|
||||
}
|
||||
skyblock.getIslandManager().previewIsland(player, structure);
|
||||
plugin.getIslandManager().previewIsland(player, structure);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@ public class PromoteCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length != 1) {
|
||||
|
@ -19,11 +19,11 @@ public class PublicCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -33,7 +33,7 @@ public class PublicCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Visitor", IslandRole.Operator))) {
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Visitor", IslandRole.Operator))) {
|
||||
switch (island.getStatus()) {
|
||||
case OPEN:
|
||||
islandManager.whitelistIsland(island);
|
||||
|
@ -3,16 +3,11 @@ package com.songoda.skyblock.command.commands.island;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.command.SubCommand;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.permission.PermissionManager;
|
||||
import com.songoda.skyblock.playerdata.PlayerData;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import com.songoda.skyblock.scoreboard.ScoreboardManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,12 +18,12 @@ public class ScoreboardCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
@ -36,7 +31,7 @@ public class ScoreboardCommand extends SubCommand {
|
||||
if (playerData == null) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Scoreboard.Error.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if(!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
} else if(!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Scoreboard.Enable", false)) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Scoreboard.GlobalDisable.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
|
@ -8,7 +8,6 @@ import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.*;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -20,12 +19,12 @@ public class SetSpawnCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -51,14 +50,14 @@ public class SetSpawnCommand extends SubCommand {
|
||||
if (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& (skyblock.getPermissionManager().hasPermission(island,
|
||||
&& (plugin.getPermissionManager().hasPermission(island,
|
||||
environment.name() + "Spawn", IslandRole.Operator)))
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
if (islandManager.isPlayerAtIsland(island, player)) {
|
||||
IslandWorld world = skyblock.getWorldManager().getIslandWorld(player.getWorld());
|
||||
IslandWorld world = plugin.getWorldManager().getIslandWorld(player.getWorld());
|
||||
Location location = player.getLocation();
|
||||
|
||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
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());
|
||||
|
@ -20,12 +20,12 @@ public class SettingsCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
PermissionManager permissionManager = skyblock.getPermissionManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
PermissionManager permissionManager = plugin.getPermissionManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -39,7 +39,7 @@ public class SettingsCommand extends SubCommand {
|
||||
&& (permissionManager.hasPermission(island, "Visitor", IslandRole.Operator)
|
||||
|| permissionManager.hasPermission(island, "Member", IslandRole.Operator)))
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
skyblock.getGuiManager().showGUI(player, new GuiPermissionsSelector(skyblock, island, null));
|
||||
plugin.getGuiManager().showGUI(player, new GuiPermissionsSelector(plugin, island, null));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
} else{
|
||||
messageManager.sendMessage(player,
|
||||
|
@ -14,8 +14,6 @@ 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.block.data.Waterlogged;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,13 +25,13 @@ public class TeleportCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
VisitManager visitManager = skyblock.getVisitManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
VisitManager visitManager = plugin.getVisitManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -115,10 +113,10 @@ public class TeleportCommand extends SubCommand {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
Bukkit.getServer().getScheduler().runTask(plugin, () -> {
|
||||
Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main);
|
||||
PaperLib.getChunkAtAsync(loc).thenRun((() -> {
|
||||
LocationUtil.removeWaterFromLoc(skyblock, loc);
|
||||
LocationUtil.removeWaterFromLoc(plugin, loc);
|
||||
PaperLib.teleportAsync(player, loc);
|
||||
}));
|
||||
|
||||
|
@ -23,12 +23,12 @@ public class UnbanCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
@ -37,11 +37,11 @@ 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(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
} else if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getBoolean("Island.Visitor.Banning")) {
|
||||
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island,"Unban", IslandRole.Operator))) {
|
||||
&& plugin.getPermissionManager().hasPermission(island,"Unban", IslandRole.Operator))) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||
|
||||
UUID targetPlayerUUID = null;
|
||||
|
@ -22,12 +22,12 @@ public class UnlockCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length != 1) {
|
||||
@ -44,7 +44,7 @@ public class UnlockCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World." + type + ".Enable")) {
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().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;
|
||||
@ -65,7 +65,7 @@ public class UnlockCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
double price = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
double price = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getDouble("Island.World." + islandWorld.name() + ".UnlockPrice");
|
||||
|
||||
if (!EconomyManager.hasBalance(player, price)) {
|
||||
|
@ -17,14 +17,14 @@ public class UpgradeCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (skyblock.getIslandManager().getIsland(player) == null) {
|
||||
skyblock.getMessageManager().sendMessage(player,
|
||||
if (plugin.getIslandManager().getIsland(player) == null) {
|
||||
plugin.getMessageManager().sendMessage(player,
|
||||
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
|
@ -9,7 +9,6 @@ import com.songoda.skyblock.levelling.IslandLevelManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -22,12 +21,12 @@ public class ValueCommand extends SubCommand {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
IslandLevelManager levellingManager = plugin.getLevellingManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (player.getItemInHand() == null) {
|
||||
@ -38,7 +37,7 @@ public class ValueCommand extends SubCommand {
|
||||
|
||||
if (materials != null && levellingManager.hasWorth(materials)) {
|
||||
long worth = levellingManager.getWorth(materials);
|
||||
double level = (double) worth / (double) fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Levelling.Division");
|
||||
double level = (double) worth / (double) fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Levelling.Division");
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
|
||||
|
@ -16,24 +16,24 @@ public class VisitCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
if (args.length == 0) {
|
||||
if (!skyblock.getPlayerDataManager().hasPlayerData(player))
|
||||
skyblock.getPlayerDataManager().createPlayerData(player);
|
||||
if (!plugin.getPlayerDataManager().hasPlayerData(player))
|
||||
plugin.getPlayerDataManager().createPlayerData(player);
|
||||
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
playerData.setType(Visit.Type.Default);
|
||||
playerData.setSort(Visit.Sort.Default);
|
||||
|
||||
Visit.getInstance().open(player, (Visit.Type) playerData.getType(), (Visit.Sort) playerData.getSort());
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
} else if (args.length == 1) {
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island teleport " + args[0]));
|
||||
Bukkit.getServer().getScheduler().runTask(plugin, () -> Bukkit.getServer().dispatchCommand(player, "island teleport " + args[0]));
|
||||
} else {
|
||||
messageManager.sendMessage(player,
|
||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
||||
.getFileConfiguration().getString("Command.Island.Visit.Invalid.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
@ -18,11 +18,11 @@ public class VisitorsCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
|
@ -29,18 +29,18 @@ public class VoteCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
VisitManager visitManager = skyblock.getVisitManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
VisitManager visitManager = plugin.getVisitManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (args.length == 1) {
|
||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.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);
|
||||
|
@ -18,12 +18,12 @@ public class WeatherCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
FileConfiguration configLoad = skyblock.getFileManager()
|
||||
.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
FileConfiguration configLoad = plugin.getFileManager()
|
||||
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
|
||||
@ -31,7 +31,7 @@ public class WeatherCommand extends SubCommand {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Weather.Owner.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if ((island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Weather", IslandRole.Operator))
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Weather", IslandRole.Operator))
|
||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||
Weather.getInstance().open(player);
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
|
||||
|
@ -6,11 +6,9 @@ import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandRole;
|
||||
import com.songoda.skyblock.island.IslandStatus;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,15 +21,15 @@ public class WhitelistCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
|
||||
FileManager.Config language = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config language = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration languageLoad = language.getFileConfiguration();
|
||||
|
||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -41,7 +39,7 @@ public class WhitelistCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||
&& skyblock.getPermissionManager().hasPermission(island, "Visitor", IslandRole.Operator))) {
|
||||
&& plugin.getPermissionManager().hasPermission(island, "Visitor", IslandRole.Operator))) {
|
||||
if(args.length == 1) {
|
||||
if(args[0].equalsIgnoreCase("on")){
|
||||
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Whitelist.Enabled.Message"));
|
||||
|
@ -26,14 +26,14 @@ public class ResetCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommandByPlayer(Player player, String[] args) {
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
SoundManager soundManager = skyblock.getSoundManager();
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
MessageManager messageManager = plugin.getMessageManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
SoundManager soundManager = plugin.getSoundManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||
PlayerData playerData = plugin.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Island island = islandManager.getIsland(player);
|
||||
@ -47,7 +47,7 @@ public class ResetCommand extends SubCommand {
|
||||
configLoad.getString("Command.Island.Reset.Confirmation.Pending.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
int confirmationTime = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
int confirmationTime = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getInt("Island.Confirmation.Timeout");
|
||||
|
||||
playerData.setConfirmation(Confirmation.Reset);
|
||||
|
@ -1,5 +1,9 @@
|
||||
package com.songoda.skyblock.config;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.EnumMap;
|
||||
@ -7,29 +11,24 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
|
||||
public class FileChecker {
|
||||
|
||||
private final FileManager fileManager;
|
||||
|
||||
private Map<File.Type, File> loadedFiles;
|
||||
|
||||
public FileChecker(SkyBlock skyblock, FileManager fileManager, String configurationFileName, boolean applyComments) {
|
||||
public FileChecker(SkyBlock plugin, FileManager fileManager, String configurationFileName, boolean applyComments) {
|
||||
this.fileManager = fileManager;
|
||||
|
||||
loadedFiles = new EnumMap<>(File.Type.class);
|
||||
|
||||
java.io.File configFile = new java.io.File(skyblock.getDataFolder(), configurationFileName);
|
||||
java.io.File configFile = new java.io.File(plugin.getDataFolder(), configurationFileName);
|
||||
loadedFiles.put(File.Type.CREATED, new File(fileManager, configFile, YamlConfiguration.loadConfiguration(configFile)));
|
||||
|
||||
if (applyComments) {
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(new InputStreamReader(skyblock.getResource(configurationFileName)))))));
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(fileManager.getConfigContent(new InputStreamReader(plugin.getResource(configurationFileName)))))));
|
||||
} else {
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(skyblock.getResource(configurationFileName)))));
|
||||
loadedFiles.put(File.Type.RESOURCE, new File(null, null, YamlConfiguration.loadConfiguration(new InputStreamReader(plugin.getResource(configurationFileName)))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
package com.songoda.skyblock.config;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -20,33 +17,23 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
|
||||
public class FileManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
private Map<String, Config> loadedConfigs = new HashMap<>();
|
||||
|
||||
public FileManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public FileManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
loadConfigs();
|
||||
}
|
||||
|
||||
public void loadConfigs() {
|
||||
if (!skyblock.getDataFolder().exists()) {
|
||||
skyblock.getDataFolder().mkdir();
|
||||
if (!plugin.getDataFolder().exists()) {
|
||||
plugin.getDataFolder().mkdir();
|
||||
}
|
||||
|
||||
File structureDirectory = new File(skyblock.getDataFolder().toString() + "/structures");
|
||||
File structureDirectory = new File(plugin.getDataFolder().toString() + "/structures");
|
||||
|
||||
if (!structureDirectory.exists()) {
|
||||
structureDirectory.mkdir();
|
||||
@ -55,28 +42,28 @@ public class FileManager {
|
||||
// Will remain null unless WorldEdit is present.
|
||||
File schematicsDirectory = null;
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit") && !(schematicsDirectory = new File(skyblock.getDataFolder().toString() + "/schematics")).exists()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit") && !(schematicsDirectory = new File(plugin.getDataFolder().toString() + "/schematics")).exists()) {
|
||||
schematicsDirectory.mkdir();
|
||||
}
|
||||
|
||||
Map<String, File> configFiles = new LinkedHashMap<>();
|
||||
configFiles.put("limits.yml", new File(skyblock.getDataFolder(), "limits.yml"));
|
||||
configFiles.put("worlds.yml", new File(skyblock.getDataFolder(), "worlds.yml"));
|
||||
configFiles.put("levelling.yml", new File(skyblock.getDataFolder(), "levelling.yml"));
|
||||
configFiles.put("config.yml", new File(skyblock.getDataFolder(), "config.yml"));
|
||||
configFiles.put("language.yml", new File(skyblock.getDataFolder(), "language.yml"));
|
||||
configFiles.put("settings.yml", new File(skyblock.getDataFolder(), "settings.yml"));
|
||||
configFiles.put("upgrades.yml", new File(skyblock.getDataFolder(), "upgrades.yml"));
|
||||
configFiles.put("biomes.yml", new File(skyblock.getDataFolder(), "biomes.yml"));
|
||||
configFiles.put("limits.yml", new File(plugin.getDataFolder(), "limits.yml"));
|
||||
configFiles.put("worlds.yml", new File(plugin.getDataFolder(), "worlds.yml"));
|
||||
configFiles.put("levelling.yml", new File(plugin.getDataFolder(), "levelling.yml"));
|
||||
configFiles.put("config.yml", new File(plugin.getDataFolder(), "config.yml"));
|
||||
configFiles.put("language.yml", new File(plugin.getDataFolder(), "language.yml"));
|
||||
configFiles.put("settings.yml", new File(plugin.getDataFolder(), "settings.yml"));
|
||||
configFiles.put("upgrades.yml", new File(plugin.getDataFolder(), "upgrades.yml"));
|
||||
configFiles.put("biomes.yml", new File(plugin.getDataFolder(), "biomes.yml"));
|
||||
// configFiles.put("menus.yml", new File(skyblock.getDataFolder(), "menus.yml"));
|
||||
configFiles.put("generators.yml", new File(skyblock.getDataFolder(), "generators.yml"));
|
||||
configFiles.put("stackables.yml", new File(skyblock.getDataFolder(), "stackables.yml"));
|
||||
configFiles.put("structures.yml", new File(skyblock.getDataFolder(), "structures.yml"));
|
||||
configFiles.put("rewards.yml", new File(skyblock.getDataFolder(), "rewards.yml"));
|
||||
configFiles.put("structures/default.structure", new File(skyblock.getDataFolder().toString() + "/structures", "default.structure"));
|
||||
configFiles.put("challenges.yml", new File(skyblock.getDataFolder(), "challenges.yml"));
|
||||
configFiles.put("generators.yml", new File(plugin.getDataFolder(), "generators.yml"));
|
||||
configFiles.put("stackables.yml", new File(plugin.getDataFolder(), "stackables.yml"));
|
||||
configFiles.put("structures.yml", new File(plugin.getDataFolder(), "structures.yml"));
|
||||
configFiles.put("rewards.yml", new File(plugin.getDataFolder(), "rewards.yml"));
|
||||
configFiles.put("structures/default.structure", new File(plugin.getDataFolder().toString() + "/structures", "default.structure"));
|
||||
configFiles.put("challenges.yml", new File(plugin.getDataFolder(), "challenges.yml"));
|
||||
|
||||
File oldStructureFile = new File(skyblock.getDataFolder().toString() + "/structures", "default.structure");
|
||||
File oldStructureFile = new File(plugin.getDataFolder().toString() + "/structures", "default.structure");
|
||||
oldStructureFile.delete();
|
||||
|
||||
for (Entry<String, File> configEntry : configFiles.entrySet()) {
|
||||
@ -91,7 +78,7 @@ public class FileManager {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try (InputStream is = skyblock.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
try (InputStream is = plugin.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
if(is != null){
|
||||
ByteStreams.copy(is, os);
|
||||
}
|
||||
@ -106,9 +93,9 @@ public class FileManager {
|
||||
FileChecker fileChecker;
|
||||
|
||||
if (fileName.equals("config.yml") || fileName.equals("biomes.yml")) {
|
||||
fileChecker = new FileChecker(skyblock, this, fileName, true);
|
||||
fileChecker = new FileChecker(plugin, this, fileName, true);
|
||||
} else {
|
||||
fileChecker = new FileChecker(skyblock, this, fileName, false);
|
||||
fileChecker = new FileChecker(plugin, this, fileName, false);
|
||||
}
|
||||
|
||||
fileChecker.loadSections();
|
||||
@ -118,7 +105,7 @@ public class FileManager {
|
||||
} else {
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
try (InputStream is = skyblock.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
try (InputStream is = plugin.getResource(fileName); OutputStream os = new FileOutputStream(configFile)) {
|
||||
if(is != null){
|
||||
ByteStreams.copy(is, os);
|
||||
}
|
||||
@ -233,7 +220,7 @@ public class FileManager {
|
||||
|
||||
public InputStream getConfigContent(Reader reader) {
|
||||
try {
|
||||
String addLine, currentLine, pluginName = skyblock.getDescription().getName();
|
||||
String addLine, currentLine, pluginName = plugin.getDescription().getName();
|
||||
int commentNum = 0;
|
||||
|
||||
StringBuilder whole = new StringBuilder();
|
||||
@ -280,8 +267,8 @@ public class FileManager {
|
||||
StringBuilder config = new StringBuilder();
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.contains(skyblock.getDescription().getName() + "_COMMENT")) {
|
||||
config.append(line.replace("IMPORTANT", "[!]").replace("\n", "").replace(skyblock.getDescription().getName() + "_COMMENT_", "#").replaceAll("[0-9]+:", "") + "\n");
|
||||
if (line.contains(plugin.getDescription().getName() + "_COMMENT")) {
|
||||
config.append(line.replace("IMPORTANT", "[!]").replace("\n", "").replace(plugin.getDescription().getName() + "_COMMENT_", "#").replaceAll("[0-9]+:", "") + "\n");
|
||||
} else if (line.contains(":")) {
|
||||
config.append(line + "\n");
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.songoda.skyblock.confirmation;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.songoda.skyblock.playerdata.PlayerData;
|
||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ConfirmationTask extends BukkitRunnable {
|
||||
|
||||
|
@ -12,23 +12,18 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class CooldownManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
|
||||
private Map<CooldownType, List<CooldownPlayer>> cooldownStorage = new EnumMap<>(CooldownType.class);
|
||||
|
||||
public CooldownManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public CooldownManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
|
||||
for (CooldownType cooldownTypeList : CooldownType.getTypes()) {
|
||||
List<CooldownPlayer> cooldownPlayers = new ArrayList<>();
|
||||
@ -58,7 +53,7 @@ public class CooldownManager {
|
||||
cooldownStorage.put(cooldownTypeList, cooldownPlayers);
|
||||
}
|
||||
|
||||
new CooldownTask(this).runTaskTimerAsynchronously(skyblock, 0L, 20L);
|
||||
new CooldownTask(this).runTaskTimerAsynchronously(plugin, 0L, 20L);
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
@ -70,16 +65,16 @@ public class CooldownManager {
|
||||
|
||||
public CooldownPlayer loadCooldownPlayer(CooldownType cooldownType, OfflinePlayer player) {
|
||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
||||
Config config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
Config config = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getString("Island." + cooldownType.name() + ".Cooldown") != null) {
|
||||
return new CooldownPlayer(player.getUniqueId(), new Cooldown(configLoad.getInt("Island." + cooldownType.name() + ".Cooldown")));
|
||||
}
|
||||
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
|
||||
Config config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
Config config = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getString(cooldownType.name() + ".Cooldown") != null) {
|
||||
@ -91,7 +86,7 @@ public class CooldownManager {
|
||||
}
|
||||
|
||||
public void createPlayer(CooldownType cooldownType, OfflinePlayer player) {
|
||||
FileManager fileManager = skyblock.getFileManager();
|
||||
FileManager fileManager = plugin.getFileManager();
|
||||
|
||||
List<CooldownPlayer> cooldowns = cooldownStorage.get(cooldownType);
|
||||
|
||||
@ -100,11 +95,11 @@ public class CooldownManager {
|
||||
int time = 0;
|
||||
|
||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
||||
time = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
time = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
|
||||
|
||||
Config config = fileManager
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
File configFile = config.getFile();
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
@ -116,11 +111,11 @@ public class CooldownManager {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
|
||||
time = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
time = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||
.getInt("Island." + cooldownType.name() + ".Cooldown.Time");
|
||||
|
||||
Config config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
Config config = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
File configFile = config.getFile();
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
@ -140,13 +135,13 @@ public class CooldownManager {
|
||||
for (Iterator<CooldownPlayer> it = getCooldownPlayersOrEmptyList(cooldownType).iterator(); it.hasNext();) {
|
||||
if (it.next().getUUID().equals(player.getUniqueId())) {
|
||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
||||
skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
|
||||
plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"),
|
||||
player.getUniqueId().toString() + ".yml"))
|
||||
.getFileConfiguration().set("Island." + cooldownType.name() + ".Cooldown", null);
|
||||
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
|
||||
skyblock.getFileManager().getConfig(
|
||||
new File(new File(skyblock.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"))
|
||||
plugin.getFileManager().getConfig(
|
||||
new File(new File(plugin.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"))
|
||||
.getFileConfiguration().set(cooldownType.name() + ".Cooldown", null);
|
||||
}
|
||||
it.remove();
|
||||
@ -198,13 +193,13 @@ public class CooldownManager {
|
||||
for (CooldownPlayer cooldownPlayerList : getCooldownPlayersOrEmptyList(cooldownType)) {
|
||||
if (cooldownPlayerList.getUUID().equals(player.getUniqueId())) {
|
||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
||||
skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
|
||||
plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"),
|
||||
player.getUniqueId().toString() + ".yml"))
|
||||
.getFileConfiguration().set("Island." + cooldownType + ".Cooldown", cooldownPlayerList.getCooldown().getTime());
|
||||
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
|
||||
skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
|
||||
plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"),
|
||||
player.getUniqueId().toString() + ".yml"))
|
||||
.getFileConfiguration().set(cooldownType.name() + ".Cooldown", cooldownPlayerList.getCooldown().getTime());
|
||||
}
|
||||
@ -223,11 +218,11 @@ public class CooldownManager {
|
||||
Config config = null;
|
||||
|
||||
if (cooldownType == CooldownType.Biome || cooldownType == CooldownType.Creation || cooldownType == CooldownType.Deletion) {
|
||||
config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
config = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
} else if (cooldownType == CooldownType.Levelling || cooldownType == CooldownType.Ownership) {
|
||||
config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
config = plugin.getFileManager()
|
||||
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), player.getUniqueId().toString() + ".yml"));
|
||||
}
|
||||
|
||||
if (config != null) {
|
||||
|
@ -3,7 +3,6 @@ package com.songoda.skyblock.generator;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Generator {
|
||||
|
@ -4,7 +4,6 @@ import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||
import org.bukkit.block.Block;
|
||||
@ -22,16 +21,16 @@ import java.util.Random;
|
||||
|
||||
public class GeneratorManager {
|
||||
|
||||
private final SkyBlock skyblock;
|
||||
private final SkyBlock plugin;
|
||||
private List<Generator> generatorStorage = new ArrayList<>();
|
||||
|
||||
public GeneratorManager(SkyBlock skyblock) {
|
||||
this.skyblock = skyblock;
|
||||
public GeneratorManager(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
registerGenerators();
|
||||
}
|
||||
|
||||
public void registerGenerators() {
|
||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "generators.yml"));
|
||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "generators.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getString("Generators") == null)
|
||||
@ -123,7 +122,7 @@ public class GeneratorManager {
|
||||
CompatibleMaterial materials = getRandomMaterials(generator);
|
||||
if (materials == null) return block.getState();
|
||||
|
||||
skyblock.getSoundManager().playSound(block.getLocation(), CompatibleSound.BLOCK_FIRE_EXTINGUISH.getSound(), 1.0F, 10.0F);
|
||||
plugin.getSoundManager().playSound(block.getLocation(), CompatibleSound.BLOCK_FIRE_EXTINGUISH.getSound(), 1.0F, 10.0F);
|
||||
|
||||
|
||||
if (NMSUtil.getVersionNumber() > 12) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user