mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-10 17:58:03 +01:00
Build 28
# Added the path 'Island.Creation.Commands' to the configuration file where you can provide command you want to be executed by the player or console on Island creation. # Added the variable '%island_radius' to the scoreboard that returns the radius of the Island. # Added the variable '%island_size' to the scoreboard that returns the size of the Island. # Added the placeholder 'skyblock_island_radius' that returns the Island radius. # Added the placeholder 'skyblock_island_size' that returns the Island size. # Added the alias 'new' to the '/island create' command. # Added the alias 'banned' to the '/island bans' command. # Added PlaceholderAPI support to the Island chat. # Fixed NPE when loading an Island if an island world name has been changed in the configuration file while there's island data. # Fixed NPE when teleporting to the set spawn point if the world is not loaded or no longer exists.
This commit is contained in:
parent
9bc370616d
commit
aadd2f0817
@ -31,6 +31,12 @@ Island:
|
||||
Deletion:
|
||||
Enable: false
|
||||
Time: 300
|
||||
# Commands that are executed either by the player or the console on Island creation.
|
||||
# [!] To add commands, create a list and remove the open and closed brackets.
|
||||
# Use the variable %player to get the players name.
|
||||
Commands:
|
||||
Player: []
|
||||
Console: []
|
||||
World:
|
||||
# [!] The Island height is 72 blocks.
|
||||
# Delete the Island world when changing the liquid option.
|
||||
|
14
language.yml
14
language.yml
@ -839,6 +839,16 @@ Island:
|
||||
Division:
|
||||
Message: "&bSkyBlock &8| &aInfo&8: &eYou have set the points division to '&f%division&e'."
|
||||
Placeholder:
|
||||
skyblock_island_size:
|
||||
Empty:
|
||||
Message: "&c0"
|
||||
Non-empty:
|
||||
Message: "&f%placeholder"
|
||||
skyblock_island_radius:
|
||||
Empty:
|
||||
Message: "&c0"
|
||||
Non-empty:
|
||||
Message: "&f%placeholder"
|
||||
skyblock_island_level:
|
||||
Empty:
|
||||
Message: "&c0"
|
||||
@ -925,6 +935,7 @@ Scoreboard:
|
||||
- "&bIsland&f:"
|
||||
- " &8- &7Level&8: &f%island_level"
|
||||
- " &8- &7Visitors&8: &f%island_visitors"
|
||||
- " &8- &7Size&8: &f%island_size&7x&f%island_size"
|
||||
- ""
|
||||
- "&bProfile&f:"
|
||||
- " &8- &7Rank&8: &fDefault"
|
||||
@ -936,6 +947,7 @@ Scoreboard:
|
||||
- ""
|
||||
- "&bIsland&f:"
|
||||
- " &8- &7Level&8: &f%island_level"
|
||||
- " &8- &7Size&8: &f%island_size&7x&f%island_size"
|
||||
- ""
|
||||
- "&bProfile&f:"
|
||||
- " &8- &7Rank&8: &fDefault"
|
||||
@ -956,6 +968,7 @@ Scoreboard:
|
||||
- " &8- &7Members&8: &f%island_members"
|
||||
- " &8- &7Level&8: &f%island_level"
|
||||
- " &8- &7Visitors&8: &f%island_visitors"
|
||||
- " &8- &7Size&8: &f%island_size&7x&f%island_size"
|
||||
- ""
|
||||
- "&bProfile&f:"
|
||||
- " &8- &7Rank&8: &fDefault"
|
||||
@ -969,6 +982,7 @@ Scoreboard:
|
||||
- " &8- &7Role&8: &f%island_role"
|
||||
- " &8- &7Members&8: &f%island_members"
|
||||
- " &8- &7Level&8: &f%island_level"
|
||||
- " &8- &7Size&8: &f%island_size&7x&f%island_size"
|
||||
- ""
|
||||
- "&bProfile&f:"
|
||||
- " &8- &7Rank&8: &fDefault"
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: SkyBlock
|
||||
main: me.goodandevil.skyblock.Main
|
||||
version: 27
|
||||
main: me.goodandevil.skyblock.SkyBlock
|
||||
version: 28
|
||||
api-version: 1.13
|
||||
description: A unique SkyBlock plugin
|
||||
author: GoodAndEvil
|
||||
|
@ -206,6 +206,29 @@ public class IslandManager {
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
if (configLoad.getString("Island.Creation.Commands.Player") != null) {
|
||||
List<String> commands = configLoad.getStringList("Island.Creation.Commands.Player");
|
||||
|
||||
if (commands != null) {
|
||||
for (String commandList : commands) {
|
||||
Bukkit.getServer().dispatchCommand(player, commandList.replace("%player", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (configLoad.getString("Island.Creation.Commands.Console") != null) {
|
||||
List<String> commands = configLoad.getStringList("Island.Creation.Commands.Console");
|
||||
|
||||
if (commands != null) {
|
||||
for (String commandList : commands) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), commandList.replace("%player", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.teleport(island.getLocation(Location.World.Normal, Location.Environment.Main));
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,6 @@ import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -17,6 +16,7 @@ import me.goodandevil.skyblock.events.IslandChatEvent;
|
||||
import me.goodandevil.skyblock.island.Island;
|
||||
import me.goodandevil.skyblock.island.IslandManager;
|
||||
import me.goodandevil.skyblock.island.Role;
|
||||
import me.goodandevil.skyblock.message.MessageManager;
|
||||
import me.goodandevil.skyblock.playerdata.PlayerData;
|
||||
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
|
||||
|
||||
@ -33,6 +33,7 @@ public class Chat implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
|
||||
MessageManager messageManager = skyblock.getMessageManager();
|
||||
IslandManager islandManager = skyblock.getIslandManager();
|
||||
|
||||
if (playerDataManager.hasPlayerData(player)) {
|
||||
@ -61,7 +62,7 @@ public class Chat implements Listener {
|
||||
if (!islandChatEvent.isCancelled()) {
|
||||
for (UUID islandMembersOnlineList : islandManager.getMembersOnline(island)) {
|
||||
Player targetPlayer = Bukkit.getServer().getPlayer(islandMembersOnlineList);
|
||||
targetPlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', islandChatEvent.getFormat().replace("%role", islandRole).replace("%player", player.getName())).replace("%message", islandChatEvent.getMessage()));
|
||||
targetPlayer.sendMessage(messageManager.replaceMessage(targetPlayer, islandChatEvent.getFormat().replace("%role", islandRole).replace("%player", player.getName())).replace("%message", islandChatEvent.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,11 @@ public class EZPlaceholder extends PlaceholderExpansion {
|
||||
if (islandManager.hasIsland(player)) {
|
||||
Island island = islandManager.getIsland(skyblock.getPlayerDataManager().getPlayerData(player).getOwner());
|
||||
|
||||
if (identifier.equalsIgnoreCase("island_level")) {
|
||||
if (identifier.equalsIgnoreCase("island_size")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_size.Non-empty.Message").replace("%placeholder", "" + island.getSize()));
|
||||
} else if (identifier.equalsIgnoreCase("island_radius")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_radius.Non-empty.Message").replace("%placeholder", "" + island.getRadius()));
|
||||
} else if (identifier.equalsIgnoreCase("island_level")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_level.Non-empty.Message").replace("%placeholder", "" + island.getLevel().getLevel()));
|
||||
} else if (identifier.equalsIgnoreCase("island_points")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_points.Non-empty.Message").replace("%placeholder", "" + island.getLevel().getPoints()));
|
||||
@ -101,7 +105,11 @@ public class EZPlaceholder extends PlaceholderExpansion {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (identifier.equalsIgnoreCase("island_level")) {
|
||||
if (identifier.equalsIgnoreCase("island_size")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_size.Empty.Message"));
|
||||
} else if (identifier.equalsIgnoreCase("island_radius")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_radius.Empty.Message"));
|
||||
} else if (identifier.equalsIgnoreCase("island_level")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_level.Empty.Message"));
|
||||
} else if (identifier.equalsIgnoreCase("island_points")) {
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_points.Empty.Message"));
|
||||
|
@ -38,6 +38,40 @@ public class MVdWPlaceholder {
|
||||
return "" + skyblock.getVisitManager().getIslands().size();
|
||||
}
|
||||
});
|
||||
|
||||
PlaceholderAPI.registerPlaceholder(skyblock, "skyblock_island_size", new PlaceholderReplacer() {
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (islandManager.hasIsland(player)) {
|
||||
return "" + islandManager.getIsland(skyblock.getPlayerDataManager().getPlayerData(player).getOwner()).getSize();
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_size.Empty.Message"));
|
||||
}
|
||||
});
|
||||
|
||||
PlaceholderAPI.registerPlaceholder(skyblock, "skyblock_island_radius", new PlaceholderReplacer() {
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (islandManager.hasIsland(player)) {
|
||||
return "" + islandManager.getIsland(skyblock.getPlayerDataManager().getPlayerData(player).getOwner()).getRadius();
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', configLoad.getString("Placeholder.skyblock_island_radius.Empty.Message"));
|
||||
}
|
||||
});
|
||||
|
||||
PlaceholderAPI.registerPlaceholder(skyblock, "skyblock_island_level", new PlaceholderReplacer() {
|
||||
@Override
|
||||
|
@ -173,7 +173,7 @@ public class Scoreboard {
|
||||
Level level = island.getLevel();
|
||||
|
||||
if (island.getRole(Role.Member).size() == 0 && island.getRole(Role.Operator).size() == 0) {
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumber(level.getLevel())).replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null").replace("%island_visitors", "" + island.getVisitors().size());
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumber(level.getLevel())).replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null").replace("%island_visitors", "" + island.getVisitors().size()).replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||
} else {
|
||||
int islandMembers = 1 + island.getRole(Role.Member).size() + island.getRole(Role.Operator).size();
|
||||
String islandRole = "";
|
||||
@ -186,10 +186,10 @@ public class Scoreboard {
|
||||
islandRole = displayVariables.get("%member");
|
||||
}
|
||||
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumber(level.getLevel())).replace("%island_members", "" + islandMembers).replace("%island_role", islandRole).replace("%island_visitors", "" + island.getVisitors().size());
|
||||
displayLine = displayLine.replace("%island_level", "" + NumberUtil.formatNumber(level.getLevel())).replace("%island_members", "" + islandMembers).replace("%island_role", islandRole).replace("%island_visitors", "" + island.getVisitors().size()).replace("%island_size", "" + island.getSize()).replace("%island_radius", "" + island.getRadius());
|
||||
}
|
||||
} else {
|
||||
displayLine = displayLine.replace("%island_level", ChatColor.RED + "0").replace("%island_members", ChatColor.RED + "0").replace("%island_role", ChatColor.RED + "null");
|
||||
displayLine = displayLine.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");
|
||||
}
|
||||
|
||||
PlaceholderManager placeholderManager = skyblock.getPlaceholderManager();
|
||||
|
Loading…
Reference in New Issue
Block a user