mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 11:10:04 +01:00
Removed null check in scoreboard manager
This commit is contained in:
parent
168a204a6a
commit
b7a09b76a2
@ -140,20 +140,17 @@ public class AcceptCommand extends SubCommand {
|
||||
soundManager.playSound(loopPlayer, CompatibleSound.ENTITY_FIREWORK_ROCKET_BLAST.getSound(), 1.0F,
|
||||
1.0F);
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
if (island.getRole(IslandRole.Member).size() == 1
|
||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
|
||||
if (island.getRole(IslandRole.Member).size() == 1
|
||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
} else {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Accept.Owner.Message"));
|
||||
|
@ -111,17 +111,13 @@ public class ConfirmCommand extends SubCommand {
|
||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
} else if (confirmation.equals(Confirmation.Reset)) {
|
||||
playerData.setConfirmation(null);
|
||||
playerData.setConfirmationTime(0);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
} else if (confirmation.equals(Confirmation.Deletion)) {
|
||||
if (island.getStatus().equals(IslandStatus.OPEN)) {
|
||||
@ -188,9 +184,7 @@ public class ConfirmCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -147,9 +147,7 @@ public class KickCommand extends SubCommand {
|
||||
|
||||
Player finalTargetPlayer = targetPlayer;
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(finalTargetPlayer);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
|
||||
playerData = playerDataManager.getPlayerData(targetPlayer);
|
||||
@ -186,9 +184,7 @@ public class KickCommand extends SubCommand {
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -105,10 +105,8 @@ public class LeaveCommand extends SubCommand {
|
||||
|
||||
if (island.getRole(IslandRole.Member).size() == 0
|
||||
&& island.getRole(IslandRole.Operator).size() == 0) {
|
||||
if (scoreboardManager != null) {
|
||||
if (islandManager.getVisitorsAtIsland(island).size() != 0) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
if (islandManager.getVisitorsAtIsland(island).size() != 0) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -120,10 +118,8 @@ public class LeaveCommand extends SubCommand {
|
||||
messageManager.sendMessage(player,
|
||||
languageConfig.getFileConfiguration().getString("Command.Island.Leave.Left.Sender.Message"));
|
||||
soundManager.playSound(player, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 5.0F, 5.0F);
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,9 +263,7 @@ public class IslandManager {
|
||||
data.setOwner(player.getUniqueId());
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
});
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
@ -950,9 +948,7 @@ public class IslandManager {
|
||||
island.hasRole(IslandRole.Operator, loopPlayer.getUniqueId()) ||
|
||||
island.hasRole(IslandRole.Owner, loopPlayer.getUniqueId()) ||
|
||||
island.getCoopType(loopPlayer.getUniqueId()) == IslandCoop.NORMAL) {
|
||||
if (scoreboardManager != null) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
|
||||
unloadIsland = false;
|
||||
}
|
||||
@ -1190,18 +1186,16 @@ public class IslandManager {
|
||||
.getFileConfiguration().getString("Island.Teleport.Unsafe.Message")));
|
||||
}
|
||||
} else {
|
||||
if (scoreboardManager != null) {
|
||||
int islandVisitors = getVisitorsAtIsland(island).size();
|
||||
|
||||
if (islandVisitors == 0) {
|
||||
for (Player loopPlayer : Bukkit.getOnlinePlayers()) {
|
||||
PlayerData targetPlayerData = plugin.getPlayerDataManager().getPlayerData(loopPlayer);
|
||||
int islandVisitors = getVisitorsAtIsland(island).size();
|
||||
|
||||
if (targetPlayerData != null &&
|
||||
targetPlayerData.getOwner() != null &&
|
||||
targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
if (islandVisitors == 0) {
|
||||
for (Player loopPlayer : Bukkit.getOnlinePlayers()) {
|
||||
PlayerData targetPlayerData = plugin.getPlayerDataManager().getPlayerData(loopPlayer);
|
||||
|
||||
if (targetPlayerData != null &&
|
||||
targetPlayerData.getOwner() != null &&
|
||||
targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class Join implements Listener {
|
||||
SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(player.getUniqueId());
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (scoreboardManager != null && playerDataManager.getPlayerData(player).isScoreboard()) {
|
||||
if (playerDataManager.getPlayerData(player).isScoreboard()) {
|
||||
scoreboardManager.updatePlayerScoreboardType(player);
|
||||
}
|
||||
});
|
||||
|
@ -190,14 +190,12 @@ public class PlayerDataManager {
|
||||
|
||||
ScoreboardManager scoreboardManager = plugin.getScoreboardManager();
|
||||
|
||||
if (scoreboardManager != null) {
|
||||
for (Player loopPlayer : Bukkit.getOnlinePlayers()) {
|
||||
PlayerData targetPlayerData = getPlayerData(loopPlayer);
|
||||
|
||||
if (targetPlayerData.getOwner() != null &&
|
||||
targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
for (Player loopPlayer : Bukkit.getOnlinePlayers()) {
|
||||
PlayerData targetPlayerData = getPlayerData(loopPlayer);
|
||||
|
||||
if (targetPlayerData.getOwner() != null &&
|
||||
targetPlayerData.getOwner().equals(island.getOwnerUUID())) {
|
||||
scoreboardManager.updatePlayerScoreboardType(loopPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user