mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 12:45:25 +01:00
Fixed a NullPointerException when being on an island during boot/reload
This commit is contained in:
parent
1ec1528af6
commit
7a4055d0ab
@ -49,8 +49,7 @@ public class TeleportCommand extends SubCommand {
|
||||
}
|
||||
|
||||
if (islandOwnerUUID == null) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -60,39 +59,31 @@ public class TeleportCommand extends SubCommand {
|
||||
boolean isCoopPlayer = false;
|
||||
|
||||
if (islandManager.containsIsland(islandOwnerUUID)) {
|
||||
if (islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
|
||||
.isCoopPlayer(player.getUniqueId())) {
|
||||
if (islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)).isCoopPlayer(player.getUniqueId())) {
|
||||
isCoopPlayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isCoopPlayer || player.hasPermission("fabledskyblock.bypass")
|
||||
|| player.hasPermission("fabledskyblock.bypass.*") || player.hasPermission("fabledskyblock.*")
|
||||
|| visit.isOpen()) {
|
||||
if (isCoopPlayer || player.hasPermission("fabledskyblock.bypass") || player.hasPermission("fabledskyblock.bypass.*") || player.hasPermission("fabledskyblock.*") || visit.isOpen()) {
|
||||
if (!islandManager.containsIsland(islandOwnerUUID)) {
|
||||
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
||||
}
|
||||
|
||||
islandManager.visitIsland(player,
|
||||
islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
|
||||
islandManager.visitIsland(player, islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Teleport.Teleported.Other.Message")
|
||||
.replace("%player", targetPlayerName));
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Other.Message").replace("%player", targetPlayerName));
|
||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Teleport.Island.Closed.Message"));
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.Closed.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
@ -110,8 +101,7 @@ public class TeleportCommand extends SubCommand {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Owner.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message"));
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Teleported.Yourself.Message"));
|
||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
@ -138,7 +128,7 @@ public class TeleportCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public String[] getAliases() {
|
||||
return new String[]{"tp", "spawn", "home", "go", "warp"};
|
||||
return new String[] { "tp", "spawn", "home", "go", "warp" };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
@ -195,6 +196,27 @@ public class IslandManager {
|
||||
for (IslandWorld worldList : IslandWorld.getIslandWorlds())
|
||||
prepareIsland(island, worldList);
|
||||
|
||||
for (IslandWorld world : IslandWorld.values()) {
|
||||
|
||||
for (IslandEnvironment env : IslandEnvironment.values()) {
|
||||
|
||||
Location loc = island.getLocation(world, env);
|
||||
|
||||
if (loc != null) {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
loc.getWorld().loadChunk(loc.getChunk());
|
||||
}
|
||||
|
||||
}.runTask(skyblock);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!visitManager.hasIsland(island.getOwnerUUID())) {
|
||||
visitManager.createIsland(island.getOwnerUUID(),
|
||||
new IslandLocation[] { island.getIslandLocation(IslandWorld.Normal, IslandEnvironment.Island), island.getIslandLocation(IslandWorld.Nether, IslandEnvironment.Island),
|
||||
|
@ -97,15 +97,14 @@ public class Teleport implements Listener {
|
||||
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);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,8 +125,7 @@ public class Teleport implements Listener {
|
||||
|
||||
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.setPlayerTime(island.getTime(), fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
||||
player.setPlayerWeather(island.getWeather());
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,21 @@ public class MessageManager {
|
||||
}
|
||||
|
||||
public void sendMessage(CommandSender sender, String message) {
|
||||
|
||||
if (message == null) {
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
System.out.println("Message is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (placeholderManager.isPlaceholderAPIEnabled()) {
|
||||
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message.replace("&", "clr"))
|
||||
.replace("clr", "&");
|
||||
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message.replace("&", "clr")).replace("clr", "&");
|
||||
}
|
||||
|
||||
if (message.contains("\n") || message.contains("\\n")) {
|
||||
@ -61,8 +69,7 @@ public class MessageManager {
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
|
||||
if (placeholderManager.isPlaceholderAPIEnabled()) {
|
||||
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message.replace("&", "clr"))
|
||||
.replace("clr", "&");
|
||||
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message.replace("&", "clr")).replace("clr", "&");
|
||||
}
|
||||
|
||||
return message;
|
||||
|
@ -53,8 +53,7 @@ public class PlayerDataManager {
|
||||
}
|
||||
|
||||
public void createPlayerData(Player player) {
|
||||
Config config = skyblock.getFileManager().getConfig(new File(
|
||||
new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId() + ".yml"));
|
||||
Config config = skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId() + ".yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
String[] playerTexture;
|
||||
@ -64,11 +63,11 @@ public class PlayerDataManager {
|
||||
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile");
|
||||
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
|
||||
Property property = gameProfile.getProperties().get("textures").iterator().next();
|
||||
playerTexture = new String[]{property.getSignature(), property.getValue()};
|
||||
playerTexture = new String[] { property.getSignature(), property.getValue() };
|
||||
} catch (Exception e) {
|
||||
playerTexture = new String[]{
|
||||
playerTexture = new String[] {
|
||||
"K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=",
|
||||
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"};
|
||||
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19" };
|
||||
}
|
||||
|
||||
configLoad.set("Texture.Signature", playerTexture[0]);
|
||||
@ -83,8 +82,7 @@ public class PlayerDataManager {
|
||||
}
|
||||
|
||||
public void loadPlayerData(Player player) {
|
||||
if (skyblock.getFileManager().isFileExist(new File(skyblock.getDataFolder().toString() + "/player-data",
|
||||
player.getUniqueId().toString() + ".yml"))) {
|
||||
if (skyblock.getFileManager().isFileExist(new File(skyblock.getDataFolder().toString() + "/player-data", player.getUniqueId().toString() + ".yml"))) {
|
||||
PlayerData playerData = new PlayerData(player);
|
||||
playerDataStorage.put(player.getUniqueId(), playerData);
|
||||
}
|
||||
@ -92,18 +90,14 @@ public class PlayerDataManager {
|
||||
|
||||
public void unloadPlayerData(Player player) {
|
||||
if (hasPlayerData(player)) {
|
||||
skyblock.getFileManager()
|
||||
.unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
|
||||
player.getUniqueId().toString() + ".yml"));
|
||||
skyblock.getFileManager().unloadConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
playerDataStorage.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
public void savePlayerData(Player player) {
|
||||
if (hasPlayerData(player)) {
|
||||
Config config = skyblock.getFileManager()
|
||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
|
||||
player.getUniqueId().toString() + ".yml"));
|
||||
Config config = skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), player.getUniqueId().toString() + ".yml"));
|
||||
|
||||
try {
|
||||
config.getFileConfiguration().save(config.getFile());
|
||||
@ -158,24 +152,17 @@ public class PlayerDataManager {
|
||||
targetPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
if (banManager.hasIsland(island.getOwnerUUID())
|
||||
&& fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
|
||||
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.Banned.Island.Message")
|
||||
.replace("%player", targetPlayerName));
|
||||
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.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())) {
|
||||
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.setPlayerTime(island.getTime(), fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
||||
player.setPlayerWeather(island.getWeather());
|
||||
}
|
||||
}
|
||||
@ -195,9 +182,7 @@ public class PlayerDataManager {
|
||||
|
||||
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.setPlayerTime(island.getTime(), fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
||||
player.setPlayerWeather(island.getWeather());
|
||||
}
|
||||
}
|
||||
@ -210,29 +195,20 @@ public class PlayerDataManager {
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
PlayerData targetPlayerData = getPlayerData(all);
|
||||
|
||||
if (targetPlayerData.getOwner() != null
|
||||
&& targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
if (targetPlayerData.getOwner() != null && targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
Scoreboard scoreboard = scoreboardManager.getScoreboard(all);
|
||||
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
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);
|
||||
}
|
||||
@ -244,9 +220,7 @@ public class PlayerDataManager {
|
||||
|
||||
return;
|
||||
} else {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player",
|
||||
targetPlayerName));
|
||||
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,8 +235,7 @@ public class PlayerDataManager {
|
||||
Visit visit = visitIslands.get(visitIslandList);
|
||||
IslandLocation location = visit.getLocation(world);
|
||||
|
||||
if (location != null && LocationUtil.isLocationAtLocationRadius(player.getLocation(),
|
||||
location.getLocation(), visit.getRadius())) {
|
||||
if (location != null && LocationUtil.isLocationAtLocationRadius(player.getLocation(), location.getLocation(), visit.getRadius())) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(visitIslandList);
|
||||
String targetPlayerName;
|
||||
|
||||
@ -272,16 +245,11 @@ public class PlayerDataManager {
|
||||
targetPlayerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
if (banManager.hasIsland(visitIslandList)
|
||||
&& fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
|
||||
if (banManager.hasIsland(visitIslandList) && fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")
|
||||
&& banManager.getIsland(visitIslandList).isBanned(player.getUniqueId())) {
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player",
|
||||
targetPlayerName));
|
||||
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player", targetPlayerName));
|
||||
} else {
|
||||
org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer()
|
||||
.getOfflinePlayer(visitIslandList);
|
||||
org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(visitIslandList);
|
||||
|
||||
islandManager.loadIsland(offlinePlayer);
|
||||
island = islandManager.getIsland(offlinePlayer);
|
||||
@ -290,8 +258,7 @@ public class PlayerDataManager {
|
||||
if (island.isOpen() || island.isCoopPlayer(player.getUniqueId())) {
|
||||
if (!island.isOpen() && island.isCoopPlayer(player.getUniqueId())) {
|
||||
if (islandManager.removeCoopPlayers(island, null)) {
|
||||
islandManager.unloadIsland(island,
|
||||
Bukkit.getServer().getOfflinePlayer(visitIslandList));
|
||||
islandManager.unloadIsland(island, Bukkit.getServer().getOfflinePlayer(visitIslandList));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -302,10 +269,7 @@ public class PlayerDataManager {
|
||||
|
||||
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.setPlayerTime(island.getTime(), fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
||||
player.setPlayerWeather(island.getWeather());
|
||||
}
|
||||
}
|
||||
@ -314,11 +278,8 @@ public class PlayerDataManager {
|
||||
|
||||
return;
|
||||
} else {
|
||||
islandManager.unloadIsland(island,
|
||||
Bukkit.getServer().getOfflinePlayer(visitIslandList));
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Island.Visit.Closed.Island.Message")
|
||||
.replace("%player", targetPlayerName));
|
||||
islandManager.unloadIsland(island, Bukkit.getServer().getOfflinePlayer(visitIslandList));
|
||||
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -833,6 +833,9 @@ Command:
|
||||
Message: '&f&oOpens a menu of public Islands to Visit.'
|
||||
Invalid:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eInvalid: /island visit [<player>]'
|
||||
Closed:
|
||||
Island:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eThe island you were at closed.'
|
||||
Help:
|
||||
Page:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eThere are not that many pages.'
|
||||
|
Loading…
Reference in New Issue
Block a user