mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-24 03:05:56 +01:00
A lot of changes. See Commit description
This commit is contained in:
parent
811e0b5d04
commit
24c60dd35d
@ -41,12 +41,14 @@ import com.songoda.update.SongodaUpdate;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SkyBlock extends JavaPlugin {
|
public class SkyBlock extends JavaPlugin {
|
||||||
|
|
||||||
|
@ -228,12 +228,26 @@ public class IslandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an Island permanently
|
* Executes the {@link IslandManager#deleteIsland(Island, boolean)} method with <code>island<code> and
|
||||||
|
* <code>true<code> as the parameters
|
||||||
|
* <p>
|
||||||
|
* See {@link IslandManager#deleteIsland(Island, boolean)}
|
||||||
*/
|
*/
|
||||||
public void deleteIsland(Island island) {
|
public void deleteIsland(Island island) {
|
||||||
Preconditions.checkArgument(island != null, "Cannot delete island to null island");
|
Preconditions.checkArgument(island != null, "Cannot delete island to null island");
|
||||||
|
|
||||||
this.islandManager.deleteIsland(island.getIsland());
|
this.islandManager.deleteIsland(island.getIsland(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If force is set to true, the island will be deleted and no conditions will be
|
||||||
|
* checked, else it will only delete the island if the island deletion
|
||||||
|
* conditions are met.
|
||||||
|
*/
|
||||||
|
public void deleteIsland(Island island, boolean force) {
|
||||||
|
Preconditions.checkArgument(island != null, "Cannot delete island to null island");
|
||||||
|
|
||||||
|
this.islandManager.deleteIsland(island.getIsland(), force);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ public class DeleteCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
island.setDeleted(true);
|
island.setDeleted(true);
|
||||||
islandManager.deleteIsland(island);
|
islandManager.deleteIsland(island, true);
|
||||||
|
|
||||||
messageManager.sendMessage(sender,
|
messageManager.sendMessage(sender,
|
||||||
configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player",
|
configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player",
|
||||||
|
@ -19,6 +19,7 @@ import com.songoda.skyblock.limit.LimitationInstanceHandler;
|
|||||||
import com.songoda.skyblock.message.MessageManager;
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
import com.songoda.skyblock.scoreboard.ScoreboardManager;
|
import com.songoda.skyblock.scoreboard.ScoreboardManager;
|
||||||
import com.songoda.skyblock.sound.SoundManager;
|
import com.songoda.skyblock.sound.SoundManager;
|
||||||
|
import com.songoda.skyblock.utils.item.MenuClickRegistry;
|
||||||
import com.songoda.skyblock.utils.version.Sounds;
|
import com.songoda.skyblock.utils.version.Sounds;
|
||||||
|
|
||||||
public class ReloadCommand extends SubCommand {
|
public class ReloadCommand extends SubCommand {
|
||||||
@ -40,11 +41,11 @@ public class ReloadCommand extends SubCommand {
|
|||||||
LimitationInstanceHandler limitHandler = skyblock.getLimitationHandler();
|
LimitationInstanceHandler limitHandler = skyblock.getLimitationHandler();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
messageManager.sendMessage(sender, "&cPlease note that this command is not supported and may " +
|
messageManager.sendMessage(sender,
|
||||||
"cause issues that could put the plugin in an unstable state. " +
|
"&cPlease note that this command is not supported and may " + "cause issues that could put the plugin in an unstable state. "
|
||||||
"If you encounter any issues please stop your server, edit the configuration files, " +
|
+ "If you encounter any issues please stop your server, edit the configuration files, "
|
||||||
"and then start your server again. This command does NOT reload all the plugin files, only " +
|
+ "and then start your server again. This command does NOT reload all the plugin files, only "
|
||||||
"the config.yml, language.yml, generators.yml, levelling.yml, and limits.yml.");
|
+ "the config.yml, language.yml, generators.yml, levelling.yml, and limits.yml.");
|
||||||
|
|
||||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
@ -56,8 +57,7 @@ public class ReloadCommand extends SubCommand {
|
|||||||
Config configFileConfig = configs.get(configFileName);
|
Config configFileConfig = configs.get(configFileName);
|
||||||
String configFilePath = configFileName.replace(configFileConfig.getFile().getName(), "");
|
String configFilePath = configFileName.replace(configFileConfig.getFile().getName(), "");
|
||||||
|
|
||||||
if (configFilePath.equals(skyblock.getDataFolder().toString() + "\\")
|
if (configFilePath.equals(skyblock.getDataFolder().toString() + "\\") || configFilePath.equals(skyblock.getDataFolder().toString() + "/")) {
|
||||||
|| configFilePath.equals(skyblock.getDataFolder().toString() + "/")) {
|
|
||||||
configFileConfig.loadFile();
|
configFileConfig.loadFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,6 +95,7 @@ public class ReloadCommand extends SubCommand {
|
|||||||
});
|
});
|
||||||
|
|
||||||
limitHandler.reloadAll();
|
limitHandler.reloadAll();
|
||||||
|
MenuClickRegistry.getInstance().reloadAll();
|
||||||
|
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message"));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Reload.Reloaded.Message"));
|
||||||
soundManager.playSound(sender, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(sender, Sounds.ANVIL_USE.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
@ -9,7 +9,6 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.songoda.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.message.MessageManager;
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
import com.songoda.skyblock.stackable.Stackable;
|
import com.songoda.skyblock.stackable.Stackable;
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
package com.songoda.skyblock.command.commands.island;
|
package com.songoda.skyblock.command.commands.island;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.songoda.skyblock.ban.Ban;
|
import com.songoda.skyblock.ban.Ban;
|
||||||
import com.songoda.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
@ -7,19 +15,11 @@ import com.songoda.skyblock.config.FileManager.Config;
|
|||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
import com.songoda.skyblock.island.IslandRole;
|
import com.songoda.skyblock.island.IslandRole;
|
||||||
import com.songoda.skyblock.island.IslandWorld;
|
|
||||||
import com.songoda.skyblock.message.MessageManager;
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
import com.songoda.skyblock.sound.SoundManager;
|
import com.songoda.skyblock.sound.SoundManager;
|
||||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||||
import com.songoda.skyblock.utils.version.Sounds;
|
import com.songoda.skyblock.utils.version.Sounds;
|
||||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BanCommand extends SubCommand {
|
public class BanCommand extends SubCommand {
|
||||||
|
|
||||||
@ -40,16 +40,11 @@ public class BanCommand extends SubCommand {
|
|||||||
if (island == null) {
|
if (island == null) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Owner.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Owner.Message"));
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
|
||||||
.getBoolean("Island.Visitor.Banning")) {
|
|
||||||
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && island.getSetting(IslandRole.Operator, "Ban").getStatus())) {
|
||||||
&& island.getSetting(IslandRole.Operator, "Ban").getStatus())) {
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||||
|
|
||||||
if (targetPlayer != null && targetPlayer.hasPermission("fabledskyblock.bypass.ban"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UUID targetPlayerUUID = null;
|
UUID targetPlayerUUID = null;
|
||||||
String targetPlayerName = null;
|
String targetPlayerName = null;
|
||||||
|
|
||||||
@ -58,8 +53,6 @@ public class BanCommand extends SubCommand {
|
|||||||
targetPlayerUUID = targetPlayerOffline.getUniqueId();
|
targetPlayerUUID = targetPlayerOffline.getUniqueId();
|
||||||
targetPlayerName = targetPlayerOffline.getName();
|
targetPlayerName = targetPlayerOffline.getName();
|
||||||
|
|
||||||
if (skyblock.getEconomyManager().hasPermission(skyblock.getWorldManager().getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(targetPlayerUUID), "fabledskyblock.bypass.ban"))
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
targetPlayerUUID = targetPlayer.getUniqueId();
|
targetPlayerUUID = targetPlayer.getUniqueId();
|
||||||
targetPlayerName = targetPlayer.getName();
|
targetPlayerName = targetPlayer.getName();
|
||||||
@ -71,18 +64,16 @@ public class BanCommand extends SubCommand {
|
|||||||
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
|
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Yourself.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Yourself.Message"));
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID)
|
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID) || island.hasRole(IslandRole.Operator, targetPlayerUUID)
|
||||||
|| island.hasRole(IslandRole.Operator, targetPlayerUUID)
|
|
||||||
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
|
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Member.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Member.Message"));
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (island.getBan().isBanned(targetPlayerUUID)) {
|
} else
|
||||||
|
if (island.getBan().isBanned(targetPlayerUUID)) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Already.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Already.Message"));
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Banned.Sender.Message").replace("%player", targetPlayerName));
|
||||||
configLoad.getString("Command.Island.Ban.Banned.Sender.Message").replace("%player",
|
|
||||||
targetPlayerName));
|
|
||||||
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
if (island.isCoopPlayer(targetPlayerUUID)) {
|
if (island.isCoopPlayer(targetPlayerUUID)) {
|
||||||
@ -95,9 +86,7 @@ public class BanCommand extends SubCommand {
|
|||||||
|
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
|
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
|
||||||
messageManager.sendMessage(targetPlayer,
|
messageManager.sendMessage(targetPlayer, configLoad.getString("Command.Island.Ban.Banned.Target.Message").replace("%player", player.getName()));
|
||||||
configLoad.getString("Command.Island.Ban.Banned.Target.Message")
|
|
||||||
.replace("%player", player.getName()));
|
|
||||||
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
||||||
|
@ -165,12 +165,14 @@ public class ConfirmCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (islandManager.deleteIsland(island, false)) {
|
||||||
island.setDeleted(true);
|
island.setDeleted(true);
|
||||||
islandManager.deleteIsland(island);
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Confirmation.Deletion.Sender.Message"));
|
||||||
|
|
||||||
messageManager.sendMessage(player, configLoad
|
|
||||||
.getString("Command.Island.Confirmation.Deletion.Sender.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
|
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 10.0F, 10.0F);
|
||||||
|
}else {
|
||||||
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Confirmation.Deletion.Sender.MaxDeletionMessage"));
|
||||||
|
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1f, 1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
package com.songoda.skyblock.command.commands.island;
|
package com.songoda.skyblock.command.commands.island;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.songoda.skyblock.api.event.island.IslandKickEvent;
|
import com.songoda.skyblock.api.event.island.IslandKickEvent;
|
||||||
import com.songoda.skyblock.api.utils.APIUtil;
|
import com.songoda.skyblock.api.utils.APIUtil;
|
||||||
import com.songoda.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
@ -8,7 +19,6 @@ import com.songoda.skyblock.config.FileManager.Config;
|
|||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
import com.songoda.skyblock.island.IslandRole;
|
import com.songoda.skyblock.island.IslandRole;
|
||||||
import com.songoda.skyblock.island.IslandWorld;
|
|
||||||
import com.songoda.skyblock.message.MessageManager;
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
import com.songoda.skyblock.playerdata.PlayerData;
|
import com.songoda.skyblock.playerdata.PlayerData;
|
||||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||||
@ -18,16 +28,6 @@ import com.songoda.skyblock.sound.SoundManager;
|
|||||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||||
import com.songoda.skyblock.utils.version.Sounds;
|
import com.songoda.skyblock.utils.version.Sounds;
|
||||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class KickCommand extends SubCommand {
|
public class KickCommand extends SubCommand {
|
||||||
|
|
||||||
@ -49,57 +49,42 @@ public class KickCommand extends SubCommand {
|
|||||||
Island island = islandManager.getIsland(player);
|
Island island = islandManager.getIsland(player);
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Owner.Message"));
|
||||||
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Owner.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|
||||||
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
|
|| (island.hasRole(IslandRole.Operator, player.getUniqueId()) && island.getSetting(IslandRole.Operator, "Kick").getStatus())) {
|
||||||
&& island.getSetting(IslandRole.Operator, "Kick").getStatus())) {
|
|
||||||
UUID targetPlayerUUID = null;
|
UUID targetPlayerUUID = null;
|
||||||
String targetPlayerName = null;
|
String targetPlayerName = null;
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||||
|
|
||||||
if (targetPlayer != null && targetPlayer.hasPermission("fabledskyblock.bypass.ban"))
|
Set<UUID> islandMembers = island.getRole(IslandRole.Member), islandOperators = island.getRole(IslandRole.Operator),
|
||||||
return;
|
|
||||||
|
|
||||||
Set<UUID> islandMembers = island.getRole(IslandRole.Member),
|
|
||||||
islandOperators = island.getRole(IslandRole.Operator),
|
|
||||||
islandVisitors = islandManager.getVisitorsAtIsland(island);
|
islandVisitors = islandManager.getVisitorsAtIsland(island);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
|
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
|
||||||
targetPlayerUUID = targetPlayerOffline.getUniqueId();
|
targetPlayerUUID = targetPlayerOffline.getUniqueId();
|
||||||
targetPlayerName = targetPlayerOffline.getName();
|
targetPlayerName = targetPlayerOffline.getName();
|
||||||
|
|
||||||
if (skyblock.getEconomyManager().hasPermission(skyblock.getWorldManager().getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(targetPlayerUUID), "fabledskyblock.bypass.ban"))
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
targetPlayerUUID = targetPlayer.getUniqueId();
|
targetPlayerUUID = targetPlayer.getUniqueId();
|
||||||
targetPlayerName = targetPlayer.getName();
|
targetPlayerName = targetPlayer.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetPlayerUUID.equals(player.getUniqueId())) {
|
if (targetPlayerUUID.equals(player.getUniqueId())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message"));
|
||||||
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (islandOperators.contains(player.getUniqueId())
|
} else if (islandOperators.contains(player.getUniqueId()) && islandOperators.contains(targetPlayerUUID)) {
|
||||||
&& islandOperators.contains(targetPlayerUUID)) {
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Operator.Message"));
|
||||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
|
|
||||||
.getString("Command.Island.Kick.Role.Operator.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (island.getOwnerUUID().equals(targetPlayerUUID)) {
|
} else if (island.getOwnerUUID().equals(targetPlayerUUID)) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Owner.Message"));
|
||||||
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Owner.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID) && targetPlayer != null) {
|
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID) && targetPlayer != null) {
|
||||||
if (island.isCoopPlayer(targetPlayerUUID)) {
|
if (island.isCoopPlayer(targetPlayerUUID)) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Cooped.Message"));
|
||||||
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Cooped.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(),
|
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), APIUtil.fromImplementation(IslandRole.Visitor),
|
||||||
APIUtil.fromImplementation(IslandRole.Visitor),
|
|
||||||
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||||
@ -108,15 +93,11 @@ public class KickCommand extends SubCommand {
|
|||||||
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
LocationUtil.teleportPlayerToSpawn(targetPlayer);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
languageConfig.getFileConfiguration()
|
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Sender.Message").replace("%player", targetPlayerName));
|
||||||
.getString("Command.Island.Kick.Kicked.Sender.Message")
|
|
||||||
.replace("%player", targetPlayerName));
|
|
||||||
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
messageManager.sendMessage(targetPlayer,
|
messageManager.sendMessage(targetPlayer,
|
||||||
languageConfig.getFileConfiguration()
|
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Target.Message").replace("%player", player.getName()));
|
||||||
.getString("Command.Island.Kick.Kicked.Target.Message")
|
|
||||||
.replace("%player", player.getName()));
|
|
||||||
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,23 +108,18 @@ public class KickCommand extends SubCommand {
|
|||||||
islandRole = IslandRole.Operator;
|
islandRole = IslandRole.Operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(),
|
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(), APIUtil.fromImplementation(islandRole),
|
||||||
APIUtil.fromImplementation(islandRole),
|
|
||||||
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
|
||||||
|
|
||||||
if (!islandKickEvent.isCancelled()) {
|
if (!islandKickEvent.isCancelled()) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
languageConfig.getFileConfiguration()
|
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Sender.Message").replace("%player", targetPlayerName));
|
||||||
.getString("Command.Island.Kick.Kicked.Sender.Message")
|
|
||||||
.replace("%player", targetPlayerName));
|
|
||||||
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
Config config = fileManager
|
Config config = fileManager.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), targetPlayerUUID.toString() + ".yml"));
|
||||||
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
|
|
||||||
targetPlayerUUID.toString() + ".yml"));
|
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
configLoad.set("Statistics.Island.Playtime", null);
|
configLoad.set("Statistics.Island.Playtime", null);
|
||||||
@ -157,9 +133,7 @@ public class KickCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(targetPlayer,
|
messageManager.sendMessage(targetPlayer,
|
||||||
languageConfig.getFileConfiguration()
|
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Kicked.Target.Message").replace("%player", player.getName()));
|
||||||
.getString("Command.Island.Kick.Kicked.Target.Message")
|
|
||||||
.replace("%player", player.getName()));
|
|
||||||
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
|
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
|
||||||
@ -168,10 +142,9 @@ public class KickCommand extends SubCommand {
|
|||||||
|
|
||||||
if (scoreboardManager != null) {
|
if (scoreboardManager != null) {
|
||||||
Scoreboard scoreboard = scoreboardManager.getScoreboard(targetPlayer);
|
Scoreboard scoreboard = scoreboardManager.getScoreboard(targetPlayer);
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', languageConfig
|
scoreboard.setDisplayName(
|
||||||
.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
ChatColor.translateAlternateColorCodes('&', languageConfig.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
||||||
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
|
scoreboard.setDisplayList(languageConfig.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
||||||
.getStringList("Scoreboard.Tutorial.Displaylines"));
|
|
||||||
scoreboard.run();
|
scoreboard.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,27 +174,23 @@ public class KickCommand extends SubCommand {
|
|||||||
|
|
||||||
if (targetPlayerData.isChat()) {
|
if (targetPlayerData.isChat()) {
|
||||||
targetPlayerData.setChat(false);
|
targetPlayerData.setChat(false);
|
||||||
messageManager.sendMessage(targetPlayer, fileManager
|
messageManager.sendMessage(targetPlayer, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Chat.Untoggled.Message"));
|
||||||
.getFileConfiguration().getString("Island.Chat.Untoggled.Message"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scoreboardManager != null) {
|
if (scoreboardManager != null) {
|
||||||
if (island.getRole(IslandRole.Member).size() == 0
|
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
|
||||||
Scoreboard scoreboard = scoreboardManager.getScoreboard(player);
|
Scoreboard scoreboard = scoreboardManager.getScoreboard(player);
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', languageConfig
|
scoreboard.setDisplayName(
|
||||||
.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
ChatColor.translateAlternateColorCodes('&', languageConfig.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
||||||
|
|
||||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||||
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
|
scoreboard.setDisplayList(languageConfig.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
|
scoreboard.setDisplayList(languageConfig.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scoreboard.run();
|
scoreboard.run();
|
||||||
@ -230,29 +199,24 @@ public class KickCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (island.isOpen()) {
|
if (island.isOpen()) {
|
||||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Occupant.Visit.Open.Message"));
|
||||||
.getString("Command.Island.Kick.Occupant.Visit.Open.Message"));
|
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Occupant.Visit.Closed.Message"));
|
||||||
.getString("Command.Island.Kick.Occupant.Visit.Closed.Message"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (island.isOpen()) {
|
if (island.isOpen()) {
|
||||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Permission.Visit.Open.Message"));
|
||||||
.getString("Command.Island.Kick.Permission.Visit.Open.Message"));
|
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Permission.Visit.Closed.Message"));
|
||||||
.getString("Command.Island.Kick.Permission.Visit.Closed.Message"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, languageConfig.getFileConfiguration().getString("Command.Island.Kick.Invalid.Message"));
|
||||||
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Invalid.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -114,8 +114,7 @@ public class GeneratorManager {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public BlockState generateBlock(Generator generator, Block block) {
|
public BlockState generateBlock(Generator generator, Block block) {
|
||||||
Materials materials = getRandomMaterials(generator);
|
Materials materials = getRandomMaterials(generator);
|
||||||
if (materials == null)
|
if (materials == null) return block.getState();
|
||||||
return block.getState();
|
|
||||||
|
|
||||||
skyblock.getSoundManager().playSound(block.getLocation(), Sounds.FIZZ.bukkitSound(), 1.0F, 10.0F);
|
skyblock.getSoundManager().playSound(block.getLocation(), Sounds.FIZZ.bukkitSound(), 1.0F, 10.0F);
|
||||||
|
|
||||||
@ -127,8 +126,7 @@ public class GeneratorManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
block.getClass().getMethod("setData", byte.class).invoke(block, (byte) is.getDurability());
|
block.getClass().getMethod("setData", byte.class).invoke(block, (byte) is.getDurability());
|
||||||
} catch (IllegalAccessException | IllegalArgumentException
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ import com.songoda.skyblock.structure.StructureManager;
|
|||||||
import com.songoda.skyblock.upgrade.Upgrade;
|
import com.songoda.skyblock.upgrade.Upgrade;
|
||||||
import com.songoda.skyblock.upgrade.UpgradeManager;
|
import com.songoda.skyblock.upgrade.UpgradeManager;
|
||||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||||
|
import com.songoda.skyblock.utils.player.PlayerUtil;
|
||||||
import com.songoda.skyblock.utils.structure.SchematicUtil;
|
import com.songoda.skyblock.utils.structure.SchematicUtil;
|
||||||
import com.songoda.skyblock.utils.structure.StructureUtil;
|
import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||||
import com.songoda.skyblock.utils.version.Materials;
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
@ -162,6 +163,21 @@ public class IslandManager {
|
|||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
BanManager banManager = skyblock.getBanManager();
|
BanManager banManager = skyblock.getBanManager();
|
||||||
|
|
||||||
|
PlayerData data = skyblock.getPlayerDataManager().getPlayerData(player);
|
||||||
|
|
||||||
|
long amt = 0;
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
final int highest = PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.create", true, 2);
|
||||||
|
|
||||||
|
if ((amt = data.getIslandCreationCount()) >= highest) {
|
||||||
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
|
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
|
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.Message"));
|
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.Message"));
|
||||||
@ -170,6 +186,8 @@ public class IslandManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.setIslandCreationCount(amt + 1);
|
||||||
|
|
||||||
Island island = new Island(player);
|
Island island = new Island(player);
|
||||||
island.setStructure(structure.getName());
|
island.setStructure(structure.getName());
|
||||||
islandStorage.put(player.getUniqueId(), island);
|
islandStorage.put(player.getUniqueId(), island);
|
||||||
@ -231,12 +249,6 @@ public class IslandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
|
||||||
if (structure.getCommands() != null) {
|
|
||||||
for (String commandList : structure.getCommands()) {
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandList.replace("%player", player.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
}, configLoad.getInt("Island.Creation.TeleportTimeout") * 20);
|
}, configLoad.getInt("Island.Creation.TeleportTimeout") * 20);
|
||||||
@ -250,7 +262,14 @@ public class IslandManager {
|
|||||||
}
|
}
|
||||||
Biome biome = sBiome.getBiome();
|
Biome biome = sBiome.getBiome();
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> skyblock.getBiomeManager().setBiome(island, biome), 20L);
|
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> {
|
||||||
|
skyblock.getBiomeManager().setBiome(island, biome);
|
||||||
|
if (structure.getCommands() != null) {
|
||||||
|
for (String commandList : structure.getCommands()) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandList.replace("%player", player.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 20L);
|
||||||
|
|
||||||
// Recalculate island level after 5 seconds
|
// Recalculate island level after 5 seconds
|
||||||
if (configLoad.getBoolean("Island.Levelling.ScanAutomatically"))
|
if (configLoad.getBoolean("Island.Levelling.ScanAutomatically"))
|
||||||
@ -373,14 +392,31 @@ public class IslandManager {
|
|||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
public void deleteIsland(Island island) {
|
public boolean deleteIsland(Island island, boolean force) {
|
||||||
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
|
||||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||||
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
CooldownManager cooldownManager = skyblock.getCooldownManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
|
|
||||||
// Delete island from world.
|
if (!force) {
|
||||||
|
PlayerData data = playerDataManager.getPlayerData(island.getOwnerUUID());
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
|
final Player player = data.getPlayer();
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
|
||||||
|
long amt = 0;
|
||||||
|
final int highest = PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.delete", true, 1);
|
||||||
|
|
||||||
|
if ((amt = data.getIslandDeletionCount()) >= highest) return false;
|
||||||
|
|
||||||
|
data.setIslandDeletionCount(amt + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final Map<World, List<ChunkSnapshot>> snapshots = new HashMap<>(3);
|
final Map<World, List<ChunkSnapshot>> snapshots = new HashMap<>(3);
|
||||||
|
|
||||||
@ -462,6 +498,7 @@ public class IslandManager {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(new IslandDeleteEvent(island.getAPIWrapper()));
|
Bukkit.getServer().getPluginManager().callEvent(new IslandDeleteEvent(island.getAPIWrapper()));
|
||||||
|
|
||||||
islandStorage.remove(island.getOwnerUUID());
|
islandStorage.remove(island.getOwnerUUID());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteIslandData(UUID uuid) {
|
public void deleteIslandData(UUID uuid) {
|
||||||
@ -1171,16 +1208,17 @@ public class IslandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<UUID> getCoopPlayersAtIsland(Island island) {
|
public Set<UUID> getCoopPlayersAtIsland(Island island) {
|
||||||
Set<UUID> coopPlayersAtIsland = new HashSet<>();
|
final Set<UUID> coopPlayersAtIsland = new HashSet<>();
|
||||||
|
|
||||||
if (island != null) {
|
if (island == null) return coopPlayersAtIsland;
|
||||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (island.getCoopPlayers().containsKey(all.getUniqueId())) {
|
for (UUID coopUUID : island.getCoopPlayers().keySet()) {
|
||||||
if (isPlayerAtIsland(island, all)) {
|
|
||||||
coopPlayersAtIsland.add(all.getUniqueId());
|
final Player player = Bukkit.getPlayer(coopUUID);
|
||||||
}
|
|
||||||
}
|
if (player == null) continue;
|
||||||
}
|
|
||||||
|
if (isPlayerAtIsland(island, player)) coopPlayersAtIsland.add(coopUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return coopPlayersAtIsland;
|
return coopPlayersAtIsland;
|
||||||
|
@ -28,8 +28,7 @@ public class LeaderboardManager {
|
|||||||
this.skyblock = skyblock;
|
this.skyblock = skyblock;
|
||||||
|
|
||||||
new LeaderboardTask(skyblock).runTaskTimerAsynchronously(skyblock, 0L,
|
new LeaderboardTask(skyblock).runTaskTimerAsynchronously(skyblock, 0L,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Leaderboard.Reset.Time") * 20);
|
||||||
.getFileConfiguration().getInt("Island.Leaderboard.Reset.Time") * 20);
|
|
||||||
|
|
||||||
resetLeaderboard();
|
resetLeaderboard();
|
||||||
setupLeaderHeads();
|
setupLeaderHeads();
|
||||||
@ -48,13 +47,11 @@ public class LeaderboardManager {
|
|||||||
List<LeaderboardPlayer> islandBanks = new ArrayList<>(arraySize);
|
List<LeaderboardPlayer> islandBanks = new ArrayList<>(arraySize);
|
||||||
List<LeaderboardPlayer> islandVotes = new ArrayList<>(arraySize);
|
List<LeaderboardPlayer> islandVotes = new ArrayList<>(arraySize);
|
||||||
|
|
||||||
boolean enableExemptions = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
boolean enableExemptions = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||||
.getFileConfiguration().getBoolean("Island.Leaderboard.Exemptions.Enable");
|
.getBoolean("Island.Leaderboard.Exemptions.Enable");
|
||||||
|
|
||||||
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
||||||
if (enableExemptions && economyManager.hasPermission(worldManager.getWorld(IslandWorld.Normal).getName(),
|
if (enableExemptions && economyManager.hasPermission(worldManager.getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(ownerUUID), "fabledskyblock.top.exempt"))
|
||||||
Bukkit.getOfflinePlayer(ownerUUID),
|
|
||||||
"fabledskyblock.top.exempt"))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Visit visit = visitManager.getIslands().get(ownerUUID);
|
Visit visit = visitManager.getIslands().get(ownerUUID);
|
||||||
|
@ -17,9 +17,7 @@ public class TopLevel extends DataCollector {
|
|||||||
|
|
||||||
public TopLevel(SkyBlock skyblock) {
|
public TopLevel(SkyBlock skyblock) {
|
||||||
super("toplevels", skyblock.getDescription().getName(), BoardType.DEFAULT, "&bTop Level", "toplevel",
|
super("toplevels", skyblock.getDescription().getName(), BoardType.DEFAULT, "&bTop Level", "toplevel",
|
||||||
Arrays.asList(ChatColor.DARK_GRAY + "-=+=-", ChatColor.AQUA + "{name}",
|
Arrays.asList(ChatColor.DARK_GRAY + "-=+=-", ChatColor.AQUA + "{name}", ChatColor.WHITE + "{amount} Level", ChatColor.DARK_GRAY + "-=+=-"), true, UUID.class);
|
||||||
ChatColor.WHITE + "{amount} Level", ChatColor.DARK_GRAY + "-=+=-"),
|
|
||||||
true, UUID.class);
|
|
||||||
|
|
||||||
this.skyblock = skyblock;
|
this.skyblock = skyblock;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import com.songoda.skyblock.levelling.rework.calculator.impl.EpicSpawnerCalculat
|
|||||||
import com.songoda.skyblock.levelling.rework.calculator.impl.UltimateStackerCalculator;
|
import com.songoda.skyblock.levelling.rework.calculator.impl.UltimateStackerCalculator;
|
||||||
import com.songoda.skyblock.levelling.rework.calculator.impl.WildStackerCalculator;
|
import com.songoda.skyblock.levelling.rework.calculator.impl.WildStackerCalculator;
|
||||||
import com.songoda.skyblock.message.MessageManager;
|
import com.songoda.skyblock.message.MessageManager;
|
||||||
|
import com.songoda.skyblock.stackable.StackableManager;
|
||||||
import com.songoda.skyblock.utils.version.Materials;
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ public final class IslandLevelManager {
|
|||||||
|
|
||||||
if (attemptScanner != null) {
|
if (attemptScanner != null) {
|
||||||
|
|
||||||
if(SkyBlock.getInstance().getIslandManager().getIslandPlayerAt(attemptScanner) != island) {
|
if (SkyBlock.getInstance().getIslandManager().getIslandPlayerAt(attemptScanner) != island) {
|
||||||
messageManager.sendMessage(attemptScanner, config.getString("Command.Island.Level.Scanning.NotOnIsland.Message"));
|
messageManager.sendMessage(attemptScanner, config.getString("Command.Island.Level.Scanning.NotOnIsland.Message"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,7 +165,9 @@ public final class IslandLevelManager {
|
|||||||
if (finalType == Materials.SPAWNER) finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
|
if (finalType == Materials.SPAWNER) finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
|
||||||
|
|
||||||
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType);
|
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType);
|
||||||
final long stackSize = SkyBlock.getInstance().getStackableManager().getStackSizeOf(block.getLocation(), blockType);
|
final StackableManager stackableManager = SkyBlock.getInstance().getStackableManager();
|
||||||
|
|
||||||
|
final long stackSize = stackableManager == null ? 0 : stackableManager.getStackSizeOf(block.getLocation(), blockType);
|
||||||
|
|
||||||
if (calculators == null) {
|
if (calculators == null) {
|
||||||
|
|
||||||
|
@ -138,10 +138,13 @@ public final class IslandScan extends BukkitRunnable {
|
|||||||
|
|
||||||
if (config.getBoolean("Command.Island.Level.Scanning.Progress.Should-Display-Message") && executions == 1 || totalScanned == blocksSize || executions % runEveryX == 0) {
|
if (config.getBoolean("Command.Island.Level.Scanning.Progress.Should-Display-Message") && executions == 1 || totalScanned == blocksSize || executions % runEveryX == 0) {
|
||||||
|
|
||||||
|
final double percent = ((double) totalScanned / (double) blocksSize) * 100;
|
||||||
|
|
||||||
String message = config.getString("Command.Island.Level.Scanning.Progress.Message");
|
String message = config.getString("Command.Island.Level.Scanning.Progress.Message");
|
||||||
message = message.replace("%current_scanned_blocks%", String.valueOf(totalScanned));
|
message = message.replace("%current_scanned_blocks%", String.valueOf(totalScanned));
|
||||||
message = message.replace("%max_blocks%", String.valueOf(blocksSize));
|
message = message.replace("%max_blocks%", String.valueOf(blocksSize));
|
||||||
message = message.replace("%percent%", FORMATTER.format(((double) totalScanned / (double) blocksSize) * 100));
|
message = message.replace("%percent_whole%", String.valueOf((int) percent));
|
||||||
|
message = message.replace("%percent%", FORMATTER.format(percent));
|
||||||
|
|
||||||
final boolean displayComplete = totalScanned == blocksSize && config.getBoolean("Command.Island.Level.Scanning.Finished.Should-Display-Message");
|
final boolean displayComplete = totalScanned == blocksSize && config.getBoolean("Command.Island.Level.Scanning.Finished.Should-Display-Message");
|
||||||
final MessageManager messageManager = SkyBlock.getInstance().getMessageManager();
|
final MessageManager messageManager = SkyBlock.getInstance().getMessageManager();
|
||||||
|
@ -3,17 +3,14 @@ package com.songoda.skyblock.limit.impl;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
import com.songoda.skyblock.limit.EnumLimitation;
|
import com.songoda.skyblock.limit.EnumLimitation;
|
||||||
|
import com.songoda.skyblock.utils.player.PlayerUtil;
|
||||||
import com.songoda.skyblock.utils.version.Materials;
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
|
|
||||||
public final class BlockLimitation extends EnumLimitation<Materials> {
|
public final class BlockLimitation extends EnumLimitation<Materials> {
|
||||||
@ -46,7 +43,7 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
|
|||||||
final String enumName = key.toUpperCase(Locale.ENGLISH);
|
final String enumName = key.toUpperCase(Locale.ENGLISH);
|
||||||
final Materials type = Materials.fromString(enumName);
|
final Materials type = Materials.fromString(enumName);
|
||||||
|
|
||||||
if (type == null) throw new IllegalArgumentException("Unable to parse Materials from '" + enumName + "' in " + loadFrom.getCurrentPath());
|
if (type == null) throw new IllegalArgumentException("Unable to parse Materials from '" + enumName + "' in the Section '" + loadFrom.getCurrentPath() + "'");
|
||||||
|
|
||||||
getMap().put(type, loadFrom.getLong(key));
|
getMap().put(type, loadFrom.getLong(key));
|
||||||
}
|
}
|
||||||
@ -63,25 +60,9 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
|
|||||||
|
|
||||||
if (material == null) return -1;
|
if (material == null) return -1;
|
||||||
|
|
||||||
long limit = getMap().getOrDefault(material, getDefault());
|
|
||||||
|
|
||||||
final String name = material.name().toLowerCase();
|
final String name = material.name().toLowerCase();
|
||||||
|
|
||||||
Set<PermissionAttachmentInfo> permissions = player.getEffectivePermissions().stream()
|
return Math.max(getMap().getOrDefault(material, getDefault()), PlayerUtil.getNumberFromPermission(player, "fabledskyblock.limit.block." + name, true, -1));
|
||||||
.filter(x -> x.getPermission().toLowerCase().startsWith("fabledskyblock.limit.block." + name)).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
for (PermissionAttachmentInfo permission : permissions) {
|
|
||||||
try {
|
|
||||||
String permString = permission.getPermission();
|
|
||||||
String numberString = permString.substring(permString.lastIndexOf(".") + 1);
|
|
||||||
if (numberString.equals("*")) return -1;
|
|
||||||
|
|
||||||
limit = Math.max(limit, Integer.parseInt(numberString));
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return limit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -94,8 +75,7 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
|
|||||||
final long totalPlaced;
|
final long totalPlaced;
|
||||||
|
|
||||||
if (block.getType() == Materials.SPAWNER.parseMaterial()) {
|
if (block.getType() == Materials.SPAWNER.parseMaterial()) {
|
||||||
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER"))
|
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
|
||||||
.mapToLong(Map.Entry::getValue).sum();
|
|
||||||
} else {
|
} else {
|
||||||
totalPlaced = island.getLevel().getMaterialAmount(Materials.getMaterials(block.getType(), block.getData()).name());
|
totalPlaced = island.getLevel().getMaterialAmount(Materials.getMaterials(block.getType(), block.getData()).name());
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -73,8 +74,6 @@ public class Block implements Listener {
|
|||||||
|
|
||||||
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
|
||||||
|
|
||||||
Location blockLocation = block.getLocation();
|
Location blockLocation = block.getLocation();
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(blockLocation);
|
Island island = islandManager.getIslandAtLocation(blockLocation);
|
||||||
@ -87,14 +86,12 @@ public class Block implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, blockLocation, "Destroy")) {
|
if (!islandManager.hasPermission(player, blockLocation, "Destroy")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stackableManager != null
|
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
|
||||||
&& stackableManager.isStacked(blockLocation)) {
|
|
||||||
Stackable stackable = stackableManager.getStack(block.getLocation(), block.getType());
|
Stackable stackable = stackableManager.getStack(block.getLocation(), block.getType());
|
||||||
if (stackable != null) {
|
if (stackable != null) {
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
@ -102,14 +99,8 @@ public class Block implements Listener {
|
|||||||
|
|
||||||
int droppedAmount = 0;
|
int droppedAmount = 0;
|
||||||
if (event.getPlayer().isSneaking()) {
|
if (event.getPlayer().isSneaking()) {
|
||||||
Location dropLoc = blockLocation.clone().add(0.5, 0.5, 0.5);
|
droppedAmount = stackable.getSize();
|
||||||
int count = stackable.getSize();
|
block.getWorld().dropItemNaturally(blockLocation.clone().add(0.5, 0.5, 0.5), new ItemStack(material, droppedAmount, block.getData()));
|
||||||
droppedAmount = count;
|
|
||||||
while (count > 64) {
|
|
||||||
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, 64, data));
|
|
||||||
count -= 64;
|
|
||||||
}
|
|
||||||
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, count, block.getData()));
|
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
stackable.setSize(0);
|
stackable.setSize(0);
|
||||||
} else {
|
} else {
|
||||||
@ -149,20 +140,27 @@ public class Block implements Listener {
|
|||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
|
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||||
|
|
||||||
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))
|
if (LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0.0D, 1.0D, 0.0D))
|
||||||
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())) {
|
|| LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone())) {
|
||||||
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
|
||||||
.getFileConfiguration().getString("Island.SpawnProtection.Break.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isCancelled() || !configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
if (event.isCancelled() || !configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||||
|
|
||||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
final Materials materials;
|
||||||
|
|
||||||
|
if (block.getType() == Materials.SPAWNER.parseMaterial()) {
|
||||||
|
materials = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
|
||||||
|
} else {
|
||||||
|
materials = Materials.getMaterials(block.getType(), block.getData());
|
||||||
|
}
|
||||||
|
|
||||||
if (materials == null) return;
|
if (materials == null) return;
|
||||||
|
|
||||||
@ -190,8 +188,9 @@ public class Block implements Listener {
|
|||||||
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
IslandLevelManager levellingManager = skyblock.getLevellingManager();
|
||||||
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
Location blockLoc = block.getLocation();
|
||||||
Island island = islandManager.getIslandAtLocation(block.getLocation());
|
|
||||||
|
Island island = islandManager.getIslandAtLocation(blockLoc);
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -199,26 +198,26 @@ public class Block implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (levellingManager.isScanning(island)) {
|
if (levellingManager.isScanning(island)) {
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||||
.getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Place")) {
|
if (!islandManager.hasPermission(player, blockLoc, "Place")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||||
|
|
||||||
if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) {
|
if (configLoad.getBoolean("Island.WorldBorder.Block") && block.getType() == Material.DISPENSER) {
|
||||||
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world)) {
|
if (!islandManager.isLocationAtIsland(island, blockLoc, world)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +226,7 @@ public class Block implements Listener {
|
|||||||
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
if (configLoad.getBoolean("Island.Spawn.Protection")) {
|
||||||
boolean isObstructing = false;
|
boolean isObstructing = false;
|
||||||
// Directly on the block
|
// Directly on the block
|
||||||
if (LocationUtil.isLocationAffectingIslandSpawn(block.getLocation(), island, world)) {
|
if (LocationUtil.isLocationAffectingIslandSpawn(blockLoc, island, world)) {
|
||||||
isObstructing = true;
|
isObstructing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,14 +234,12 @@ public class Block implements Listener {
|
|||||||
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed) {
|
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed) {
|
||||||
BlockFace bedDirection = ((org.bukkit.material.Bed) event.getBlock().getState().getData()).getFacing();
|
BlockFace bedDirection = ((org.bukkit.material.Bed) event.getBlock().getState().getData()).getFacing();
|
||||||
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
|
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
|
||||||
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world))
|
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) isObstructing = true;
|
||||||
isObstructing = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isObstructing) {
|
if (isObstructing) {
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
|
||||||
.getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -258,36 +255,34 @@ public class Block implements Listener {
|
|||||||
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
||||||
|
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||||
.getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " ")))
|
|
||||||
.replace("%limit", NumberUtil.formatNumber(limit)));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!configLoad.getBoolean("Island.Block.Level.Enable"))
|
if (!configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getBlock().getType() == Materials.END_PORTAL_FRAME.parseMaterial()
|
if (event.getBlock().getType() == Materials.END_PORTAL_FRAME.parseMaterial() && event.getPlayer().getItemInHand().getType() == Materials.ENDER_EYE.parseMaterial()) return;
|
||||||
&& event.getPlayer().getItemInHand().getType() == Materials.ENDER_EYE.parseMaterial()) return;
|
|
||||||
|
|
||||||
// Fix a bug in Paper 1.8.8 when using ViaVersion on a 1.12.2 client.
|
// Fix a bug in Paper 1.8.8 when using ViaVersion on a 1.12.2 client.
|
||||||
// BUG: Player can infinitely increase their level by placing a block at their feet.
|
// BUG: Player can infinitely increase their level by placing a block at their
|
||||||
|
// feet.
|
||||||
// It doesn't take the block away but still increments the level.
|
// It doesn't take the block away but still increments the level.
|
||||||
// This doesn't happen in Spigot, but does happen in PaperSpigot due to a BlockPlaceEvent being incorrectly fired.
|
// This doesn't happen in Spigot, but does happen in PaperSpigot due to a
|
||||||
// The solution is to wait a tick to make sure that the block was actually placed.
|
// BlockPlaceEvent being incorrectly fired.
|
||||||
// This shouldn't cause any issues besides the task number being increased insanely fast.
|
// The solution is to wait a tick to make sure that the block was actually
|
||||||
|
// placed.
|
||||||
|
// This shouldn't cause any issues besides the task number being increased
|
||||||
|
// insanely fast.
|
||||||
Bukkit.getScheduler().runTask(skyblock, () -> {
|
Bukkit.getScheduler().runTask(skyblock, () -> {
|
||||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||||
if (materials == null || materials == Materials.AIR)
|
if (materials == null || materials == Materials.AIR) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (materials.equals(Materials.SPAWNER)) {
|
if (materials.equals(Materials.SPAWNER)) {
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") || Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
|
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") || Bukkit.getPluginManager().isPluginEnabled("WildStacker")) return;
|
||||||
return;
|
|
||||||
|
|
||||||
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
|
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
|
||||||
EntityType spawnerType = creatureSpawner.getSpawnedType();
|
EntityType spawnerType = creatureSpawner.getSpawnedType();
|
||||||
@ -305,7 +300,6 @@ public class Block implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld())) return;
|
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld())) return;
|
||||||
@ -344,10 +338,8 @@ public class Block implements Listener {
|
|||||||
// Filter valid players on the island
|
// Filter valid players on the island
|
||||||
Set<Player> possiblePlayers = new HashSet<>();
|
Set<Player> possiblePlayers = new HashSet<>();
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
boolean isMember = island.hasRole(IslandRole.Owner, p.getUniqueId()) ||
|
boolean isMember = island.hasRole(IslandRole.Owner, p.getUniqueId()) || island.hasRole(IslandRole.Member, p.getUniqueId())
|
||||||
island.hasRole(IslandRole.Member, p.getUniqueId()) ||
|
|| island.hasRole(IslandRole.Coop, p.getUniqueId()) || island.hasRole(IslandRole.Operator, p.getUniqueId());
|
||||||
island.hasRole(IslandRole.Coop, p.getUniqueId()) ||
|
|
||||||
island.hasRole(IslandRole.Operator, p.getUniqueId());
|
|
||||||
if (isMember && islandManager.isLocationAtIsland(island, p.getLocation(), world)) {
|
if (isMember && islandManager.isLocationAtIsland(island, p.getLocation(), world)) {
|
||||||
possiblePlayers.add(p);
|
possiblePlayers.add(p);
|
||||||
}
|
}
|
||||||
@ -357,16 +349,17 @@ public class Block implements Listener {
|
|||||||
for (Generator generator : generators) {
|
for (Generator generator : generators) {
|
||||||
for (Player p : possiblePlayers) {
|
for (Player p : possiblePlayers) {
|
||||||
if (generator.isPermission()) {
|
if (generator.isPermission()) {
|
||||||
if (!p.hasPermission(generator.getPermission())
|
if (!p.hasPermission(generator.getPermission()) && !p.hasPermission("fabledskyblock.generator.*") && !p.hasPermission("fabledskyblock.*")) {
|
||||||
&& !p.hasPermission("fabledskyblock.generator.*")
|
|
||||||
&& !p.hasPermission("fabledskyblock.*")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
|
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
|
||||||
event.getToBlock().getState().setType(genState.getType());
|
org.bukkit.block.BlockState toBlockState = event.getToBlock().getState();
|
||||||
event.getToBlock().getState().setData(genState.getData());
|
|
||||||
|
toBlockState.setData(genState.getData());
|
||||||
|
toBlockState.setType(genState.getType());
|
||||||
|
toBlockState.update();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -378,20 +371,24 @@ public class Block implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
if (!worldManager.isIslandWorld(event.getBlock().getWorld()))
|
if (!worldManager.isIslandWorld(event.getBlock().getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
|
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
|
if (performStackCheck(event.getBlock(), event.getBlocks(), event.getDirection())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
|
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
|
||||||
for (org.bukkit.block.Block block : event.getBlocks()) {
|
for (org.bukkit.block.Block block : event.getBlocks()) {
|
||||||
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world) || !islandManager.isLocationAtIsland(island, block.getRelative(event.getDirection()).getLocation(), world)) {
|
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world)
|
||||||
|
|| !islandManager.isLocationAtIsland(island, block.getRelative(event.getDirection()).getLocation(), world)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -429,22 +426,59 @@ public class Block implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean performStackCheck(org.bukkit.block.Block block, List<org.bukkit.block.Block> list, BlockFace blockFace) {
|
||||||
|
return !getArmorStands(list.isEmpty() ? block : list.get(list.size() - 1), blockFace).isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ArmorStand> getArmorStands(org.bukkit.block.Block block, BlockFace blockFace) {
|
||||||
|
|
||||||
|
final List<ArmorStand> list = new ArrayList<>();
|
||||||
|
|
||||||
|
block = block.getRelative(blockFace);
|
||||||
|
|
||||||
|
final Location loc = block.getLocation();
|
||||||
|
|
||||||
|
int locX = loc.getBlockX();
|
||||||
|
int locZ = loc.getBlockZ();
|
||||||
|
int locY = loc.getBlockY();
|
||||||
|
|
||||||
|
for (org.bukkit.entity.Entity entity : block.getChunk().getEntities()) {
|
||||||
|
|
||||||
|
if (!(entity instanceof ArmorStand) || !entity.hasMetadata("StackableArmorStand")) continue;
|
||||||
|
|
||||||
|
final Location entityLoc = entity.getLocation();
|
||||||
|
|
||||||
|
if (entityLoc.getBlockX() != locX) continue;
|
||||||
|
if (entityLoc.getBlockZ() != locZ) continue;
|
||||||
|
|
||||||
|
final int dist = locY - entityLoc.getBlockY();
|
||||||
|
|
||||||
|
if (dist >= 0 && dist < 2) list.add((ArmorStand) entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld()))
|
if (!skyblock.getWorldManager().isIslandWorld(event.getBlock().getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
|
Island island = islandManager.getIslandAtLocation(event.getBlock().getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
|
if (performStackCheck(event.getBlock(), event.getBlocks(), event.getDirection())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
|
IslandWorld world = worldManager.getIslandWorld(event.getBlock().getWorld());
|
||||||
for (org.bukkit.block.Block block : event.getBlocks()) {
|
for (org.bukkit.block.Block block : event.getBlocks()) {
|
||||||
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world)) {
|
if (!islandManager.isLocationAtIsland(island, block.getLocation(), world)) {
|
||||||
@ -475,8 +509,7 @@ public class Block implements Listener {
|
|||||||
public void onBlockForm(BlockFormEvent event) {
|
public void onBlockForm(BlockFormEvent event) {
|
||||||
org.bukkit.block.Block block = event.getBlock();
|
org.bukkit.block.Block block = event.getBlock();
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
if (!worldManager.isIslandWorld(block.getWorld()))
|
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Check ice/snow forming
|
// Check ice/snow forming
|
||||||
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
|
if (block.getType() == Material.ICE || block.getType() == Material.SNOW) {
|
||||||
@ -487,8 +520,7 @@ public class Block implements Listener {
|
|||||||
|
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
Island island = islandManager.getIslandAtLocation(block.getLocation());
|
Island island = islandManager.getIslandAtLocation(block.getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Check spawn block protection
|
// Check spawn block protection
|
||||||
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
|
||||||
@ -500,31 +532,26 @@ public class Block implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
if (material != Materials.WATER.parseMaterial() &&
|
if (material != Materials.WATER.parseMaterial() && material != Materials.LEGACY_STATIONARY_WATER.parseMaterial() && material != Materials.LAVA.parseMaterial()
|
||||||
material != Materials.LEGACY_STATIONARY_WATER.parseMaterial() &&
|
&& material != Materials.LEGACY_STATIONARY_LAVA.parseMaterial())
|
||||||
material != Materials.LAVA.parseMaterial() &&
|
|
||||||
material != Materials.LEGACY_STATIONARY_LAVA.parseMaterial())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState state = event.getNewState();
|
BlockState state = event.getNewState();
|
||||||
Material type = state.getType();
|
Material type = state.getType();
|
||||||
if (type != Material.COBBLESTONE && type != Material.STONE)
|
if (type != Material.COBBLESTONE && type != Material.STONE) return;
|
||||||
return;
|
|
||||||
|
|
||||||
GeneratorManager generatorManager = skyblock.getGeneratorManager();
|
GeneratorManager generatorManager = skyblock.getGeneratorManager();
|
||||||
if(generatorManager == null) return;
|
if (generatorManager == null) return;
|
||||||
|
|
||||||
List<Generator> generators = Lists.newArrayList(generatorManager.getGenerators());
|
List<Generator> generators = Lists.newArrayList(generatorManager.getGenerators());
|
||||||
if(generators == null || generators.isEmpty()) return;
|
if (generators == null || generators.isEmpty()) return;
|
||||||
Collections.reverse(generators); // Use the highest generator available
|
Collections.reverse(generators); // Use the highest generator available
|
||||||
|
|
||||||
// Filter valid players on the island.
|
// Filter valid players on the island.
|
||||||
Set<Player> possiblePlayers = new HashSet<>();
|
Set<Player> possiblePlayers = new HashSet<>();
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) ||
|
boolean isMember = island.hasRole(IslandRole.Owner, player.getUniqueId()) || island.hasRole(IslandRole.Member, player.getUniqueId())
|
||||||
island.hasRole(IslandRole.Member, player.getUniqueId()) ||
|
|| island.hasRole(IslandRole.Coop, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId());
|
||||||
island.hasRole(IslandRole.Coop, player.getUniqueId()) ||
|
|
||||||
island.hasRole(IslandRole.Operator, player.getUniqueId());
|
|
||||||
if (isMember && islandManager.isLocationAtIsland(island, player.getLocation(), world)) {
|
if (isMember && islandManager.isLocationAtIsland(island, player.getLocation(), world)) {
|
||||||
possiblePlayers.add(player);
|
possiblePlayers.add(player);
|
||||||
}
|
}
|
||||||
@ -534,9 +561,7 @@ public class Block implements Listener {
|
|||||||
for (Generator generator : generators) {
|
for (Generator generator : generators) {
|
||||||
for (Player player : possiblePlayers) {
|
for (Player player : possiblePlayers) {
|
||||||
if (generator.isPermission()) {
|
if (generator.isPermission()) {
|
||||||
if (!player.hasPermission(generator.getPermission())
|
if (!player.hasPermission(generator.getPermission()) && !player.hasPermission("fabledskyblock.generator.*") && !player.hasPermission("fabledskyblock.*")) {
|
||||||
&& !player.hasPermission("fabledskyblock.generator.*")
|
|
||||||
&& !player.hasPermission("fabledskyblock.*")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,8 +569,7 @@ public class Block implements Listener {
|
|||||||
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
|
org.bukkit.block.BlockState genState = generatorManager.generateBlock(generator, block);
|
||||||
state.setType(genState.getType());
|
state.setType(genState.getType());
|
||||||
|
|
||||||
if (NMSUtil.getVersionNumber() < 13)
|
if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData());
|
||||||
state.setData(genState.getData());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -555,30 +579,26 @@ public class Block implements Listener {
|
|||||||
public void onBlockBurn(BlockBurnEvent event) {
|
public void onBlockBurn(BlockBurnEvent event) {
|
||||||
org.bukkit.block.Block block = event.getBlock();
|
org.bukkit.block.Block block = event.getBlock();
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
if (!worldManager.isIslandWorld(block.getWorld()))
|
if (!worldManager.isIslandWorld(block.getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
if (!islandManager.hasSetting(block.getLocation(), IslandRole.Owner, "FireSpread"))
|
if (!islandManager.hasSetting(block.getLocation(), IslandRole.Owner, "FireSpread")) event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPortalCreate(PortalCreateEvent event) {
|
public void onPortalCreate(PortalCreateEvent event) {
|
||||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
|
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) return;
|
||||||
return;
|
|
||||||
|
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
// PortalCreateEvent.getBlocks() changed from ArrayList<Block> to ArrayList<BlockState> in 1.14.1
|
// PortalCreateEvent.getBlocks() changed from ArrayList<Block> to
|
||||||
|
// ArrayList<BlockState> in 1.14.1
|
||||||
if (NMSUtil.getVersionNumber() > 13) {
|
if (NMSUtil.getVersionNumber() > 13) {
|
||||||
List<BlockState> blocks = event.getBlocks();
|
List<BlockState> blocks = event.getBlocks();
|
||||||
if (event.getBlocks().isEmpty())
|
if (event.getBlocks().isEmpty()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(event.getBlocks().get(0).getLocation());
|
Island island = islandManager.getIslandAtLocation(event.getBlocks().get(0).getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Check spawn block protection
|
// Check spawn block protection
|
||||||
IslandWorld world = worldManager.getIslandWorld(event.getBlocks().get(0).getWorld());
|
IslandWorld world = worldManager.getIslandWorld(event.getBlocks().get(0).getWorld());
|
||||||
@ -593,12 +613,10 @@ public class Block implements Listener {
|
|||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<org.bukkit.block.Block> blocks = (List<org.bukkit.block.Block>) event.getClass().getMethod("getBlocks").invoke(event);
|
List<org.bukkit.block.Block> blocks = (List<org.bukkit.block.Block>) event.getClass().getMethod("getBlocks").invoke(event);
|
||||||
if (blocks.isEmpty())
|
if (blocks.isEmpty()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(blocks.get(0).getLocation());
|
Island island = islandManager.getIslandAtLocation(blocks.get(0).getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Check spawn block protection
|
// Check spawn block protection
|
||||||
IslandWorld world = worldManager.getIslandWorld(blocks.get(0).getWorld());
|
IslandWorld world = worldManager.getIslandWorld(blocks.get(0).getWorld());
|
||||||
@ -616,8 +634,7 @@ public class Block implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDispenserDispenseBlock(BlockDispenseEvent event) {
|
public void onDispenserDispenseBlock(BlockDispenseEvent event) {
|
||||||
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection"))
|
if (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Spawn.Protection")) return;
|
||||||
return;
|
|
||||||
|
|
||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
@ -626,14 +643,12 @@ public class Block implements Listener {
|
|||||||
org.bukkit.block.Block placeLocation = event.getBlock().getRelative(dispenserDirection);
|
org.bukkit.block.Block placeLocation = event.getBlock().getRelative(dispenserDirection);
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(placeLocation.getLocation());
|
Island island = islandManager.getIslandAtLocation(placeLocation.getLocation());
|
||||||
if (island == null)
|
if (island == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Check spawn block protection
|
// Check spawn block protection
|
||||||
IslandWorld world = worldManager.getIslandWorld(placeLocation.getWorld());
|
IslandWorld world = worldManager.getIslandWorld(placeLocation.getWorld());
|
||||||
|
|
||||||
if (LocationUtil.isLocationAffectingIslandSpawn(placeLocation.getLocation(), island, world))
|
if (LocationUtil.isLocationAffectingIslandSpawn(placeLocation.getLocation(), island, world)) event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
org.bukkit.block.Block block = event.getClickedBlock();
|
org.bukkit.block.Block block = event.getClickedBlock();
|
||||||
@ -84,8 +84,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -95,8 +94,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -106,8 +104,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -117,8 +114,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -132,27 +128,34 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (stackableManager != null
|
|
||||||
&& stackableManager.isStackableMaterial(event.getMaterial())
|
System.out.println("1st Condition: " + (stackableManager != null));
|
||||||
&& event.getClickedBlock().getType() == event.getMaterial()
|
System.out.println("2nd Condition: " + (stackableManager != null && stackableManager.isStackableMaterial(event.getMaterial())));
|
||||||
&& !player.isSneaking() && islandManager.hasPermission(player, block.getLocation(), "Place")
|
System.out.println("3rd Condition: " + (event.getClickedBlock().getType() == event.getMaterial()));
|
||||||
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission") || player.hasPermission("fabledskyblock.stackable"))) {
|
System.out.println("4th Condition: " + (!player.isSneaking()));
|
||||||
|
System.out.println("5th Condition: "
|
||||||
|
+ ((!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission")
|
||||||
|
|| player.hasPermission("fabledskyblock.stackable"))));
|
||||||
|
System.out.println("All must be true.");
|
||||||
|
|
||||||
|
if (stackableManager != null && stackableManager.isStackableMaterial(event.getMaterial()) && event.getClickedBlock().getType() == event.getMaterial() && !player.isSneaking()
|
||||||
|
&& islandManager.hasPermission(player, block.getLocation(), "Place")
|
||||||
|
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission")
|
||||||
|
|| player.hasPermission("fabledskyblock.stackable"))) {
|
||||||
if (NMSUtil.getVersionNumber() > 8) {
|
if (NMSUtil.getVersionNumber() > 8) {
|
||||||
if (event.getHand() == EquipmentSlot.OFF_HAND) return;
|
if (event.getHand() == EquipmentSlot.OFF_HAND) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (levellingManager.isScanning(island)) {
|
if (levellingManager.isScanning(island)) {
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
||||||
.getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -165,10 +168,8 @@ public class Interact implements Listener {
|
|||||||
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
Materials material = Materials.getMaterials(block.getType(), block.getData());
|
||||||
|
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
||||||
.getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
|
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
|
||||||
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " ")))
|
|
||||||
.replace("%limit", NumberUtil.formatNumber(limit)));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -176,18 +177,24 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Location location = event.getClickedBlock().getLocation();
|
Location location = event.getClickedBlock().getLocation();
|
||||||
if (stackableManager.isStacked(location)) {
|
|
||||||
Stackable stackable = stackableManager.getStack(location, event.getMaterial());
|
Stackable stackable = stackableManager.getStack(location, event.getMaterial());
|
||||||
if (stackable != null)
|
int itemAmount = event.getItem().getAmount();
|
||||||
stackable.addOne();
|
|
||||||
|
if (stackable == null) {
|
||||||
|
stackableManager.addStack(stackable = new Stackable(location, event.getMaterial()));
|
||||||
|
stackable.setSize(itemAmount + 1);
|
||||||
|
System.out.println("Stack is null. Creating");
|
||||||
} else {
|
} else {
|
||||||
stackableManager.addStack(new Stackable(location, event.getMaterial()));
|
stackable.setSize(stackable.getSize() + itemAmount);
|
||||||
|
System.out.println("Incrementing stack count.");
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
InventoryUtil.takeItem(player, 1);
|
InventoryUtil.takeItem(player, itemAmount);
|
||||||
|
|
||||||
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
FileManager.Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (!configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
if (!configLoad.getBoolean("Island.Block.Level.Enable")) return;
|
||||||
|
|
||||||
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
Materials materials = Materials.getMaterials(block.getType(), block.getData());
|
||||||
@ -200,7 +207,7 @@ public class Interact implements Listener {
|
|||||||
materialAmount = level.getMaterialAmount(materials.name());
|
materialAmount = level.getMaterialAmount(materials.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
level.setMaterialAmount(materials.name(), materialAmount + 1);
|
level.setMaterialAmount(materials.name(), materialAmount + itemAmount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,8 +231,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -235,203 +241,163 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.LEGACY_BED_BLOCK.parseMaterial()
|
} else if (block.getType() == Materials.LEGACY_BED_BLOCK.parseMaterial() || block.getType() == Materials.WHITE_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.WHITE_BED.parseMaterial()
|
|| block.getType() == Materials.ORANGE_BED.parseMaterial() || block.getType() == Materials.MAGENTA_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.ORANGE_BED.parseMaterial()
|
|| block.getType() == Materials.LIGHT_BLUE_BED.parseMaterial() || block.getType() == Materials.YELLOW_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.MAGENTA_BED.parseMaterial()
|
|| block.getType() == Materials.LIME_BED.parseMaterial() || block.getType() == Materials.PINK_BED.parseMaterial() || block.getType() == Materials.GRAY_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.LIGHT_BLUE_BED.parseMaterial()
|
|| block.getType() == Materials.LIGHT_GRAY_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.YELLOW_BED.parseMaterial()
|
|| block.getType() == Materials.CYAN_BED.parseMaterial() || block.getType() == Materials.PURPLE_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.LIME_BED.parseMaterial()
|
|| block.getType() == Materials.BLUE_BED.parseMaterial() || block.getType() == Materials.BROWN_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.PINK_BED.parseMaterial()
|
|| block.getType() == Materials.GREEN_BED.parseMaterial() || block.getType() == Materials.RED_BED.parseMaterial()
|
||||||
|| block.getType() == Materials.GRAY_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LIGHT_GRAY_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.CYAN_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.CYAN_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.PURPLE_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.BLUE_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.BROWN_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.GREEN_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.RED_BED.parseMaterial()
|
|
||||||
|| block.getType() == Materials.BLACK_BED.parseMaterial()) {
|
|| block.getType() == Materials.BLACK_BED.parseMaterial()) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Bed")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Bed")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.BREWING_STAND) {
|
} else
|
||||||
|
if (block.getType() == Material.BREWING_STAND) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Brewing")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Brewing")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST
|
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST
|
||||||
|| (NMSUtil.getVersionNumber() > 9
|
|| (NMSUtil.getVersionNumber() > 9 && (block.getType() == Materials.SHULKER_BOX.parseMaterial() || block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial()
|
||||||
&& (block.getType() == Materials.SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BROWN_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GRAY_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.GREEN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIGHT_BLUE_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.BROWN_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.LIGHT_GRAY_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIME_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.MAGENTA_SHULKER_BOX.parseMaterial() || block.getType() == Materials.ORANGE_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.GRAY_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.PINK_SHULKER_BOX.parseMaterial() || block.getType() == Materials.PURPLE_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.GREEN_SHULKER_BOX.parseMaterial()
|
|| block.getType() == Materials.RED_SHULKER_BOX.parseMaterial() || block.getType() == Materials.WHITE_SHULKER_BOX.parseMaterial()
|
||||||
|| block.getType() == Materials.LIGHT_BLUE_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LIGHT_GRAY_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LIME_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.MAGENTA_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.ORANGE_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.PINK_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.PURPLE_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.RED_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.WHITE_SHULKER_BOX.parseMaterial()
|
|
||||||
|| block.getType() == Materials.YELLOW_SHULKER_BOX.parseMaterial()))) {
|
|| block.getType() == Materials.YELLOW_SHULKER_BOX.parseMaterial()))) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.CRAFTING_TABLE.parseMaterial()) {
|
} else
|
||||||
|
if (block.getType() == Materials.CRAFTING_TABLE.parseMaterial()) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Workbench")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Workbench")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.BIRCH_DOOR || block.getType() == Material.ACACIA_DOOR
|
} else if (block.getType() == Material.BIRCH_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR
|
||||||
|| block.getType() == Material.DARK_OAK_DOOR || block.getType() == Material.JUNGLE_DOOR
|
|| block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.SPRUCE_DOOR || block.getType() == Materials.LEGACY_WOODEN_DOOR.parseMaterial()
|
||||||
|| block.getType() == Material.SPRUCE_DOOR
|
|
||||||
|| block.getType() == Materials.LEGACY_WOODEN_DOOR.parseMaterial()
|
|
||||||
|| block.getType() == Materials.OAK_DOOR.parseMaterial()) {
|
|| block.getType() == Materials.OAK_DOOR.parseMaterial()) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Door")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Door")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.ENCHANTING_TABLE.parseMaterial()) {
|
} else
|
||||||
|
if (block.getType() == Materials.ENCHANTING_TABLE.parseMaterial()) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Enchant")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Enchant")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.FURNACE
|
} else if (block.getType() == Material.FURNACE || block.getType() == Materials.LEGACY_BURNING_FURNACE.parseMaterial()) {
|
||||||
|| block.getType() == Materials.LEGACY_BURNING_FURNACE.parseMaterial()) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Furnace")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Furnace")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.STONE_BUTTON
|
} else if (block.getType() == Material.STONE_BUTTON || block.getType() == Materials.OAK_BUTTON.parseMaterial()
|
||||||
|| block.getType() == Materials.OAK_BUTTON.parseMaterial()
|
|| block.getType() == Materials.SPRUCE_BUTTON.parseMaterial() || block.getType() == Materials.BIRCH_BUTTON.parseMaterial()
|
||||||
|| block.getType() == Materials.SPRUCE_BUTTON.parseMaterial()
|
|| block.getType() == Materials.JUNGLE_BUTTON.parseMaterial() || block.getType() == Materials.ACACIA_BUTTON.parseMaterial()
|
||||||
|| block.getType() == Materials.BIRCH_BUTTON.parseMaterial()
|
|| block.getType() == Materials.DARK_OAK_BUTTON.parseMaterial() || block.getType() == Materials.LEVER.parseMaterial()) {
|
||||||
|| block.getType() == Materials.JUNGLE_BUTTON.parseMaterial()
|
|
||||||
|| block.getType() == Materials.ACACIA_BUTTON.parseMaterial()
|
|
||||||
|| block.getType() == Materials.DARK_OAK_BUTTON.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LEVER.parseMaterial()) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "LeverButton")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "LeverButton")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.JUKEBOX) {
|
} else
|
||||||
|
if (block.getType() == Material.JUKEBOX) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Jukebox")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Jukebox")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.OAK_TRAPDOOR.parseMaterial()
|
} else if (block.getType() == Materials.OAK_TRAPDOOR.parseMaterial() || block.getType() == Materials.SPRUCE_TRAPDOOR.parseMaterial()
|
||||||
|| block.getType() == Materials.SPRUCE_TRAPDOOR.parseMaterial()
|
|| block.getType() == Materials.BIRCH_TRAPDOOR.parseMaterial() || block.getType() == Materials.JUNGLE_TRAPDOOR.parseMaterial()
|
||||||
|| block.getType() == Materials.BIRCH_TRAPDOOR.parseMaterial()
|
|| block.getType() == Materials.ACACIA_TRAPDOOR.parseMaterial() || block.getType() == Materials.DARK_OAK_TRAPDOOR.parseMaterial()
|
||||||
|| block.getType() == Materials.JUNGLE_TRAPDOOR.parseMaterial()
|
|| block.getType() == Material.NOTE_BLOCK || block.getType() == Material.HOPPER || block.getType() == Materials.COMPARATOR.parseMaterial()
|
||||||
|| block.getType() == Materials.ACACIA_TRAPDOOR.parseMaterial()
|
|
||||||
|| block.getType() == Materials.DARK_OAK_TRAPDOOR.parseMaterial()
|
|
||||||
|| block.getType() == Material.NOTE_BLOCK
|
|
||||||
|| block.getType() == Material.HOPPER
|
|
||||||
|| block.getType() == Materials.COMPARATOR.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_OFF.parseMaterial()
|
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_OFF.parseMaterial()
|
||||||
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_ON.parseMaterial()
|
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_ON.parseMaterial() || block.getType() == Materials.REPEATER.parseMaterial()
|
||||||
|| block.getType() == Materials.REPEATER.parseMaterial()
|
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_OFF.parseMaterial() || block.getType() == Materials.LEGACY_DIODE_BLOCK_ON.parseMaterial()) {
|
||||||
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_OFF.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_ON.parseMaterial()) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.OAK_FENCE_GATE.parseMaterial()
|
} else
|
||||||
|| block.getType() == Material.ACACIA_FENCE_GATE || block.getType() == Material.BIRCH_FENCE_GATE
|
if (block.getType() == Materials.OAK_FENCE_GATE.parseMaterial() || block.getType() == Material.ACACIA_FENCE_GATE
|
||||||
|| block.getType() == Material.DARK_OAK_FENCE_GATE || block.getType() == Material.JUNGLE_FENCE_GATE
|
|| block.getType() == Material.BIRCH_FENCE_GATE || block.getType() == Material.DARK_OAK_FENCE_GATE || block.getType() == Material.JUNGLE_FENCE_GATE
|
||||||
|| block.getType() == Material.SPRUCE_FENCE_GATE) {
|
|| block.getType() == Material.SPRUCE_FENCE_GATE) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Gate")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Gate")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.DROPPER || block.getType() == Material.DISPENSER) {
|
} else
|
||||||
|
if (block.getType() == Material.DROPPER || block.getType() == Material.DISPENSER) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "DropperDispenser")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "DropperDispenser")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -440,9 +406,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -451,9 +416,8 @@ public class Interact implements Listener {
|
|||||||
if (player.getFoodLevel() < 20 && !islandManager.hasPermission(player, block.getLocation(), "Cake")) {
|
if (player.getFoodLevel() < 20 && !islandManager.hasPermission(player, block.getLocation(), "Cake")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -462,19 +426,16 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Hopper")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Hopper")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if ((player.getGameMode() == GameMode.SURVIVAL) && (block.getType() == Material.OBSIDIAN)
|
} else if ((player.getGameMode() == GameMode.SURVIVAL) && (block.getType() == Material.OBSIDIAN) && (event.getItem() != null)
|
||||||
&& (event.getItem() != null) && (event.getItem().getType() != Material.AIR)
|
&& (event.getItem().getType() != Material.AIR) && (event.getItem().getType() == Material.BUCKET)) {
|
||||||
&& (event.getItem().getType() == Material.BUCKET)) {
|
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
.getBoolean("Island.Block.Obsidian.Enable") && islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||||
.getFileConfiguration().getBoolean("Island.Block.Obsidian.Enable")
|
|
||||||
&& islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
|
||||||
int NMSVersion = NMSUtil.getVersionNumber();
|
int NMSVersion = NMSUtil.getVersionNumber();
|
||||||
boolean isInventoryFull = false;
|
boolean isInventoryFull = false;
|
||||||
|
|
||||||
@ -493,16 +454,13 @@ public class Interact implements Listener {
|
|||||||
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(Material.LAVA_BUCKET));
|
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(Material.LAVA_BUCKET));
|
||||||
} else {
|
} else {
|
||||||
if (NMSVersion > 8) {
|
if (NMSVersion > 8) {
|
||||||
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1,
|
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1, Material.LAVA_BUCKET);
|
||||||
Material.LAVA_BUCKET);
|
|
||||||
} else {
|
} else {
|
||||||
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1,
|
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1, Material.LAVA_BUCKET);
|
||||||
Material.LAVA_BUCKET);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInventoryFull) {
|
if (isInventoryFull) {
|
||||||
player.getWorld().dropItemNaturally(player.getLocation(),
|
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(Material.LAVA_BUCKET));
|
||||||
new ItemStack(Material.LAVA_BUCKET));
|
|
||||||
} else {
|
} else {
|
||||||
player.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET));
|
player.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET));
|
||||||
}
|
}
|
||||||
@ -512,13 +470,12 @@ public class Interact implements Listener {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.END_PORTAL_FRAME.parseMaterial()) {
|
} else
|
||||||
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
if (block.getType() == Materials.END_PORTAL_FRAME.parseMaterial()) {
|
||||||
.getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")
|
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
||||||
&& islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
.getBoolean("Island.Block.EndFrame.Enable") && islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
|
||||||
|
|
||||||
if (NMSUtil.getVersionNumber() > 8 && event.getHand() == EquipmentSlot.OFF_HAND)
|
if (NMSUtil.getVersionNumber() > 8 && event.getHand() == EquipmentSlot.OFF_HAND) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("EpicAnchors")) {
|
if (Bukkit.getPluginManager().isPluginEnabled("EpicAnchors")) {
|
||||||
if (com.songoda.epicanchors.EpicAnchors.getInstance().getAnchorManager().getAnchor(block.getLocation()) != null) {
|
if (com.songoda.epicanchors.EpicAnchors.getInstance().getAnchorManager().getAnchor(block.getLocation()) != null) {
|
||||||
@ -573,29 +530,23 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((event.getItem() != null) && (event.getItem().getType() != Material.AIR) && !event.isCancelled()) {
|
if ((event.getItem() != null) && (event.getItem().getType() != Material.AIR) && !event.isCancelled()) {
|
||||||
if (event.getItem().getType() == Material.BUCKET || event.getItem().getType() == Material.WATER_BUCKET
|
if (event.getItem().getType() == Material.BUCKET || event.getItem().getType() == Material.WATER_BUCKET || event.getItem().getType() == Material.LAVA_BUCKET) {
|
||||||
|| event.getItem().getType() == Material.LAVA_BUCKET) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
} else if (event.getItem().getType() == Material.GLASS_BOTTLE) {
|
} else if (event.getItem().getType() == Material.GLASS_BOTTLE) {
|
||||||
if (block.getType() == Material.WATER
|
if (block.getType() == Material.WATER || block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial() || block.getType() == Material.CAULDRON) {
|
||||||
|| block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial()
|
|
||||||
|| block.getType() == Material.CAULDRON) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "WaterCollection")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "WaterCollection")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager()
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.getConfig(new File(skyblock.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);
|
||||||
|
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
@ -605,21 +556,18 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, block.getLocation(), "SpawnEgg")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "SpawnEgg")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
} else if (event.getItem().getType() == Material.ARMOR_STAND || event.getItem().getType().name().contains("BOAT")
|
} else if (event.getItem().getType() == Material.ARMOR_STAND || event.getItem().getType().name().contains("BOAT") || event.getItem().getType().name().contains("MINECART")) {
|
||||||
|| event.getItem().getType().name().contains("MINECART")) {
|
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "EntityPlacement")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "EntityPlacement")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
@ -633,8 +581,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,29 +593,24 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Materials.STONE_PRESSURE_PLATE.parseMaterial()
|
} else if (block.getType() == Materials.STONE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.OAK_PRESSURE_PLATE.parseMaterial()
|
||||||
|| block.getType() == Materials.OAK_PRESSURE_PLATE.parseMaterial()
|
|| block.getType() == Materials.SPRUCE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.BIRCH_PRESSURE_PLATE.parseMaterial()
|
||||||
|| block.getType() == Materials.SPRUCE_PRESSURE_PLATE.parseMaterial()
|
|| block.getType() == Materials.JUNGLE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.ACACIA_PRESSURE_PLATE.parseMaterial()
|
||||||
|| block.getType() == Materials.BIRCH_PRESSURE_PLATE.parseMaterial()
|
|| block.getType() == Materials.DARK_OAK_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.LIGHT_WEIGHTED_PRESSURE_PLATE.parseMaterial()
|
||||||
|| block.getType() == Materials.JUNGLE_PRESSURE_PLATE.parseMaterial()
|
|
||||||
|| block.getType() == Materials.ACACIA_PRESSURE_PLATE.parseMaterial()
|
|
||||||
|| block.getType() == Materials.DARK_OAK_PRESSURE_PLATE.parseMaterial()
|
|
||||||
|| block.getType() == Materials.LIGHT_WEIGHTED_PRESSURE_PLATE.parseMaterial()
|
|
||||||
|| block.getType() == Materials.HEAVY_WEIGHTED_PRESSURE_PLATE.parseMaterial()) {
|
|| block.getType() == Materials.HEAVY_WEIGHTED_PRESSURE_PLATE.parseMaterial()) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "PressurePlate")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "PressurePlate")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (block.getType() == Material.TRIPWIRE) {
|
} else
|
||||||
|
if (block.getType() == Material.TRIPWIRE) {
|
||||||
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -688,21 +630,15 @@ public class Interact implements Listener {
|
|||||||
ItemStack structureTool = StructureUtil.getTool();
|
ItemStack structureTool = StructureUtil.getTool();
|
||||||
|
|
||||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
||||||
&& (event.getItem().getItemMeta().getDisplayName()
|
&& (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||||
.equals(structureTool.getItemMeta().getDisplayName()))) {
|
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*")
|
||||||
if (player.hasPermission("fabledskyblock.admin.structure.selection")
|
|
||||||
|| player.hasPermission("fabledskyblock.admin.structure.*")
|
|
||||||
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(1,
|
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(1, event.getClickedBlock().getLocation());
|
||||||
event.getClickedBlock().getLocation());
|
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager()
|
.getString("Island.Structure.Tool.Position.Message").replace("%position", "1"));
|
||||||
.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
|
||||||
.getFileConfiguration().getString("Island.Structure.Tool.Position.Message")
|
|
||||||
.replace("%position", "1"));
|
|
||||||
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,21 +646,15 @@ public class Interact implements Listener {
|
|||||||
ItemStack structureTool = StructureUtil.getTool();
|
ItemStack structureTool = StructureUtil.getTool();
|
||||||
|
|
||||||
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
if ((event.getItem().getType() == structureTool.getType()) && (event.getItem().hasItemMeta())
|
||||||
&& (event.getItem().getItemMeta().getDisplayName()
|
&& (event.getItem().getItemMeta().getDisplayName().equals(structureTool.getItemMeta().getDisplayName()))) {
|
||||||
.equals(structureTool.getItemMeta().getDisplayName()))) {
|
if (player.hasPermission("fabledskyblock.admin.structure.selection") || player.hasPermission("fabledskyblock.admin.structure.*")
|
||||||
if (player.hasPermission("fabledskyblock.admin.structure.selection")
|
|
||||||
|| player.hasPermission("fabledskyblock.admin.structure.*")
|
|
||||||
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
|| player.hasPermission("fabledskyblock.admin.*") || player.hasPermission("fabledskyblock.*")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(2,
|
skyblock.getPlayerDataManager().getPlayerData(player).getArea().setPosition(2, event.getClickedBlock().getLocation());
|
||||||
event.getClickedBlock().getLocation());
|
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager()
|
.getString("Island.Structure.Tool.Position.Message").replace("%position", "2"));
|
||||||
.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
|
||||||
.getFileConfiguration().getString("Island.Structure.Tool.Position.Message")
|
|
||||||
.replace("%position", "2"));
|
|
||||||
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -752,9 +682,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Leash")) {
|
if (!islandManager.hasPermission(player, entity.getLocation(), "Leash")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -770,10 +699,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, horse.getLocation(), "HorseInventory")) {
|
if (!islandManager.hasPermission(player, horse.getLocation(), "HorseInventory")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager()
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.getConfig(new File(skyblock.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -782,10 +709,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, horse.getLocation(), "MobRiding")) {
|
if (!islandManager.hasPermission(player, horse.getLocation(), "MobRiding")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager()
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.getConfig(new File(skyblock.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -795,9 +720,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, entity.getLocation(), "MobRiding")) {
|
if (!islandManager.hasPermission(player, entity.getLocation(), "MobRiding")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -807,16 +731,14 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, entity.getLocation(), "EntityPlacement")) {
|
if (!islandManager.hasPermission(player, entity.getLocation(), "EntityPlacement")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
} else if (entity.getType().equals(EntityType.ITEM_FRAME)) {
|
} else if (entity.getType().equals(EntityType.ITEM_FRAME)) {
|
||||||
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "Storage")) {
|
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "Storage")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
|
} else if (entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
|
||||||
@ -824,9 +746,8 @@ public class Interact implements Listener {
|
|||||||
if (!islandManager.hasPermission(player, entity.getLocation(), "Milking")) {
|
if (!islandManager.hasPermission(player, entity.getLocation(), "Milking")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -837,8 +758,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -848,8 +768,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -859,8 +778,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -870,8 +788,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -879,24 +796,20 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getType() == EntityType.HORSE) {
|
if (entity.getType() == EntityType.HORSE) {
|
||||||
if (!(is.getType() == Material.GOLDEN_APPLE || is.getType() == Material.GOLDEN_CARROT
|
if (!(is.getType() == Material.GOLDEN_APPLE || is.getType() == Material.GOLDEN_CARROT || is.getType() == Material.SUGAR || is.getType() == Material.WHEAT
|
||||||
|| is.getType() == Material.SUGAR || is.getType() == Material.WHEAT
|
|
||||||
|| is.getType() == Material.APPLE || is.getType() == Material.HAY_BLOCK)) {
|
|| is.getType() == Material.APPLE || is.getType() == Material.HAY_BLOCK)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW
|
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
|
||||||
|| entity.getType() == EntityType.MUSHROOM_COW) {
|
|
||||||
if (!(is.getType() == Material.WHEAT)) {
|
if (!(is.getType() == Material.WHEAT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.PIG) {
|
} else if (entity.getType() == EntityType.PIG) {
|
||||||
if (!(is.getType() == Materials.CARROT.parseMaterial()
|
if (!(is.getType() == Materials.CARROT.parseMaterial() || is.getType() == Materials.POTATO.parseMaterial())) {
|
||||||
|| is.getType() == Materials.POTATO.parseMaterial())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.CHICKEN) {
|
} else if (entity.getType() == EntityType.CHICKEN) {
|
||||||
if (!(is.getType() == Materials.WHEAT_SEEDS.parseMaterial() || is.getType() == Material.PUMPKIN_SEEDS
|
if (!(is.getType() == Materials.WHEAT_SEEDS.parseMaterial() || is.getType() == Material.PUMPKIN_SEEDS || is.getType() == Material.MELON_SEEDS)) {
|
||||||
|| is.getType() == Material.MELON_SEEDS)) {
|
|
||||||
if (NMSUtil.getVersionNumber() > 8) {
|
if (NMSUtil.getVersionNumber() > 8) {
|
||||||
if (!(is.getType() == Materials.BEETROOT_SEEDS.parseMaterial())) {
|
if (!(is.getType() == Materials.BEETROOT_SEEDS.parseMaterial())) {
|
||||||
return;
|
return;
|
||||||
@ -906,25 +819,19 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.WOLF) {
|
} else if (entity.getType() == EntityType.WOLF) {
|
||||||
if (!(is.getType() == Material.BONE || is.getType() == Materials.PORKCHOP.parseMaterial()
|
if (!(is.getType() == Material.BONE || is.getType() == Materials.PORKCHOP.parseMaterial() || is.getType() == Materials.BEEF.parseMaterial()
|
||||||
|| is.getType() == Materials.BEEF.parseMaterial()
|
|| is.getType() == Materials.CHICKEN.parseMaterial() || is.getType() == Material.RABBIT || is.getType() == Material.MUTTON || is.getType() == Material.ROTTEN_FLESH
|
||||||
|| is.getType() == Materials.CHICKEN.parseMaterial() || is.getType() == Material.RABBIT
|
|| is.getType() == Materials.COOKED_PORKCHOP.parseMaterial() || is.getType() == Material.COOKED_BEEF || is.getType() == Material.COOKED_CHICKEN
|
||||||
|| is.getType() == Material.MUTTON || is.getType() == Material.ROTTEN_FLESH
|
|
||||||
|| is.getType() == Materials.COOKED_PORKCHOP.parseMaterial()
|
|
||||||
|| is.getType() == Material.COOKED_BEEF || is.getType() == Material.COOKED_CHICKEN
|
|
||||||
|| is.getType() == Material.COOKED_RABBIT || is.getType() == Material.COOKED_MUTTON)) {
|
|| is.getType() == Material.COOKED_RABBIT || is.getType() == Material.COOKED_MUTTON)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.OCELOT) {
|
} else if (entity.getType() == EntityType.OCELOT) {
|
||||||
if (!(is.getType() == Materials.COD.parseMaterial() || is.getType() == Materials.SALMON.parseMaterial()
|
if (!(is.getType() == Materials.COD.parseMaterial() || is.getType() == Materials.SALMON.parseMaterial() || is.getType() == Materials.TROPICAL_FISH.parseMaterial()
|
||||||
|| is.getType() == Materials.TROPICAL_FISH.parseMaterial()
|
|
||||||
|| is.getType() == Materials.PUFFERFISH.parseMaterial())) {
|
|| is.getType() == Materials.PUFFERFISH.parseMaterial())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (entity.getType() == EntityType.RABBIT) {
|
} else if (entity.getType() == EntityType.RABBIT) {
|
||||||
if (!(is.getType() == Materials.DANDELION.parseMaterial()
|
if (!(is.getType() == Materials.DANDELION.parseMaterial() || is.getType() == Materials.CARROTS.parseMaterial() || is.getType() == Material.GOLDEN_CARROT)) {
|
||||||
|| is.getType() == Materials.CARROTS.parseMaterial()
|
|
||||||
|| is.getType() == Material.GOLDEN_CARROT)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -955,8 +862,7 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -964,8 +870,7 @@ public class Interact implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDamageVehicle(VehicleDamageEvent event) {
|
public void onPlayerDamageVehicle(VehicleDamageEvent event) {
|
||||||
if (!(event.getAttacker() instanceof Player))
|
if (!(event.getAttacker() instanceof Player)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) event.getAttacker();
|
Player player = (Player) event.getAttacker();
|
||||||
|
|
||||||
@ -973,16 +878,14 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDestroyVehicle(VehicleDestroyEvent event) {
|
public void onPlayerDestroyVehicle(VehicleDestroyEvent event) {
|
||||||
if (!(event.getAttacker() instanceof Player))
|
if (!(event.getAttacker() instanceof Player)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) event.getAttacker();
|
Player player = (Player) event.getAttacker();
|
||||||
|
|
||||||
@ -990,13 +893,11 @@ public class Interact implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
|
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
|
||||||
if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(event.getRightClicked().getLocation().getBlock().getLocation())) {
|
if (skyblock.getStackableManager() != null && skyblock.getStackableManager().isStacked(event.getRightClicked().getLocation().getBlock().getLocation())) {
|
||||||
@ -1004,22 +905,19 @@ public class Interact implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteractAtEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractAtEntity(PlayerInteractEntityEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
org.bukkit.entity.Entity entity = event.getRightClicked();
|
org.bukkit.entity.Entity entity = event.getRightClicked();
|
||||||
|
|
||||||
if (!skyblock.getWorldManager().isIslandWorld(entity.getWorld()))
|
if (!skyblock.getWorldManager().isIslandWorld(entity.getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (entity instanceof ArmorStand) {
|
if (entity instanceof ArmorStand) {
|
||||||
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "ArmorStandUse")) {
|
if (!skyblock.getIslandManager().hasPermission(player, entity.getLocation(), "ArmorStandUse")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
skyblock.getMessageManager().sendMessage(player,
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,10 @@ import org.bukkit.attribute.Attribute;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -51,30 +53,25 @@ public class Move implements Listener {
|
|||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
if (!worldManager.isIslandWorld(player.getWorld()))
|
if (!worldManager.isIslandWorld(player.getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
|
IslandWorld world = worldManager.getIslandWorld(player.getWorld());
|
||||||
|
|
||||||
if (world == IslandWorld.Nether || world == IslandWorld.End) {
|
if (world == IslandWorld.Nether || world == IslandWorld.End) {
|
||||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.World." + world.name() + ".Enable")) {
|
||||||
.getBoolean("Island.World." + world.name() + ".Enable")) {
|
|
||||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
messageManager.sendMessage(player, configLoad.getString("Island.World.Message")
|
messageManager.sendMessage(player, configLoad.getString("Island.World.Message").replace(configLoad.getString("Island.World.Word." + world.name()), world.name()));
|
||||||
.replace(configLoad.getString("Island.World.Word." + world.name()), world.name()));
|
|
||||||
|
|
||||||
if (playerDataManager.hasPlayerData(player)) {
|
if (playerDataManager.hasPlayerData(player)) {
|
||||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||||
|
|
||||||
if (playerData.getIsland() != null) {
|
if (playerData.getIsland() != null) {
|
||||||
Island island = islandManager
|
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland()));
|
||||||
.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland()));
|
|
||||||
|
|
||||||
if (island != null) {
|
if (island != null) {
|
||||||
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||||
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|
|
||||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||||
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
||||||
} else {
|
} else {
|
||||||
@ -98,8 +95,7 @@ public class Move implements Listener {
|
|||||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||||
|
|
||||||
if (playerData.getIsland() != null) {
|
if (playerData.getIsland() != null) {
|
||||||
Island island = islandManager
|
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland()));
|
||||||
.getIsland(Bukkit.getServer().getOfflinePlayer(playerData.getIsland()));
|
|
||||||
|
|
||||||
if (island != null) {
|
if (island != null) {
|
||||||
if (islandManager.isLocationAtIsland(island, to)) {
|
if (islandManager.isLocationAtIsland(island, to)) {
|
||||||
@ -119,19 +115,15 @@ public class Move implements Listener {
|
|||||||
if (keepItemsOnDeath && configLoad.getBoolean("Island.Liquid.Teleport.Enable")) {
|
if (keepItemsOnDeath && configLoad.getBoolean("Island.Liquid.Teleport.Enable")) {
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
|
|
||||||
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||||
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|
|
||||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||||
player.teleport(
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
||||||
island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
|
||||||
} else {
|
} else {
|
||||||
player.teleport(
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
||||||
island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F,
|
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
1.0F);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -145,8 +137,7 @@ public class Move implements Listener {
|
|||||||
player.setExp(0.0F);
|
player.setExp(0.0F);
|
||||||
|
|
||||||
if (NMSUtil.getVersionNumber() > 8) {
|
if (NMSUtil.getVersionNumber() > 8) {
|
||||||
player.setHealth(
|
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
|
||||||
} else {
|
} else {
|
||||||
player.setHealth(player.getMaxHealth());
|
player.setHealth(player.getMaxHealth());
|
||||||
}
|
}
|
||||||
@ -161,14 +152,11 @@ public class Move implements Listener {
|
|||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
|
|
||||||
if (configLoad.getBoolean("Island.Void.Teleport.Island")) {
|
if (configLoad.getBoolean("Island.Void.Teleport.Island")) {
|
||||||
if (island.hasRole(IslandRole.Member, player.getUniqueId())
|
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId())
|
||||||
|| island.hasRole(IslandRole.Operator, player.getUniqueId())
|
|
||||||
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
|| island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||||
player.teleport(
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
||||||
island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
|
|
||||||
} else {
|
} else {
|
||||||
player.teleport(
|
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
||||||
island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LocationUtil.teleportPlayerToSpawn(player);
|
LocationUtil.teleportPlayerToSpawn(player);
|
||||||
@ -187,9 +175,8 @@ public class Move implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.setFallDistance(0.0F);
|
player.setFallDistance(0.0F);
|
||||||
messageManager.sendMessage(player, skyblock.getFileManager()
|
messageManager.sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
.getString("Island.WorldBorder.Outside.Message"));
|
||||||
.getFileConfiguration().getString("Island.WorldBorder.Outside.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,13 +194,28 @@ public class Move implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LocationUtil.teleportPlayerToSpawn(player);
|
LocationUtil.teleportPlayerToSpawn(player);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.WorldBorder.Disappeared.Message"));
|
||||||
.getFileConfiguration().getString("Island.WorldBorder.Disappeared.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onTeleport(PlayerTeleportEvent e) {
|
||||||
|
|
||||||
|
final Player player = e.getPlayer();
|
||||||
|
final WorldManager worldManager = skyblock.getWorldManager();
|
||||||
|
|
||||||
|
if (!worldManager.isIslandWorld(e.getTo().getWorld())) return;
|
||||||
|
if (skyblock.getIslandManager().getIslandAtLocation(e.getTo()) != null) return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
skyblock.getMessageManager().sendMessage(player,
|
||||||
|
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.WorldBorder.Disappeared.Message"));
|
||||||
|
skyblock.getSoundManager().playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,26 +48,25 @@ public class Portal implements Listener {
|
|||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
SoundManager soundManager = skyblock.getSoundManager();
|
SoundManager soundManager = skyblock.getSoundManager();
|
||||||
|
|
||||||
|
if (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()) return;
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(to.getLocation());
|
Island island = islandManager.getIslandAtLocation(to.getLocation());
|
||||||
if (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (island == null) return;
|
if (island == null) return;
|
||||||
if ((to.getType().equals(Materials.NETHER_PORTAL.parseMaterial()) ||
|
|
||||||
to.getType().equals(Materials.END_PORTAL.parseMaterial())) &&
|
if ((to.getType().equals(Materials.NETHER_PORTAL.parseMaterial()) || to.getType().equals(Materials.END_PORTAL.parseMaterial()))
|
||||||
!islandManager.hasPermission(player, player.getLocation(), "Portal")) {
|
&& !islandManager.hasPermission(player, player.getLocation(), "Portal")) {
|
||||||
event.setTo(LocationUtil.getRandomLocation(event.getFrom().getWorld(), 5000, 5000, true, true));
|
event.setTo(LocationUtil.getRandomLocation(event.getFrom().getWorld(), 5000, 5000, true, true));
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onEntityPortalEnter(EntityPortalEnterEvent event) {
|
public void onEntityPortalEnter(EntityPortalEnterEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player))
|
if (!(event.getEntity() instanceof Player)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
org.bukkit.block.Block block = event.getLocation().getBlock();
|
org.bukkit.block.Block block = event.getLocation().getBlock();
|
||||||
@ -78,8 +77,7 @@ public class Portal implements Listener {
|
|||||||
WorldManager worldManager = skyblock.getWorldManager();
|
WorldManager worldManager = skyblock.getWorldManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
if (!worldManager.isIslandWorld(player.getWorld()))
|
if (!worldManager.isIslandWorld(player.getWorld())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Island island = islandManager.getIslandAtLocation(player.getLocation());
|
Island island = islandManager.getIslandAtLocation(player.getLocation());
|
||||||
|
|
||||||
@ -90,8 +88,7 @@ public class Portal implements Listener {
|
|||||||
|
|
||||||
if (!islandManager.hasPermission(player, player.getLocation(), "Portal")) {
|
if (!islandManager.hasPermission(player, player.getLocation(), "Portal")) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
|
||||||
.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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -123,9 +120,7 @@ public class Portal implements Listener {
|
|||||||
tick.setLast(System.currentTimeMillis());
|
tick.setLast(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
if (tick.getTick() >= 100) {
|
if (tick.getTick() >= 100) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Portal.Stuck.Message"));
|
||||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
|
|
||||||
.getString("Island.Portal.Stuck.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
LocationUtil.teleportPlayerToSpawn(player);
|
LocationUtil.teleportPlayerToSpawn(player);
|
||||||
return;
|
return;
|
||||||
@ -137,10 +132,8 @@ public class Portal implements Listener {
|
|||||||
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
|
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
|
||||||
IslandWorld toWorld = IslandWorld.Normal;
|
IslandWorld toWorld = IslandWorld.Normal;
|
||||||
|
|
||||||
if (block.getType().equals(Materials.NETHER_PORTAL.parseMaterial()))
|
if (block.getType().equals(Materials.NETHER_PORTAL.parseMaterial())) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.Nether : IslandWorld.Normal;
|
||||||
toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.Nether : IslandWorld.Normal;
|
else if (block.getType().equals(Materials.END_PORTAL.parseMaterial())) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
|
||||||
else if (block.getType().equals(Materials.END_PORTAL.parseMaterial()))
|
|
||||||
toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
|
|
||||||
|
|
||||||
switch (toWorld) {
|
switch (toWorld) {
|
||||||
case Nether:
|
case Nether:
|
||||||
|
@ -54,7 +54,7 @@ public class Spawner implements Listener {
|
|||||||
Object TileEntityMobSpawner = TileEntityMobSpawnerField.get(spawner);
|
Object TileEntityMobSpawner = TileEntityMobSpawnerField.get(spawner);
|
||||||
MobSpawner = TileEntityMobSpawner.getClass().getMethod("getSpawner")
|
MobSpawner = TileEntityMobSpawner.getClass().getMethod("getSpawner")
|
||||||
.invoke(TileEntityMobSpawner);
|
.invoke(TileEntityMobSpawner);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException ignored) {
|
||||||
Field snapshotField = spawner.getClass().getSuperclass().getDeclaredField("snapshot");
|
Field snapshotField = spawner.getClass().getSuperclass().getDeclaredField("snapshot");
|
||||||
snapshotField.setAccessible(true);
|
snapshotField.setAccessible(true);
|
||||||
Object snapshot = snapshotField.get(spawner);
|
Object snapshot = snapshotField.get(spawner);
|
||||||
@ -92,6 +92,8 @@ public class Spawner implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spawner.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -57,8 +57,7 @@ public class Teleport implements Listener {
|
|||||||
if (worldManager.isIslandWorld(player.getWorld())) {
|
if (worldManager.isIslandWorld(player.getWorld())) {
|
||||||
boolean isCause = false;
|
boolean isCause = false;
|
||||||
|
|
||||||
if (event.getCause() == TeleportCause.ENDER_PEARL || event.getCause() == TeleportCause.NETHER_PORTAL
|
if (event.getCause() == TeleportCause.ENDER_PEARL || event.getCause() == TeleportCause.NETHER_PORTAL || event.getCause() == TeleportCause.END_PORTAL) {
|
||||||
|| event.getCause() == TeleportCause.END_PORTAL) {
|
|
||||||
isCause = true;
|
isCause = true;
|
||||||
} else {
|
} else {
|
||||||
if (NMSUtil.getVersionNumber() > 9) {
|
if (NMSUtil.getVersionNumber() > 9) {
|
||||||
@ -90,23 +89,19 @@ public class Teleport implements Listener {
|
|||||||
|
|
||||||
if (island != null) {
|
if (island != null) {
|
||||||
if (!island.getOwnerUUID().equals(playerData.getOwner())) {
|
if (!island.getOwnerUUID().equals(playerData.getOwner())) {
|
||||||
if (!player.hasPermission("fabledskyblock.bypass") && !player.hasPermission("fabledskyblock.bypass.*")
|
if (!player.hasPermission("fabledskyblock.bypass") && !player.hasPermission("fabledskyblock.bypass.*") && !player.hasPermission("fabledskyblock.*")) {
|
||||||
&& !player.hasPermission("fabledskyblock.*")) {
|
|
||||||
if (!island.isOpen() && !island.isCoopPlayer(player.getUniqueId())) {
|
if (!island.isOpen() && !island.isCoopPlayer(player.getUniqueId())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Plugin.Message"));
|
||||||
configLoad.getString("Island.Visit.Closed.Plugin.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")
|
||||||
.getFileConfiguration().getBoolean("Island.Visitor.Banning")
|
|
||||||
&& island.getBan().isBanned(player.getUniqueId())) {
|
&& island.getBan().isBanned(player.getUniqueId())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Teleport.Message"));
|
||||||
configLoad.getString("Island.Visit.Banned.Teleport.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -124,8 +119,7 @@ public class Teleport implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player, exitIsland));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandExitEvent(player, exitIsland));
|
||||||
Bukkit.getServer().getPluginManager()
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandSwitchEvent(player, exitIsland, island.getAPIWrapper()));
|
||||||
.callEvent(new PlayerIslandSwitchEvent(player, exitIsland, island.getAPIWrapper()));
|
|
||||||
|
|
||||||
playerData.setVisitTime(0);
|
playerData.setVisitTime(0);
|
||||||
}
|
}
|
||||||
@ -133,8 +127,7 @@ public class Teleport implements Listener {
|
|||||||
if (worldManager.getIslandWorld(event.getTo().getWorld()) == IslandWorld.Normal) {
|
if (worldManager.getIslandWorld(event.getTo().getWorld()) == IslandWorld.Normal) {
|
||||||
if (!island.isWeatherSynchronized()) {
|
if (!island.isWeatherSynchronized()) {
|
||||||
player.setPlayerTime(island.getTime(),
|
player.setPlayerTime(island.getTime(),
|
||||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
||||||
.getFileConfiguration().getBoolean("Island.Weather.Time.Cycle"));
|
|
||||||
player.setPlayerWeather(island.getWeather());
|
player.setPlayerWeather(island.getWeather());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,17 +135,14 @@ public class Teleport implements Listener {
|
|||||||
UUID islandOwnerUUID = playerData.getIsland();
|
UUID islandOwnerUUID = playerData.getIsland();
|
||||||
playerData.setIsland(island.getOwnerUUID());
|
playerData.setIsland(island.getOwnerUUID());
|
||||||
|
|
||||||
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID)
|
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID) && (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
|
||||||
&& (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
|
islandManager.unloadIsland(islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)), null);
|
||||||
islandManager.unloadIsland(
|
|
||||||
islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)), null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Visit visit = island.getVisit();
|
Visit visit = island.getVisit();
|
||||||
|
|
||||||
if (!visit.isVisitor(player.getUniqueId())) {
|
if (!visit.isVisitor(player.getUniqueId())) {
|
||||||
Bukkit.getServer().getPluginManager()
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerIslandEnterEvent(player, island.getAPIWrapper()));
|
||||||
.callEvent(new PlayerIslandEnterEvent(player, island.getAPIWrapper()));
|
|
||||||
|
|
||||||
visit.addVisitor(player.getUniqueId());
|
visit.addVisitor(player.getUniqueId());
|
||||||
visit.save();
|
visit.save();
|
||||||
@ -180,10 +170,8 @@ public class Teleport implements Listener {
|
|||||||
UUID islandOwnerUUID = playerData.getIsland();
|
UUID islandOwnerUUID = playerData.getIsland();
|
||||||
playerData.setIsland(null);
|
playerData.setIsland(null);
|
||||||
|
|
||||||
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID)
|
if (islandOwnerUUID != null && islandManager.containsIsland(islandOwnerUUID) && (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
|
||||||
&& (playerData.getOwner() == null || !playerData.getOwner().equals(islandOwnerUUID))) {
|
islandManager.unloadIsland(islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)), null);
|
||||||
islandManager.unloadIsland(
|
|
||||||
islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)), null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package com.songoda.skyblock.menus;
|
package com.songoda.skyblock.menus;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import java.io.File;
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
|
||||||
import com.songoda.skyblock.island.Island;
|
|
||||||
import com.songoda.skyblock.utils.item.nInventoryUtil;
|
|
||||||
import com.songoda.skyblock.utils.version.Materials;
|
|
||||||
import com.songoda.skyblock.utils.version.Sounds;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -14,123 +10,116 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.io.File;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
|
import com.songoda.skyblock.island.Island;
|
||||||
|
import com.songoda.skyblock.utils.item.MenuClickRegistry;
|
||||||
|
import com.songoda.skyblock.utils.item.MenuClickRegistry.RegistryKey;
|
||||||
|
import com.songoda.skyblock.utils.item.nInventoryUtil;
|
||||||
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
|
import com.songoda.skyblock.utils.version.Sounds;
|
||||||
|
|
||||||
public class ControlPanel {
|
public final class ControlPanel {
|
||||||
|
|
||||||
private static ControlPanel instance;
|
private static ControlPanel instance;
|
||||||
|
|
||||||
public static ControlPanel getInstance() {
|
public static ControlPanel getInstance() {
|
||||||
if (instance == null) {
|
return instance == null ? instance = new ControlPanel() : instance;
|
||||||
instance = new ControlPanel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
private ControlPanel() {
|
||||||
|
|
||||||
|
MenuClickRegistry.getInstance().register((executors) -> {
|
||||||
|
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Teleport.Displayname", Materials.OAK_DOOR), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island teleport"), 1L);
|
||||||
|
});
|
||||||
|
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Lock.Displayname", Materials.IRON_DOOR), (inst, player, e) -> {
|
||||||
|
|
||||||
|
final Island island = SkyBlock.getInstance().getIslandManager().getIsland((Player) player);
|
||||||
|
|
||||||
|
if (island.isOpen()) {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island close"), 1L);
|
||||||
|
} else {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island open"), 1L);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Barrier.Displayname", Materials.BLACK_STAINED_GLASS_PANE), (inst, player, e) -> {
|
||||||
|
inst.getSoundManager().playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
|
e.setWillClose(false);
|
||||||
|
e.setWillDestroy(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Level.Displayname", Materials.EXPERIENCE_BOTTLE), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island level"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Settings.Displayname", Materials.NAME_TAG), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island settings"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Members.Displayname", Materials.ITEM_FRAME), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island members"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Biome.Displayname", Materials.OAK_SAPLING), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island biome"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Weather.Displayname", Materials.CLOCK), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island weather"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Bans.Displayname", Materials.IRON_AXE), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island bans"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Visitors.Displayname", Materials.OAK_SIGN), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island visitors"), 1L);
|
||||||
|
});
|
||||||
|
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Upgrades.Displayname", Materials.ANVIL), (inst, player, e) -> {
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island upgrades"), 1L);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(Player player) {
|
public void open(Player player) {
|
||||||
SkyBlock skyblock = SkyBlock.getInstance();
|
SkyBlock skyblock = SkyBlock.getInstance();
|
||||||
Island island = skyblock.getIslandManager().getIsland(player);
|
|
||||||
|
|
||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
||||||
ItemStack is = event.getItem();
|
MenuClickRegistry.getInstance().dispatch(player, event);
|
||||||
|
|
||||||
if ((is.getType() == Materials.OAK_DOOR.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island teleport"), 1L);
|
|
||||||
} else if ((is.getType() == Materials.IRON_DOOR.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"))))) {
|
|
||||||
if (island.isOpen()) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island close"), 1L);
|
|
||||||
} else {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island open"), 1L);
|
|
||||||
}
|
|
||||||
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"))))) {
|
|
||||||
skyblock.getSoundManager().playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
|
|
||||||
|
|
||||||
event.setWillClose(false);
|
|
||||||
event.setWillDestroy(false);
|
|
||||||
} else if ((is.getType() == Materials.EXPERIENCE_BOTTLE.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island level"), 1L);
|
|
||||||
} else if ((is.getType() == Material.NAME_TAG) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island settings"), 1L);
|
|
||||||
} else if ((is.getType() == Material.ITEM_FRAME) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island members"), 1L);
|
|
||||||
} else if ((is.getType() == Materials.OAK_SAPLING.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island biome"), 1L);
|
|
||||||
} else if ((is.getType() == Materials.CLOCK.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island weather"), 1L);
|
|
||||||
} else if ((is.getType() == Material.IRON_AXE) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island bans"), 1L);
|
|
||||||
} else if ((is.getType() == Materials.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island visitors"), 1L);
|
|
||||||
} else if ((is.getType() == Materials.ANVIL.parseMaterial()) && (is.hasItemMeta())
|
|
||||||
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"))))) {
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> Bukkit.getServer().dispatchCommand(player, "island upgrades"), 1L);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Teleport to island and open/close island
|
// Teleport to island and open/close island
|
||||||
nInv.addItem(nInv.createItem(Materials.OAK_DOOR.parseItem(),
|
nInv.addItem(nInv.createItem(Materials.OAK_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1);
|
configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1);
|
||||||
nInv.addItem(nInv.createItem(Materials.IRON_DOOR.parseItem(),
|
nInv.addItem(nInv.createItem(Materials.IRON_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10);
|
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10);
|
||||||
|
|
||||||
// Glass panes barriers
|
// Glass panes barriers
|
||||||
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
|
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8,
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8, 9, 11, 14, 17);
|
9, 11, 14, 17);
|
||||||
|
|
||||||
// 4 Items at the left
|
// 4 Items at the left
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Materials.EXPERIENCE_BOTTLE.parseMaterial()),
|
nInv.addItem(nInv.createItem(new ItemStack(Materials.EXPERIENCE_BOTTLE.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3);
|
configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3);
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
|
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG), configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Settings.Lore"), null, null, null), 4);
|
configLoad.getStringList("Menu.ControlPanel.Item.Settings.Lore"), null, null, null), 4);
|
||||||
nInv.addItem(nInv.createItem(Materials.CLOCK.parseItem(),
|
nInv.addItem(nInv.createItem(Materials.CLOCK.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12);
|
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12);
|
||||||
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(),
|
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13);
|
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13);
|
||||||
|
|
||||||
// 4 Items at the right
|
// 4 Items at the right
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME),
|
nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME), configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16);
|
configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16);
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Material.IRON_AXE),
|
nInv.addItem(nInv.createItem(new ItemStack(Material.IRON_AXE), configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"),
|
configLoad.getStringList("Menu.ControlPanel.Item.Bans.Lore"), null, null, new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES }), 6);
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Bans.Lore"), null, null,
|
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
|
||||||
new ItemFlag[]{ItemFlag.HIDE_ATTRIBUTES}), 6);
|
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
|
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7);
|
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7);
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Materials.ANVIL.parseMaterial()),
|
nInv.addItem(nInv.createItem(new ItemStack(Materials.ANVIL.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
|
||||||
configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
|
|
||||||
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15);
|
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15);
|
||||||
|
|
||||||
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.ControlPanel.Title")));
|
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.ControlPanel.Title")));
|
||||||
|
@ -116,14 +116,7 @@ public class PlaceholderManager {
|
|||||||
.replace("%placeholder", "" + island.getRadius()));
|
.replace("%placeholder", "" + island.getRadius()));
|
||||||
}
|
}
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_level")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_level")) {
|
||||||
if (island == null) {
|
return island == null ? "0": Long.toString(island.getLevel().getLevel());
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_level.Empty.Message"));
|
|
||||||
} else {
|
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_level.Non-empty.Message")
|
|
||||||
.replace("%placeholder", "" + island.getLevel().getLevel()));
|
|
||||||
}
|
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_level_formatted")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_level_formatted")) {
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
@ -134,14 +127,7 @@ public class PlaceholderManager {
|
|||||||
"%placeholder", "" + NumberUtil.formatNumberBySuffix(island.getLevel().getLevel())));
|
"%placeholder", "" + NumberUtil.formatNumberBySuffix(island.getLevel().getLevel())));
|
||||||
}
|
}
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_points")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_points")) {
|
||||||
if (island == null) {
|
return island == null ? "0": Long.toString(island.getLevel().getPoints());
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_points.Empty.Message"));
|
|
||||||
} else {
|
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_points.Non-empty.Message")
|
|
||||||
.replace("%placeholder", "" + island.getLevel().getPoints()));
|
|
||||||
}
|
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_votes")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_votes")) {
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
|
@ -4,6 +4,8 @@ import com.songoda.skyblock.SkyBlock;
|
|||||||
import com.songoda.skyblock.config.FileManager.Config;
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
import com.songoda.skyblock.confirmation.Confirmation;
|
import com.songoda.skyblock.confirmation.Confirmation;
|
||||||
import com.songoda.skyblock.utils.structure.Area;
|
import com.songoda.skyblock.utils.structure.Area;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -146,7 +148,7 @@ public class PlayerData {
|
|||||||
public String[] getTexture() {
|
public String[] getTexture() {
|
||||||
FileConfiguration configLoad = getConfig().getFileConfiguration();
|
FileConfiguration configLoad = getConfig().getFileConfiguration();
|
||||||
|
|
||||||
return new String[]{configLoad.getString("Texture.Signature"), configLoad.getString("Texture.Value")};
|
return new String[] { configLoad.getString("Texture.Signature"), configLoad.getString("Texture.Value") };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTexture(String signature, String value) {
|
public void setTexture(String signature, String value) {
|
||||||
@ -162,6 +164,23 @@ public class PlayerData {
|
|||||||
getConfig().getFileConfiguration().set("Statistics.Island.LastOnline", date);
|
getConfig().getFileConfiguration().set("Statistics.Island.LastOnline", date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getIslandCreationCount() {
|
||||||
|
return getConfig().getFileConfiguration().getLong("Statistics.Island.IslandCreationCount");
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getIslandDeletionCount() {
|
||||||
|
return getConfig().getFileConfiguration().getLong("Statistics.Island.IslandDeleteCount");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIslandCreationCount(long newNumber) {
|
||||||
|
getConfig().getFileConfiguration().set("Statistics.Island.IslandCreationCount", newNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIslandDeletionCount(long newNumber) {
|
||||||
|
getConfig().getFileConfiguration().set("Statistics.Island.IslandDeleteCount", newNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Area getArea() {
|
public Area getArea() {
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
@ -197,7 +216,11 @@ public class PlayerData {
|
|||||||
private Config getConfig() {
|
private Config getConfig() {
|
||||||
SkyBlock skyblock = SkyBlock.getInstance();
|
SkyBlock skyblock = SkyBlock.getInstance();
|
||||||
|
|
||||||
return skyblock.getFileManager().getConfig(
|
return skyblock.getFileManager().getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
|
||||||
new File(new File(skyblock.getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return Bukkit.getPlayer(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,12 +117,20 @@ public class PlayerDataManager {
|
|||||||
return playerDataStorage;
|
return playerDataStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerData getPlayerData(UUID uuid) {
|
||||||
|
return playerDataStorage.get(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPlayerData(UUID uuid) {
|
||||||
|
return playerDataStorage.containsKey(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerData getPlayerData(Player player) {
|
public PlayerData getPlayerData(Player player) {
|
||||||
return playerDataStorage.get(player.getUniqueId());
|
return getPlayerData(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPlayerData(Player player) {
|
public boolean hasPlayerData(Player player) {
|
||||||
return playerDataStorage.containsKey(player.getUniqueId());
|
return hasPlayerData(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storeIsland(Player player) {
|
public void storeIsland(Player player) {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.songoda.skyblock.scoreboard;
|
package com.songoda.skyblock.scoreboard;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import java.util.ArrayList;
|
||||||
import com.songoda.skyblock.island.Island;
|
import java.util.HashMap;
|
||||||
import com.songoda.skyblock.island.IslandLevel;
|
import java.util.List;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import java.util.Map;
|
||||||
import com.songoda.skyblock.island.IslandRole;
|
import java.util.UUID;
|
||||||
import com.songoda.skyblock.placeholder.PlaceholderManager;
|
|
||||||
import com.songoda.skyblock.utils.NumberUtil;
|
|
||||||
import com.songoda.skyblock.utils.version.NMSUtil;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -18,13 +15,20 @@ import org.bukkit.scoreboard.DisplaySlot;
|
|||||||
import org.bukkit.scoreboard.Objective;
|
import org.bukkit.scoreboard.Objective;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
import java.util.*;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
|
import com.songoda.skyblock.island.Island;
|
||||||
|
import com.songoda.skyblock.island.IslandLevel;
|
||||||
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
|
import com.songoda.skyblock.island.IslandRole;
|
||||||
|
import com.songoda.skyblock.placeholder.PlaceholderManager;
|
||||||
|
import com.songoda.skyblock.utils.NumberUtil;
|
||||||
|
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||||
|
|
||||||
public class Scoreboard {
|
public class Scoreboard {
|
||||||
|
|
||||||
private final SkyBlock plugin;
|
private final SkyBlock plugin;
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
private String displayName;
|
private String displayName;
|
||||||
private List<String> displayList;
|
private List<String> displayList;
|
||||||
private Map<String, String> displayVariables;
|
private Map<String, String> displayVariables;
|
||||||
@ -72,8 +76,7 @@ public class Scoreboard {
|
|||||||
|
|
||||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
|
|
||||||
String formattedDisplayName = ChatColor.translateAlternateColorCodes('&',
|
String formattedDisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName));
|
||||||
replaceDisplayName(displayName));
|
|
||||||
int max = NMSUtil.getVersionNumber() > 8 ? 32 : 16;
|
int max = NMSUtil.getVersionNumber() > 8 ? 32 : 16;
|
||||||
if (formattedDisplayName.length() > max) {
|
if (formattedDisplayName.length() > max) {
|
||||||
obj.setDisplayName(ChatColor.RED + "Too long...");
|
obj.setDisplayName(ChatColor.RED + "Too long...");
|
||||||
@ -100,8 +103,7 @@ public class Scoreboard {
|
|||||||
if (!player.isOnline()) cancel();
|
if (!player.isOnline()) cancel();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String formattedDisplayName = ChatColor.translateAlternateColorCodes('&',
|
String formattedDisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName));
|
||||||
replaceDisplayName(displayName));
|
|
||||||
|
|
||||||
if (formattedDisplayName.length() > max) {
|
if (formattedDisplayName.length() > max) {
|
||||||
obj.setDisplayName(ChatColor.RED + "Too long...");
|
obj.setDisplayName(ChatColor.RED + "Too long...");
|
||||||
@ -119,50 +121,37 @@ public class Scoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (displayLine.length() >= 16) {
|
if (displayLine.length() >= 16) {
|
||||||
String prefixLine = displayLine.substring(0,
|
String prefixLine = displayLine.substring(0, Math.min(displayLine.length(), 16));
|
||||||
Math.min(displayLine.length(), 16));
|
String suffixLine = displayLine.substring(16, Math.min(displayLine.length(), displayLine.length()));
|
||||||
String suffixLine = displayLine.substring(16,
|
|
||||||
Math.min(displayLine.length(), displayLine.length()));
|
|
||||||
|
|
||||||
if (prefixLine.substring(prefixLine.length() - 1).equals("&")) {
|
if (prefixLine.substring(prefixLine.length() - 1).equals("&")) {
|
||||||
prefixLine = ChatColor.translateAlternateColorCodes('&',
|
prefixLine = ChatColor.translateAlternateColorCodes('&', prefixLine.substring(0, prefixLine.length() - 1));
|
||||||
prefixLine.substring(0, prefixLine.length() - 1));
|
suffixLine = ChatColor.translateAlternateColorCodes('&', "&" + suffixLine);
|
||||||
suffixLine = ChatColor.translateAlternateColorCodes('&',
|
|
||||||
"&" + suffixLine);
|
|
||||||
} else {
|
} else {
|
||||||
String lastColorCodes;
|
String lastColorCodes;
|
||||||
|
|
||||||
if (prefixLine.contains("&")) {
|
if (prefixLine.contains("&")) {
|
||||||
String[] colorCodes = prefixLine.split("&");
|
String[] colorCodes = prefixLine.split("&");
|
||||||
String lastColorCodeText = colorCodes[colorCodes.length - 1];
|
String lastColorCodeText = colorCodes[colorCodes.length - 1];
|
||||||
lastColorCodes = "&" + lastColorCodeText.substring(0,
|
lastColorCodes = "&" + lastColorCodeText.substring(0, Math.min(lastColorCodeText.length(), 1));
|
||||||
Math.min(lastColorCodeText.length(), 1));
|
|
||||||
|
|
||||||
if ((colorCodes.length >= 2) && (lastColorCodes.equals("&l")
|
if ((colorCodes.length >= 2)
|
||||||
|| lastColorCodes.equals("&m")
|
&& (lastColorCodes.equals("&l") || lastColorCodes.equals("&m") || lastColorCodes.equals("&n") || lastColorCodes.equals("&o"))) {
|
||||||
|| lastColorCodes.equals("&n")
|
|
||||||
|| lastColorCodes.equals("&o"))) {
|
|
||||||
lastColorCodeText = colorCodes[colorCodes.length - 2];
|
lastColorCodeText = colorCodes[colorCodes.length - 2];
|
||||||
lastColorCodes = "&"
|
lastColorCodes = "&" + lastColorCodeText.substring(0, Math.min(lastColorCodeText.length(), 1)) + lastColorCodes;
|
||||||
+ lastColorCodeText.substring(0,
|
|
||||||
Math.min(lastColorCodeText.length(), 1))
|
|
||||||
+ lastColorCodes;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastColorCodes = "&f";
|
lastColorCodes = "&f";
|
||||||
}
|
}
|
||||||
|
|
||||||
prefixLine = ChatColor.translateAlternateColorCodes('&',
|
prefixLine = ChatColor.translateAlternateColorCodes('&', prefixLine);
|
||||||
prefixLine);
|
suffixLine = ChatColor.translateAlternateColorCodes('&', lastColorCodes + suffixLine);
|
||||||
suffixLine = ChatColor.translateAlternateColorCodes('&',
|
|
||||||
lastColorCodes + suffixLine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scoreboard.getTeam(ranStr + i1).setPrefix(prefixLine);
|
scoreboard.getTeam(ranStr + i1).setPrefix(prefixLine);
|
||||||
scoreboard.getTeam(ranStr + i1).setSuffix(suffixLine);
|
scoreboard.getTeam(ranStr + i1).setSuffix(suffixLine);
|
||||||
} else {
|
} else {
|
||||||
scoreboard.getTeam(ranStr + i1).setPrefix(
|
scoreboard.getTeam(ranStr + i1).setPrefix(ChatColor.translateAlternateColorCodes('&', displayLine));
|
||||||
ChatColor.translateAlternateColorCodes('&', displayLine));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,8 +170,7 @@ public class Scoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String replaceDisplayName(String displayName) {
|
private String replaceDisplayName(String displayName) {
|
||||||
displayName = displayName.replace("%players_online", "" + Bukkit.getServer().getOnlinePlayers().size())
|
displayName = displayName.replace("%players_online", "" + Bukkit.getServer().getOnlinePlayers().size()).replace("%players_max", "" + Bukkit.getServer().getMaxPlayers());
|
||||||
.replace("%players_max", "" + Bukkit.getServer().getMaxPlayers());
|
|
||||||
|
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
@ -192,8 +180,7 @@ public class Scoreboard {
|
|||||||
|
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
|
|
||||||
displayLine = displayLine.replace("%players_online", "" + Bukkit.getServer().getOnlinePlayers().size())
|
displayLine = displayLine.replace("%players_online", "" + Bukkit.getServer().getOnlinePlayers().size()).replace("%players_max", "" + Bukkit.getServer().getMaxPlayers());
|
||||||
.replace("%players_max", "" + Bukkit.getServer().getMaxPlayers());
|
|
||||||
|
|
||||||
Island island = islandManager.getIsland(player);
|
Island island = islandManager.getIsland(player);
|
||||||
|
|
||||||
@ -201,15 +188,11 @@ public class Scoreboard {
|
|||||||
IslandLevel level = island.getLevel();
|
IslandLevel level = island.getLevel();
|
||||||
|
|
||||||
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||||
displayLine = displayLine
|
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel())).replace("%island_members", ChatColor.RED + "0")
|
||||||
.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel()))
|
.replace("%island_role", ChatColor.RED + "null").replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size())
|
||||||
.replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null")
|
.replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||||
.replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size())
|
|
||||||
.replace("%island_size", "" + island.getSize())
|
|
||||||
.replace("%island_radius", "" + island.getRadius());
|
|
||||||
} else {
|
} else {
|
||||||
int islandMembers = 1 + island.getRole(IslandRole.Member).size()
|
int islandMembers = 1 + island.getRole(IslandRole.Member).size() + island.getRole(IslandRole.Operator).size();
|
||||||
+ island.getRole(IslandRole.Operator).size();
|
|
||||||
String islandRole = "";
|
String islandRole = "";
|
||||||
|
|
||||||
if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
if (island.hasRole(IslandRole.Owner, player.getUniqueId())) {
|
||||||
@ -220,26 +203,20 @@ public class Scoreboard {
|
|||||||
islandRole = displayVariables.get("%member");
|
islandRole = displayVariables.get("%member");
|
||||||
}
|
}
|
||||||
|
|
||||||
displayLine = displayLine
|
displayLine = displayLine.replace("%island_points", "" + NumberUtil.formatNumberByDecimal(level.getPoints()))
|
||||||
.replace("%island_points", "" + NumberUtil.formatNumberByDecimal(level.getPoints()))
|
.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel())).replace("%island_members", "" + islandMembers).replace("%island_role", islandRole)
|
||||||
.replace("%island_level", "" + NumberUtil.formatNumberByDecimal(level.getLevel()))
|
.replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size()).replace("%island_size", "" + island.getSize())
|
||||||
.replace("%island_members", "" + islandMembers).replace("%island_role", islandRole)
|
|
||||||
.replace("%island_visitors", "" + islandManager.getVisitorsAtIsland(island).size())
|
|
||||||
.replace("%island_size", "" + island.getSize())
|
|
||||||
.replace("%island_radius", "" + island.getRadius());
|
.replace("%island_radius", "" + island.getRadius());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayLine = displayLine.replace("%island_points", ChatColor.RED + "0")
|
displayLine = displayLine.replace("%island_points", ChatColor.RED + "0").replace("%island_level", ChatColor.RED + "0").replace("%island_members", ChatColor.RED + "0")
|
||||||
.replace("%island_level", ChatColor.RED + "0").replace("%island_members", ChatColor.RED + "0")
|
.replace("%island_role", ChatColor.RED + "null").replace("%island_size", ChatColor.RED + "0").replace("%island_radius", ChatColor.RED + "0");
|
||||||
.replace("%island_role", ChatColor.RED + "null").replace("%island_size", ChatColor.RED + "0")
|
|
||||||
.replace("%island_radius", ChatColor.RED + "0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||||
|
|
||||||
if (placeholderManager.isPlaceholderAPIEnabled()) {
|
if (placeholderManager.isPlaceholderAPIEnabled()) {
|
||||||
displayLine = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, displayLine.replace("&", "clr"))
|
displayLine = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, displayLine.replace("&", "clr")).replace("clr", "&");
|
||||||
.replace("clr", "&");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return displayLine;
|
return displayLine;
|
||||||
|
@ -1,37 +1,58 @@
|
|||||||
package com.songoda.skyblock.scoreboard;
|
package com.songoda.skyblock.scoreboard;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.scoreboard.Objective;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
|
import org.bukkit.scoreboard.Team.Option;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
import com.songoda.skyblock.island.IslandRole;
|
import com.songoda.skyblock.island.IslandRole;
|
||||||
import org.bukkit.Bukkit;
|
import com.songoda.skyblock.utils.version.NMSUtil;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.io.File;
|
public class ScoreboardManager extends BukkitRunnable {
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ScoreboardManager {
|
|
||||||
|
|
||||||
|
private final static int VERSION = NMSUtil.getVersionNumber();
|
||||||
private final SkyBlock skyblock;
|
private final SkyBlock skyblock;
|
||||||
private Map<UUID, Scoreboard> scoreboardStorage = new HashMap<>();
|
private final Map<UUID, Scoreboard> scoreboardStorage;
|
||||||
|
|
||||||
|
private int runTicks = 0;
|
||||||
|
|
||||||
|
private List<String> teamNames;
|
||||||
|
private List<String> objectiveNames;
|
||||||
|
|
||||||
public ScoreboardManager(SkyBlock skyblock) {
|
public ScoreboardManager(SkyBlock skyblock) {
|
||||||
this.skyblock = skyblock;
|
this.skyblock = skyblock;
|
||||||
|
this.scoreboardStorage = new HashMap<>();
|
||||||
|
this.teamNames = new ArrayList<>();
|
||||||
|
this.objectiveNames = new ArrayList<>();
|
||||||
|
this.runTaskTimer(skyblock, 20, 40);
|
||||||
|
}
|
||||||
|
|
||||||
new BukkitRunnable() {
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
if (runTicks++ == 0) {
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Scoreboard.Enable")) {
|
||||||
.getBoolean("Island.Scoreboard.Enable")) {
|
|
||||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||||
|
|
||||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||||
@ -39,42 +60,30 @@ public class ScoreboardManager {
|
|||||||
Island island = islandManager.getIsland(all);
|
Island island = islandManager.getIsland(all);
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
||||||
scoreboard.setDisplayList(
|
|
||||||
config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
if (island.getRole(IslandRole.Member).size() == 0
|
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
|
||||||
|
|
||||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
|
||||||
|
|
||||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> displayVariables = new HashMap<>();
|
Map<String, String> displayVariables = new HashMap<>();
|
||||||
displayVariables.put("%owner",
|
displayVariables.put("%owner", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
displayVariables.put("%operator", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
||||||
displayVariables.put("%operator", config.getFileConfiguration()
|
displayVariables.put("%member", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
||||||
.getString("Scoreboard.Island.Team.Word.Operator"));
|
|
||||||
displayVariables.put("%member",
|
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
|
||||||
|
|
||||||
scoreboard.setDisplayVariables(displayVariables);
|
scoreboard.setDisplayVariables(displayVariables);
|
||||||
}
|
}
|
||||||
@ -84,16 +93,112 @@ public class ScoreboardManager {
|
|||||||
storeScoreboard(all, scoreboard);
|
storeScoreboard(all, scoreboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}.runTaskLater(skyblock, 20L);
|
|
||||||
|
final org.bukkit.scoreboard.Scoreboard primary = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||||
|
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
|
||||||
|
final Set<Objective> objectives = primary.getObjectives();
|
||||||
|
final Set<Team> teams = primary.getTeams();
|
||||||
|
|
||||||
|
for (Player player : players) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unregister all teams or objectives that are no longer present in the main
|
||||||
|
* scoreboard.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final org.bukkit.scoreboard.Scoreboard board = player.getScoreboard();
|
||||||
|
|
||||||
|
for (String name : objectiveNames) {
|
||||||
|
|
||||||
|
if (primary.getObjective(name) != null) continue;
|
||||||
|
|
||||||
|
final Objective objective = board.getObjective(name);
|
||||||
|
|
||||||
|
if (objective != null) objective.unregister();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String name : teamNames) {
|
||||||
|
|
||||||
|
if (primary.getTeam(name) != null) continue;
|
||||||
|
|
||||||
|
final Team team = board.getTeam(name);
|
||||||
|
|
||||||
|
if (team != null) team.unregister();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the objective/team names.
|
||||||
|
*/
|
||||||
|
|
||||||
|
objectiveNames.clear();
|
||||||
|
teamNames.clear();
|
||||||
|
|
||||||
|
objectives.forEach(objective -> {
|
||||||
|
if (primary.getObjective(objective.getName()) != null) objectiveNames.add(objective.getName());
|
||||||
|
});
|
||||||
|
teams.forEach(team -> {
|
||||||
|
if (primary.getTeam(team.getName()) != null) teamNames.add(team.getName());
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update or add any missing information to the player's scoreboard.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (Player player : players) {
|
||||||
|
|
||||||
|
final org.bukkit.scoreboard.Scoreboard playerBoard = player.getScoreboard();
|
||||||
|
|
||||||
|
for (Objective primaryObjective : objectives) {
|
||||||
|
|
||||||
|
Objective obj = playerBoard.getObjective(primaryObjective.getName());
|
||||||
|
|
||||||
|
if (obj == null) obj = playerBoard.registerNewObjective(primaryObjective.getName(), primaryObjective.getCriteria());
|
||||||
|
|
||||||
|
obj.setDisplayName(primaryObjective.getDisplayName());
|
||||||
|
obj.setDisplaySlot(primaryObjective.getDisplaySlot());
|
||||||
|
obj.setRenderType(primaryObjective.getRenderType());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Team primaryTeam : teams) {
|
||||||
|
|
||||||
|
Team obj = playerBoard.getTeam(primaryTeam.getName());
|
||||||
|
|
||||||
|
if (obj == null) obj = playerBoard.registerNewTeam(primaryTeam.getName());
|
||||||
|
|
||||||
|
obj.setAllowFriendlyFire(primaryTeam.allowFriendlyFire());
|
||||||
|
obj.setCanSeeFriendlyInvisibles(primaryTeam.canSeeFriendlyInvisibles());
|
||||||
|
if (VERSION > 11) obj.setColor(primaryTeam.getColor());
|
||||||
|
obj.setDisplayName(primaryTeam.getDisplayName());
|
||||||
|
obj.setNameTagVisibility(primaryTeam.getNameTagVisibility());
|
||||||
|
obj.setPrefix(primaryTeam.getPrefix());
|
||||||
|
obj.setSuffix(primaryTeam.getSuffix());
|
||||||
|
|
||||||
|
for (String primaryEntry : primaryTeam.getEntries()) {
|
||||||
|
obj.addEntry(primaryEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VERSION > 8) {
|
||||||
|
for (Option option : Option.values()) {
|
||||||
|
obj.setOption(option, primaryTeam.getOption(option));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resendScoreboard() {
|
public void resendScoreboard() {
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
FileManager fileManager = skyblock.getFileManager();
|
||||||
|
|
||||||
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
|
if (!fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Scoreboard.Enable")) return;
|
||||||
.getBoolean("Island.Scoreboard.Enable")) return;
|
|
||||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||||
|
|
||||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||||
@ -104,42 +209,30 @@ public class ScoreboardManager {
|
|||||||
Island island = islandManager.getIsland(all);
|
Island island = islandManager.getIsland(all);
|
||||||
|
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
||||||
scoreboard.setDisplayList(
|
|
||||||
config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
if (island.getRole(IslandRole.Member).size() == 0
|
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
|
||||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
|
|
||||||
|
|
||||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
|
|
||||||
|
|
||||||
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
|
|
||||||
} else {
|
} else {
|
||||||
scoreboard.setDisplayList(config.getFileConfiguration()
|
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
||||||
.getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> displayVariables = new HashMap<>();
|
Map<String, String> displayVariables = new HashMap<>();
|
||||||
displayVariables.put("%owner",
|
displayVariables.put("%owner", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Owner"));
|
displayVariables.put("%operator", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
||||||
displayVariables.put("%operator",
|
displayVariables.put("%member", config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Operator"));
|
|
||||||
displayVariables.put("%member",
|
|
||||||
config.getFileConfiguration().getString("Scoreboard.Island.Team.Word.Member"));
|
|
||||||
|
|
||||||
scoreboard.setDisplayVariables(displayVariables);
|
scoreboard.setDisplayVariables(displayVariables);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.entity.ArmorStand;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -91,14 +92,19 @@ public class Stackable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay() {
|
private void updateDisplay() {
|
||||||
// The chunk needs to be loaded otherwise the getNearbyEntities() in removeDisplay() won't find anything
|
// The chunk needs to be loaded otherwise the getNearbyEntities() in
|
||||||
if (!this.location.getWorld().isChunkLoaded(this.location.getBlockX() >> 4, this.location.getBlockZ() >> 4))
|
// removeDisplay() won't find anything
|
||||||
this.location.getChunk().load();
|
if (!this.location.getWorld().isChunkLoaded(this.location.getBlockX() >> 4, this.location.getBlockZ() >> 4)) this.location.getChunk().load();
|
||||||
|
|
||||||
if (this.size > 1) {
|
if (this.size > 1) {
|
||||||
|
|
||||||
|
if (display == null || !display.isValid()) {
|
||||||
this.createDisplay();
|
this.createDisplay();
|
||||||
|
} else {
|
||||||
this.display.setCustomName(this.getCustomName());
|
this.display.setCustomName(this.getCustomName());
|
||||||
this.display.setCustomNameVisible(true);
|
this.display.setCustomNameVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.removeDisplay();
|
this.removeDisplay();
|
||||||
}
|
}
|
||||||
@ -119,6 +125,7 @@ public class Stackable {
|
|||||||
as.setHelmet(new ItemStack(this.material));
|
as.setHelmet(new ItemStack(this.material));
|
||||||
as.setCustomName(this.getCustomName());
|
as.setCustomName(this.getCustomName());
|
||||||
as.setCustomNameVisible(true);
|
as.setCustomNameVisible(true);
|
||||||
|
as.setMetadata("StackableArmorStand", new FixedMetadataValue(SkyBlock.getInstance(), ""));
|
||||||
this.display = as;
|
this.display = as;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,14 +136,13 @@ public class Stackable {
|
|||||||
|
|
||||||
// Find any stragglers
|
// Find any stragglers
|
||||||
for (Entity entity : this.location.getWorld().getNearbyEntities(this.location.clone().add(0.5, 0.55, 0.5), 0.25, 0.5, 0.25))
|
for (Entity entity : this.location.getWorld().getNearbyEntities(this.location.clone().add(0.5, 0.55, 0.5), 0.25, 0.5, 0.25))
|
||||||
if (entity instanceof ArmorStand)
|
if (entity instanceof ArmorStand) entity.remove();
|
||||||
entity.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save() {
|
private void save() {
|
||||||
File configFile = new File(SkyBlock.getInstance().getDataFolder().toString() + "/island-data");
|
File configFile = new File(SkyBlock.getInstance().getDataFolder().toString() + "/island-data");
|
||||||
FileManager.Config config = SkyBlock.getInstance().getFileManager().getConfig(new File(configFile,
|
FileManager.Config config = SkyBlock.getInstance().getFileManager()
|
||||||
SkyBlock.getInstance().getIslandManager().getIslandAtLocation(this.location).getOwnerUUID() + ".yml"));
|
.getConfig(new File(configFile, SkyBlock.getInstance().getIslandManager().getIslandAtLocation(this.location).getOwnerUUID() + ".yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (this.getSize() == 0) {
|
if (this.getSize() == 0) {
|
||||||
@ -150,10 +156,10 @@ public class Stackable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getCustomName() {
|
private String getCustomName() {
|
||||||
return ChatColor.translateAlternateColorCodes('&', SkyBlock.getInstance().getFileManager()
|
return ChatColor
|
||||||
.getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml"))
|
.translateAlternateColorCodes('&',
|
||||||
.getFileConfiguration().getString("Hologram.Stackable.Message"))
|
SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration()
|
||||||
.replace("%block", WordUtils.capitalize(this.material.name().toLowerCase()).replace("_", " "))
|
.getString("Hologram.Stackable.Message"))
|
||||||
.replace("%amount", NumberUtil.formatNumber(this.size));
|
.replace("%block", WordUtils.capitalize(this.material.name().toLowerCase()).replace("_", " ")).replace("%amount", NumberUtil.formatNumber(this.size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
package com.songoda.skyblock.stackable;
|
package com.songoda.skyblock.stackable;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import java.io.File;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import java.util.Collections;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import java.util.*;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
|
|
||||||
public class StackableManager {
|
public class StackableManager {
|
||||||
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
package com.songoda.skyblock.usercache;
|
package com.songoda.skyblock.usercache;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
|
||||||
import com.songoda.skyblock.config.FileManager;
|
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
|
||||||
import com.songoda.skyblock.utils.player.NameFetcher;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -14,7 +7,15 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class UserCacheManager {
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import com.songoda.skyblock.SkyBlock;
|
||||||
|
import com.songoda.skyblock.config.FileManager;
|
||||||
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
|
import com.songoda.skyblock.utils.player.NameFetcher;
|
||||||
|
|
||||||
|
public final class UserCacheManager {
|
||||||
|
|
||||||
private final SkyBlock skyblock;
|
private final SkyBlock skyblock;
|
||||||
private final Config config;
|
private final Config config;
|
||||||
@ -23,49 +24,39 @@ public class UserCacheManager {
|
|||||||
this.skyblock = skyblock;
|
this.skyblock = skyblock;
|
||||||
this.config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "usercache.yml"));
|
this.config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "usercache.yml"));
|
||||||
|
|
||||||
FileManager fileManager = skyblock.getFileManager();
|
final FileManager fileManager = skyblock.getFileManager();
|
||||||
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
final File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
|
||||||
if (configFile.exists()) {
|
if (configFile.exists()) {
|
||||||
int usersIgnored = 0;
|
int usersIgnored = 0;
|
||||||
|
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Fetching user information from island data. This may take a while...");
|
||||||
"SkyBlock | Info: Fetching user information from island data. This may take a while...");
|
|
||||||
|
|
||||||
for (File fileList : configFile.listFiles()) {
|
for (File fileList : configFile.listFiles()) {
|
||||||
if (fileList != null && fileList.getName().contains(".yml")
|
|
||||||
&& fileList.getName().length() > 35) {
|
if (fileList == null) continue;
|
||||||
UUID islandOwnerUUID = null;
|
|
||||||
|
final String fileName = fileList.getName();
|
||||||
|
|
||||||
|
if (fileName.length() < 35 || !fileName.endsWith(".yml")) continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Config config = new Config(fileManager, fileList);
|
final FileConfiguration configLoad = new Config(fileManager, fileList).getFileConfiguration();
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
final String ownerUUIDString = fileName.substring(0, fileName.indexOf('.'));
|
||||||
|
|
||||||
islandOwnerUUID = UUID.fromString(fileList.getName().replace(".yml", ""));
|
System.out.println(ownerUUIDString);
|
||||||
|
|
||||||
if (islandOwnerUUID == null) {
|
|
||||||
islandOwnerUUID = UUID.fromString(fileList.getName().replaceFirst("[.][^.]+$", ""));
|
|
||||||
|
|
||||||
if (islandOwnerUUID == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<UUID> islandMembers = new HashSet<>();
|
Set<UUID> islandMembers = new HashSet<>();
|
||||||
islandMembers.add(islandOwnerUUID);
|
islandMembers.add(UUID.fromString(ownerUUIDString));
|
||||||
|
|
||||||
if (configLoad.getString("Members") != null) {
|
|
||||||
for (String memberList : configLoad.getStringList("Members")) {
|
for (String memberList : configLoad.getStringList("Members")) {
|
||||||
islandMembers.add(UUID.fromString(memberList));
|
islandMembers.add(UUID.fromString(memberList));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (configLoad.getString("Operators") != null) {
|
|
||||||
for (String operatorList : configLoad.getStringList("Operators")) {
|
for (String operatorList : configLoad.getStringList("Operators")) {
|
||||||
islandMembers.add(UUID.fromString(operatorList));
|
islandMembers.add(UUID.fromString(operatorList));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (UUID islandMemberList : islandMembers) {
|
for (UUID islandMemberList : islandMembers) {
|
||||||
if (!hasUser(islandMemberList)) {
|
if (!hasUser(islandMemberList)) {
|
||||||
@ -79,18 +70,16 @@ public class UserCacheManager {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
usersIgnored++;
|
usersIgnored++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save();
|
save();
|
||||||
|
|
||||||
if (usersIgnored != 0) {
|
if (usersIgnored != 0) {
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO,
|
||||||
"SkyBlock | Info: Finished fetching user information from island data. There were "
|
"SkyBlock | Info: Finished fetching user information from island data. There were " + usersIgnored + " users that were skipped.");
|
||||||
+ usersIgnored + " users that were skipped.");
|
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Finished fetching user information from island data. No users were ignored.");
|
||||||
"SkyBlock | Info: Finished fetching user information from island data.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.songoda.skyblock.utils.item;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import com.songoda.skyblock.SkyBlock;
|
||||||
|
import com.songoda.skyblock.utils.StringUtil;
|
||||||
|
import com.songoda.skyblock.utils.item.nInventoryUtil.ClickEvent;
|
||||||
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
|
|
||||||
|
public final class MenuClickRegistry {
|
||||||
|
|
||||||
|
private static MenuClickRegistry instance;
|
||||||
|
|
||||||
|
public static MenuClickRegistry getInstance() {
|
||||||
|
return instance == null ? instance = new MenuClickRegistry() : instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<MenuPopulator> populators;
|
||||||
|
private Map<RegistryKey, MenuExecutor> executors;
|
||||||
|
|
||||||
|
private MenuClickRegistry() {
|
||||||
|
this.executors = new HashMap<>();
|
||||||
|
this.populators = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register(MenuPopulator populator) {
|
||||||
|
populator.populate(executors);
|
||||||
|
populators.add(populator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reloadAll() {
|
||||||
|
executors.clear();
|
||||||
|
for (MenuPopulator populator : populators) {
|
||||||
|
populator.populate(executors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispatch(Player clicker, ClickEvent e) {
|
||||||
|
|
||||||
|
final ItemStack item = e.getItem();
|
||||||
|
|
||||||
|
if (item == null) return;
|
||||||
|
|
||||||
|
final ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
|
if (meta == null) return;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
final MenuExecutor executor = executors.get(RegistryKey.fromName(meta.getDisplayName(), Materials.getMaterials(item.getType(), (byte) item.getDurability())));
|
||||||
|
|
||||||
|
System.out.println(executors.size());
|
||||||
|
|
||||||
|
if (executor == null) return;
|
||||||
|
|
||||||
|
executor.onClick(SkyBlock.getInstance(), clicker, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MenuPopulator {
|
||||||
|
|
||||||
|
void populate(Map<RegistryKey, MenuExecutor> executors);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MenuExecutor {
|
||||||
|
|
||||||
|
void onClick(SkyBlock skyblock, Player clicker, ClickEvent e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RegistryKey {
|
||||||
|
|
||||||
|
private static final File path = new File(SkyBlock.getInstance().getDataFolder(), "language.yml");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final Materials type;
|
||||||
|
|
||||||
|
private RegistryKey(String name, Materials type) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) return true;
|
||||||
|
if (!(obj instanceof RegistryKey)) return false;
|
||||||
|
|
||||||
|
final RegistryKey other = (RegistryKey) obj;
|
||||||
|
|
||||||
|
return Objects.equals(name, other.name) && type == other.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RegistryKey fromName(String name, Materials type) {
|
||||||
|
return new RegistryKey(name, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RegistryKey fromLanguageFile(String namePath, Materials type) {
|
||||||
|
return new RegistryKey(StringUtil.color(SkyBlock.getInstance().getFileManager().getConfig(path).getFileConfiguration().getString(namePath)), type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class nInventoryUtil {
|
public class nInventoryUtil {
|
||||||
|
|
||||||
@ -55,8 +56,7 @@ public class nInventoryUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClickEvent clickEvent = new ClickEvent(event.getClick(), event.getSlot(),
|
ClickEvent clickEvent = new ClickEvent(event.getClick(), event.getSlot(), event.getCurrentItem());
|
||||||
event.getCurrentItem());
|
|
||||||
handler.onClick(clickEvent);
|
handler.onClick(clickEvent);
|
||||||
|
|
||||||
if (!clickEvent.getCancelled()) {
|
if (!clickEvent.getCancelled()) {
|
||||||
@ -115,8 +115,7 @@ public class nInventoryUtil {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item createItem(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders,
|
public Item createItem(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders, Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
|
||||||
Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
|
|
||||||
return new Item(is, itemDisplayname, itemLore, placeholders, itemEnchantments, itemFlags);
|
return new Item(is, itemDisplayname, itemLore, placeholders, itemEnchantments, itemFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ public class nInventoryUtil {
|
|||||||
public void setRows(int rows) {
|
public void setRows(int rows) {
|
||||||
if (rows > 6 || rows < 0) {
|
if (rows > 6 || rows < 0) {
|
||||||
size = 9;
|
size = 9;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,9 +160,8 @@ public class nInventoryUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for(Entry<Integer, ItemStack> entry : items.entrySet()) {
|
||||||
int slot = (int) items.keySet().toArray()[i];
|
inv.setItem(entry.getKey(), entry.getValue());
|
||||||
inv.setItem(slot, items.get(slot));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +190,7 @@ public class nInventoryUtil {
|
|||||||
void onClick(ClickEvent event);
|
void onClick(ClickEvent event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Item {
|
public static class Item {
|
||||||
|
|
||||||
private ItemStack is;
|
private ItemStack is;
|
||||||
private String itemDisplayname;
|
private String itemDisplayname;
|
||||||
@ -202,8 +199,7 @@ public class nInventoryUtil {
|
|||||||
private Enchantment[] itemEnchantments;
|
private Enchantment[] itemEnchantments;
|
||||||
private ItemFlag[] itemFlags;
|
private ItemFlag[] itemFlags;
|
||||||
|
|
||||||
public Item(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders,
|
public Item(ItemStack is, String itemDisplayname, List<String> itemLore, Placeholder[] placeholders, Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
|
||||||
Enchantment[] itemEnchantments, ItemFlag[] itemFlags) {
|
|
||||||
this.is = is;
|
this.is = is;
|
||||||
this.itemDisplayname = ChatColor.translateAlternateColorCodes('&', itemDisplayname);
|
this.itemDisplayname = ChatColor.translateAlternateColorCodes('&', itemDisplayname);
|
||||||
this.itemLore = itemLore;
|
this.itemLore = itemLore;
|
||||||
@ -214,14 +210,13 @@ public class nInventoryUtil {
|
|||||||
|
|
||||||
public void setLore() {
|
public void setLore() {
|
||||||
if (itemLore != null) {
|
if (itemLore != null) {
|
||||||
ArrayList<String> formattedItemLore = new ArrayList<>();
|
List<String> formattedItemLore = new ArrayList<>(itemLore.size());
|
||||||
|
|
||||||
for (String itemLoreList : itemLore) {
|
for (String itemLoreList : itemLore) {
|
||||||
if (placeholders != null) {
|
if (placeholders != null) {
|
||||||
for (Placeholder placeholderList : placeholders) {
|
for (Placeholder placeholderList : placeholders) {
|
||||||
if (itemLoreList.contains(placeholderList.getPlaceholder())) {
|
if (itemLoreList.contains(placeholderList.getPlaceholder())) {
|
||||||
itemLoreList = ChatColor.translateAlternateColorCodes('&', itemLoreList
|
itemLoreList = ChatColor.translateAlternateColorCodes('&', itemLoreList.replace(placeholderList.getPlaceholder(), placeholderList.getResult()));
|
||||||
.replace(placeholderList.getPlaceholder(), placeholderList.getResult()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package com.songoda.skyblock.utils.player;
|
package com.songoda.skyblock.utils.player;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class NameFetcher {
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
public final class NameFetcher {
|
||||||
|
|
||||||
|
private NameFetcher() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static Names[] getNames(UUID uuid) throws IOException {
|
public static Names[] getNames(UUID uuid) throws IOException {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
@ -18,17 +21,14 @@ public class NameFetcher {
|
|||||||
|
|
||||||
Names[] names = null;
|
Names[] names = null;
|
||||||
|
|
||||||
Scanner jsonScanner = new Scanner(
|
Scanner jsonScanner = new Scanner((new URL("https://api.mojang.com/user/profiles/" + uuid.toString().replaceAll("-", "") + "/names")).openConnection().getInputStream(), "UTF-8");
|
||||||
(new URL("https://api.mojang.com/user/profiles/" + uuid.toString().replaceAll("-", "") + "/names"))
|
|
||||||
.openConnection().getInputStream(),
|
|
||||||
"UTF-8");
|
|
||||||
names = new Gson().fromJson(jsonScanner.next(), Names[].class);
|
names = new Gson().fromJson(jsonScanner.next(), Names[].class);
|
||||||
jsonScanner.close();
|
jsonScanner.close();
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Names {
|
public static class Names {
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
public long changedToAt;
|
public long changedToAt;
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.songoda.skyblock.utils.player;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
|
public final class PlayerUtil {
|
||||||
|
|
||||||
|
private PlayerUtil() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will only parse positive numbers and will skip any non digit.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* An example:
|
||||||
|
* <p>
|
||||||
|
* <code>int number = getPositiveNumber("abc-123", 0, "abc-123".length())</code>
|
||||||
|
* will return 123
|
||||||
|
*
|
||||||
|
* @throws IndexOutOfBoundsException if (input.length() < start ||
|
||||||
|
* input.length() > end) evaluates to true.
|
||||||
|
* @return a positive number for the given input String at the start and end
|
||||||
|
* index.
|
||||||
|
*/
|
||||||
|
public static int getPositiveNumber(String input, int start, int end) {
|
||||||
|
|
||||||
|
if (input.length() < start || input.length() > end) throw new IndexOutOfBoundsException("");
|
||||||
|
|
||||||
|
int num = 0;
|
||||||
|
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
|
||||||
|
final char ch = input.charAt(i);
|
||||||
|
|
||||||
|
if (!Character.isDigit(ch)) continue;
|
||||||
|
|
||||||
|
final int digit = Character.getNumericValue(ch);
|
||||||
|
|
||||||
|
num = num * 10 + digit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNumberFromPermission(Player player, String permission, boolean bypassPermission, int def) {
|
||||||
|
|
||||||
|
final Set<PermissionAttachmentInfo> permissions = player.getEffectivePermissions();
|
||||||
|
|
||||||
|
if (bypassPermission && player.hasPermission(permission + ".bypass")) return Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
boolean set = false;
|
||||||
|
int highest = 0;
|
||||||
|
|
||||||
|
for (PermissionAttachmentInfo info : permissions) {
|
||||||
|
|
||||||
|
final String perm = info.getPermission();
|
||||||
|
|
||||||
|
if (!perm.startsWith(permission)) continue;
|
||||||
|
|
||||||
|
final int index = perm.lastIndexOf('.');
|
||||||
|
|
||||||
|
if (index == -1 || index == perm.length()) continue;
|
||||||
|
|
||||||
|
final int number = getPositiveNumber(perm, index, perm.length());
|
||||||
|
|
||||||
|
if (number >= highest) {
|
||||||
|
highest = number;
|
||||||
|
set = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return set ? highest : def;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,19 +7,32 @@ import java.lang.reflect.Field;
|
|||||||
|
|
||||||
public class NMSUtil {
|
public class NMSUtil {
|
||||||
|
|
||||||
|
private static final String version;
|
||||||
|
private static final int versionNumber;
|
||||||
|
private static final int versionReleaseNumber;
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
|
version = packageName.substring(packageName.lastIndexOf('.') + 1) + ".";
|
||||||
|
|
||||||
|
String name = version.substring(3);
|
||||||
|
versionNumber = Integer.parseInt(name.substring(0, name.length() - 4));
|
||||||
|
|
||||||
|
versionReleaseNumber = Integer.parseInt(version.substring(version.length() - 2).replace(".", ""));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
return version;
|
||||||
return name.substring(name.lastIndexOf('.') + 1) + ".";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getVersionNumber() {
|
public static int getVersionNumber() {
|
||||||
String name = getVersion().substring(3);
|
return versionNumber;
|
||||||
return Integer.valueOf(name.substring(0, name.length() - 4));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getVersionReleaseNumber() {
|
public static int getVersionReleaseNumber() {
|
||||||
String NMSVersion = getVersion();
|
return versionReleaseNumber;
|
||||||
return Integer.valueOf(NMSVersion.substring(NMSVersion.length() - 2).replace(".", ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getNMSClass(String className) {
|
public static Class<?> getNMSClass(String className) {
|
||||||
|
@ -25,11 +25,13 @@ public enum Sounds {
|
|||||||
FIRE("FIRE", "BLOCK_FIRE_AMBIENT", "BLOCK_FIRE_AMBIENT"),
|
FIRE("FIRE", "BLOCK_FIRE_AMBIENT", "BLOCK_FIRE_AMBIENT"),
|
||||||
FIRE_IGNITE("FIRE_IGNITE", "ITEM_FLINTANDSTEEL_USE", "ITEM_FLINTANDSTEEL_USE"),
|
FIRE_IGNITE("FIRE_IGNITE", "ITEM_FLINTANDSTEEL_USE", "ITEM_FLINTANDSTEEL_USE"),
|
||||||
FIZZ("FIZZ", "BLOCK_FIRE_EXTINGUISH", "BLOCK_FIRE_EXTINGUISH"),
|
FIZZ("FIZZ", "BLOCK_FIRE_EXTINGUISH", "BLOCK_FIRE_EXTINGUISH"),
|
||||||
FUSE("FUSE", "ENTITY_TNT_PRIMED", "ENTITY_TNT_PRIMED"), GLASS("GLASS", "BLOCK_GLASS_BREAK", "BLOCK_GLASS_BREAK"),
|
FUSE("FUSE", "ENTITY_TNT_PRIMED", "ENTITY_TNT_PRIMED"),
|
||||||
|
GLASS("GLASS", "BLOCK_GLASS_BREAK", "BLOCK_GLASS_BREAK"),
|
||||||
HURT_FLESH("HURT_FLESH", "ENTITY_PLAYER_HURT", "ENTITY_PLAYER_HURT"),
|
HURT_FLESH("HURT_FLESH", "ENTITY_PLAYER_HURT", "ENTITY_PLAYER_HURT"),
|
||||||
ITEM_BREAK("ITEM_BREAK", "ENTITY_ITEM_BREAK", "ENTITY_ITEM_BREAK"),
|
ITEM_BREAK("ITEM_BREAK", "ENTITY_ITEM_BREAK", "ENTITY_ITEM_BREAK"),
|
||||||
ITEM_PICKUP("ITEM_PICKUP", "ENTITY_ITEM_PICKUP", "ENTITY_ITEM_PICKUP"),
|
ITEM_PICKUP("ITEM_PICKUP", "ENTITY_ITEM_PICKUP", "ENTITY_ITEM_PICKUP"),
|
||||||
LAVA("LAVA", "BLOCK_LAVA_AMBIENT", "BLOCK_LAVA_AMBIENT"), LAVA_POP("LAVA_POP", "BLOCK_LAVA_POP", "BLOCK_LAVA_POP"),
|
LAVA("LAVA", "BLOCK_LAVA_AMBIENT", "BLOCK_LAVA_AMBIENT"),
|
||||||
|
LAVA_POP("LAVA_POP", "BLOCK_LAVA_POP", "BLOCK_LAVA_POP"),
|
||||||
LEVEL_UP("LEVEL_UP", "ENTITY_PLAYER_LEVELUP", "ENTITY_PLAYER_LEVELUP"),
|
LEVEL_UP("LEVEL_UP", "ENTITY_PLAYER_LEVELUP", "ENTITY_PLAYER_LEVELUP"),
|
||||||
MINECART_BASE("MINECART_BASE", "ENTITY_MINECART_RIDING", "ENTITY_MINECART_RIDING"),
|
MINECART_BASE("MINECART_BASE", "ENTITY_MINECART_RIDING", "ENTITY_MINECART_RIDING"),
|
||||||
MINECART_INSIDE("MINECART_INSIDE", "ENTITY_MINECART_RIDING", "ENTITY_MINECART_RIDING"),
|
MINECART_INSIDE("MINECART_INSIDE", "ENTITY_MINECART_RIDING", "ENTITY_MINECART_RIDING"),
|
||||||
@ -163,8 +165,7 @@ public enum Sounds {
|
|||||||
FIREWORK_BLAST("FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_ROCKET_BLAST"),
|
FIREWORK_BLAST("FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_ROCKET_BLAST"),
|
||||||
FIREWORK_BLAST2("FIREWORK_BLAST2", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_ROCKET_BLAST_FAR"),
|
FIREWORK_BLAST2("FIREWORK_BLAST2", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_ROCKET_BLAST_FAR"),
|
||||||
FIREWORK_LARGE_BLAST("FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_ROCKET_LARGE_BLAST"),
|
FIREWORK_LARGE_BLAST("FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_ROCKET_LARGE_BLAST"),
|
||||||
FIREWORK_LARGE_BLAST2("FIREWORK_LARGE_BLAST2", "ENTITY_FIREWORK_LARGE_BLAST_FAR",
|
FIREWORK_LARGE_BLAST2("FIREWORK_LARGE_BLAST2", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR"),
|
||||||
"ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR"),
|
|
||||||
FIREWORK_TWINKLE("FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_ROCKET_TWINKLE"),
|
FIREWORK_TWINKLE("FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_ROCKET_TWINKLE"),
|
||||||
FIREWORK_TWINKLE2("FIREWORK_TWINKLE2", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_ROCKET_TWINKLE_FAR"),
|
FIREWORK_TWINKLE2("FIREWORK_TWINKLE2", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_ROCKET_TWINKLE_FAR"),
|
||||||
FIREWORK_LAUNCH("FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_ROCKET_LAUNCH"),
|
FIREWORK_LAUNCH("FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_ROCKET_LAUNCH"),
|
||||||
|
@ -26,8 +26,7 @@ import java.util.logging.Level;
|
|||||||
public final class LocationUtil {
|
public final class LocationUtil {
|
||||||
|
|
||||||
public static boolean isLocationLocation(Location location1, Location location2) {
|
public static boolean isLocationLocation(Location location1, Location location2) {
|
||||||
return location1.getBlockX() == location2.getBlockX() && location1.getBlockY() == location2.getBlockY()
|
return location1.getBlockX() == location2.getBlockX() && location1.getBlockY() == location2.getBlockY() && location1.getBlockZ() == location2.getBlockZ();
|
||||||
&& location1.getBlockZ() == location2.getBlockZ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocationAffectingIslandSpawn(Location location, Island island, IslandWorld world) {
|
public static boolean isLocationAffectingIslandSpawn(Location location, Island island, IslandWorld world) {
|
||||||
@ -36,13 +35,14 @@ public final class LocationUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isLocationAffectingLocation(Location location1, Location location2) {
|
private static boolean isLocationAffectingLocation(Location location1, Location location2) {
|
||||||
Location headHeight = location2.clone().add(0, 1, 0);
|
location2 = location2.clone();
|
||||||
Location feetHeight = location2.clone();
|
|
||||||
Location groundHeight = location2.clone().add(0, -1, 0);
|
|
||||||
|
|
||||||
return isLocationLocation(headHeight, location1)
|
/*
|
||||||
|| isLocationLocation(feetHeight, location1)
|
* First isLocationLocation() call is HeadHeight, second feetHeight, and the
|
||||||
|| isLocationLocation(groundHeight, location1);
|
* final one is GroundHeight.
|
||||||
|
*/
|
||||||
|
return isLocationLocation(location2.add(0, 1, 0), location1) || isLocationLocation(location2.subtract(0, 1, 0), location1)
|
||||||
|
|| isLocationLocation(location2.subtract(0, 1, 0), location1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocationAtLocationRadius(Location location1, Location location2, double radius) {
|
public static boolean isLocationAtLocationRadius(Location location1, Location location2, double radius) {
|
||||||
@ -58,19 +58,20 @@ public final class LocationUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Location> getLocations(Location minLocation, Location maxLocation) {
|
public static List<Location> getLocations(Location minLocation, Location maxLocation) {
|
||||||
List<Location> locations = new ArrayList<>();
|
|
||||||
|
|
||||||
int MinX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX());
|
int minX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX());
|
||||||
int MinY = Math.min(maxLocation.getBlockY(), minLocation.getBlockY());
|
int minY = Math.min(maxLocation.getBlockY(), minLocation.getBlockY());
|
||||||
int MinZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
int minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
||||||
|
|
||||||
int MaxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX());
|
int maxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX());
|
||||||
int MaxY = Math.max(maxLocation.getBlockY(), minLocation.getBlockY());
|
int maxY = Math.max(maxLocation.getBlockY(), minLocation.getBlockY());
|
||||||
int MaxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
int maxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
||||||
|
|
||||||
for (int x = MinX; x <= MaxX; x++) {
|
List<Location> locations = new ArrayList<>(maxX + maxY + maxZ + 3);
|
||||||
for (int y = MinY; y <= MaxY; y++) {
|
|
||||||
for (int z = MinZ; z <= MaxZ; z++) {
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int y = minY; y <= maxY; y++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
locations.add(new Location(minLocation.getWorld(), x, y, z));
|
locations.add(new Location(minLocation.getWorld(), x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,8 +89,8 @@ public final class LocationUtil {
|
|||||||
int MaxY = Math.max(maxLocation.getBlockY(), minLocation.getBlockY());
|
int MaxY = Math.max(maxLocation.getBlockY(), minLocation.getBlockY());
|
||||||
int MaxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
int MaxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
||||||
|
|
||||||
return MinX < targetLocation.getX() && MaxX > targetLocation.getX() && MinY < targetLocation.getY()
|
return MinX < targetLocation.getX() && MaxX > targetLocation.getX() && MinY < targetLocation.getY() && MaxY > targetLocation.getY() && MinZ < targetLocation.getZ()
|
||||||
&& MaxY > targetLocation.getY() && MinZ < targetLocation.getZ() && MaxZ > targetLocation.getZ();
|
&& MaxZ > targetLocation.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getHighestBlock(Location location) {
|
public static Location getHighestBlock(Location location) {
|
||||||
@ -110,28 +111,25 @@ public final class LocationUtil {
|
|||||||
int maxY = 0;
|
int maxY = 0;
|
||||||
boolean followY = false;
|
boolean followY = false;
|
||||||
|
|
||||||
|
final int blockX = location.getBlockX();
|
||||||
|
final int blockZ = location.getBlockZ();
|
||||||
|
final World world = location.getWorld();
|
||||||
|
|
||||||
for (int y = 0; y < location.getWorld().getMaxHeight(); y++) {
|
for (int y = 0; y < location.getWorld().getMaxHeight(); y++) {
|
||||||
Location loc = new Location(location.getWorld(), location.getBlockX(), y, location.getBlockZ());
|
final Block block = world.getBlockAt(blockX, y, blockZ).getRelative(BlockFace.UP);
|
||||||
Block block = loc.getBlock().getRelative(BlockFace.UP);
|
|
||||||
|
|
||||||
if (isNether) {
|
if (isNether) {
|
||||||
if (y < 127 && (block.getType() == Material.LAVA
|
if (y < 127 && (block.getType() == Material.LAVA || block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial() || block.getType() == Material.AIR)) {
|
||||||
|| block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial()
|
|
||||||
|| block.getType() == Material.AIR)) {
|
|
||||||
maxY = y;
|
maxY = y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (block.getType() == Materials.OAK_LEAVES.parseMaterial()
|
if (block.getType() == Materials.OAK_LEAVES.parseMaterial() || block.getType() == Materials.ACACIA_LEAVES.parseMaterial()) {
|
||||||
|| block.getType() == Materials.ACACIA_LEAVES.parseMaterial()) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.getType() == Material.AIR
|
if (block.getType() == Material.AIR || block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial() || block.getType() == Material.WATER
|
||||||
|| block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial()
|
|| block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial() || block.getType() == Material.LAVA) {
|
||||||
|| block.getType() == Material.WATER
|
|
||||||
|| block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial()
|
|
||||||
|| block.getType() == Material.LAVA) {
|
|
||||||
if (!followY) {
|
if (!followY) {
|
||||||
maxY = y;
|
maxY = y;
|
||||||
followY = true;
|
followY = true;
|
||||||
@ -191,8 +189,7 @@ public final class LocationUtil {
|
|||||||
Location spawnLocation = getSpawnLocation();
|
Location spawnLocation = getSpawnLocation();
|
||||||
|
|
||||||
if (spawnLocation == null) {
|
if (spawnLocation == null) {
|
||||||
Bukkit.getServer().getLogger().log(Level.WARNING,
|
Bukkit.getServer().getLogger().log(Level.WARNING, "SkyBlock | Error: The location for the spawn point could not be found.");
|
||||||
"SkyBlock | Error: The location for the spawn point could not be found.");
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -230,8 +227,7 @@ public final class LocationUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getRandomLocation(World world, int xRange, int zRange, boolean loadChunk,
|
public static Location getRandomLocation(World world, int xRange, int zRange, boolean loadChunk, boolean ignoreLiquid) {
|
||||||
boolean ignoreLiquid) {
|
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
|
|
||||||
int rndX = rnd.nextInt(xRange);
|
int rndX = rnd.nextInt(xRange);
|
||||||
@ -248,10 +244,8 @@ public final class LocationUtil {
|
|||||||
for (int i = 120; i > 0; i--) {
|
for (int i = 120; i > 0; i--) {
|
||||||
rndLoc.setY(i);
|
rndLoc.setY(i);
|
||||||
|
|
||||||
if (rndLoc.getBlock().getType() != Material.AIR
|
if (rndLoc.getBlock().getType() != Material.AIR && rndLoc.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR
|
||||||
&& rndLoc.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR
|
&& rndLoc.clone().add(0.0D, 2.0D, 0.0D).getBlock().getType() == Material.AIR && rndLoc.clone().add(0.0D, 3.0D, 0.0D).getBlock().getType() == Material.AIR
|
||||||
&& rndLoc.clone().add(0.0D, 2.0D, 0.0D).getBlock().getType() == Material.AIR
|
|
||||||
&& rndLoc.clone().add(0.0D, 3.0D, 0.0D).getBlock().getType() == Material.AIR
|
|
||||||
&& rndLoc.clone().add(0.0D, 4.0D, 0.0D).getBlock().getType() == Material.AIR) {
|
&& rndLoc.clone().add(0.0D, 4.0D, 0.0D).getBlock().getType() == Material.AIR) {
|
||||||
rndY = i;
|
rndY = i;
|
||||||
break;
|
break;
|
||||||
|
@ -22,8 +22,7 @@ import java.util.List;
|
|||||||
public final class BlockUtil {
|
public final class BlockUtil {
|
||||||
|
|
||||||
public static BlockData convertBlockToBlockData(Block block, int x, int y, int z) {
|
public static BlockData convertBlockToBlockData(Block block, int x, int y, int z) {
|
||||||
BlockData blockData = new BlockData(block.getType().toString(), block.getData(), x, y, z,
|
BlockData blockData = new BlockData(block.getType().toString(), block.getData(), x, y, z, block.getBiome().toString());
|
||||||
block.getBiome().toString());
|
|
||||||
|
|
||||||
int NMSVersion = NMSUtil.getVersionNumber();
|
int NMSVersion = NMSUtil.getVersionNumber();
|
||||||
blockData.setVersion(NMSVersion);
|
blockData.setVersion(NMSVersion);
|
||||||
@ -39,13 +38,14 @@ public final class BlockUtil {
|
|||||||
Banner banner = (Banner) blockState;
|
Banner banner = (Banner) blockState;
|
||||||
blockData.setBaseColor(banner.getBaseColor().toString());
|
blockData.setBaseColor(banner.getBaseColor().toString());
|
||||||
|
|
||||||
List<String> patterns = new ArrayList<>();
|
final List<Pattern> bannerPatterns = banner.getPatterns();
|
||||||
|
final List<String> stringPatterns = new ArrayList<>(bannerPatterns.size());
|
||||||
|
|
||||||
for (Pattern patternList : banner.getPatterns()) {
|
for (Pattern patternList : bannerPatterns) {
|
||||||
patterns.add(patternList.getPattern().toString() + ":" + patternList.getColor().toString());
|
stringPatterns.add(patternList.getPattern().toString() + ":" + patternList.getColor().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
blockData.setPatterns(patterns);
|
blockData.setPatterns(stringPatterns);
|
||||||
blockData.setStateType(BlockStateType.BANNER.toString());
|
blockData.setStateType(BlockStateType.BANNER.toString());
|
||||||
} else if (blockState instanceof Beacon) {
|
} else if (blockState instanceof Beacon) {
|
||||||
Beacon beacon = (Beacon) blockState;
|
Beacon beacon = (Beacon) blockState;
|
||||||
@ -153,8 +153,7 @@ public final class BlockUtil {
|
|||||||
|
|
||||||
for (String signLineList : signLines) {
|
for (String signLineList : signLines) {
|
||||||
for (ChatColor chatColorList : ChatColor.values()) {
|
for (ChatColor chatColorList : ChatColor.values()) {
|
||||||
signLineList = signLineList.replace(chatColorList + "",
|
signLineList = signLineList.replace(chatColorList + "", "&" + chatColorList.toString().substring(chatColorList.toString().length() - 1));
|
||||||
"&" + chatColorList.toString().substring(chatColorList.toString().length() - 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
correctedSignLines.add(signLineList);
|
correctedSignLines.add(signLineList);
|
||||||
@ -178,8 +177,7 @@ public final class BlockUtil {
|
|||||||
blockData.setExactTeleport(endGateway.isExactTeleport());
|
blockData.setExactTeleport(endGateway.isExactTeleport());
|
||||||
|
|
||||||
Location location = endGateway.getExitLocation();
|
Location location = endGateway.getExitLocation();
|
||||||
blockData.setExitLocation(location.getX() + ":" + location.getY() + ":" + location.getZ() + ":"
|
blockData.setExitLocation(location.getX() + ":" + location.getY() + ":" + location.getZ() + ":" + location.getWorld().getName());
|
||||||
+ location.getWorld().getName());
|
|
||||||
blockData.setStateType(BlockStateType.ENDGATEWAY.toString());
|
blockData.setStateType(BlockStateType.ENDGATEWAY.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,10 +210,8 @@ public final class BlockUtil {
|
|||||||
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
|
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
|
||||||
|
|
||||||
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
||||||
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class)
|
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(block.getX(), block.getY(), block.getZ());
|
||||||
.newInstance(block.getX(), block.getY(), block.getZ());
|
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass).invoke(worldHandle, blockPosition);
|
||||||
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass)
|
|
||||||
.invoke(worldHandle, blockPosition);
|
|
||||||
|
|
||||||
Field aField = tileEntity.getClass().getDeclaredField("a");
|
Field aField = tileEntity.getClass().getDeclaredField("a");
|
||||||
aField.setAccessible(true);
|
aField.setAccessible(true);
|
||||||
@ -223,11 +219,9 @@ public final class BlockUtil {
|
|||||||
Object item = aField.get(tileEntity);
|
Object item = aField.get(tileEntity);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
Object itemStackNMS = NMSUtil.getNMSClass("ItemStack")
|
Object itemStackNMS = NMSUtil.getNMSClass("ItemStack").getConstructor(NMSUtil.getNMSClass("Item")).newInstance(item);
|
||||||
.getConstructor(NMSUtil.getNMSClass("Item")).newInstance(item);
|
|
||||||
|
|
||||||
ItemStack itemStack = (ItemStack) NMSUtil.getCraftClass("inventory.CraftItemStack")
|
ItemStack itemStack = (ItemStack) NMSUtil.getCraftClass("inventory.CraftItemStack").getMethod("asBukkitCopy", itemStackNMS.getClass()).invoke(null, itemStackNMS);
|
||||||
.getMethod("asBukkitCopy", itemStackNMS.getClass()).invoke(null, itemStackNMS);
|
|
||||||
|
|
||||||
Field fField = tileEntity.getClass().getDeclaredField("f");
|
Field fField = tileEntity.getClass().getDeclaredField("f");
|
||||||
fField.setAccessible(true);
|
fField.setAccessible(true);
|
||||||
@ -243,8 +237,7 @@ public final class BlockUtil {
|
|||||||
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) materialData;
|
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) materialData;
|
||||||
|
|
||||||
if (flowerPot.getContents() != null && flowerPot.getContents().getItemType() != Material.AIR) {
|
if (flowerPot.getContents() != null && flowerPot.getContents().getItemType() != Material.AIR) {
|
||||||
blockData.setFlower(
|
blockData.setFlower(flowerPot.getContents().getItemType().toString() + ":" + flowerPot.getContents().getData());
|
||||||
flowerPot.getContents().getItemType().toString() + ":" + flowerPot.getContents().getData());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,8 +255,7 @@ public final class BlockUtil {
|
|||||||
if (NMSVersion > 12 && blockData.getVersion() > 12 && blockData.getBlockData() != null) {
|
if (NMSVersion > 12 && blockData.getVersion() > 12 && blockData.getBlockData() != null) {
|
||||||
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
|
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
|
||||||
} else {
|
} else {
|
||||||
material = MaterialUtil.getMaterial(NMSVersion, blockData.getVersion(),
|
material = MaterialUtil.getMaterial(NMSVersion, blockData.getVersion(), blockData.getMaterial(), block.getData());
|
||||||
blockData.getMaterial(), block.getData());
|
|
||||||
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
|
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,17 +264,19 @@ public final class BlockUtil {
|
|||||||
|
|
||||||
BlockStateType blockTypeState = BlockStateType.valueOf(blockData.getStateType());
|
BlockStateType blockTypeState = BlockStateType.valueOf(blockData.getStateType());
|
||||||
|
|
||||||
|
BlockState state = block.getState();
|
||||||
|
|
||||||
if (blockTypeState == BlockStateType.BANNER) {
|
if (blockTypeState == BlockStateType.BANNER) {
|
||||||
Banner banner = (Banner) block.getState();
|
Banner banner = (Banner) state;
|
||||||
banner.setBaseColor(DyeColor.valueOf(blockData.getBaseColor().toUpperCase()));
|
banner.setBaseColor(DyeColor.valueOf(blockData.getBaseColor().toUpperCase()));
|
||||||
|
|
||||||
for (String patternList : blockData.getPatterns()) {
|
for (String patternList : blockData.getPatterns()) {
|
||||||
String[] pattern = patternList.split(":");
|
String[] pattern = patternList.split(":");
|
||||||
banner.addPattern(new Pattern(DyeColor.valueOf(pattern[1].toUpperCase()),
|
banner.addPattern(new Pattern(DyeColor.valueOf(pattern[1].toUpperCase()), PatternType.valueOf(pattern[0].toUpperCase())));
|
||||||
PatternType.valueOf(pattern[0].toUpperCase())));
|
|
||||||
}
|
}
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.BEACON) {
|
} else if (blockTypeState == BlockStateType.BEACON) {
|
||||||
Beacon beacon = (Beacon) block.getState();
|
Beacon beacon = (Beacon) state;
|
||||||
String[] potionEffect = blockData.getPotionEffect().split(":");
|
String[] potionEffect = blockData.getPotionEffect().split(":");
|
||||||
if (!potionEffect[0].equals("null")) {
|
if (!potionEffect[0].equals("null")) {
|
||||||
beacon.setPrimaryEffect(PotionEffectType.getByName(potionEffect[0].toUpperCase()));
|
beacon.setPrimaryEffect(PotionEffectType.getByName(potionEffect[0].toUpperCase()));
|
||||||
@ -291,16 +285,19 @@ public final class BlockUtil {
|
|||||||
if (!potionEffect[1].equals("null")) {
|
if (!potionEffect[1].equals("null")) {
|
||||||
beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase()));
|
beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase()));
|
||||||
}
|
}
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.BREWINGSTAND) {
|
} else if (blockTypeState == BlockStateType.BREWINGSTAND) {
|
||||||
BrewingStand brewingStand = (BrewingStand) block.getState();
|
BrewingStand brewingStand = (BrewingStand) state;
|
||||||
brewingStand.setBrewingTime(blockData.getBrewingTime());
|
brewingStand.setBrewingTime(blockData.getBrewingTime());
|
||||||
brewingStand.setFuelLevel(blockData.getFuelLevel());
|
brewingStand.setFuelLevel(blockData.getFuelLevel());
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.COMMANDBLOCK) {
|
} else if (blockTypeState == BlockStateType.COMMANDBLOCK) {
|
||||||
CommandBlock commandBlock = (CommandBlock) block.getState();
|
CommandBlock commandBlock = (CommandBlock) state;
|
||||||
commandBlock.setCommand(blockData.getCommand());
|
commandBlock.setCommand(blockData.getCommand());
|
||||||
commandBlock.setName(blockData.getCommandBlockName());
|
commandBlock.setName(blockData.getCommandBlockName());
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.CHEST) {
|
} else if (blockTypeState == BlockStateType.CHEST) {
|
||||||
Chest chest = (Chest) block.getState();
|
Chest chest = (Chest) state;
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < chest.getInventory().getSize()) {
|
if (slotList < chest.getInventory().getSize()) {
|
||||||
@ -309,7 +306,7 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (blockTypeState == BlockStateType.DISPENSER) {
|
} else if (blockTypeState == BlockStateType.DISPENSER) {
|
||||||
Dispenser dispenser = (Dispenser) block.getState();
|
Dispenser dispenser = (Dispenser) state;
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < dispenser.getInventory().getSize()) {
|
if (slotList < dispenser.getInventory().getSize()) {
|
||||||
@ -318,7 +315,7 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (blockTypeState == BlockStateType.DROPPER) {
|
} else if (blockTypeState == BlockStateType.DROPPER) {
|
||||||
Dropper dropper = (Dropper) block.getState();
|
Dropper dropper = (Dropper) state;
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < dropper.getInventory().getSize()) {
|
if (slotList < dropper.getInventory().getSize()) {
|
||||||
@ -327,7 +324,7 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (blockTypeState == BlockStateType.HOPPER) {
|
} else if (blockTypeState == BlockStateType.HOPPER) {
|
||||||
Hopper hopper = (Hopper) block.getState();
|
Hopper hopper = (Hopper) state;
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < hopper.getInventory().getSize()) {
|
if (slotList < hopper.getInventory().getSize()) {
|
||||||
@ -336,18 +333,21 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (blockTypeState == BlockStateType.CREATURESPAWNER) {
|
} else if (blockTypeState == BlockStateType.CREATURESPAWNER) {
|
||||||
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
|
CreatureSpawner creatureSpawner = (CreatureSpawner) state;
|
||||||
|
|
||||||
if (blockData.getEntity() != null) {
|
if (blockData.getEntity() != null) {
|
||||||
creatureSpawner.setSpawnedType(EntityType.valueOf(blockData.getEntity().toUpperCase()));
|
creatureSpawner.setSpawnedType(EntityType.valueOf(blockData.getEntity().toUpperCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
creatureSpawner.setDelay(blockData.getDelay());
|
creatureSpawner.setDelay(blockData.getDelay());
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.FURNACE) {
|
} else if (blockTypeState == BlockStateType.FURNACE) {
|
||||||
Furnace furnace = (Furnace) block.getState();
|
Furnace furnace = (Furnace) state;
|
||||||
furnace.setBurnTime(blockData.getBurnTime());
|
furnace.setBurnTime(blockData.getBurnTime());
|
||||||
furnace.setCookTime(blockData.getCookTime());
|
furnace.setCookTime(blockData.getCookTime());
|
||||||
|
|
||||||
|
state.update();
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < furnace.getInventory().getSize()) {
|
if (slotList < furnace.getInventory().getSize()) {
|
||||||
ItemStack is = ItemStackUtil.deserializeItemStack(blockData.getInventory().get(slotList));
|
ItemStack is = ItemStackUtil.deserializeItemStack(blockData.getInventory().get(slotList));
|
||||||
@ -355,19 +355,21 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (blockTypeState == BlockStateType.JUKEBOX) {
|
} else if (blockTypeState == BlockStateType.JUKEBOX) {
|
||||||
Jukebox jukebox = (Jukebox) block.getState();
|
Jukebox jukebox = (Jukebox) state;
|
||||||
|
|
||||||
if (blockData.getPlaying() != null) {
|
if (blockData.getPlaying() != null) {
|
||||||
jukebox.setPlaying(Material.valueOf(blockData.getPlaying().toUpperCase()));
|
jukebox.setPlaying(Material.valueOf(blockData.getPlaying().toUpperCase()));
|
||||||
}
|
}
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.SIGN) {
|
} else if (blockTypeState == BlockStateType.SIGN) {
|
||||||
Sign sign = (Sign) block.getState();
|
Sign sign = (Sign) state;
|
||||||
|
|
||||||
for (int i = 0; i < blockData.getSignLines().length; i++) {
|
for (int i = 0; i < blockData.getSignLines().length; i++) {
|
||||||
sign.setLine(i, ChatColor.translateAlternateColorCodes('&', blockData.getSignLines()[i]));
|
sign.setLine(i, ChatColor.translateAlternateColorCodes('&', blockData.getSignLines()[i]));
|
||||||
}
|
}
|
||||||
|
state.update();
|
||||||
} else if (blockTypeState == BlockStateType.SKULL) {
|
} else if (blockTypeState == BlockStateType.SKULL) {
|
||||||
Skull skull = (Skull) block.getState();
|
Skull skull = (Skull) state;
|
||||||
|
|
||||||
skull.setRotation(BlockFace.valueOf(blockData.getRotateFace().toUpperCase()));
|
skull.setRotation(BlockFace.valueOf(blockData.getRotateFace().toUpperCase()));
|
||||||
skull.setSkullType(SkullType.valueOf(blockData.getSkullType().toUpperCase()));
|
skull.setSkullType(SkullType.valueOf(blockData.getSkullType().toUpperCase()));
|
||||||
@ -377,10 +379,11 @@ public final class BlockUtil {
|
|||||||
} else {
|
} else {
|
||||||
skull.setOwner(blockData.getSkullOwner());
|
skull.setOwner(blockData.getSkullOwner());
|
||||||
}
|
}
|
||||||
|
state.update();
|
||||||
} else {
|
} else {
|
||||||
if (NMSVersion > 8) {
|
if (NMSVersion > 8) {
|
||||||
if (blockTypeState == BlockStateType.ENDGATEWAY) {
|
if (blockTypeState == BlockStateType.ENDGATEWAY) {
|
||||||
EndGateway endGateway = (EndGateway) block.getState();
|
EndGateway endGateway = (EndGateway) state;
|
||||||
endGateway.setExactTeleport(blockData.isExactTeleport());
|
endGateway.setExactTeleport(blockData.isExactTeleport());
|
||||||
|
|
||||||
String[] exitLocation = blockData.getExitLocation().split(":");
|
String[] exitLocation = blockData.getExitLocation().split(":");
|
||||||
@ -390,19 +393,18 @@ public final class BlockUtil {
|
|||||||
double exitLocationY = Double.parseDouble(exitLocation[1]);
|
double exitLocationY = Double.parseDouble(exitLocation[1]);
|
||||||
double exitLocationZ = Double.parseDouble(exitLocation[2]);
|
double exitLocationZ = Double.parseDouble(exitLocation[2]);
|
||||||
|
|
||||||
endGateway.setExitLocation(
|
endGateway.setExitLocation(new Location(exitLocationWorld, exitLocationX, exitLocationY, exitLocationZ));
|
||||||
new Location(exitLocationWorld, exitLocationX, exitLocationY, exitLocationZ));
|
state.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NMSVersion > 9) {
|
if (NMSVersion > 9) {
|
||||||
if (NMSVersion > 10) {
|
if (NMSVersion > 10) {
|
||||||
if (blockTypeState == BlockStateType.SHULKERBOX) {
|
if (blockTypeState == BlockStateType.SHULKERBOX) {
|
||||||
ShulkerBox shulkerBox = (ShulkerBox) block.getState();
|
ShulkerBox shulkerBox = (ShulkerBox) state;
|
||||||
|
|
||||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||||
if (slotList < shulkerBox.getInventory().getSize()) {
|
if (slotList < shulkerBox.getInventory().getSize()) {
|
||||||
ItemStack is = ItemStackUtil
|
ItemStack is = ItemStackUtil.deserializeItemStack(blockData.getInventory().get(slotList));
|
||||||
.deserializeItemStack(blockData.getInventory().get(slotList));
|
|
||||||
shulkerBox.getInventory().setItem(slotList, is);
|
shulkerBox.getInventory().setItem(slotList, is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,14 +417,13 @@ public final class BlockUtil {
|
|||||||
BlockDataType blockDataType = BlockDataType.valueOf(blockData.getDataType());
|
BlockDataType blockDataType = BlockDataType.valueOf(blockData.getDataType());
|
||||||
|
|
||||||
if (blockDataType == BlockDataType.STAIRS) {
|
if (blockDataType == BlockDataType.STAIRS) {
|
||||||
Stairs stairs = (Stairs) block.getState().getData();
|
Stairs stairs = (Stairs) state.getData();
|
||||||
stairs.setFacingDirection(BlockFace.valueOf(blockData.getFacing()));
|
stairs.setFacingDirection(BlockFace.valueOf(blockData.getFacing()));
|
||||||
block.getState().setData(stairs);
|
state.setData(stairs);
|
||||||
} else if (blockDataType == BlockDataType.FLOWERPOT) {
|
} else if (blockDataType == BlockDataType.FLOWERPOT) {
|
||||||
if (NMSVersion >= 8 && NMSVersion <= 12) {
|
if (NMSVersion >= 8 && NMSVersion <= 12) {
|
||||||
if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
|
if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
|
||||||
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), Material.STONE,
|
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), Material.STONE, (byte) 0);
|
||||||
(byte) 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockData.getFlower() != null && !blockData.getFlower().isEmpty()) {
|
if (blockData.getFlower() != null && !blockData.getFlower().isEmpty()) {
|
||||||
@ -430,8 +431,7 @@ public final class BlockUtil {
|
|||||||
String[] flower = blockData.getFlower().split(":");
|
String[] flower = blockData.getFlower().split(":");
|
||||||
int materialData = Integer.parseInt(flower[1]);
|
int materialData = Integer.parseInt(flower[1]);
|
||||||
|
|
||||||
material = MaterialUtil.getMaterial(NMSVersion,
|
material = MaterialUtil.getMaterial(NMSVersion, blockData.getVersion(), flower[0].toUpperCase(), materialData);
|
||||||
blockData.getVersion(), flower[0].toUpperCase(), materialData);
|
|
||||||
|
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
ItemStack is = new ItemStack(material, 1, (byte) materialData);
|
ItemStack is = new ItemStack(material, 1, (byte) materialData);
|
||||||
@ -441,12 +441,9 @@ public final class BlockUtil {
|
|||||||
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
|
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
|
||||||
|
|
||||||
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
||||||
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class)
|
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(block.getX(), block.getY(), block.getZ());
|
||||||
.newInstance(block.getX(), block.getY(), block.getZ());
|
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass).invoke(worldHandle, blockPosition);
|
||||||
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass)
|
Object itemStack = NMSUtil.getCraftClass("inventory.CraftItemStack").getMethod("asNMSCopy", is.getClass()).invoke(null, is);
|
||||||
.invoke(worldHandle, blockPosition);
|
|
||||||
Object itemStack = NMSUtil.getCraftClass("inventory.CraftItemStack")
|
|
||||||
.getMethod("asNMSCopy", is.getClass()).invoke(null, is);
|
|
||||||
Object item = itemStack.getClass().getMethod("getItem").invoke(itemStack);
|
Object item = itemStack.getClass().getMethod("getItem").invoke(itemStack);
|
||||||
Object data = itemStack.getClass().getMethod("getData").invoke(itemStack);
|
Object data = itemStack.getClass().getMethod("getData").invoke(itemStack);
|
||||||
|
|
||||||
@ -466,8 +463,7 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (blockData.getFlower() != null && !blockData.getFlower().isEmpty()) {
|
if (blockData.getFlower() != null && !blockData.getFlower().isEmpty()) {
|
||||||
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) block.getState()
|
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) state.getData();
|
||||||
.getData();
|
|
||||||
String[] flower = blockData.getFlower().split(":");
|
String[] flower = blockData.getFlower().split(":");
|
||||||
material = null;
|
material = null;
|
||||||
|
|
||||||
@ -485,18 +481,14 @@ public final class BlockUtil {
|
|||||||
flowerPot.setContents(new MaterialData(material, (byte) Integer.parseInt(flower[1])));
|
flowerPot.setContents(new MaterialData(material, (byte) Integer.parseInt(flower[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
block.getState().setData(flowerPot);
|
state.setData(flowerPot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NMSVersion < 13) {
|
|
||||||
block.getState().update();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blockData.getMaterial().equals("DOUBLE_PLANT")) {
|
if (blockData.getMaterial().equals("DOUBLE_PLANT")) {
|
||||||
Block topBlock = block.getLocation().clone().add(0.0D, 1.0D, 0.0D).getBlock();
|
Block topBlock = block.getLocation().add(0.0D, 1.0D, 0.0D).getBlock();
|
||||||
Block bottomBlock = block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock();
|
Block bottomBlock = block.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
|
||||||
|
|
||||||
if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) {
|
if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) {
|
||||||
bottomBlock.setType(Materials.LEGACY_DOUBLE_PLANT.getPostMaterial());
|
bottomBlock.setType(Materials.LEGACY_DOUBLE_PLANT.getPostMaterial());
|
||||||
@ -513,13 +505,12 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Block> getNearbyBlocks(Location loc, int rx, int ry, int rz) {
|
public static List<Block> getNearbyBlocks(Location loc, int rx, int ry, int rz) {
|
||||||
List<Block> nearbyBlocks = new ArrayList<>();
|
final List<Block> nearbyBlocks = new ArrayList<>((rx + ry + rz) * 2);
|
||||||
|
|
||||||
for (int x = -(rx); x <= rx; x++) {
|
for (int x = -(rx); x <= rx; x++) {
|
||||||
for (int y = -(ry); y <= ry; y++) {
|
for (int y = -(ry); y <= ry; y++) {
|
||||||
for (int z = -(rz); z <= rz; z++) {
|
for (int z = -(rz); z <= rz; z++) {
|
||||||
nearbyBlocks.add(
|
nearbyBlocks.add(new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y, loc.getZ() + z).getBlock());
|
||||||
new Location(loc.getWorld(), loc.getX() + x, loc.getY() + y, loc.getZ() + z).getBlock());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,31 +524,23 @@ public final class BlockUtil {
|
|||||||
private static void setBlockFast(World world, int x, int y, int z, Material material, byte data) {
|
private static void setBlockFast(World world, int x, int y, int z, Material material, byte data) {
|
||||||
try {
|
try {
|
||||||
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
||||||
Object chunk = worldHandle.getClass().getMethod("getChunkAt", int.class, int.class).invoke(worldHandle,
|
Object chunk = worldHandle.getClass().getMethod("getChunkAt", int.class, int.class).invoke(worldHandle, x >> 4, z >> 4);
|
||||||
x >> 4, z >> 4);
|
Object blockPosition = NMSUtil.getNMSClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(x & 0xF, y, z & 0xF);
|
||||||
Object blockPosition = NMSUtil.getNMSClass("BlockPosition").getConstructor(int.class, int.class, int.class)
|
|
||||||
.newInstance(x & 0xF, y, z & 0xF);
|
|
||||||
|
|
||||||
if (NMSUtil.getVersionNumber() > 12) {
|
if (NMSUtil.getVersionNumber() > 12) {
|
||||||
Object block = blocksClass.getField(material.name()).get(null);
|
Object block = blocksClass.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)
|
worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class).invoke(worldHandle, blockPosition, IBlockData, 2);
|
||||||
.invoke(worldHandle, blockPosition, IBlockData, 2);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class)
|
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class).invoke(chunk, blockPosition, IBlockData, true);
|
||||||
.invoke(chunk, blockPosition, IBlockData, true);
|
} catch (Exception ignored) {
|
||||||
} catch (Exception e) {
|
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class).invoke(chunk, blockPosition, IBlockData, true);
|
||||||
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class)
|
|
||||||
.invoke(chunk, blockPosition, IBlockData, true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null,
|
Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null, material.getId() + (data << 12));
|
||||||
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)
|
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass).invoke(chunk, blockPosition, IBlockData);
|
||||||
.invoke(worldHandle, blockPosition, IBlockData, 3);
|
|
||||||
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass).invoke(chunk, blockPosition,
|
|
||||||
IBlockData);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
|
@ -173,13 +173,9 @@ public class VisitManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Visit getIsland(UUID islandOwnerUUID) {
|
public Visit getIsland(UUID islandOwnerUUID) {
|
||||||
if (hasIsland(islandOwnerUUID)) {
|
|
||||||
return visitStorage.get(islandOwnerUUID);
|
return visitStorage.get(islandOwnerUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<UUID, Visit> getIslands() {
|
public HashMap<UUID, Visit> getIslands() {
|
||||||
return visitStorage;
|
return visitStorage;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package com.songoda.skyblock.visit;
|
package com.songoda.skyblock.visit;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.songoda.skyblock.playerdata.PlayerData;
|
import com.songoda.skyblock.playerdata.PlayerData;
|
||||||
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
import com.songoda.skyblock.playerdata.PlayerDataManager;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class VisitTask extends BukkitRunnable {
|
public class VisitTask extends BukkitRunnable {
|
||||||
|
|
||||||
@ -16,14 +15,10 @@ public class VisitTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
for (PlayerData playerData : playerDataManager.getPlayerData().values()) {
|
||||||
if (playerDataManager.hasPlayerData(all)) {
|
|
||||||
PlayerData playerData = playerDataManager.getPlayerData(all);
|
|
||||||
|
|
||||||
if (playerData.getIsland() != null) {
|
if (playerData.getIsland() != null) {
|
||||||
playerData.setVisitTime(playerData.getVisitTime() + 1);
|
playerData.setVisitTime(playerData.getVisitTime() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,28 +44,22 @@ public class WorldManager {
|
|||||||
endWorld = Bukkit.getServer().getWorld(endWorldName);
|
endWorld = Bukkit.getServer().getWorld(endWorldName);
|
||||||
|
|
||||||
if (normalWorld == null) {
|
if (normalWorld == null) {
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Generating VoidWorld '" + normalWorldName + "'.");
|
||||||
"SkyBlock | Info: Generating VoidWorld '" + normalWorldName + "'.");
|
normalWorld = WorldCreator.name(normalWorldName).type(WorldType.FLAT).environment(normalWorldEnvironment).generator(new VoidGenerator()).createWorld();
|
||||||
normalWorld = WorldCreator.name(normalWorldName).type(WorldType.FLAT).environment(normalWorldEnvironment)
|
|
||||||
.generator(new VoidGenerator()).createWorld();
|
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(normalWorldName, normalWorldEnvironment));
|
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(normalWorldName, normalWorldEnvironment));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netherWorld == null && netherWorldEnabled) {
|
if (netherWorld == null && netherWorldEnabled) {
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Generating VoidWorld '" + netherWorldName + "'.");
|
||||||
"SkyBlock | Info: Generating VoidWorld '" + netherWorldName + "'.");
|
netherWorld = WorldCreator.name(netherWorldName).type(WorldType.FLAT).environment(netherWorldEnvironment).generator(new VoidGenerator()).createWorld();
|
||||||
netherWorld = WorldCreator.name(netherWorldName).type(WorldType.FLAT).environment(netherWorldEnvironment)
|
|
||||||
.generator(new VoidGenerator()).createWorld();
|
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(netherWorldName, netherWorldEnvironment));
|
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(netherWorldName, netherWorldEnvironment));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endWorld == null && endWorldEnabled) {
|
if (endWorld == null && endWorldEnabled) {
|
||||||
Bukkit.getServer().getLogger().log(Level.INFO,
|
Bukkit.getServer().getLogger().log(Level.INFO, "SkyBlock | Info: Generating VoidWorld '" + endWorldName + "'.");
|
||||||
"SkyBlock | Info: Generating VoidWorld '" + endWorldName + "'.");
|
endWorld = WorldCreator.name(endWorldName).type(WorldType.FLAT).environment(endWorldEnvironment).generator(new VoidGenerator()).createWorld();
|
||||||
endWorld = WorldCreator.name(endWorldName).type(WorldType.FLAT).environment(endWorldEnvironment)
|
|
||||||
.generator(new VoidGenerator()).createWorld();
|
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(endWorldName, endWorldEnvironment));
|
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(endWorldName, endWorldEnvironment));
|
||||||
}
|
}
|
||||||
@ -73,10 +67,8 @@ public class WorldManager {
|
|||||||
|
|
||||||
public void registerMultiverse(String worldName, World.Environment environment) {
|
public void registerMultiverse(String worldName, World.Environment environment) {
|
||||||
if (Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Core") != null) {
|
if (Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Core") != null) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + worldName + " " + environment.name().toLowerCase() + " -g " + skyblock.getName());
|
||||||
"mv import " + worldName + " " + environment.name().toLowerCase() + " -g " + skyblock.getName());
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv modify set generator " + skyblock.getName() + " " + worldName);
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mv modify set generator " + skyblock.getName() + " " + worldName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,27 +89,21 @@ public class WorldManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normalWorld != null && normalWorld.getName().equals(world.getName()))
|
if (normalWorld != null && normalWorld.getName().equals(world.getName())) return IslandWorld.Normal;
|
||||||
return IslandWorld.Normal;
|
|
||||||
|
|
||||||
if (netherWorld != null && netherWorld.getName().equals(world.getName()))
|
if (netherWorld != null && netherWorld.getName().equals(world.getName())) return IslandWorld.Nether;
|
||||||
return IslandWorld.Nether;
|
|
||||||
|
|
||||||
if (endWorld != null && endWorld.getName().equals(world.getName()))
|
if (endWorld != null && endWorld.getName().equals(world.getName())) return IslandWorld.End;
|
||||||
return IslandWorld.End;
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIslandWorld(World world) {
|
public boolean isIslandWorld(World world) {
|
||||||
if (world == null)
|
if (world == null) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (normalWorld != null && normalWorld.getName().equals(world.getName()))
|
if (normalWorld != null && normalWorld.getName().equals(world.getName())) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
if (netherWorld != null && netherWorld.getName().equals(world.getName()))
|
if (netherWorld != null && netherWorld.getName().equals(world.getName())) return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
return endWorld != null && endWorld.getName().equals(world.getName());
|
return endWorld != null && endWorld.getName().equals(world.getName());
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,41 @@
|
|||||||
package com.songoda.skyblock.world.generator;
|
package com.songoda.skyblock.world.generator;
|
||||||
|
|
||||||
import com.songoda.skyblock.SkyBlock;
|
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
|
||||||
import com.songoda.skyblock.island.IslandWorld;
|
|
||||||
import com.songoda.skyblock.utils.version.Materials;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.generator.BlockPopulator;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.Configuration;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
|
import com.songoda.skyblock.SkyBlock;
|
||||||
|
import com.songoda.skyblock.island.IslandWorld;
|
||||||
|
import com.songoda.skyblock.utils.version.Materials;
|
||||||
|
|
||||||
public class VoidGenerator extends ChunkGenerator {
|
public class VoidGenerator extends ChunkGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
|
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
|
||||||
ChunkData chunkData = createChunkData(world);
|
final ChunkData chunkData = createChunkData(world);
|
||||||
|
|
||||||
SkyBlock skyblock = SkyBlock.getInstance();
|
final SkyBlock skyblock = SkyBlock.getInstance();
|
||||||
|
final Configuration configLoad = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration();
|
||||||
Config config = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
final ConfigurationSection worldSection = configLoad.getConfigurationSection("Island.World");
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
|
||||||
|
|
||||||
for (IslandWorld worldList : IslandWorld.values()) {
|
for (IslandWorld worldList : IslandWorld.values()) {
|
||||||
if (world.getEnvironment() == worldList.getUncheckedEnvironment()) {
|
if (world.getEnvironment() == worldList.getUncheckedEnvironment()) {
|
||||||
if (configLoad.getBoolean("Island.World." + worldList.name() + ".Liquid.Enable")) {
|
|
||||||
if (configLoad.getBoolean("Island.World." + worldList.name() + ".Liquid.Lava")) {
|
ConfigurationSection section = worldSection.getConfigurationSection(worldList.name());
|
||||||
setBlock(chunkData, Materials.LEGACY_STATIONARY_LAVA.parseMaterial(),
|
|
||||||
configLoad.getInt("Island.World." + worldList.name() + ".Liquid.Height"));
|
if (section.getBoolean("Liquid.Enable")) {
|
||||||
|
if (section.getBoolean("Liquid.Lava")) {
|
||||||
|
setBlock(chunkData, Materials.LEGACY_STATIONARY_LAVA.parseMaterial(), section.getInt("Liquid.Height"));
|
||||||
} else {
|
} else {
|
||||||
setBlock(chunkData, Materials.LEGACY_STATIONARY_WATER.parseMaterial(),
|
setBlock(chunkData, Materials.LEGACY_STATIONARY_WATER.parseMaterial(), section.getInt("Liquid.Height"));
|
||||||
configLoad.getInt("Island.World." + worldList.name() + ".Liquid.Height"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,6 +806,7 @@ Command:
|
|||||||
Message: '&bSkyBlock &8| &cError&8: &eYou must close your Island before deleting it.'
|
Message: '&bSkyBlock &8| &cError&8: &eYou must close your Island before deleting it.'
|
||||||
Sender:
|
Sender:
|
||||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou are no longer an Island Owner.'
|
Message: '&bSkyBlock &8| &aInfo&8: &eYou are no longer an Island Owner.'
|
||||||
|
MaxDeletionMessage: '&bSkyBlock &8| &cError&8: &eYou have reach the maximum island deletions. Sorry.'
|
||||||
Broadcast:
|
Broadcast:
|
||||||
Message: '&bSkyBlock &8| &aInfo&8: &eThe Island Owner has disbanded the Island.'
|
Message: '&bSkyBlock &8| &aInfo&8: &eThe Island Owner has disbanded the Island.'
|
||||||
Money:
|
Money:
|
||||||
@ -3109,11 +3110,6 @@ Placeholder:
|
|||||||
Message: '&f&oUnclaimed'
|
Message: '&f&oUnclaimed'
|
||||||
Non-empty:
|
Non-empty:
|
||||||
Message: '&f[%position] %player [%level]'
|
Message: '&f[%position] %player [%level]'
|
||||||
fabledskyblock_island_points:
|
|
||||||
Non-empty:
|
|
||||||
Message: '&f%placeholder'
|
|
||||||
Empty:
|
|
||||||
Message: '&c0'
|
|
||||||
fabledskyblock_island_visitors:
|
fabledskyblock_island_visitors:
|
||||||
Non-empty:
|
Non-empty:
|
||||||
Message: '&f%placeholder'
|
Message: '&f%placeholder'
|
||||||
@ -3194,11 +3190,6 @@ Placeholder:
|
|||||||
Message: '&f&oNone'
|
Message: '&f&oNone'
|
||||||
Non-empty:
|
Non-empty:
|
||||||
Message: '&f%placeholder'
|
Message: '&f%placeholder'
|
||||||
fabledskyblock_island_level:
|
|
||||||
Empty:
|
|
||||||
Message: '&c0'
|
|
||||||
Non-empty:
|
|
||||||
Message: '&f%placeholder'
|
|
||||||
fabledskyblock_island_level_formatted:
|
fabledskyblock_island_level_formatted:
|
||||||
Empty:
|
Empty:
|
||||||
Message: '&c0'
|
Message: '&c0'
|
||||||
@ -3376,6 +3367,7 @@ Island:
|
|||||||
Message: '&bSkyBlock &8| &cError&8: &eYou must wait &c&o%time &ebefore creating an Island.'
|
Message: '&bSkyBlock &8| &cError&8: &eYou must wait &c&o%time &ebefore creating an Island.'
|
||||||
Error:
|
Error:
|
||||||
Message: '&bSkyBlock &8| &cError&8: &eThe main spawn point must be set before you are able to create an Island by performing the command ''&f&o/island admin setspawn&e''.'
|
Message: '&bSkyBlock &8| &cError&8: &eThe main spawn point must be set before you are able to create an Island by performing the command ''&f&o/island admin setspawn&e''.'
|
||||||
|
MaxCreationMessage: '&bSkyBlock &8| &cError&8: &eYou have reach the maximum island creations. Sorry.'
|
||||||
Upgrade:
|
Upgrade:
|
||||||
Owner:
|
Owner:
|
||||||
Message: '&bSkyBlock &8| &cError&8: &eYou are not an Island Owner.'
|
Message: '&bSkyBlock &8| &cError&8: &eYou are not an Island Owner.'
|
||||||
|
Loading…
Reference in New Issue
Block a user