# Added the option 'Island.KeepInventoryOnDeath.Enable' to prevent players losing items on death when the 'KeepItemsOnDeath' setting is disabled in the configuration file.
# Added the option 'Island.Damage.Enable' to enable/disable damage when the 'Damage' setting is disabled in the configuration file.
# Added the option 'Island.PvP.Enable' to enable/disable pvp when the 'PvP' setting is disabled in the configuration file.
# Added support for LeaderHeads for the level and votes leaderboard.
# Added the method 'SkyBlockAPI.getIslandAtLocation(org.bukkit.Location)' to the API.
# Fixed the island location being set to the wrong path when setting the island location through the API.
# Fixed placeholders for messages in menus not working when adding the character '#' after it.
# Fixed the 'Loot Drops' upgrade not working correctly when having a drop multiplier plugin.
# Fixed NPE when teleporting to another island straight after deleting yours.
# Fixed being able to delete an island the main spawn point is set at.
# Fixed NPE when saving a structure with jukeboxes that don't have a record playing.
# Fixed NPE when saving a structure with spawners that don't have a spawner type.
# Changed the nextAvailableLocation being set in the 'config.yml' file. The nextAvailableLocation's are now set in the 'worlds.yml' file.
# Changed a few comments in the configuration file for the path 'Island.Settings'.
This commit is contained in:
SystemEncryption 2018-12-18 18:27:03 +00:00
parent 7c2f6b998d
commit ed6d514cc8
45 changed files with 1236 additions and 985 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>SkyBlock</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>53</version>
<version>54</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
@ -44,6 +44,11 @@
<artifactId>coins</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>me.robin</groupId>
<artifactId>leaderheads</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>

View File

@ -269,6 +269,21 @@ public class SkyBlockAPI {
return null;
}
/**
* @return The Island at a location
*/
public static Island getIslandAtLocation(Location location) {
Preconditions.checkArgument(location != null, "Cannot get island to null location");
me.goodandevil.skyblock.island.Island island = implementation.getIslandManager().getIslandAtLocation(location);
if (island != null) {
return island.getAPIWrapper();
}
return null;
}
/**
* @return true of conditions met, false otherwise
*/

View File

@ -5,6 +5,7 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -25,6 +26,7 @@ import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil;
public class ConfirmCommand extends SubCommand {
@ -114,6 +116,17 @@ public class ConfirmCommand extends SubCommand {
configLoad.getString("Command.Island.Confirmation.Deletion.Open.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
Location spawnLocation = LocationUtil.getSpawnLocation();
if (spawnLocation != null
&& islandManager.isLocationAtIsland(island, spawnLocation)) {
messageManager.sendMessage(player, configLoad
.getString("Command.Island.Confirmation.Deletion.Spawn.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
playerData.setConfirmation(null);
playerData.setConfirmationTime(0);

View File

@ -15,12 +15,14 @@ import java.io.OutputStream;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.logging.Level;
import com.google.common.io.ByteStreams;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.island.IslandWorld;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -47,7 +49,8 @@ public class FileManager {
new File(skyblock.getDataFolder().toString() + "/structures").mkdir();
}
Map<String, File> configFiles = new HashMap<>();
Map<String, File> configFiles = new LinkedHashMap<>();
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"));
@ -83,6 +86,34 @@ public class FileManager {
OutputStream os = new FileOutputStream(configFile)) {
ByteStreams.copy(is, os);
}
if (configFileList.equals("worlds.yml")) {
File mainConfigFile = new File(skyblock.getDataFolder(), "config.yml");
if (isFileExist(mainConfigFile)) {
Config config = new Config(this, configFile);
Config mainConfig = new Config(this, mainConfigFile);
FileConfiguration configLoad = config.getFileConfiguration();
FileConfiguration mainConfigLoad = mainConfig.getFileConfiguration();
for (IslandWorld worldList : IslandWorld.values()) {
if (mainConfigLoad.getString("World." + worldList.name()) != null) {
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.x",
mainConfigLoad.getDouble(
"World." + worldList.name() + ".nextAvailableLocation.x"));
configLoad.set("World." + worldList.name() + ".nextAvailableLocation.z",
mainConfigLoad.getDouble(
"World." + worldList.name() + ".nextAvailableLocation.z"));
}
}
mainConfigLoad.set("World", null);
configLoad.save(config.getFile());
saveConfig(mainConfigLoad.saveToString(), mainConfig.getFile());
}
}
} catch (IOException ex) {
Bukkit.getServer().getLogger().log(Level.WARNING,
"SkyBlock | Error: Unable to create configuration file.");

View File

@ -292,10 +292,20 @@ public class Island {
location)));
FileManager fileManager = skyblock.getFileManager();
fileManager.setLocation(
fileManager.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
getOwnerUUID().toString() + ".yml")),
"Location." + world.name() + ".Spawn." + environment.name(), location, true);
if (environment == IslandEnvironment.Island) {
fileManager.setLocation(
fileManager
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
getOwnerUUID().toString() + ".yml")),
"Location." + world.name() + "." + environment.name(), location, true);
} else {
fileManager.setLocation(
fileManager
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
getOwnerUUID().toString() + ".yml")),
"Location." + world.name() + ".Spawn." + environment.name(), location, true);
}
islandLocationList.setLocation(location);

View File

@ -68,7 +68,7 @@ public class IslandManager {
public IslandManager(SkyBlock skyblock) {
this.skyblock = skyblock;
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "worlds.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
for (IslandWorld worldList : IslandWorld.values()) {
@ -93,7 +93,7 @@ public class IslandManager {
public void saveNextAvailableLocation(IslandWorld world) {
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "worlds.yml"));
File configFile = config.getFile();
FileConfiguration configLoad = config.getFileConfiguration();
@ -107,7 +107,11 @@ public class IslandManager {
}
}
fileManager.saveConfig(configLoad.saveToString(), configFile);
try {
configLoad.save(configFile);
} catch (IOException e) {
e.printStackTrace();
}
}
public void setNextAvailableLocation(IslandWorld world, org.bukkit.Location location) {
@ -633,75 +637,14 @@ public class IslandManager {
}
public void prepareIsland(Island island, IslandWorld world) {
StructureManager structureManager = skyblock.getStructureManager();
WorldManager worldManager = skyblock.getWorldManager();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(
new File(skyblock.getDataFolder().toString() + "/island-data", island.getOwnerUUID() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getString("Location." + world.name()) == null) {
Structure structure;
if (island.getStructure() != null && !island.getStructure().isEmpty()
&& structureManager.containsStructure(island.getStructure())) {
structure = structureManager.getStructure(island.getStructure());
} else {
structure = structureManager.getStructures().get(0);
}
org.bukkit.Location islandLocation = prepareNextAvailableLocation(world);
for (IslandEnvironment environmentList : IslandEnvironment.values()) {
if (environmentList == IslandEnvironment.Island) {
island.addLocation(world, environmentList, islandLocation);
fileManager.setLocation(config, "Location." + world.name() + "." + environmentList.name(),
islandLocation, true);
} else {
island.addLocation(world, environmentList, islandLocation.clone().add(0.5D, 0.0D, 0.5D));
fileManager.setLocation(config, "Location." + world.name() + ".Spawn." + environmentList.name(),
islandLocation.clone().add(0.5D, 0.0D, 0.5D), true);
}
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Spawn.Protection")) {
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
@Override
public void run() {
islandLocation.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().setType(Material.STONE);
}
});
}
try {
File structureFile = null;
if (world == IslandWorld.Normal) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getOverworldFile());
} else if (world == IslandWorld.Nether) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getNetherFile());
} else if (world == IslandWorld.End) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getEndFile());
}
Float[] direction = StructureUtil.pasteStructure(StructureUtil.loadStructure(structureFile),
island.getLocation(world, IslandEnvironment.Island), BlockDegreesType.ROTATE_360);
org.bukkit.Location spawnLocation = island.getLocation(world, IslandEnvironment.Main).clone();
spawnLocation.setYaw(direction[0]);
spawnLocation.setPitch(direction[1]);
island.setLocation(world, IslandEnvironment.Main, spawnLocation);
island.setLocation(world, IslandEnvironment.Visitor, spawnLocation);
} catch (Exception e) {
e.printStackTrace();
}
setNextAvailableLocation(world, islandLocation);
saveNextAvailableLocation(world);
if (config.getFileConfiguration().getString("Location." + world.name()) == null) {
pasteStructure(island, world);
} else {
for (IslandEnvironment environmentList : IslandEnvironment.values()) {
org.bukkit.Location location;
@ -726,6 +669,81 @@ public class IslandManager {
}
}
public void resetIsland(Island island) {
for (IslandWorld worldList : IslandWorld.values()) {
pasteStructure(island, worldList);
}
}
public void pasteStructure(Island island, IslandWorld world) {
StructureManager structureManager = skyblock.getStructureManager();
FileManager fileManager = skyblock.getFileManager();
Structure structure;
if (island.getStructure() != null && !island.getStructure().isEmpty()
&& structureManager.containsStructure(island.getStructure())) {
structure = structureManager.getStructure(island.getStructure());
} else {
structure = structureManager.getStructures().get(0);
}
org.bukkit.Location islandLocation = prepareNextAvailableLocation(world);
Config config = fileManager.getConfig(
new File(skyblock.getDataFolder().toString() + "/island-data", island.getOwnerUUID() + ".yml"));
for (IslandEnvironment environmentList : IslandEnvironment.values()) {
if (environmentList == IslandEnvironment.Island) {
island.addLocation(world, environmentList, islandLocation);
fileManager.setLocation(config, "Location." + world.name() + "." + environmentList.name(),
islandLocation, true);
} else {
island.addLocation(world, environmentList, islandLocation.clone().add(0.5D, 0.0D, 0.5D));
fileManager.setLocation(config, "Location." + world.name() + ".Spawn." + environmentList.name(),
islandLocation.clone().add(0.5D, 0.0D, 0.5D), true);
}
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Spawn.Protection")) {
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
@Override
public void run() {
islandLocation.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().setType(Material.STONE);
}
});
}
try {
File structureFile = null;
if (world == IslandWorld.Normal) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getOverworldFile());
} else if (world == IslandWorld.Nether) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getNetherFile());
} else if (world == IslandWorld.End) {
structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"),
structure.getEndFile());
}
Float[] direction = StructureUtil.pasteStructure(StructureUtil.loadStructure(structureFile),
island.getLocation(world, IslandEnvironment.Island), BlockDegreesType.ROTATE_360);
org.bukkit.Location spawnLocation = island.getLocation(world, IslandEnvironment.Main).clone();
spawnLocation.setYaw(direction[0]);
spawnLocation.setPitch(direction[1]);
island.setLocation(world, IslandEnvironment.Main, spawnLocation);
island.setLocation(world, IslandEnvironment.Visitor, spawnLocation);
} catch (Exception e) {
e.printStackTrace();
}
setNextAvailableLocation(world, islandLocation);
saveNextAvailableLocation(world);
}
public Set<UUID> getVisitorsAtIsland(Island island) {
Map<UUID, PlayerData> playerDataStorage = skyblock.getPlayerDataManager().getPlayerData();
Set<UUID> islandVisitors = new HashSet<>();
@ -917,22 +935,18 @@ public class IslandManager {
}
}
for (UUID islandList : getIslands().keySet()) {
Island island = getIslands().get(islandList);
Island island = getIslandAtLocation(location);
if (isLocationAtIsland(island, location)) {
if (player.hasPermission("skyblock.bypass." + setting.toLowerCase())
|| player.hasPermission("skyblock.bypass.*") || player.hasPermission("skyblock.*")) {
return true;
} else if (island.isCoopPlayer(player.getUniqueId())) {
if (!island.getSetting(IslandRole.Coop, setting).getStatus()) {
return false;
}
} else if (!island.getSetting(IslandRole.Visitor, setting).getStatus()) {
if (island != null) {
if (player.hasPermission("skyblock.bypass." + setting.toLowerCase())
|| player.hasPermission("skyblock.bypass.*") || player.hasPermission("skyblock.*")) {
return true;
} else if (island.isCoopPlayer(player.getUniqueId())) {
if (!island.getSetting(IslandRole.Coop, setting).getStatus()) {
return false;
}
return true;
} else if (!island.getSetting(IslandRole.Visitor, setting).getStatus()) {
return false;
}
}
@ -940,15 +954,11 @@ public class IslandManager {
}
public boolean hasSetting(org.bukkit.Location location, IslandRole role, String setting) {
for (UUID islandList : getIslands().keySet()) {
Island island = getIslands().get(islandList);
Island island = getIslandAtLocation(location);
if (isLocationAtIsland(island, location)) {
if (island.getSetting(role, setting).getStatus()) {
return true;
}
return false;
if (island != null) {
if (island.getSetting(role, setting).getStatus()) {
return true;
}
}
@ -1016,34 +1026,31 @@ public class IslandManager {
@Override
public void run() {
if (worldManager.isIslandWorld(player.getWorld())) {
for (UUID islandList : getIslands().keySet()) {
Island island = getIslands().get(islandList);
Island island = getIslandAtLocation(player.getLocation());
if (isPlayerAtIsland(island, player)) {
Config config = skyblock.getFileManager()
.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (island != null) {
Config config = skyblock.getFileManager()
.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
configLoad.getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
if (configLoad.getBoolean("Island.WorldBorder.Enable") && island.isBorder()) {
WorldBorder.send(player, island.getBorderColor(), island.getSize() + 2.5,
island.getLocation(worldManager.getIslandWorld(player.getWorld()),
IslandEnvironment.Island));
} else {
WorldBorder.send(player, null, 1.4999992E7D,
new org.bukkit.Location(player.getWorld(), 0, 0, 0));
}
giveUpgrades(player, island);
giveFly(player, island);
return;
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(), configLoad.getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
if (configLoad.getBoolean("Island.WorldBorder.Enable") && island.isBorder()) {
WorldBorder.send(player, island.getBorderColor(), island.getSize() + 2.5,
island.getLocation(worldManager.getIslandWorld(player.getWorld()),
IslandEnvironment.Island));
} else {
WorldBorder.send(player, null, 1.4999992E7D,
new org.bukkit.Location(player.getWorld(), 0, 0, 0));
}
giveUpgrades(player, island);
giveFly(player, island);
return;
}
}
}
@ -1242,6 +1249,18 @@ public class IslandManager {
}
}
public Island getIslandAtLocation(org.bukkit.Location location) {
for (UUID islandList : getIslands().keySet()) {
Island island = getIslands().get(islandList);
if (isLocationAtIsland(island, location)) {
return island;
}
}
return null;
}
public boolean isPlayerAtIsland(Island island, Player player) {
return isLocationAtIsland(island, player.getLocation());
}

View File

@ -6,7 +6,11 @@ import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.leaderboard.leaderheads.TopLevel;
import me.goodandevil.skyblock.leaderboard.leaderheads.TopVotes;
import me.goodandevil.skyblock.visit.Visit;
import me.goodandevil.skyblock.visit.VisitManager;
@ -24,6 +28,7 @@ public class LeaderboardManager {
.getFileConfiguration().getInt("Island.Leaderboard.Reset.Time") * 20);
resetLeaderboard();
setupLeaderHeads();
}
public void resetLeaderboard() {
@ -66,6 +71,13 @@ public class LeaderboardManager {
}
}
public void setupLeaderHeads() {
if (Bukkit.getServer().getPluginManager().getPlugin("LeaderHeads") != null) {
new TopLevel(skyblock);
new TopVotes(skyblock);
}
}
public void clearLeaderboard() {
leaderboardStorage.clear();
}

View File

@ -17,6 +17,7 @@ public class LeaderboardTask extends BukkitRunnable {
LeaderboardManager leaderboardManager = skyblock.getLeaderboardManager();
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
leaderboardManager.setupLeaderHeads();
skyblock.getHologramManager().resetHologram();
}

View File

@ -0,0 +1,48 @@
package me.goodandevil.skyblock.leaderboard.leaderheads;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import java.util.UUID;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.leaderboard.Leaderboard;
import me.goodandevil.skyblock.leaderboard.Leaderboard.Type;
import me.goodandevil.skyblock.visit.Visit;
import me.robin.leaderheads.api.LeaderHeadsAPI;
import me.robin.leaderheads.datacollectors.DataCollector;
import me.robin.leaderheads.objects.BoardType;
public class TopLevel extends DataCollector {
private final SkyBlock skyblock;
public TopLevel(SkyBlock skyblock) {
super("toplevels", "SkyBlock", BoardType.DEFAULT, "&bTop Level", "toplevel",
Arrays.asList(ChatColor.DARK_GRAY + "-=+=-", ChatColor.AQUA + "{name}",
ChatColor.WHITE + "{amount} Level", ChatColor.DARK_GRAY + "-=+=-"),
true, UUID.class);
this.skyblock = skyblock;
}
@Override
public List<Entry<?, Double>> requestAll() {
Map<UUID, Double> topLevels = new HashMap<>();
List<Leaderboard> leaderboards = skyblock.getLeaderboardManager().getLeaderboard(Type.Level);
for (int i = 0; i < leaderboards.size(); i++) {
Leaderboard leaderboard = leaderboards.get(i);
Visit visit = leaderboard.getVisit();
topLevels.put(visit.getOwnerUUID(), (double) visit.getLevel().getLevel());
}
return LeaderHeadsAPI.sortMap(topLevels);
}
}

View File

@ -0,0 +1,47 @@
package me.goodandevil.skyblock.leaderboard.leaderheads;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.Map.Entry;
import org.bukkit.ChatColor;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.leaderboard.Leaderboard;
import me.goodandevil.skyblock.leaderboard.Leaderboard.Type;
import me.goodandevil.skyblock.visit.Visit;
import me.robin.leaderheads.api.LeaderHeadsAPI;
import me.robin.leaderheads.datacollectors.DataCollector;
import me.robin.leaderheads.objects.BoardType;
public class TopVotes extends DataCollector {
private final SkyBlock skyblock;
public TopVotes(SkyBlock skyblock) {
super("topvotes", "SkyBlock", BoardType.DEFAULT, "&bTop Votes", "topvotes",
Arrays.asList(ChatColor.DARK_GRAY + "-=+=-", ChatColor.AQUA + "{name}",
ChatColor.WHITE + "{amount} Votes", ChatColor.DARK_GRAY + "-=+=-"),
true, UUID.class);
this.skyblock = skyblock;
}
@Override
public List<Entry<?, Double>> requestAll() {
Map<UUID, Double> topLevels = new HashMap<>();
List<Leaderboard> leaderboards = skyblock.getLeaderboardManager().getLeaderboard(Type.Votes);
for (int i = 0; i < leaderboards.size(); i++) {
Leaderboard leaderboard = leaderboards.get(i);
Visit visit = leaderboard.getVisit();
topLevels.put(visit.getOwnerUUID(), (double) visit.getVoters().size());
}
return LeaderHeadsAPI.sortMap(topLevels);
}
}

View File

@ -3,7 +3,6 @@ package me.goodandevil.skyblock.listeners;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -62,51 +61,44 @@ public class Block implements Listener {
if (worldManager.isIslandWorld(block.getWorld())) {
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
Island island = islandManager.getIslandAtLocation(block.getLocation());
if (islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
if (generatorManager != null) {
if (generatorManager.isGenerator(block)) {
if (playerDataManager.hasPlayerData(player)) {
org.bukkit.block.Block liquid = null;
if (islandManager.isLocationAtIsland(island, block.getLocation(), world)) {
if (generatorManager != null) {
if (generatorManager.isGenerator(block)) {
if (playerDataManager.hasPlayerData(player)) {
org.bukkit.block.Block liquid = null;
if (NMSUtil.getVersionNumber() < 13) {
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST,
BlockFace.SOUTH, BlockFace.WEST };
if (NMSUtil.getVersionNumber() < 13) {
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST,
BlockFace.SOUTH, BlockFace.WEST };
for (BlockFace blockFaceList : blockFaces) {
if (event.getBlock().getRelative(blockFaceList)
.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial()
|| event.getBlock().getRelative(blockFaceList)
.getType() == Materials.LAVA.parseMaterial()) {
liquid = event.getBlock().getRelative(blockFaceList);
break;
}
}
for (BlockFace blockFaceList : blockFaces) {
if (event.getBlock().getRelative(blockFaceList)
.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial()
|| event.getBlock().getRelative(blockFaceList).getType() == Materials.LAVA
.parseMaterial()) {
liquid = event.getBlock().getRelative(blockFaceList);
break;
}
playerDataManager.getPlayerData(player)
.setGenerator(new GeneratorLocation(world, block, liquid));
}
}
}
if (LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
}
playerDataManager.getPlayerData(player)
.setGenerator(new GeneratorLocation(world, block, liquid));
}
return;
}
}
event.setCancelled(true);
if (LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
}
}
return;
} else {
event.setCancelled(true);
@ -128,51 +120,38 @@ public class Block implements Listener {
if (worldManager.isIslandWorld(block.getWorld())) {
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
Island island = islandManager.getIslandAtLocation(block.getLocation());
if (islandManager.hasPermission(player, "Place")) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
if (islandManager.hasPermission(player, block.getLocation(), "Place")) {
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (islandManager.isLocationAtIsland(island, block.getLocation())) {
Config config = skyblock.getFileManager()
.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.WorldBorder.Block")) {
if (block.getType() == Materials.PISTON.parseMaterial()
|| block.getType() == Materials.STICKY_PISTON.parseMaterial()) {
if (!LocationUtil.isLocationAtLocationRadius(block.getLocation(),
island.getLocation(world, IslandEnvironment.Island),
island.getRadius() - 12.0D)) {
event.setCancelled(true);
}
} else if (block.getType() == Material.DISPENSER) {
if (!LocationUtil.isLocationAtLocationRadius(block.getLocation(),
island.getLocation(world, IslandEnvironment.Island),
island.getRadius() - 2.0D)) {
event.setCancelled(true);
}
}
if (configLoad.getBoolean("Island.WorldBorder.Block")) {
if (block.getType() == Materials.PISTON.parseMaterial()
|| block.getType() == Materials.STICKY_PISTON.parseMaterial()) {
if (!LocationUtil.isLocationAtLocationRadius(block.getLocation(),
island.getLocation(world, IslandEnvironment.Island), island.getRadius() - 12.0D)) {
event.setCancelled(true);
}
if (LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().add(0.0D, 1.0D, 0.0D))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D,
0.0D))) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
}
} else if (block.getType() == Material.DISPENSER) {
if (!LocationUtil.isLocationAtLocationRadius(block.getLocation(),
island.getLocation(world, IslandEnvironment.Island), island.getRadius() - 2.0D)) {
event.setCancelled(true);
}
return;
}
}
event.setCancelled(true);
if (LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().add(0.0D, 1.0D, 0.0D))
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
}
}
} else {
event.setCancelled(true);
@ -338,45 +317,43 @@ public class Block implements Listener {
IslandManager islandManager = skyblock.getIslandManager();
if (skyblock.getWorldManager().isIslandWorld(block.getWorld())) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
Island island = islandManager.getIslandAtLocation(block.getLocation());
if (islandManager.isLocationAtIsland(island, block.getLocation())) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Crop);
if (island != null) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Crop);
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Crop)) {
if (NMSUtil.getVersionNumber() > 12) {
try {
Object blockData = block.getClass().getMethod("getBlockData").invoke(block);
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Crop)) {
if (NMSUtil.getVersionNumber() > 12) {
try {
Object blockData = block.getClass().getMethod("getBlockData").invoke(block);
if (blockData instanceof org.bukkit.block.data.Ageable) {
org.bukkit.block.data.Ageable ageable = (org.bukkit.block.data.Ageable) blockData;
ageable.setAge(ageable.getAge() + 1);
block.getClass()
.getMethod("setBlockData", Class.forName("org.bukkit.block.data.BlockData"))
.invoke(block, ageable);
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException | ClassNotFoundException e) {
e.printStackTrace();
if (blockData instanceof org.bukkit.block.data.Ageable) {
org.bukkit.block.data.Ageable ageable = (org.bukkit.block.data.Ageable) blockData;
ageable.setAge(ageable.getAge() + 1);
block.getClass()
.getMethod("setBlockData", Class.forName("org.bukkit.block.data.BlockData"))
.invoke(block, ageable);
}
} else {
if (block.getState().getData() instanceof Crops) {
try {
block.getClass().getMethod("setData", byte.class).invoke(block,
(byte) (block.getData() + 1));
block.getState().update();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException | ClassNotFoundException e) {
e.printStackTrace();
}
} else {
if (block.getState().getData() instanceof Crops) {
try {
block.getClass().getMethod("setData", byte.class).invoke(block,
(byte) (block.getData() + 1));
block.getState().update();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
}
return;
}
return;
}
}
}

View File

@ -36,8 +36,10 @@ public class Death implements Listener {
"KeepItemsOnDeath")) {
keepInventory = true;
}
} else {
} else if (configLoad.getBoolean("Island.KeepItemsOnDeath.Enable")) {
keepInventory = true;
} else {
keepInventory = false;
}
if (keepInventory) {

View File

@ -2,7 +2,6 @@ package me.goodandevil.skyblock.listeners;
import java.io.File;
import java.util.List;
import java.util.UUID;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.ArmorStand;
@ -14,6 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -90,12 +90,11 @@ public class Entity implements Listener {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Settings.PvP.Enable")) {
if (!configLoad.getBoolean("Island.Settings.PvP.Enable")
|| !skyblock.getIslandManager().hasSetting(player.getLocation(), IslandRole.Owner, "Damage")) {
if (configLoad.getBoolean("Island.Settings.Damage.Enable")) {
if (!skyblock.getIslandManager().hasSetting(player.getLocation(), IslandRole.Owner, "Damage")) {
event.setCancelled(true);
}
} else {
} else if (!configLoad.getBoolean("Island.Damage.Enable")) {
event.setCancelled(true);
}
}
@ -114,15 +113,15 @@ public class Entity implements Listener {
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
if (entity instanceof Player) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Settings.PvP.Enable")) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Settings.PvP.Enable")) {
if (!islandManager.hasSetting(entity.getLocation(), IslandRole.Owner, "PvP")) {
event.setCancelled(true);
}
} else {
} else if (!configLoad.getBoolean("Island.PvP.Enable")) {
event.setCancelled(true);
return;
}
} else if (entity instanceof ArmorStand) {
if (!islandManager.hasPermission(player, entity.getLocation(), "Destroy")) {
@ -157,12 +156,14 @@ public class Entity implements Listener {
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
if (event.getEntity() instanceof Player) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Settings.PvP.Enable")) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Settings.PvP.Enable")) {
if (!islandManager.hasSetting(entity.getLocation(), IslandRole.Owner, "PvP")) {
event.setCancelled(true);
}
} else {
} else if (!configLoad.getBoolean("Island.PvP.Enable")) {
event.setCancelled(true);
}
} else {
@ -182,14 +183,16 @@ public class Entity implements Listener {
Player player = (Player) event.getEntity();
if (skyblock.getWorldManager().isIslandWorld(player.getWorld())) {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Settings.Damage.Enable")) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Settings.Damage.Enable")) {
if (!islandManager.hasSetting(player.getLocation(), IslandRole.Owner, "Damage")
|| (event.getDamager() instanceof TNTPrimed && !islandManager
.hasSetting(player.getLocation(), IslandRole.Owner, "Explosions"))) {
event.setCancelled(true);
}
} else {
} else if (!configLoad.getBoolean("Island.Damage.Enable")) {
event.setCancelled(true);
}
}
@ -320,7 +323,7 @@ public class Entity implements Listener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event) {
if (event.getEntity() instanceof Player) {
return;
@ -335,21 +338,19 @@ public class Entity implements Listener {
IslandManager islandManager = skyblock.getIslandManager();
if (skyblock.getWorldManager().isIslandWorld(livingEntity.getWorld())) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
Island island = islandManager.getIslandAtLocation(livingEntity.getLocation());
if (islandManager.isLocationAtIsland(island, livingEntity.getLocation())) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Drops);
if (island != null) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Drops);
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Drops)) {
List<ItemStack> entityDrops = event.getDrops();
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Drops)) {
List<ItemStack> entityDrops = event.getDrops();
if (entityDrops != null) {
for (int i = 0; i < entityDrops.size(); i++) {
ItemStack is = entityDrops.get(i);
is.setAmount(is.getAmount() * 2);
}
if (entityDrops != null) {
for (int i = 0; i < entityDrops.size(); i++) {
ItemStack is = entityDrops.get(i);
is.setAmount(is.getAmount() * 2);
}
}
}

View File

@ -116,8 +116,10 @@ public class Move implements Listener {
} else {
keepItemsOnDeath = false;
}
} else {
} else if (configLoad.getBoolean("Island.KeepItemsOnDeath.Enable")) {
keepItemsOnDeath = true;
} else {
keepItemsOnDeath = false;
}
if (configLoad.getBoolean("Island.World." + world.name() + ".Liquid.Enable")) {

View File

@ -1,7 +1,6 @@
package me.goodandevil.skyblock.listeners;
import java.io.File;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -55,100 +54,97 @@ public class Portal implements Listener {
}
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
Island island = islandManager.getIslandAtLocation(player.getLocation());
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
if (island != null) {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (islandManager.isPlayerAtIsland(island, player)) {
if (((block.getType() == Materials.NETHER_PORTAL.parseMaterial()
&& configLoad.getBoolean("Island.World.Nether.Enable"))
|| (block.getType() == Materials.END_PORTAL.parseMaterial()
&& configLoad.getBoolean("Island.World.End.Enable")))
&& islandManager.hasPermission(player, "Portal")) {
if (configLoad.getBoolean("Island.Portal.Island")) {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (world == IslandWorld.Normal) {
if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.Nether, IslandEnvironment.Main));
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.End, IslandEnvironment.Main));
}
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
if (((block.getType() == Materials.NETHER_PORTAL.parseMaterial()
&& configLoad.getBoolean("Island.World.Nether.Enable"))
|| (block.getType() == Materials.END_PORTAL.parseMaterial()
&& configLoad.getBoolean("Island.World.End.Enable")))
&& islandManager.hasPermission(player, "Portal")) {
if (configLoad.getBoolean("Island.Portal.Island")) {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
if (world == IslandWorld.Normal) {
if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.Nether, IslandEnvironment.Main));
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.End, IslandEnvironment.Main));
}
} else {
if (world == IslandWorld.Normal) {
if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.Nether, IslandEnvironment.Visitor));
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.End, IslandEnvironment.Visitor));
}
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()
&& Bukkit.getServer().getAllowNether()) {
for (World worldList : Bukkit.getServer().getWorlds()) {
if (worldList.getEnvironment() == Environment.NETHER) {
player.teleport(LocationUtil.getRandomLocation(worldList, 5000, 5000, true, true));
break;
}
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()
&& Bukkit.getServer().getAllowEnd()) {
for (World worldList : Bukkit.getServer().getWorlds()) {
if (worldList.getEnvironment() == Environment.THE_END) {
player.teleport(worldList.getSpawnLocation());
break;
}
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
}
} else {
if (world == IslandWorld.Normal) {
if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.Nether, IslandEnvironment.Visitor));
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()) {
player.teleport(island.getLocation(IslandWorld.End, IslandEnvironment.Visitor));
}
} else {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
messageManager.sendMessage(player,
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Portal.Destination.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else if (block.getType() == Materials.NETHER_PORTAL.parseMaterial()
&& Bukkit.getServer().getAllowNether()) {
for (World worldList : Bukkit.getServer().getWorlds()) {
if (worldList.getEnvironment() == Environment.NETHER) {
player.teleport(LocationUtil.getRandomLocation(worldList, 5000, 5000, true, true));
break;
}
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else if (block.getType() == Materials.END_PORTAL.parseMaterial()
&& Bukkit.getServer().getAllowEnd()) {
for (World worldList : Bukkit.getServer().getWorlds()) {
if (worldList.getEnvironment() == Environment.THE_END) {
player.teleport(worldList.getSpawnLocation());
break;
}
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(world, IslandEnvironment.Main));
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
} else {
player.teleport(island.getLocation(world, IslandEnvironment.Visitor));
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
}
messageManager.sendMessage(player,
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
.getFileConfiguration().getString("Island.Portal.Destination.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
player.teleport(island.getLocation(world, IslandEnvironment.Main));
} else {
player.teleport(island.getLocation(world, IslandEnvironment.Visitor));
}
player.setFallDistance(0.0F);
return;
messageManager.sendMessage(player,
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
player.setFallDistance(0.0F);
return;
}
}
}

View File

@ -1,7 +1,6 @@
package me.goodandevil.skyblock.listeners;
import java.io.File;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
@ -44,30 +43,28 @@ public class Respawn implements Listener {
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Death.Respawn.Island")) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
Island island = islandManager.getIslandAtLocation(player.getLocation());
if (islandManager.isPlayerAtIsland(island, player)) {
Location playerLocation = player.getLocation().clone(), islandLocation;
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
if (island != null) {
Location playerLocation = player.getLocation().clone(), islandLocation;
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
islandLocation = island.getLocation(world, IslandEnvironment.Main);
} else {
islandLocation = island.getLocation(world, IslandEnvironment.Visitor);
}
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerTeleportEvent(player, playerLocation, islandLocation));
event.setRespawnLocation(islandLocation);
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
return;
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
islandLocation = island.getLocation(world, IslandEnvironment.Main);
} else {
islandLocation = island.getLocation(world, IslandEnvironment.Visitor);
}
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerTeleportEvent(player, playerLocation, islandLocation));
event.setRespawnLocation(islandLocation);
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
return;
}
}

View File

@ -3,7 +3,6 @@ package me.goodandevil.skyblock.listeners;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.UUID;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.event.EventHandler;
@ -32,75 +31,71 @@ public class Spawner implements Listener {
org.bukkit.Location location = spawner.getBlock().getLocation();
if (skyblock.getWorldManager().isIslandWorld(location.getWorld())) {
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
Island island = islandManager.getIslandAtLocation(location);
if (islandManager.isLocationAtIsland(island, location)) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Spawner);
if (island != null) {
List<Upgrade> upgrades = skyblock.getUpgradeManager().getUpgrades(Upgrade.Type.Spawner);
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Spawner)) {
if (NMSUtil.getVersionNumber() > 12) {
if (spawner.getDelay() == 20) {
spawner.setDelay(10);
}
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.Spawner)) {
if (NMSUtil.getVersionNumber() > 12) {
if (spawner.getDelay() == 20) {
spawner.setDelay(10);
}
spawner.setMinSpawnDelay(100);
spawner.setMaxSpawnDelay(400);
} else {
try {
Object MobSpawner = null;
spawner.setMinSpawnDelay(100);
spawner.setMaxSpawnDelay(400);
} else {
try {
Object MobSpawner = null;
try {
Field TileEntityMobSpawnerField = spawner.getClass().getDeclaredField("spawner");
TileEntityMobSpawnerField.setAccessible(true);
Object TileEntityMobSpawner = TileEntityMobSpawnerField.get(spawner);
MobSpawner = TileEntityMobSpawner.getClass().getMethod("getSpawner")
.invoke(TileEntityMobSpawner);
} catch (NoSuchFieldException e) {
Field snapshotField = spawner.getClass().getSuperclass()
.getDeclaredField("snapshot");
snapshotField.setAccessible(true);
Object snapshot = snapshotField.get(spawner);
MobSpawner = snapshot.getClass().getMethod("getSpawner").invoke(snapshot);
}
int spawnDelay = (int) MobSpawner.getClass().getSuperclass().getField("spawnDelay")
.get(MobSpawner);
if (spawnDelay == 20) {
Field spawnDelayField = MobSpawner.getClass().getSuperclass()
.getField("spawnDelay");
spawnDelayField.setAccessible(true);
spawnDelayField.set(MobSpawner, 10);
}
Field minSpawnDelayField = MobSpawner.getClass().getSuperclass()
.getDeclaredField("minSpawnDelay");
minSpawnDelayField.setAccessible(true);
int minSpawnDelay = (int) minSpawnDelayField.get(MobSpawner);
if (minSpawnDelay != 100) {
minSpawnDelayField.set(MobSpawner, 100);
}
Field maxSpawnDelayField = MobSpawner.getClass().getSuperclass()
.getDeclaredField("maxSpawnDelay");
maxSpawnDelayField.setAccessible(true);
int maxSpawnDelay = (int) maxSpawnDelayField.get(MobSpawner);
if (maxSpawnDelay != 400) {
maxSpawnDelayField.set(MobSpawner, 400);
}
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException
| SecurityException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
Field TileEntityMobSpawnerField = spawner.getClass().getDeclaredField("spawner");
TileEntityMobSpawnerField.setAccessible(true);
Object TileEntityMobSpawner = TileEntityMobSpawnerField.get(spawner);
MobSpawner = TileEntityMobSpawner.getClass().getMethod("getSpawner")
.invoke(TileEntityMobSpawner);
} catch (NoSuchFieldException e) {
Field snapshotField = spawner.getClass().getSuperclass().getDeclaredField("snapshot");
snapshotField.setAccessible(true);
Object snapshot = snapshotField.get(spawner);
MobSpawner = snapshot.getClass().getMethod("getSpawner").invoke(snapshot);
}
int spawnDelay = (int) MobSpawner.getClass().getSuperclass().getField("spawnDelay")
.get(MobSpawner);
if (spawnDelay == 20) {
Field spawnDelayField = MobSpawner.getClass().getSuperclass().getField("spawnDelay");
spawnDelayField.setAccessible(true);
spawnDelayField.set(MobSpawner, 10);
}
Field minSpawnDelayField = MobSpawner.getClass().getSuperclass()
.getDeclaredField("minSpawnDelay");
minSpawnDelayField.setAccessible(true);
int minSpawnDelay = (int) minSpawnDelayField.get(MobSpawner);
if (minSpawnDelay != 100) {
minSpawnDelayField.set(MobSpawner, 100);
}
Field maxSpawnDelayField = MobSpawner.getClass().getSuperclass()
.getDeclaredField("maxSpawnDelay");
maxSpawnDelayField.setAccessible(true);
int maxSpawnDelay = (int) maxSpawnDelayField.get(MobSpawner);
if (maxSpawnDelay != 400) {
maxSpawnDelayField.set(MobSpawner, 400);
}
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException
| SecurityException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
}
return;
}
return;
}
}
}

View File

@ -82,86 +82,88 @@ public class Teleport implements Listener {
PlayerData playerData = playerDataManager.getPlayerData(player);
UUID islandOwnerUUID = playerData.getIsland();
Island island = islandManager.getIslandAtLocation(event.getTo());
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
if (island != null) {
if (!island.getOwnerUUID().equals(playerData.getOwner())) {
if (!player.hasPermission("skyblock.bypass") && !player.hasPermission("skyblock.bypass.*")
&& !player.hasPermission("skyblock.*")) {
if (!island.isOpen() && !island.isCoopPlayer(player.getUniqueId())) {
event.setCancelled(true);
if (islandManager.isLocationAtIsland(island, event.getTo())) {
if (!island.getOwnerUUID().equals(playerData.getOwner())) {
if (!player.hasPermission("skyblock.bypass") && !player.hasPermission("skyblock.bypass.*")
&& !player.hasPermission("skyblock.*")) {
if (!island.isOpen() && !island.isCoopPlayer(player.getUniqueId())) {
event.setCancelled(true);
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Closed.Plugin.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Closed.Plugin.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& island.getBan().isBanned(player.getUniqueId())) {
event.setCancelled(true);
return;
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& island.getBan().isBanned(player.getUniqueId())) {
event.setCancelled(true);
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Banned.Teleport.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Banned.Teleport.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
return;
}
}
if (playerData.getIsland() != null && !playerData.getIsland().equals(island.getOwnerUUID())) {
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player,
islandManager.getIsland(islandOwnerUUID).getAPIWrapper()));
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandSwitchEvent(player,
islandManager.getIsland(islandOwnerUUID).getAPIWrapper(), island.getAPIWrapper()));
playerData.setVisitTime(0);
}
if (worldManager.getIslandWorld(event.getTo().getWorld()) == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
playerData.setIsland(island.getOwnerUUID());
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID)
&& (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
islandManager.unloadIsland(islandManager.getIsland(islandOwnerUUID), null);
}
Visit visit = island.getVisit();
if (!visit.isVisitor(player.getUniqueId())) {
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerIslandEnterEvent(player, island.getAPIWrapper()));
visit.addVisitor(player.getUniqueId());
visit.save();
}
return;
}
if (playerData.getIsland() != null && !playerData.getIsland().equals(island.getOwnerUUID())) {
me.goodandevil.skyblock.api.island.Island exitIsland = null;
if (islandManager.containsIsland(islandOwnerUUID)) {
exitIsland = islandManager.getIsland(islandOwnerUUID).getAPIWrapper();
}
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player, exitIsland));
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerIslandSwitchEvent(player, exitIsland, island.getAPIWrapper()));
playerData.setVisitTime(0);
}
if (worldManager.getIslandWorld(event.getTo().getWorld()) == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
playerData.setIsland(island.getOwnerUUID());
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID)
&& (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
islandManager.unloadIsland(islandManager.getIsland(islandOwnerUUID), null);
}
Visit visit = island.getVisit();
if (!visit.isVisitor(player.getUniqueId())) {
Bukkit.getServer().getPluginManager()
.callEvent(new PlayerIslandEnterEvent(player, island.getAPIWrapper()));
visit.addVisitor(player.getUniqueId());
visit.save();
}
return;
}
player.resetPlayerTime();
player.resetPlayerWeather();
if (islandOwnerUUID != null) {
me.goodandevil.skyblock.api.island.Island island = null;
me.goodandevil.skyblock.api.island.Island islandWrapper = null;
if (islandManager.hasIsland(islandOwnerUUID)) {
island = islandManager.getIsland(islandOwnerUUID).getAPIWrapper();
islandWrapper = islandManager.getIsland(islandOwnerUUID).getAPIWrapper();
}
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player, island));
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player, islandWrapper));
playerData.setVisitTime(0);
}

View File

@ -19,6 +19,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -193,7 +194,7 @@ public class Bans {
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Bans.Item.Information.Displayname"),
configLoad.getStringList("Menu.Bans.Item.Information.Lore"),
nInv.createItemLoreVariable(new String[] { "%bans#" + islandBans.size() }), null, null), 4);
new Placeholder[] { new Placeholder("%bans", "" + islandBans.size()) }, null, null), 4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Bans.Item.Barrier.Displayname"), null, null, null, null),

View File

@ -20,6 +20,7 @@ import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.island.IslandWorld;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.NumberUtil;
@ -194,7 +195,7 @@ public class Biome {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Biome.Item.Info.Displayname")),
configLoad.getStringList("Menu.Biome.Item.Info.Lore"),
nInv.createItemLoreVariable(new String[] { "%biome_type#" + islandBiomeName }), null, null), 0);
new Placeholder[] { new Placeholder("%biome_type", islandBiomeName) }, null, null), 0);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
ChatColor.translateAlternateColorCodes('&',

View File

@ -16,6 +16,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.item.nInventoryUtil;
@ -201,50 +202,42 @@ public class Border {
nInv.addItem(nInv.createItem(new ItemStack(Material.TRIPWIRE_HOOK),
configLoad.getString("Menu.Border.Item.Toggle.Displayname"),
configLoad.getStringList("Menu.Border.Item.Toggle.Lore"),
nInv.createItemLoreVariable(new String[] { "%toggle#" + borderToggle }), null, null), 1);
new Placeholder[] { new Placeholder("%toggle", borderToggle) }, null, null), 1);
if (borderColor == WorldBorder.Color.Blue) {
nInv.addItem(
nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
nInv.createItemLoreVariable(new String[] {
"%color#" + configLoad.getString("Menu.Border.Item.Word.Blue") }),
null, null),
2);
nInv.addItem(nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue")) },
null, null), 2);
} else {
nInv.addItem(
nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
nInv.createItemLoreVariable(new String[] {
"%color#" + configLoad.getString("Menu.Border.Item.Word.Blue") }),
null, null),
2);
nInv.addItem(nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue")) },
null, null), 2);
}
if (borderColor == WorldBorder.Color.Green) {
nInv.addItem(
nInv.createItem(Materials.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
nInv.createItemLoreVariable(new String[] {
"%color#" + configLoad.getString("Menu.Border.Item.Word.Green") }),
null, null),
3);
nInv.addItem(nInv.createItem(Materials.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green")) },
null, null), 3);
} else {
nInv.addItem(
nInv.createItem(Materials.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
nInv.createItemLoreVariable(new String[] {
"%color#" + configLoad.getString("Menu.Border.Item.Word.Green") }),
null, null),
3);
nInv.addItem(nInv.createItem(Materials.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green")) },
null, null), 3);
}
if (borderColor == WorldBorder.Color.Red) {
@ -252,16 +245,16 @@ public class Border {
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
nInv.createItemLoreVariable(
new String[] { "%color#" + configLoad.getString("Menu.Border.Item.Word.Red") }),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red")) },
null, null), 4);
} else {
nInv.addItem(nInv.createItem(Materials.ROSE_RED.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
nInv.createItemLoreVariable(
new String[] { "%color#" + configLoad.getString("Menu.Border.Item.Word.Red") }),
new Placeholder[] {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red")) },
null, null), 4);
}

View File

@ -19,6 +19,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -193,12 +194,10 @@ public class Coop {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Coop.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Coop.Item.Information.Displayname"),
configLoad.getStringList("Menu.Coop.Item.Information.Lore"),
nInv.createItemLoreVariable(new String[] { "%coops#" + coopPlayers.size() }), null, null),
4);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Coop.Item.Information.Displayname"),
configLoad.getStringList("Menu.Coop.Item.Information.Lore"),
new Placeholder[] { new Placeholder("%coops", "" + coopPlayers.size()) }, null, null), 4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Coop.Item.Barrier.Displayname"), null, null, null, null),

View File

@ -21,6 +21,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -219,13 +220,17 @@ public class Information {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
nInv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(),
"%members#" + visit.getMembers(), "%votes#" + visit.getVoters().size(),
"%visits#" + visit.getVisitors().size(),
"%players#" + islandManager.getPlayersAtIsland(island).size(),
"%player_capacity#"
+ mainConfig.getFileConfiguration().getInt("Island.Visitor.Capacity"),
"%owner#" + islandOwnerName, "%safety#" + safety }),
new Placeholder[] { new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%members", "" + visit.getMembers()),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%players",
"" + islandManager.getPlayersAtIsland(island).size()),
new Placeholder("%player_capacity",
"" + mainConfig.getFileConfiguration()
.getInt("Island.Visitor.Capacity")),
new Placeholder("%owner", islandOwnerName),
new Placeholder("%safety", safety) },
null, null), 2);
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Visitor.Signature.Enable")) {
@ -254,12 +259,16 @@ public class Information {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
nInv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(),
"%members#" + visit.getMembers(), "%visits#" + visit.getVisitors().size(),
"%players#" + islandManager.getPlayersAtIsland(island).size(),
"%player_capacity#"
+ mainConfig.getFileConfiguration().getInt("Island.Visitor.Capacity"),
"%owner#" + islandOwnerName, "%safety#" + safety }),
new Placeholder[] { new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%members", "" + visit.getMembers()),
new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%players",
"" + islandManager.getPlayersAtIsland(island).size()),
new Placeholder("%player_capacity",
"" + mainConfig.getFileConfiguration()
.getInt("Island.Visitor.Capacity")),
new Placeholder("%owner", islandOwnerName),
new Placeholder("%safety", safety) },
null, null), 2);
}
@ -366,16 +375,21 @@ public class Information {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Information.Members.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Information.Members.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Information.Members.Item.Statistics.Lore"),
nInv.createItemLoreVariable(new String[] {
"%island_members#" + (islandMembers.size() + islandOperators.size() + 1),
"%island_capacity#" + skyblock.getFileManager()
.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Member.Capacity"),
"%members#" + islandMembers.size(), "%operators#" + islandOperators.size() }),
null, null), 4);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Information.Members.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Information.Members.Item.Statistics.Lore"),
new Placeholder[] {
new Placeholder("%island_members",
"" + (islandMembers.size() + islandOperators.size() + 1)),
new Placeholder("%island_capacity",
"" + skyblock.getFileManager()
.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Member.Capacity")),
new Placeholder("%members", "" + islandMembers.size()),
new Placeholder("%operators", "" + islandOperators.size()) },
null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Information.Members.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -432,11 +446,12 @@ public class Information {
islandRole = configLoad.getString("Menu.Information.Members.Item.Member.Word.Owner");
}
nInv.addItem(nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Information.Members.Item.Member.Displayname")
.replace("%player", playerName),
configLoad.getStringList("Menu.Information.Members.Item.Member.Lore"),
nInv.createItemLoreVariable(new String[] { "%role#" + islandRole }), null, null),
nInv.addItem(
nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Information.Members.Item.Member.Displayname")
.replace("%player", playerName),
configLoad.getStringList("Menu.Information.Members.Item.Member.Lore"),
new Placeholder[] { new Placeholder("%role", islandRole) }, null, null),
inventorySlot);
}
}
@ -538,14 +553,11 @@ public class Information {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Information.Visitors.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Information.Visitors.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Information.Visitors.Item.Statistics.Lore"),
nInv.createItemLoreVariable(
new String[] { "%island_visitors#" + displayedVisitors.size() }),
null, null),
4);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Information.Visitors.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Information.Visitors.Item.Statistics.Lore"),
new Placeholder[] { new Placeholder("%island_visitors", "" + displayedVisitors.size()) },
null, null), 4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Information.Visitors.Item.Barrier.Displayname"), null, null,
null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -15,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.item.SkullUtil;
@ -98,20 +99,26 @@ public class Leaderboard {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Leaderboard." + viewer.getType().name() + ".Item.Exit.Displayname"),
null, null, null, null), 0, 4);
nInv.addItem(nInv.createItem(new ItemStack(Material.DIAMOND), configLoad
.getString("Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname")
.replace("%leaderboard", Viewer.Type.Level.name()),
configLoad.getStringList(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"),
nInv.createItemLoreVariable(new String[] { "%leaderboard#" + Viewer.Type.Level.name() }), null,
null), 1);
nInv.addItem(nInv.createItem(new ItemStack(Material.EMERALD), configLoad
.getString("Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname")
.replace("%leaderboard", Viewer.Type.Votes.name()),
configLoad.getStringList(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"),
nInv.createItemLoreVariable(new String[] { "%leaderboard#" + Viewer.Type.Votes.name() }), null,
null), 3);
nInv.addItem(
nInv.createItem(new ItemStack(Material.DIAMOND), configLoad
.getString(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname")
.replace("%leaderboard", Viewer.Type.Level.name()),
configLoad.getStringList(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"),
new Placeholder[] { new Placeholder("%leaderboard", Viewer.Type.Level.name()) }, null,
null),
1);
nInv.addItem(
nInv.createItem(new ItemStack(Material.EMERALD), configLoad
.getString(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Displayname")
.replace("%leaderboard", Viewer.Type.Votes.name()),
configLoad.getStringList(
"Menu.Leaderboard." + viewer.getType().name() + ".Item.Leaderboard.Lore"),
new Placeholder[] { new Placeholder("%leaderboard", Viewer.Type.Votes.name()) }, null,
null),
3);
nInv.setTitle(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Leaderboard." + viewer.getType().name() + ".Title")));
@ -242,16 +249,21 @@ public class Leaderboard {
}
}
nInv.addItem(nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname")
.replace("%owner",
playerName)
.replace("%position", "" + (leaderboard.getPosition() + 1)),
itemLore,
nInv.createItemLoreVariable(new String[] { "%position#" + (leaderboard.getPosition() + 1),
"%owner#" + playerName, "%level#" + visit.getLevel().getLevel(),
"%votes#" + visit.getVoters().size(), "%members#" + visit.getMembers() }),
null, null), itemSlot);
nInv.addItem(
nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname")
.replace(
"%owner", playerName)
.replace("%position", "" + (leaderboard.getPosition() + 1)),
itemLore,
new Placeholder[] {
new Placeholder("%position", "" + (leaderboard.getPosition() + 1)),
new Placeholder("%owner", playerName),
new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%members", "" + visit.getMembers()) },
null, null),
itemSlot);
}
int[] itemSlots = new int[] { 13, 21, 22, 23, 29, 31, 33, 37, 40, 43 };
@ -264,7 +276,7 @@ public class Leaderboard {
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Empty.Displayname")
.replace("%position", "" + (i + 1)),
configLoad.getStringList("Menu.Leaderboard.Leaderboard.Item.Empty.Lore"),
nInv.createItemLoreVariable(new String[] { "%position#" + (i + 1) }), null, null),
new Placeholder[] { new Placeholder("%position", "" + (i + 1)) }, null, null),
itemSlots[i]);
}
}

View File

@ -20,6 +20,7 @@ import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.Level;
import me.goodandevil.skyblock.levelling.LevellingManager;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -211,9 +212,9 @@ public class Levelling {
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Levelling.Item.Statistics.Lore"),
nInv.createItemLoreVariable(
new String[] { "%level_points#" + NumberUtil.formatNumberByDecimal(level.getPoints()),
"%level#" + NumberUtil.formatNumberByDecimal(level.getLevel()) }),
new Placeholder[] {
new Placeholder("%level_points", NumberUtil.formatNumberByDecimal(level.getPoints())),
new Placeholder("%level", NumberUtil.formatNumberByDecimal(level.getLevel())) },
null, null), 4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),

View File

@ -25,6 +25,7 @@ import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -366,24 +367,23 @@ public class Members {
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Members.Item.Type.Displayname"),
configLoad.getStringList("Menu.Members.Item.Type.Lore"),
nInv.createItemLoreVariable(new String[] { "%type#" + type.name() }), null, null), 3);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Members.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Members.Item.Statistics.Lore"),
nInv.createItemLoreVariable(new String[] {
"%island_members#" + (islandMembers.size() + islandOperators.size() + 1),
"%island_capacity#"
+ fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Member.Capacity"),
"%members#" + islandMembers.size(), "%operators#" + islandOperators.size() }),
null, null),
4);
new Placeholder[] { new Placeholder("%type", type.name()) }, null, null), 3);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Members.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Members.Item.Statistics.Lore"),
new Placeholder[] {
new Placeholder("%island_members",
"" + (islandMembers.size() + islandOperators.size() + 1)),
new Placeholder("%island_capacity",
"" + fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Member.Capacity")),
new Placeholder("%members", "" + islandMembers.size()),
new Placeholder("%operators", "" + islandOperators.size()) },
null, null), 4);
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Members.Item.Sort.Displayname"),
configLoad.getStringList("Menu.Members.Item.Sort.Lore"),
nInv.createItemLoreVariable(
new String[] { "%sort#" + StringUtil.capatilizeUppercaseLetters(sort.name()) }),
new Placeholder[] { new Placeholder("%sort", StringUtil.capatilizeUppercaseLetters(sort.name())) },
null, null), 5);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
@ -602,14 +602,17 @@ public class Members {
}
}
nInv.addItem(nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString(
"Menu.Members.Item.Member.Displayname").replace("%player", playerName),
itemLore,
nInv.createItemLoreVariable(new String[] { "%role#" + islandRole,
"%playtime#" + islandPlaytimeFormatted, "%since#" + memberSinceFormatted,
"%last_online#" + lastOnlineFormatted }),
null, null), inventorySlot);
nInv.addItem(
nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Members.Item.Member.Displayname").replace("%player",
playerName),
itemLore,
new Placeholder[] { new Placeholder("%role", islandRole),
new Placeholder("%playtime", islandPlaytimeFormatted),
new Placeholder("%since", memberSinceFormatted),
new Placeholder("%last_online", lastOnlineFormatted) },
null, null),
inventorySlot);
}
}
}

View File

@ -19,6 +19,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -299,12 +300,10 @@ public class Ownership {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0);
nInv.addItem(
nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Ownership.Item.Original.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Original.Lore"),
nInv.createItemLoreVariable(new String[] { "%player#" + originalOwnerName }), null, null),
1);
nInv.addItem(nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Ownership.Item.Original.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Original.Lore"),
new Placeholder[] { new Placeholder("%player", originalOwnerName) }, null, null), 1);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Ownership.Item.Barrier.Displayname"), null, null, null, null),
@ -319,10 +318,11 @@ public class Ownership {
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Hidden.Lore"), null, null, null), 4);
} else {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Visible.Lore"),
nInv.createItemLoreVariable(new String[] { "%password#" + ownershipPassword }), null, null),
nInv.addItem(
nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Visible.Lore"),
new Placeholder[] { new Placeholder("%password", ownershipPassword) }, null, null),
4);
}
} else {

View File

@ -23,6 +23,7 @@ import me.goodandevil.skyblock.island.IslandMessage;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.island.Setting;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.AnvilGUI;
@ -428,22 +429,20 @@ public class Settings {
configLoad.getString("Menu.Settings.Visitor.Item.Statistics.Displayname"),
configLoad.getStringList(
"Menu.Settings.Visitor.Item.Statistics.Vote.Enabled.Open.Lore"),
nInv.createItemLoreVariable(
new String[] { "%visits#" + visit.getVisitors().size(),
"%votes#" + visit.getVoters().size(),
"%visitors#"
+ islandManager.getVisitorsAtIsland(island).size() }),
new Placeholder[] { new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%visitors",
"" + islandManager.getVisitorsAtIsland(island).size()) },
null, null), 4);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Settings.Visitor.Item.Statistics.Displayname"),
configLoad.getStringList(
"Menu.Settings.Visitor.Item.Statistics.Vote.Enabled.Closed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%visits#" + visit.getVisitors().size(),
"%votes#" + visit.getVoters().size(),
"%visitors#"
+ islandManager.getVisitorsAtIsland(island).size() }),
new Placeholder[] { new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%visitors",
"" + islandManager.getVisitorsAtIsland(island).size()) },
null, null), 4);
}
} else {
@ -452,20 +451,18 @@ public class Settings {
configLoad.getString("Menu.Settings.Visitor.Item.Statistics.Displayname"),
configLoad.getStringList(
"Menu.Settings.Visitor.Item.Statistics.Vote.Disabled.Open.Lore"),
nInv.createItemLoreVariable(
new String[] { "%visits#" + visit.getVisitors().size(),
"%visitors#"
+ islandManager.getVisitorsAtIsland(island).size() }),
new Placeholder[] { new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%visitors",
"" + islandManager.getVisitorsAtIsland(island).size()) },
null, null), 4);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Settings.Visitor.Item.Statistics.Displayname"),
configLoad.getStringList(
"Menu.Settings.Visitor.Item.Statistics.Vote.Disabled.Closed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%visits#" + visit.getVisitors().size(),
"%visitors#"
+ islandManager.getVisitorsAtIsland(island).size() }),
new Placeholder[] { new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%visitors",
"" + islandManager.getVisitorsAtIsland(island).size()) },
null, null), 4);
}
}

View File

@ -25,6 +25,7 @@ import me.goodandevil.skyblock.economy.EconomyManager;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -596,10 +597,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island,
me.goodandevil.skyblock.upgrade.Upgrade.Type.Speed) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Speed)) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 0);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -607,16 +608,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 0);
} else {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 0);
}
}
@ -647,10 +648,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island,
me.goodandevil.skyblock.upgrade.Upgrade.Type.Jump) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Jump)) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 1);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -658,16 +659,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 1);
} else {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 1);
}
}
@ -683,10 +684,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island,
me.goodandevil.skyblock.upgrade.Upgrade.Type.Crop) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Crop)) },
null, null), 3);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -694,16 +695,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 3);
} else {
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 3);
}
}
@ -719,9 +720,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Claimed.Lore"),
nInv.createItemLoreVariable(new String[] {
"%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Fly) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Fly)) },
null, null), 4);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -729,16 +731,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 4);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 4);
}
}
@ -754,10 +756,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island,
me.goodandevil.skyblock.upgrade.Upgrade.Type.Drops) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Drops)) },
null, null), 5);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -765,16 +767,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 5);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 5);
}
}
@ -794,17 +796,16 @@ public class Upgrade {
}
if (island.getSize() >= upgrade.getValue()) {
nInv.addItem(
nInv.createItem(new ItemStack(Material.BEACON),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Size.Displayname")
.replace("%tier", "" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Size.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%tier#" + tier, "%size#" + upgrade.getValue() }),
null, null),
7);
nInv.addItem(nInv.createItem(new ItemStack(Material.BEACON),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Size.Displayname").replace("%tier",
"" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Size.Claimed.Lore"),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue()) },
null, null), 7);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(
@ -813,9 +814,11 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Size.Displayname")
.replace("%tier", "" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Size.Claimable.Lore"),
nInv.createItemLoreVariable(new String[] {
"%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%tier#" + tier, "%size#" + upgrade.getValue() }),
new Placeholder[] {
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue()) },
null, null),
7);
} else {
@ -825,9 +828,11 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Size.Displayname")
.replace("%tier", "" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Size.Unclaimable.Lore"),
nInv.createItemLoreVariable(new String[] {
"%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%tier#" + tier, "%size#" + upgrade.getValue() }),
new Placeholder[] {
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue()) },
null, null),
7);
}
@ -847,10 +852,10 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(island,
me.goodandevil.skyblock.upgrade.Upgrade.Type.Spawner) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, me.goodandevil.skyblock.upgrade.Upgrade.Type.Spawner)) },
null, null), 8);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
@ -858,16 +863,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 8);
} else {
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Unclaimable.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), 8);
}
}

View File

@ -22,6 +22,7 @@ import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -365,22 +366,21 @@ public class Visit {
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Visit.Item.Type.Displayname"),
configLoad.getStringList("Menu.Visit.Item.Type.Lore"),
nInv.createItemLoreVariable(
new String[] { "%type#" + StringUtil.capatilizeUppercaseLetters(type.name()) }),
new Placeholder[] { new Placeholder("%type", StringUtil.capatilizeUppercaseLetters(type.name())) },
null, null), 3);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Visit.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Visit.Item.Statistics.Lore"),
nInv.createItemLoreVariable(
new String[] { "%islands_open#" + NumberUtil.formatNumberByDecimal(visitIslands.size()),
"%islands_closed#" + NumberUtil.formatNumberByDecimal(totalIslands - visitIslands.size()),
"%islands#" + NumberUtil.formatNumberByDecimal(totalIslands) }),
new Placeholder[] {
new Placeholder("%islands_open", NumberUtil.formatNumberByDecimal(visitIslands.size())),
new Placeholder("%islands_closed",
NumberUtil.formatNumberByDecimal(totalIslands - visitIslands.size())),
new Placeholder("%islands", NumberUtil.formatNumberByDecimal(totalIslands)) },
null, null), 4);
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Visit.Item.Sort.Displayname"),
configLoad.getStringList("Menu.Visit.Item.Sort.Lore"),
nInv.createItemLoreVariable(
new String[] { "%sort#" + StringUtil.capatilizeUppercaseLetters(sort.name()) }),
new Placeholder[] { new Placeholder("%sort", StringUtil.capatilizeUppercaseLetters(sort.name())) },
null, null), 5);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
@ -500,15 +500,17 @@ public class Visit {
}
nInv.addItem(nInv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]),
configLoad.getString(
"Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName),
configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player",
targetPlayerName),
itemLore,
nInv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(),
"%members#" + visit.getMembers(), "%votes#" + visit.getVoters().size(),
"%visits#" + visit.getVisitors().size(),
"%players#" + islandManager.getPlayersAtIsland(island).size(),
"%player_capacity#" + playerCapacity, "%action#" + voteAction,
"%safety#" + safety }),
new Placeholder[] { new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%members", "" + visit.getMembers()),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%players",
"" + islandManager.getPlayersAtIsland(island).size()),
new Placeholder("%player_capacity", "" + playerCapacity),
new Placeholder("%action", voteAction), new Placeholder("%safety", safety) },
null, null), inventorySlot);
} else {
if (signatureEnabled) {
@ -534,13 +536,16 @@ public class Visit {
}
nInv.addItem(nInv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]),
configLoad.getString(
"Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName),
configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player",
targetPlayerName),
itemLore,
nInv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(),
"%members#" + visit.getMembers(), "%visits#" + visit.getVisitors().size(),
"%players#" + islandManager.getPlayersAtIsland(island).size(),
"%player_capacity#" + playerCapacity, "%safety#" + safety }),
new Placeholder[] { new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%members", "" + visit.getMembers()),
new Placeholder("%visits", "" + visit.getVisitors().size()),
new Placeholder("%players",
"" + islandManager.getPlayersAtIsland(island).size()),
new Placeholder("%player_capacity", "" + playerCapacity),
new Placeholder("%safety", safety) },
null, null), inventorySlot);
}
}

View File

@ -21,6 +21,7 @@ import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -185,10 +186,12 @@ public class Visitors {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Visitors.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Visitors.Item.Statistics.Lore"),
nInv.createItemLoreVariable(new String[] { "%visitors#" + islandVisitors.size() }), null, null), 4);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Visitors.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Visitors.Item.Statistics.Lore"),
new Placeholder[] { new Placeholder("%visitors", "" + islandVisitors.size()) }, null, null),
4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null),
@ -296,13 +299,15 @@ public class Visitors {
}
}
nInv.addItem(nInv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Visitor.Displayname")
.replace("%player", targetPlayer.getName())),
itemLore,
nInv.createItemLoreVariable(new String[] { "%time#" + islandVisitTimeFormatted }), null,
null), inventorySlot);
nInv.addItem(
nInv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Visitor.Displayname")
.replace("%player", targetPlayer.getName())),
itemLore,
new Placeholder[] { new Placeholder("%time", islandVisitTimeFormatted) }, null,
null),
inventorySlot);
}
}
}

View File

@ -18,6 +18,7 @@ import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.island.IslandWorld;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.item.nInventoryUtil;
@ -237,26 +238,24 @@ public class Weather {
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
configLoad.getString("Menu.Weather.Item.Info.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Info.Lore"),
nInv.createItemLoreVariable(
new String[] { "%synchronised#" + weatherSynchronised, "%time_name#" + timeName,
"%time#" + island.getTime(), "%weather#" + island.getWeatherName() }),
new Placeholder[] { new Placeholder("%synchronised", weatherSynchronised),
new Placeholder("%time_name", timeName), new Placeholder("%time", "" + island.getTime()),
new Placeholder("%weather", island.getWeatherName()) },
null, null), 0);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Weather.Item.Barrier.Displayname"), null, null, null, null), 1);
nInv.addItem(nInv.createItem(Materials.SUNFLOWER.parseItem(),
configLoad.getString("Menu.Weather.Item.Time.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Time.Lore"),
nInv.createItemLoreVariable(new String[] { "%choice#" + timeChoice }), null, null), 2);
new Placeholder[] { new Placeholder("%choice", timeChoice) }, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.GHAST_TEAR),
configLoad.getString("Menu.Weather.Item.Weather.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Weather.Lore"),
nInv.createItemLoreVariable(new String[] { "%choice#" + weatherChoice }), null, null), 3);
nInv.addItem(
nInv.createItem(new ItemStack(Material.TRIPWIRE_HOOK),
configLoad.getString("Menu.Weather.Item.Synchronised.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Synchronised.Lore"),
nInv.createItemLoreVariable(new String[] { "%choice#" + synchronisedChoice }), null, null),
4);
new Placeholder[] { new Placeholder("%choice", weatherChoice) }, null, null), 3);
nInv.addItem(nInv.createItem(new ItemStack(Material.TRIPWIRE_HOOK),
configLoad.getString("Menu.Weather.Item.Synchronised.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Synchronised.Lore"),
new Placeholder[] { new Placeholder("%choice", synchronisedChoice) }, null, null), 4);
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Weather.Title")));
nInv.setType(InventoryType.HOPPER);

View File

@ -22,6 +22,7 @@ import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -65,10 +66,12 @@ public class Creator implements Listener {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Exit.Displayname"), null, null, null, null), 0,
8);
nInv.addItem(nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Browse.Item.Information.Lore"),
nInv.createItemLoreVariable(new String[] { "%structures#" + structures.size() }), null, null), 4);
nInv.addItem(
nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Browse.Item.Information.Lore"),
new Placeholder[] { new Placeholder("%structures", "" + structures.size()) }, null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -129,12 +132,10 @@ public class Creator implements Listener {
displayName = ChatColor.translateAlternateColorCodes('&', structure.getDisplayname());
}
nInv.addItem(
nInv.createItem(new ItemStack(Material.NAME_TAG),
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Displayname.Lore"),
nInv.createItemLoreVariable(new String[] { "%displayname#" + displayName }), null, null),
1);
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Displayname.Lore"),
new Placeholder[] { new Placeholder("%displayname", displayName) }, null, null), 1);
List<String> descriptionLore = new ArrayList<>();
@ -201,8 +202,7 @@ public class Creator implements Listener {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Admin.Creator.Options.Item.Permission.Displayname"), permissionLore,
nInv.createItemLoreVariable(new String[] { "%permission#" + structure.getPermission() }), null,
null), 4);
new Placeholder[] { new Placeholder("%permission", structure.getPermission()) }, null, null), 4);
String fileName = ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Word.Unset")), overworldFileName,
@ -223,14 +223,14 @@ public class Creator implements Listener {
nInv.addItem(nInv.createItem(new ItemStack(Material.PAPER),
configLoad.getString("Menu.Admin.Creator.Options.Item.File.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.File.Lore"),
nInv.createItemLoreVariable(
new String[] { "%overworld_file#" + overworldFileName, "%nether_file#" + netherFileName }),
new Placeholder[] { new Placeholder("%overworld_file", overworldFileName),
new Placeholder("%nether_file", netherFileName) },
null, null), 5);
nInv.addItem(nInv.createItem(new ItemStack(Material.DIAMOND),
configLoad.getString("Menu.Admin.Creator.Options.Item.Item.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Item.Lore"),
nInv.createItemLoreVariable(new String[] { "%material#" + structure.getMaterials().name() }), null,
null), 6);
new Placeholder[] { new Placeholder("%material", structure.getMaterials().name()) }, null, null),
6);
nInv.setRows(1);
}

View File

@ -23,6 +23,7 @@ import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.generator.GeneratorManager;
import me.goodandevil.skyblock.generator.GeneratorMaterial;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.AnvilGUI;
@ -63,10 +64,12 @@ public class Generator implements Listener {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Generator.Browse.Item.Information.Lore"),
nInv.createItemLoreVariable(new String[] { "%generators#" + generators.size() }), null, null), 4);
nInv.addItem(
nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Generator.Browse.Item.Information.Lore"),
new Placeholder[] { new Placeholder("%generators", "" + generators.size()) }, null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -127,9 +130,9 @@ public class Generator implements Listener {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Information.Displayname"), permissionLore,
nInv.createItemLoreVariable(new String[] { "%name#" + generator.getName(),
"%materials#" + generator.getGeneratorMaterials().size(),
"%permission#" + generator.getPermission() }),
new Placeholder[] { new Placeholder("%name", generator.getName()),
new Placeholder("%materials", "" + generator.getGeneratorMaterials().size()),
new Placeholder("%permission", generator.getPermission()) },
null, null), 4);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Return.Displayname"), null, null, null,
@ -159,8 +162,7 @@ public class Generator implements Listener {
configLoad.getString("Menu.Admin.Generator.Generator.Item.Material.Displayname")
.replace("%material", generatorMaterial.getMaterials().name())),
configLoad.getStringList("Menu.Admin.Generator.Generator.Item.Material.Lore"),
nInv.createItemLoreVariable(
new String[] { "%chance#" + generatorMaterial.getChance() }),
new Placeholder[] { new Placeholder("%chance", "" + generatorMaterial.getChance()) },
null, null), inventorySlot);
}
}

View File

@ -21,6 +21,7 @@ import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.levelling.LevellingManager;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.AnvilGUI;
@ -63,13 +64,16 @@ public class Levelling implements Listener {
nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Levelling.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Levelling.Item.Information.Lore"),
nInv.createItemLoreVariable(new String[] { "%materials#" + levellingMaterials.size(),
"%division#" + fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Levelling.Division") }),
null, null), 4);
nInv.addItem(
nInv.createItem(new ItemStack(org.bukkit.Material.SIGN),
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Levelling.Item.Information.Lore"),
new Placeholder[] { new Placeholder("%materials", "" + levellingMaterials.size()),
new Placeholder("%division",
"" + fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getInt("Island.Levelling.Division")) },
null, null),
4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Levelling.Item.Barrier.Displayname"), null, null, null, null),
@ -104,16 +108,18 @@ public class Levelling implements Listener {
inventorySlot++;
me.goodandevil.skyblock.levelling.Material material = levellingMaterials.get(index);
nInv.addItem(nInv.createItem(
new ItemStack(MaterialUtil.correctMaterial(material.getItemStack().getType()), 1,
material.getItemStack().getDurability()),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Material.Displayname")
.replace("%material", material.getMaterials().name())),
configLoad.getStringList("Menu.Admin.Levelling.Item.Material.Lore"),
nInv.createItemLoreVariable(
new String[] { "%points#" + NumberUtil.formatNumberByDecimal(material.getPoints()) }),
null, null), inventorySlot);
nInv.addItem(
nInv.createItem(
new ItemStack(MaterialUtil.correctMaterial(material.getItemStack().getType()), 1,
material.getItemStack().getDurability()),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Material.Displayname")
.replace("%material", material.getMaterials().name())),
configLoad.getStringList("Menu.Admin.Levelling.Item.Material.Lore"),
new Placeholder[] { new Placeholder("%points",
NumberUtil.formatNumberByDecimal(material.getPoints())) },
null, null),
inventorySlot);
}
}
}
@ -314,11 +320,10 @@ public class Levelling implements Listener {
int materialPoints = Integer.valueOf(event1.getName());
materialList.setPoints(materialPoints);
messageManager.sendMessage(player,
configLoad.getString("Island.Admin.Levelling.Points.Message")
.replace("%material", materials.name())
.replace("%points",
NumberUtil.formatNumberByDecimal(materialPoints)));
messageManager.sendMessage(player, configLoad
.getString("Island.Admin.Levelling.Points.Message")
.replace("%material", materials.name()).replace("%points",
NumberUtil.formatNumberByDecimal(materialPoints)));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F,
1.0F);
player.closeInventory();

View File

@ -21,6 +21,7 @@ import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.placeholder.Placeholder;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
@ -270,9 +271,9 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Speed.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 1);
if (NMSVersion > 12) {
@ -288,9 +289,9 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Jump.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS }), 2);
upgrade = upgradeManager.getUpgrades(me.goodandevil.skyblock.upgrade.Upgrade.Type.Crop).get(0);
@ -298,9 +299,9 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Crop.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, null), 3);
upgrade = upgradeManager.getUpgrades(me.goodandevil.skyblock.upgrade.Upgrade.Type.Fly).get(0);
@ -308,9 +309,9 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Fly.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, null), 4);
upgrade = upgradeManager.getUpgrades(me.goodandevil.skyblock.upgrade.Upgrade.Type.Drops).get(0);
@ -318,9 +319,9 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Drops.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, null), 5);
List<me.goodandevil.skyblock.upgrade.Upgrade> upgrades = upgradeManager
@ -335,16 +336,16 @@ public class Upgrade {
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Size.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Size.Lore"),
nInv.createItemLoreVariable(new String[] { "%tiers#" + upgradeTiers }), null, null), 6);
new Placeholder[] { new Placeholder("%tiers", "" + upgradeTiers) }, null, null), 6);
upgrade = upgradeManager.getUpgrades(me.goodandevil.skyblock.upgrade.Upgrade.Type.Spawner).get(0);
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Lore"),
nInv.createItemLoreVariable(
new String[] { "%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()),
"%status#" + getStatus(upgrade) }),
new Placeholder[] {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade)) },
null, null), 7);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
@ -827,8 +828,9 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Tier.Displayname")
.replace("%tier", "" + tier)),
configLoad.getStringList("Menu.Admin.Upgrade.Size.Item.Tier.Lore"),
nInv.createItemLoreVariable(new String[] { "%size#" + upgrade.getValue(),
"%cost#" + NumberUtil.formatNumberByDecimal(upgrade.getCost()) }),
new Placeholder[] { new Placeholder("%size", "" + upgrade.getValue()),
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())) },
null, null), i + 3);
}
}

View File

@ -0,0 +1,20 @@
package me.goodandevil.skyblock.placeholder;
public class Placeholder {
private String placeholder;
private String result;
public Placeholder(String placeholder, String result) {
this.placeholder = placeholder;
this.result = result;
}
public String getPlaceholder() {
return placeholder;
}
public String getResult() {
return result;
}
}

View File

@ -147,122 +147,116 @@ public class PlayerDataManager {
if (hasPlayerData(player)) {
if (worldManager.isIslandWorld(player.getWorld())) {
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
Island island = islandManager.getIslandAtLocation(player.getLocation());
for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList);
if (island != null) {
Player targetPlayer = Bukkit.getServer().getPlayer(island.getOwnerUUID());
String targetPlayerName;
if (islandManager.isPlayerAtIsland(island, player, world)) {
Player targetPlayer = Bukkit.getServer().getPlayer(islandList);
String targetPlayerName;
if (targetPlayer == null) {
targetPlayerName = new OfflinePlayer(islandList).getName();
} else {
targetPlayerName = targetPlayer.getName();
}
if (banManager.hasIsland(islandList)
&& fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& banManager.getIsland(islandList).isBanned(player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Teleport.Island.Message").replace("%player",
targetPlayerName));
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
PlayerData playerData = getPlayerData(player);
playerData.setIsland(island.getOwnerUUID());
if (world == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration()
.getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
return;
} else if (island.isOpen() || island.isCoopPlayer(player.getUniqueId())) {
if (!island.isOpen() && island.isCoopPlayer(player.getUniqueId())) {
if (islandManager.removeCoopPlayers(island, null)) {
return;
}
}
PlayerData playerData = getPlayerData(player);
playerData.setIsland(island.getOwnerUUID());
if (world == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration()
.getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
if (scoreboardManager != null) {
for (Player all : Bukkit.getOnlinePlayers()) {
PlayerData targetPlayerData = getPlayerData(all);
if (targetPlayerData.getOwner() != null
&& targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
Scoreboard scoreboard = scoreboardManager.getScoreboard(all);
scoreboard.cancel();
if ((island.getRole(IslandRole.Member).size()
+ island.getRole(IslandRole.Operator).size() + 1) == 1) {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Scoreboard.Island.Solo.Displayname")));
scoreboard.setDisplayList(configLoad
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
} else {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Scoreboard.Island.Team.Displayname")));
scoreboard.setDisplayList(configLoad
.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
Map<String, String> displayVariables = new HashMap<>();
displayVariables.put("%owner",
configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
displayVariables.put("%operator",
configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
displayVariables.put("%member",
configLoad.getString("Scoreboard.Island.Team.Word.Member"));
scoreboard.setDisplayVariables(displayVariables);
}
scoreboard.run();
}
}
}
return;
} else {
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player",
targetPlayerName));
}
}
LocationUtil.teleportPlayerToSpawn(player);
return;
if (targetPlayer == null) {
targetPlayerName = new OfflinePlayer(island.getOwnerUUID()).getName();
} else {
targetPlayerName = targetPlayer.getName();
}
if (banManager.hasIsland(island.getOwnerUUID())
&& fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& banManager.getIsland(island.getOwnerUUID()).isBanned(player.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Teleport.Island.Message")
.replace("%player", targetPlayerName));
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
PlayerData playerData = getPlayerData(player);
playerData.setIsland(island.getOwnerUUID());
if (world == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
return;
} else if (island.isOpen() || island.isCoopPlayer(player.getUniqueId())) {
if (!island.isOpen() && island.isCoopPlayer(player.getUniqueId())) {
if (islandManager.removeCoopPlayers(island, null)) {
return;
}
}
PlayerData playerData = getPlayerData(player);
playerData.setIsland(island.getOwnerUUID());
if (world == IslandWorld.Normal) {
if (!island.isWeatherSynchronized()) {
player.setPlayerTime(island.getTime(),
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
player.setPlayerWeather(island.getWeather());
}
}
islandManager.giveUpgrades(player, island);
islandManager.giveFly(player, island);
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
if (scoreboardManager != null) {
for (Player all : Bukkit.getOnlinePlayers()) {
PlayerData targetPlayerData = getPlayerData(all);
if (targetPlayerData.getOwner() != null
&& targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
Scoreboard scoreboard = scoreboardManager.getScoreboard(all);
scoreboard.cancel();
if ((island.getRole(IslandRole.Member).size()
+ island.getRole(IslandRole.Operator).size() + 1) == 1) {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Scoreboard.Island.Solo.Displayname")));
scoreboard.setDisplayList(configLoad
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
} else {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Scoreboard.Island.Team.Displayname")));
scoreboard.setDisplayList(configLoad
.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
Map<String, String> displayVariables = new HashMap<>();
displayVariables.put("%owner",
configLoad.getString("Scoreboard.Island.Team.Word.Owner"));
displayVariables.put("%operator",
configLoad.getString("Scoreboard.Island.Team.Word.Operator"));
displayVariables.put("%member",
configLoad.getString("Scoreboard.Island.Team.Word.Member"));
scoreboard.setDisplayVariables(displayVariables);
}
scoreboard.run();
}
}
}
return;
} else {
messageManager.sendMessage(player,
configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player",
targetPlayerName));
}
}
LocationUtil.teleportPlayerToSpawn(player);
return;
}
HashMap<UUID, Visit> visitIslands = skyblock.getVisitManager().getIslands();
@ -290,7 +284,7 @@ public class PlayerDataManager {
targetPlayerName));
} else {
islandManager.loadIsland(visitIslandList);
Island island = islandManager.getIsland(visitIslandList);
island = islandManager.getIsland(visitIslandList);
if (island != null) {
if (island.isOpen() || island.isCoopPlayer(player.getUniqueId())) {

View File

@ -24,6 +24,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.placeholder.Placeholder;
public class nInventoryUtil {
@ -115,28 +116,9 @@ public class nInventoryUtil {
return items;
}
public Item createItem(ItemStack is, String itemDisplayname, List<String> itemLore,
Map<String, String> itemLoreVariables, Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
return new Item(is, itemDisplayname, itemLore, itemLoreVariables, itemEnchantments, itemFlags);
}
public Map<String, String> createItemLoreVariable(String[] itemLoreVariables) {
Map<String, String> itemLoreVariablesFormatted = new HashMap<>();
for (String itemLoreVariableList : itemLoreVariables) {
String variableName = itemLoreVariableList.split("#")[0];
String variableObject;
if (itemLoreVariableList.split("#").length == 1) {
variableObject = "null";
} else {
variableObject = itemLoreVariableList.split("#")[1];
}
itemLoreVariablesFormatted.put(variableName, variableObject);
}
return itemLoreVariablesFormatted;
public Item createItem(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders,
Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
return new Item(is, itemDisplayname, itemLore, placeholders, itemEnchantments, itemFlags);
}
public void open() {
@ -199,17 +181,17 @@ public class nInventoryUtil {
private ItemStack is;
private String itemDisplayname;
private Map<String, String> itemLoreVariables;
private List<String> itemLore;
private Placeholder[] placeholders;
private Enchantment[] itemEnchantments;
private ItemFlag[] itemFlags;
public Item(ItemStack is, String itemDisplayname, List<String> itemLore, Map<String, String> itemLoreVariables,
public Item(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders,
Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
this.is = is;
this.itemDisplayname = ChatColor.translateAlternateColorCodes('&', itemDisplayname);
this.itemLore = itemLore;
this.itemLoreVariables = itemLoreVariables;
this.placeholders = placeholders;
this.itemEnchantments = itemEnchantments;
this.itemFlags = itemFlags;
}
@ -219,11 +201,11 @@ public class nInventoryUtil {
ArrayList<String> formattedItemLore = new ArrayList<>();
for (String itemLoreList : itemLore) {
if (itemLoreVariables != null) {
for (String itemLoreVariableList : itemLoreVariables.keySet()) {
if (itemLoreList.contains(itemLoreVariableList)) {
if (placeholders != null) {
for (Placeholder placeholderList : placeholders) {
if (itemLoreList.contains(placeholderList.getPlaceholder())) {
itemLoreList = ChatColor.translateAlternateColorCodes('&', itemLoreList
.replace(itemLoreVariableList, itemLoreVariables.get(itemLoreVariableList)));
.replace(placeholderList.getPlaceholder(), placeholderList.getResult()));
}
}
}

View File

@ -189,11 +189,11 @@ public final class LocationUtil {
if (config.getFileConfiguration().getString("Location.Spawn") == null) {
Bukkit.getServer().getLogger().log(Level.WARNING, "SkyBlock | Error: A spawn point hasn't been set.");
} else {
Location spawnLocation = fileManager.getLocation(config, "Location.Spawn", true);
Location spawnLocation = getSpawnLocation();
if (spawnLocation.getWorld() == null) {
if (spawnLocation == null) {
Bukkit.getServer().getLogger().log(Level.WARNING,
"SkyBlock | Error: The world for the spawn point is not loaded or no longer exists.");
"SkyBlock | Error: The location for the spawn point could not be found.");
return;
}
@ -201,13 +201,31 @@ public final class LocationUtil {
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
@Override
public void run() {
player.teleport(fileManager.getLocation(config, "Location.Spawn", true));
player.teleport(spawnLocation);
player.setFallDistance(0.0F);
}
});
}
}
public static Location getSpawnLocation() {
SkyBlock skyblock = SkyBlock.getInstance();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml"));
if (config.getFileConfiguration().getString("Location.Spawn") != null) {
Location location = fileManager.getLocation(config, "Location.Spawn", true);
if (location != null && location.getWorld() != null) {
return location;
}
}
return null;
}
public static Location getRandomLocation(World world, int xRange, int zRange, boolean loadChunk,
boolean ignoreLiquid) {
Random rnd = new Random();

View File

@ -142,12 +142,20 @@ public final class BlockUtil {
blockData.setStateType(BlockStateType.COMMANDBLOCK.toString());
} else if (blockState instanceof CreatureSpawner) {
CreatureSpawner creatureSpawner = (CreatureSpawner) blockState;
blockData.setEntity(creatureSpawner.getSpawnedType().toString());
if (creatureSpawner.getSpawnedType() != null) {
blockData.setEntity(creatureSpawner.getSpawnedType().toString());
}
blockData.setDelay(creatureSpawner.getDelay());
blockData.setStateType(BlockStateType.CREATURESPAWNER.toString());
} else if (blockState instanceof Jukebox) {
Jukebox jukebox = (Jukebox) blockState;
blockData.setPlaying(jukebox.getPlaying().toString());
if (jukebox.getPlaying() != null) {
blockData.setPlaying(jukebox.getPlaying().toString());
}
blockData.setStateType(BlockStateType.JUKEBOX.toString());
} else if (blockState instanceof Sign) {
Sign sign = (Sign) blockState;
@ -347,8 +355,12 @@ public final class BlockUtil {
}
} else if (blockTypeState == BlockStateType.CREATURESPAWNER) {
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
if (blockData.getEntity() != null) {
creatureSpawner.setSpawnedType(EntityType.valueOf(blockData.getEntity().toUpperCase()));
}
creatureSpawner.setDelay(blockData.getDelay());
creatureSpawner.setSpawnedType(EntityType.valueOf(blockData.getEntity().toUpperCase()));
} else if (blockTypeState == BlockStateType.FURNACE) {
Furnace furnace = (Furnace) block.getState();
furnace.setBurnTime(blockData.getBurnTime());
@ -362,7 +374,10 @@ public final class BlockUtil {
}
} else if (blockTypeState == BlockStateType.JUKEBOX) {
Jukebox jukebox = (Jukebox) block.getState();
jukebox.setPlaying(Material.valueOf(blockData.getPlaying().toUpperCase()));
if (blockData.getPlaying() != null) {
jukebox.setPlaying(Material.valueOf(blockData.getPlaying().toUpperCase()));
}
} else if (blockTypeState == BlockStateType.SIGN) {
Sign sign = (Sign) block.getState();

View File

@ -206,21 +206,27 @@ Island:
# [!] If Enabled Players will respawn at the Island they died at. If Disabled
# Players will respawn at the Spawn location.
Island: true
Damage:
# When the setting 'Damage' has been disabled, if this option is enabled, players will take
# damage at an island. This discludes entity and void damage.
Enable: false
PvP:
# When the setting 'PvP' has been disabled, if this option is enabled, players will be
# able to damage other players at an island.
Enable: false
KeepItemsOnDeath:
# When the setting 'KeepItemsOnDeath' has been disabled, if this option is enabled, players will keep
# items in their inventory if they die at an island.
Enable: true
Settings:
# When disabled, players will not lose their items when they die at an island and
# the setting will be removed from the Island Settings menu.
# When any of these options are disabled, the setting will be removed from the 'Island Settings'
# menu.
KeepItemsOnDeath:
Enable: true
# When disabled, players will not take any damage from entities when at an island
# and the setting will be removed from the Island Settings menu.
PvP:
Enable: true
# When disabled, players will not take any damage when at an island and the setting
# will be removed from the Island Settings menu. This setting discludes entity and
# void damage.
Damage:
Enable: true
# When disabled, the hunger setting will be removed from the Island Settings menu.
Hunger:
Enable: false
Portal:
@ -235,18 +241,4 @@ Island:
Scoreboard:
Enable: true
Generator:
Enable: true
# Stuff you shouldn't change
World:
Normal:
nextAvailableLocation:
x: 0.0
z: 0.0
Nether:
nextAvailableLocation:
x: 0.0
z: 0.0
End:
nextAvailableLocation:
x: 0.0
z: 0.0
Enable: true

View File

@ -549,6 +549,8 @@ Command:
Message: "&bSkyBlock &8| &aInfo&8: &eYou are no longer an Island owner."
Open:
Message: "&bSkyBlock &8| &cError&8: &eYou must close your island before deleting it."
Spawn:
Message: "&bSkyBlock &8| &cError&8: &eYou cannot delete your island because the main spawn point is set there."
Broadcast:
Message: "&bSkyBlock &8| &aInfo&8: &eThe Island owner has disbanded the Island."
Confirmed:

View File

@ -1,10 +1,10 @@
name: SkyBlock
main: me.goodandevil.skyblock.SkyBlock
version: 53
version: 54
api-version: 1.13
description: A unique SkyBlock plugin
author: GoodAndEvil
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault]
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, Vault, Coins, LeaderHeads]
loadbefore: [Multiverse-Core]
commands:
island:

View File

@ -0,0 +1,13 @@
World:
Normal:
nextAvailableLocation:
x: 0.0
z: 0.0
Nether:
nextAvailableLocation:
x: 0.0
z: 0.0
End:
nextAvailableLocation:
x: 0.0
z: 0.0