Bug Fixes

# Fixed players being teleported to the nether island world when they enter a nether portal when the nether island world is disabled.
# Fixed command tab completion suggesting all available commands rather than commands that contain an entered argument.
# Fixed Island level not updating in the Visit menu or the Leaderboard menu when peforming an Island level request.
# Fixed NPE when voting for another Island when the player who's voting doesn't own one.
# Fixed the Visit menu displaying the previous owner when changing the Island owner.
# Fixed players being able to remain in the nether island world when it is disabled.
# Fixed NSME when pasting an Island structure on creation when using 1.13 release 1.
# Fixed chunk error when setting the Island biome on 1.13.x builds.
# Fixed Leaderboard not sort values correctly.
This commit is contained in:
Unknown 2018-11-23 16:41:11 +00:00
parent 5b62969a6a
commit 5189a035d0
17 changed files with 174 additions and 51 deletions

View File

@ -658,6 +658,9 @@ Island:
Signature: Signature:
Disabled: Disabled:
Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to use that feature." Message: "&bSkyBlock &8| &cError&8: &eYou don't have permission to use that feature."
World:
Nether:
Message: "&bSkyBlock &8| &aInfo&8: &eYou have been teleported out of the nether because the nether is disabled."
WorldBorder: WorldBorder:
Outside: Outside:
Message: "&bSkyBlock &8| &cError&8: &eYou went too far outside the Island WorldBorder." Message: "&bSkyBlock &8| &cError&8: &eYou went too far outside the Island WorldBorder."

View File

@ -1,6 +1,6 @@
name: SkyBlock name: SkyBlock
main: me.goodandevil.skyblock.Main main: me.goodandevil.skyblock.Main
version: 21 version: 22
api-version: 1.13 api-version: 1.13
description: A unique SkyBlock plugin description: A unique SkyBlock plugin
author: GoodAndEvil author: GoodAndEvil

View File

@ -245,21 +245,51 @@ public class CommandManager implements CommandExecutor, TabCompleter {
List<String> commandAliases = new ArrayList<>(); List<String> commandAliases = new ArrayList<>();
if (args.length == 1) { if (args.length == 1) {
commandAliases.add("admin"); if (args[0] == null || args[0].isEmpty()) {
commandAliases.add("admin");
for (SubCommand subCommandList : subCommands.get(Type.Default)) { for (SubCommand subCommandList : subCommands.get(Type.Default)) {
commandAliases.add(subCommandList.getName()); commandAliases.add(subCommandList.getName());
}
} else {
if ("admin".contains(args[0].toLowerCase())) {
commandAliases.add("admin");
}
for (SubCommand subCommandList : subCommands.get(Type.Default)) {
if (subCommandList.getName().toLowerCase().contains(args[0].toLowerCase())) {
commandAliases.add(subCommandList.getName());
}
}
} }
} else if (args.length == 2) { } else if (args.length == 2) {
if (args[0].equalsIgnoreCase("admin")) { if (args[0].equalsIgnoreCase("admin")) {
for (SubCommand subCommandList : subCommands.get(Type.Admin)) { if (args[1] == null || args[1].isEmpty()) {
commandAliases.add(subCommandList.getName()); for (SubCommand subCommandList : subCommands.get(Type.Admin)) {
commandAliases.add(subCommandList.getName());
}
} else {
for (SubCommand subCommandList : subCommands.get(Type.Admin)) {
if (subCommandList.getName().toLowerCase().contains(args[1].toLowerCase())) {
commandAliases.add(subCommandList.getName());
}
}
} }
} }
} else if (args.length == 3) { } else if (args.length == 3) {
if (args[0].equalsIgnoreCase("admin") && args[1].equalsIgnoreCase("structure")) { if (args[0].equalsIgnoreCase("admin") && args[1].equalsIgnoreCase("structure")) {
commandAliases.add("tool"); if (args[2] == null || args[2].isEmpty()) {
commandAliases.add("save"); commandAliases.add("tool");
commandAliases.add("save");
} else {
if ("tool".contains(args[2].toLowerCase())) {
commandAliases.add("tool");
}
if ("save".contains(args[2].toLowerCase())) {
commandAliases.add("save");
}
}
} }
} }

View File

@ -146,12 +146,12 @@ public class Island {
}.runTask(plugin); }.runTask(plugin);
} }
level = new Level(this, plugin); level = new Level(getOwnerUUID(), plugin);
VisitManager visitManager = plugin.getVisitManager(); VisitManager visitManager = plugin.getVisitManager();
if (!visitManager.hasIsland(getOwnerUUID())) { if (!visitManager.hasIsland(getOwnerUUID())) {
visitManager.createIsland(getOwnerUUID(), new org.bukkit.Location[] { getLocation(Location.World.Normal, Location.Environment.Island), getLocation(Location.World.Nether, Location.Environment.Island) }, size, getRole(Role.Member).size() + getRole(Role.Operator).size() + 1, level.getLevel(), getMessage(Message.Signature), isOpen()); visitManager.createIsland(getOwnerUUID(), new org.bukkit.Location[] { getLocation(Location.World.Normal, Location.Environment.Island), getLocation(Location.World.Nether, Location.Environment.Island) }, size, getRole(Role.Member).size() + getRole(Role.Operator).size() + 1, level, getMessage(Message.Signature), isOpen());
} }
BanManager banManager = plugin.getBanManager(); BanManager banManager = plugin.getBanManager();

View File

@ -39,6 +39,7 @@ import me.goodandevil.skyblock.structure.Structure;
import me.goodandevil.skyblock.utils.OfflinePlayer; import me.goodandevil.skyblock.utils.OfflinePlayer;
import me.goodandevil.skyblock.utils.structure.StructureUtil; import me.goodandevil.skyblock.utils.structure.StructureUtil;
import me.goodandevil.skyblock.utils.version.Materials; import me.goodandevil.skyblock.utils.version.Materials;
import me.goodandevil.skyblock.utils.version.NMSUtil;
import me.goodandevil.skyblock.utils.world.LocationUtil; import me.goodandevil.skyblock.utils.world.LocationUtil;
import me.goodandevil.skyblock.utils.world.WorldBorder; import me.goodandevil.skyblock.utils.world.WorldBorder;
import me.goodandevil.skyblock.utils.world.block.BlockDegreesType; import me.goodandevil.skyblock.utils.world.block.BlockDegreesType;
@ -185,12 +186,14 @@ public class IslandManager {
} }
}.runTask(plugin); }.runTask(plugin);
Bukkit.getServer().getScheduler().runTaskLater(plugin, new Runnable() { if (NMSUtil.getVersionNumber() < 13) {
@Override Bukkit.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
public void run() { @Override
plugin.getBiomeManager().setBiome(null, island, Biome.valueOf(fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getString("Island.Biome.Default.Type").toUpperCase())); public void run() {
} plugin.getBiomeManager().setBiome(null, island, Biome.valueOf(fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getString("Island.Biome.Default.Type").toUpperCase()));
}, 20L); }
}, 20L);
}
} }
public void giveIslandOwnership(UUID uuid) { public void giveIslandOwnership(UUID uuid) {
@ -209,6 +212,7 @@ public class IslandManager {
if (containsIsland(islandOwnerUUID)) { if (containsIsland(islandOwnerUUID)) {
Island island = getIsland(islandOwnerUUID); Island island = getIsland(islandOwnerUUID);
island.getLevel().setOwnerUUID(uuid);
island.setOwnerUUID(uuid); island.setOwnerUUID(uuid);
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")); Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -13,18 +14,19 @@ import me.goodandevil.skyblock.config.FileManager.Config;
public class Level { public class Level {
private final Main plugin; private final Main plugin;
private final Island island;
private UUID ownerUUID;
private int lastLevel = 0; private int lastLevel = 0;
private int lastPoints = 0; private int lastPoints = 0;
private Map<String, Integer> materials; private Map<String, Integer> materials;
public Level(Island island, Main plugin) { public Level(UUID ownerUUID, Main plugin) {
this.island = island;
this.plugin = plugin; this.plugin = plugin;
this.ownerUUID = ownerUUID;
Config config = plugin.getFileManager().getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), island.getOwnerUUID().toString() + ".yml")); Config config = plugin.getFileManager().getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
Map<String, Integer> materials = new HashMap<>(); Map<String, Integer> materials = new HashMap<>();
@ -40,6 +42,10 @@ public class Level {
this.materials = materials; this.materials = materials;
} }
public void setOwnerUUID(UUID ownerUUID) {
this.ownerUUID = ownerUUID;
}
public int getPoints() { public int getPoints() {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "levelling.yml")); Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "levelling.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
@ -72,7 +78,7 @@ public class Level {
} }
public void setMaterials(Map<String, Integer> materials) { public void setMaterials(Map<String, Integer> materials) {
Config config = plugin.getFileManager().getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), island.getOwnerUUID().toString() + ".yml")); Config config = plugin.getFileManager().getConfig(new File(new File(plugin.getDataFolder().toString() + "/island-data"), ownerUUID.toString() + ".yml"));
File configFile = config.getFile(); File configFile = config.getFile();
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();

View File

@ -2,9 +2,8 @@ package me.goodandevil.skyblock.leaderboard;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import me.goodandevil.skyblock.Main; import me.goodandevil.skyblock.Main;
@ -28,23 +27,37 @@ public class LeaderboardManager {
public void resetLeaderboard() { public void resetLeaderboard() {
VisitManager visitManager = plugin.getVisitManager(); VisitManager visitManager = plugin.getVisitManager();
Map<UUID, Integer> islandLevels = new LinkedHashMap<>(); List<LeaderboardPlayer> islandLevels = new ArrayList<>();
Map<UUID, Integer> islandVotes = new LinkedHashMap<>(); List<LeaderboardPlayer> islandVotes = new ArrayList<>();
for (int i = 0; i < visitManager.getIslands().size(); i++) { for (int i = 0; i < visitManager.getIslands().size(); i++) {
UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i]; UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i];
Visit visit = visitManager.getIslands().get(ownerUUID); Visit visit = visitManager.getIslands().get(ownerUUID);
islandLevels.put(ownerUUID, visit.getLevel()); islandLevels.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel()));
islandVotes.put(ownerUUID, visit.getVoters().size()); islandVotes.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size()));
} }
islandLevels.sort(new Comparator<LeaderboardPlayer>() {
@Override
public int compare(LeaderboardPlayer leaderboardPlayer1, LeaderboardPlayer leaderboardPlayer2) {
return Integer.valueOf(leaderboardPlayer2.getValue()).compareTo(leaderboardPlayer1.getValue());
}
});
islandVotes.sort(new Comparator<LeaderboardPlayer>() {
@Override
public int compare(LeaderboardPlayer leaderboardPlayer1, LeaderboardPlayer leaderboardPlayer2) {
return Integer.valueOf(leaderboardPlayer2.getValue()).compareTo(leaderboardPlayer1.getValue());
}
});
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (islandLevels.size() != 0 && i <= islandLevels.size()-1) { if (islandLevels.size() != 0 && i <= islandLevels.size()-1) {
leaderboardStorage.add(new Leaderboard(Leaderboard.Type.Level, visitManager.getIsland((UUID) islandLevels.keySet().toArray()[i]), i)); leaderboardStorage.add(new Leaderboard(Leaderboard.Type.Level, visitManager.getIsland((UUID) islandLevels.get(i).getUUID()), i));
} }
if (islandVotes.size() != 0 && i <= islandVotes.size()-1) { if (islandVotes.size() != 0 && i <= islandVotes.size()-1) {
leaderboardStorage.add(new Leaderboard(Leaderboard.Type.Votes, visitManager.getIsland((UUID) islandLevels.keySet().toArray()[i]), i)); leaderboardStorage.add(new Leaderboard(Leaderboard.Type.Votes, visitManager.getIsland((UUID) islandLevels.get(i).getUUID()), i));
} }
} }
} }

View File

@ -0,0 +1,22 @@
package me.goodandevil.skyblock.leaderboard;
import java.util.UUID;
public class LeaderboardPlayer {
private UUID uuid;
private int value;
public LeaderboardPlayer(UUID uuid, int value) {
this.uuid = uuid;
this.value = value;
}
public UUID getUUID() {
return uuid;
}
public int getValue() {
return value;
}
}

View File

@ -155,7 +155,6 @@ public class LevellingManager {
level.setLastPoints(level.getPoints()); level.setLastPoints(level.getPoints());
level.setLastLevel(level.getLevel()); level.setLastLevel(level.getLevel());
level.setMaterials(materials); level.setMaterials(materials);
island.getVisit().setLevel(level.getLevel());
if (player != null) { if (player != null) {
me.goodandevil.skyblock.menus.Levelling.getInstance().open(player); me.goodandevil.skyblock.menus.Levelling.getInstance().open(player);

View File

@ -12,6 +12,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import me.goodandevil.skyblock.Main; import me.goodandevil.skyblock.Main;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager; import me.goodandevil.skyblock.island.IslandManager;
@ -38,16 +39,48 @@ public class Move implements Listener {
Location to = event.getTo(); Location to = event.getTo();
if (from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ()) { if (from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ()) {
if (player.getWorld().getName().equals(plugin.getWorldManager().getWorld(me.goodandevil.skyblock.island.Location.World.Normal).getName()) || player.getWorld().getName().equals(plugin.getWorldManager().getWorld(me.goodandevil.skyblock.island.Location.World.Nether).getName())) { String netherWorldName = plugin.getWorldManager().getWorld(me.goodandevil.skyblock.island.Location.World.Nether).getName();
if (player.getWorld().getName().equals(plugin.getWorldManager().getWorld(me.goodandevil.skyblock.island.Location.World.Normal).getName()) || player.getWorld().getName().equals(netherWorldName)) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager(); PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager(); SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
if (player.getWorld().getName().equals(netherWorldName)) {
if (!fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World.Nether.Enable")) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.World.Nether.Message")));
if (playerDataManager.hasPlayerData(player)) {
PlayerData playerData = playerDataManager.getPlayerData(player);
if (playerData.getIsland() != null) {
Island island = islandManager.getIsland(playerData.getIsland());
if (island != null) {
if (island.getVisit().isVisitor(player.getUniqueId())) {
player.teleport(island.getLocation(me.goodandevil.skyblock.island.Location.World.Normal, me.goodandevil.skyblock.island.Location.Environment.Visitor));
} else {
player.teleport(island.getLocation(me.goodandevil.skyblock.island.Location.World.Normal, me.goodandevil.skyblock.island.Location.Environment.Main));
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
return;
}
}
}
LocationUtil.teleportPlayerToSpawn(player);
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
}
}
if (playerDataManager.hasPlayerData(player)) { if (playerDataManager.hasPlayerData(player)) {
PlayerData playerData = playerDataManager.getPlayerData(player); PlayerData playerData = playerDataManager.getPlayerData(player);
UUID islandOwnerUUID = playerData.getIsland(); UUID islandOwnerUUID = playerData.getIsland();
if (islandOwnerUUID != null) { if (islandOwnerUUID != null) {
IslandManager islandManager = plugin.getIslandManager();
Island island = islandManager.getIsland(islandOwnerUUID); Island island = islandManager.getIsland(islandOwnerUUID);
if (island != null) { if (island != null) {
@ -60,7 +93,7 @@ public class Move implements Listener {
} }
if (world != null) { if (world != null) {
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")); Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.World." + world.name() + ".Liquid.Enable")) { if (configLoad.getBoolean("Island.World." + world.name() + ".Liquid.Enable")) {

View File

@ -10,6 +10,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEnterEvent; import org.bukkit.event.entity.EntityPortalEnterEvent;
import me.goodandevil.skyblock.Main; import me.goodandevil.skyblock.Main;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.Location; import me.goodandevil.skyblock.island.Location;
import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.sound.SoundManager;
@ -35,18 +36,19 @@ public class Portal implements Listener {
IslandManager islandManager = plugin.getIslandManager(); IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager(); SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
if (player.getWorld().getName().equals(plugin.getWorldManager().getWorld(Location.World.Normal).getName())) { if (player.getWorld().getName().equals(plugin.getWorldManager().getWorld(Location.World.Normal).getName())) {
for (UUID islandList : islandManager.getIslands().keySet()) { for (UUID islandList : islandManager.getIslands().keySet()) {
Island island = islandManager.getIslands().get(islandList); Island island = islandManager.getIslands().get(islandList);
if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(Location.World.Normal, Location.Environment.Island), island.getRadius())) { if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(Location.World.Normal, Location.Environment.Island), island.getRadius())) {
if (islandManager.hasPermission(player, "Portal")) { if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World.Nether.Enable") && islandManager.hasPermission(player, "Portal")) {
player.teleport(island.getLocation(Location.World.Nether, Location.Environment.Main)); player.teleport(island.getLocation(Location.World.Nether, Location.Environment.Main));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else { } else {
player.teleport(island.getLocation(Location.World.Normal, Location.Environment.Main)); player.teleport(island.getLocation(Location.World.Normal, Location.Environment.Main));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"))); player.sendMessage(ChatColor.translateAlternateColorCodes('&', fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message")));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
} }
@ -58,12 +60,12 @@ public class Portal implements Listener {
Island island = islandManager.getIslands().get(islandList); Island island = islandManager.getIslands().get(islandList);
if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(Location.World.Nether, Location.Environment.Island), island.getRadius())) { if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(Location.World.Nether, Location.Environment.Island), island.getRadius())) {
if (islandManager.hasPermission(player, "Portal")) { if (fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World.Nether.Enable") && islandManager.hasPermission(player, "Portal")) {
player.teleport(island.getLocation(Location.World.Normal, Location.Environment.Main)); player.teleport(island.getLocation(Location.World.Normal, Location.Environment.Main));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
} else { } else {
player.teleport(island.getLocation(Location.World.Nether, Location.Environment.Main)); player.teleport(island.getLocation(Location.World.Nether, Location.Environment.Main));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"))); player.sendMessage(ChatColor.translateAlternateColorCodes('&', fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message")));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
} }

View File

@ -125,7 +125,7 @@ public class Leaderboard implements Listener {
} }
} }
inv.addItem(inv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]), configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname").replace("%position", "" + (leaderboard.getPosition() + 1)), itemLore, inv.createItemLoreVariable(new String[] { "%position#" + (leaderboard.getPosition() + 1), "%owner#" + playerName, "%level#" + visit.getLevel(), "%votes#" + visit.getVoters().size(), "%members#" + visit.getMembers() }), null, null), itemSlot); inv.addItem(inv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]), configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname").replace("%position", "" + (leaderboard.getPosition() + 1)), itemLore, inv.createItemLoreVariable(new String[] { "%position#" + (leaderboard.getPosition() + 1), "%owner#" + playerName, "%level#" + visit.getLevel().getLevel(), "%votes#" + visit.getVoters().size(), "%members#" + visit.getMembers() }), null, null), itemSlot);
} }
int[] itemSlots = new int[] { 13, 21, 22, 23, 29, 31, 33, 37, 40, 43 }; int[] itemSlots = new int[] { 13, 21, 22, 23, 29, 31, 33, 37, 40, 43 };

View File

@ -90,7 +90,7 @@ public class Visit implements Listener {
islandInteger = islandManager.getPlayersAtIsland(islandManager.getIsland(visitIslandList)).size(); islandInteger = islandManager.getPlayersAtIsland(islandManager.getIsland(visitIslandList)).size();
} }
} else if (sort == Visit.Sort.Level) { } else if (sort == Visit.Sort.Level) {
islandInteger = visitIslands.get(visitIslandList).getLevel(); islandInteger = visitIslands.get(visitIslandList).getLevel().getLevel();
} else if (sort == Visit.Sort.Members) { } else if (sort == Visit.Sort.Members) {
islandInteger = visitIslands.get(visitIslandList).getMembers(); islandInteger = visitIslands.get(visitIslandList).getMembers();
} else if (sort == Visit.Sort.Visits) { } else if (sort == Visit.Sort.Visits) {
@ -333,7 +333,7 @@ public class Visit implements Listener {
if ((!island.isRole(Role.Member, player.getUniqueId()) && !island.isRole(Role.Operator, player.getUniqueId()) && !island.isRole(Role.Owner, player.getUniqueId())) && fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Vote")) { if ((!island.isRole(Role.Member, player.getUniqueId()) && !island.isRole(Role.Operator, player.getUniqueId()) && !island.isRole(Role.Owner, player.getUniqueId())) && fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Vote")) {
if (event.getClick() == ClickType.RIGHT) { if (event.getClick() == ClickType.RIGHT) {
if (playerData.getIsland().equals(island.getOwnerUUID())) { if (playerData.getIsland() != null && playerData.getIsland().equals(island.getOwnerUUID())) {
List<UUID> islandVotes = visit.getVoters(); List<UUID> islandVotes = visit.getVoters();
if (islandVotes.contains(player.getUniqueId())) { if (islandVotes.contains(player.getUniqueId())) {

View File

@ -17,6 +17,11 @@ public class NMSUtil {
return Integer.valueOf(name.substring(0, name.length() - 4)); return Integer.valueOf(name.substring(0, name.length() - 4));
} }
public static int getVersionReleaseNumber() {
String NMSVersion = getVersion();
return Integer.valueOf(NMSVersion.substring(NMSVersion.length() - 2).replace(".", ""));
}
public static Class<?> getNMSClass(String className) { public static Class<?> getNMSClass(String className) {
try { try {
String fullName = "net.minecraft.server." + getVersion() + className; String fullName = "net.minecraft.server." + getVersion() + className;

View File

@ -401,7 +401,12 @@ public final class BlockUtil {
Object block = NMSUtil.getNMSClass("Blocks").getField(material.name()).get(null); Object block = NMSUtil.getNMSClass("Blocks").getField(material.name()).get(null);
Object IBlockData = block.getClass().getMethod("getBlockData").invoke(block); Object IBlockData = block.getClass().getMethod("getBlockData").invoke(block);
worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class).invoke(worldHandle, blockPosition, IBlockData, 2); worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class).invoke(worldHandle, blockPosition, IBlockData, 2);
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class).invoke(chunk, blockPosition, IBlockData, true);
if (NMSUtil.getVersionReleaseNumber() > 1) {
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class).invoke(chunk, blockPosition, IBlockData, true);
} else {
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class).invoke(chunk, blockPosition, IBlockData, true);
}
} else { } else {
Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null, material.getId() + (data << 12)); Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null, material.getId() + (data << 12));
worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class).invoke(worldHandle, blockPosition, IBlockData, 3); worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class).invoke(worldHandle, blockPosition, IBlockData, 3);

View File

@ -11,6 +11,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import me.goodandevil.skyblock.Main; import me.goodandevil.skyblock.Main;
import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.island.Level;
public class Visit { public class Visit {
@ -22,13 +23,14 @@ public class Visit {
private int islandSize; private int islandSize;
private int islandMembers; private int islandMembers;
private int islandLevel;
private final Level islandLevel;
private List<String> islandSignature; private List<String> islandSignature;
private boolean open; private boolean open;
protected Visit(Main plugin, UUID islandOwnerUUID, Location[] islandLocations, int islandSize, int islandMembers, int islandLevel, List<String> islandSignature, boolean open) { protected Visit(Main plugin, UUID islandOwnerUUID, Location[] islandLocations, int islandSize, int islandMembers, Level islandLevel, List<String> islandSignature, boolean open) {
this.plugin = plugin; this.plugin = plugin;
this.islandOwnerUUID = islandOwnerUUID; this.islandOwnerUUID = islandOwnerUUID;
this.islandLocations = islandLocations; this.islandLocations = islandLocations;
@ -73,14 +75,10 @@ public class Visit {
this.islandSize = islandSize; this.islandSize = islandSize;
} }
public int getLevel() { public Level getLevel() {
return islandLevel; return islandLevel;
} }
public void setLevel(int islandLevel) {
this.islandLevel = islandLevel;
}
public boolean isVisitor(UUID uuid) { public boolean isVisitor(UUID uuid) {
return getVisitors().contains(uuid); return getVisitors().contains(uuid);
} }

View File

@ -19,6 +19,7 @@ import me.goodandevil.skyblock.Main;
import me.goodandevil.skyblock.config.FileManager; import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config; import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.island.Island; import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.Level;
import me.goodandevil.skyblock.sound.SoundManager; import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil; import me.goodandevil.skyblock.utils.world.LocationUtil;
@ -73,7 +74,7 @@ public class VisitManager {
size = configLoad.getInt("Size"); size = configLoad.getInt("Size");
} }
createIsland(islandOwnerUUID, new Location[] { fileManager.getLocation(config, "Location.Normal.Island", true), fileManager.getLocation(config, "Location.Nether.Island", true) }, size, configLoad.getStringList("Members").size() + configLoad.getStringList("Operators").size() + 1, configLoad.getInt("Levelling.Points") / division, islandSignature, configLoad.getBoolean("Visitor.Open")); createIsland(islandOwnerUUID, new Location[] { fileManager.getLocation(config, "Location.Normal.Island", true), fileManager.getLocation(config, "Location.Nether.Island", true) }, size, configLoad.getStringList("Members").size() + configLoad.getStringList("Operators").size() + 1, new Level(islandOwnerUUID, plugin), islandSignature, configLoad.getBoolean("Visitor.Open"));
} }
} }
} }
@ -81,6 +82,8 @@ public class VisitManager {
public void transfer(UUID uuid, UUID islandOwnerUUID) { public void transfer(UUID uuid, UUID islandOwnerUUID) {
Visit visit = getIsland(islandOwnerUUID); Visit visit = getIsland(islandOwnerUUID);
visit.setOwnerUUID(uuid);
visit.getLevel().setOwnerUUID(uuid);
visit.save(); visit.save();
File oldVisitDataFile = new File(new File(plugin.getDataFolder().toString() + "/visit-data"), islandOwnerUUID.toString() + ".yml"); File oldVisitDataFile = new File(new File(plugin.getDataFolder().toString() + "/visit-data"), islandOwnerUUID.toString() + ".yml");
@ -146,7 +149,7 @@ public class VisitManager {
return visitIslands; return visitIslands;
} }
public void createIsland(UUID islandOwnerUUID, Location[] islandLocations, int islandSize, int islandMembers, int islandLevel, List<String> islandSignature, boolean open) { public void createIsland(UUID islandOwnerUUID, Location[] islandLocations, int islandSize, int islandMembers, Level islandLevel, List<String> islandSignature, boolean open) {
visitStorage.put(islandOwnerUUID, new Visit(plugin, islandOwnerUUID, islandLocations, islandSize, islandMembers, islandLevel, islandSignature, open)); visitStorage.put(islandOwnerUUID, new Visit(plugin, islandOwnerUUID, islandLocations, islandSize, islandMembers, islandLevel, islandSignature, open));
} }