Get island scoreboard by island player.

This commit is contained in:
Brianna 2020-09-01 12:10:32 -05:00
parent d189ab058b
commit 82ad0e69a3
5 changed files with 19 additions and 14 deletions

View File

@ -60,7 +60,7 @@ public class AdminBank extends SubCommand {
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2]))));
}else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
@ -68,7 +68,7 @@ public class AdminBank extends SubCommand {
return;
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2]))));
}else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
@ -122,7 +122,7 @@ public class AdminBank extends SubCommand {
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2]))));
}else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
@ -130,7 +130,7 @@ public class AdminBank extends SubCommand {
return;
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2]))));
}else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));

View File

@ -52,7 +52,7 @@ public class ChatSpyCommand extends SubCommand {
case "add":
if(args.length == 2){
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
Island island = islandManager.getIslandByPlayer(offlinePlayer.getBukkitOfflinePlayer());
Island island = islandManager.getIslandByOwner(offlinePlayer.getBukkitOfflinePlayer());
if(island != null) {
playerData.addChatSpyIsland(island);
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Add.Message")
@ -68,7 +68,7 @@ public class ChatSpyCommand extends SubCommand {
case "remove":
if(args.length == 2){
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
Island island = islandManager.getIslandByPlayer(offlinePlayer.getBukkitOfflinePlayer());
Island island = islandManager.getIslandByOwner(offlinePlayer.getBukkitOfflinePlayer());
if(island != null) {
playerData.removeChatSpyIsland(island);
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Remove.Message")

View File

@ -1003,4 +1003,10 @@ public class Island {
this.removeWhitelistedPlayer(player.getUniqueId());
}
@Override
public String toString() {
return "Island{" +
"ownerUUID=" + ownerUUID +
'}';
}
}

View File

@ -47,7 +47,6 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@ -735,14 +734,14 @@ public class IslandManager {
try {
UUID islandOwnerUUID = FastUUID.parseUUID(file.getName().split("\\.")[0]);
Island island = getIslandByPlayer(Bukkit.getOfflinePlayer(islandOwnerUUID));
Island island = getIslandByOwner(Bukkit.getOfflinePlayer(islandOwnerUUID));
if(island != null) {
island.setSize(island.getSize() + diff);
island.save();
} else {
loadIsland(file);
island = getIslandByPlayer(Bukkit.getOfflinePlayer(islandOwnerUUID));
island = getIslandByOwner(Bukkit.getOfflinePlayer(islandOwnerUUID));
island.setSize(island.getSize() + diff);
island.save();
@ -772,14 +771,14 @@ public class IslandManager {
try {
UUID islandOwnerUUID = FastUUID.parseUUID(file.getName().split("\\.")[0]);
Island island = getIslandByPlayer(Bukkit.getOfflinePlayer(islandOwnerUUID));
Island island = getIslandByOwner(Bukkit.getOfflinePlayer(islandOwnerUUID));
if(island != null) {
island.setSize(size);
island.save();
} else {
loadIsland(file);
island = getIslandByPlayer(Bukkit.getOfflinePlayer(islandOwnerUUID));
island = getIslandByOwner(Bukkit.getOfflinePlayer(islandOwnerUUID));
island.setSize(size);
island.save();
@ -1690,7 +1689,7 @@ public class IslandManager {
return false;
}
public Island getIslandByPlayer(org.bukkit.OfflinePlayer player) {
public Island getIslandByOwner(org.bukkit.OfflinePlayer player) {
if (islandStorage.containsKey(player.getUniqueId())) {
return islandStorage.get(player.getUniqueId());
}

View File

@ -71,8 +71,8 @@ public class ScoreboardManager extends Manager {
IslandManager islandManager = plugin.getIslandManager();
PlayerData playerData = playerDataManager.getPlayerData(player);
Island island = islandManager.getIslandByPlayer(player);
Island island = islandManager.getIsland(player);
if(playerData.isScoreboard()) {
ScoreboardType type;
if(island != null) {