mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-27 04:35:46 +01:00
Fix permission issue, add placeholder fabledskyblock_island_votes
This commit is contained in:
parent
d6c409cccc
commit
18ba514e3d
@ -34,71 +34,64 @@ public class TeleportCommand extends SubCommand {
|
|||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (player.hasPermission("fabledskyblock.teleport") || player.hasPermission("fabledskyblock.*")) {
|
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
||||||
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
|
UUID islandOwnerUUID = null;
|
||||||
UUID islandOwnerUUID = null;
|
String targetPlayerName;
|
||||||
String targetPlayerName;
|
|
||||||
|
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
OfflinePlayer targetOfflinePlayer = new OfflinePlayer(args[0]);
|
||||||
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
islandOwnerUUID = targetOfflinePlayer.getOwner();
|
||||||
targetPlayerName = targetOfflinePlayer.getName();
|
targetPlayerName = targetOfflinePlayer.getName();
|
||||||
} else {
|
} else {
|
||||||
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
|
||||||
targetPlayerName = targetPlayer.getName();
|
targetPlayerName = targetPlayer.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (islandOwnerUUID == null) {
|
if (islandOwnerUUID == null) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
configLoad.getString("Command.Island.Teleport.Island.None.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 (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
|
} else if (!islandOwnerUUID.equals(playerDataManager.getPlayerData(player).getOwner())) {
|
||||||
if (visitManager.hasIsland(islandOwnerUUID)) {
|
if (visitManager.hasIsland(islandOwnerUUID)) {
|
||||||
me.goodandevil.skyblock.visit.Visit visit = visitManager.getIsland(islandOwnerUUID);
|
me.goodandevil.skyblock.visit.Visit visit = visitManager.getIsland(islandOwnerUUID);
|
||||||
boolean isCoopPlayer = false;
|
boolean isCoopPlayer = false;
|
||||||
|
|
||||||
if (islandManager.containsIsland(islandOwnerUUID)) {
|
if (islandManager.containsIsland(islandOwnerUUID)) {
|
||||||
if (islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
|
if (islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
|
||||||
.isCoopPlayer(player.getUniqueId())) {
|
.isCoopPlayer(player.getUniqueId())) {
|
||||||
isCoopPlayer = true;
|
isCoopPlayer = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCoopPlayer || player.hasPermission("fabledskyblock.bypass")
|
|
||||||
|| player.hasPermission("fabledskyblock.bypass.*") || player.hasPermission("fabledskyblock.*")
|
|
||||||
|| visit.isOpen()) {
|
|
||||||
if (!islandManager.containsIsland(islandOwnerUUID)) {
|
|
||||||
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
|
||||||
}
|
|
||||||
|
|
||||||
islandManager.visitIsland(player,
|
|
||||||
islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
|
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
|
||||||
configLoad.getString("Command.Island.Teleport.Teleported.Other.Message")
|
|
||||||
.replace("%player", targetPlayerName));
|
|
||||||
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
messageManager.sendMessage(player,
|
|
||||||
configLoad.getString("Command.Island.Teleport.Island.Closed.Message"));
|
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
messageManager.sendMessage(player,
|
if (isCoopPlayer || player.hasPermission("fabledskyblock.bypass")
|
||||||
configLoad.getString("Command.Island.Teleport.Island.None.Message"));
|
|| player.hasPermission("fabledskyblock.bypass.*") || player.hasPermission("fabledskyblock.*")
|
||||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
|| visit.isOpen()) {
|
||||||
|
if (!islandManager.containsIsland(islandOwnerUUID)) {
|
||||||
|
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
|
||||||
|
}
|
||||||
|
|
||||||
|
islandManager.visitIsland(player,
|
||||||
|
islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)));
|
||||||
|
|
||||||
|
messageManager.sendMessage(player,
|
||||||
|
configLoad.getString("Command.Island.Teleport.Teleported.Other.Message")
|
||||||
|
.replace("%player", targetPlayerName));
|
||||||
|
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
messageManager.sendMessage(player,
|
||||||
|
configLoad.getString("Command.Island.Teleport.Island.Closed.Message"));
|
||||||
|
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Permission.Message"));
|
messageManager.sendMessage(player,
|
||||||
|
configLoad.getString("Command.Island.Teleport.Island.None.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;
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
package me.goodandevil.skyblock.placeholder;
|
package me.goodandevil.skyblock.placeholder;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
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.plugin.PluginManager;
|
|
||||||
|
|
||||||
import me.goodandevil.skyblock.SkyBlock;
|
import me.goodandevil.skyblock.SkyBlock;
|
||||||
import me.goodandevil.skyblock.config.FileManager.Config;
|
import me.goodandevil.skyblock.config.FileManager.Config;
|
||||||
import me.goodandevil.skyblock.invite.Invite;
|
import me.goodandevil.skyblock.invite.Invite;
|
||||||
import me.goodandevil.skyblock.island.Island;
|
import me.goodandevil.skyblock.island.Island;
|
||||||
import me.goodandevil.skyblock.island.IslandManager;
|
import me.goodandevil.skyblock.island.IslandManager;
|
||||||
import me.goodandevil.skyblock.island.IslandRole;
|
import me.goodandevil.skyblock.island.IslandRole;
|
||||||
|
import me.goodandevil.skyblock.leaderboard.Leaderboard;
|
||||||
import me.goodandevil.skyblock.utils.NumberUtil;
|
import me.goodandevil.skyblock.utils.NumberUtil;
|
||||||
|
import me.goodandevil.skyblock.visit.VisitManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlaceholderManager {
|
public class PlaceholderManager {
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ public class PlaceholderManager {
|
|||||||
|
|
||||||
public String getPlaceholder(Player player, String placeholder) {
|
public String getPlaceholder(Player player, String placeholder) {
|
||||||
IslandManager islandManager = skyblock.getIslandManager();
|
IslandManager islandManager = skyblock.getIslandManager();
|
||||||
|
VisitManager visitManager = skyblock.getVisitManager();
|
||||||
|
|
||||||
Island island = islandManager.getIsland(player);
|
Island island = islandManager.getIsland(player);
|
||||||
|
|
||||||
@ -112,6 +114,15 @@ public class PlaceholderManager {
|
|||||||
configLoad.getString("Placeholder.fabledskyblock_island_points.Non-empty.Message")
|
configLoad.getString("Placeholder.fabledskyblock_island_points.Non-empty.Message")
|
||||||
.replace("%placeholder", "" + island.getLevel().getPoints()));
|
.replace("%placeholder", "" + island.getLevel().getPoints()));
|
||||||
}
|
}
|
||||||
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_votes")) {
|
||||||
|
if (island == null) {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
|
configLoad.getString("Placeholder.fabledskyblock_island_votes.Empty.Message"));
|
||||||
|
} else {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
|
configLoad.getString("Placeholder.fabledskyblock_island_votes.Non-empty.Message")
|
||||||
|
.replace("%placeholder", "" + visitManager.getIslands().get(player.getUniqueId()).getVoters().size()));
|
||||||
|
}
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_role")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_role")) {
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
|
@ -1115,6 +1115,11 @@ Placeholder:
|
|||||||
Message: "&c0"
|
Message: "&c0"
|
||||||
Non-empty:
|
Non-empty:
|
||||||
Message: "&f%placeholder"
|
Message: "&f%placeholder"
|
||||||
|
fabledskyblock_island_votes:
|
||||||
|
Empty:
|
||||||
|
Message: "&c0"
|
||||||
|
Non-empty:
|
||||||
|
Message: "&f%placeholder"
|
||||||
fabledskyblock_island_role:
|
fabledskyblock_island_role:
|
||||||
Empty:
|
Empty:
|
||||||
Message: "&f&oNone"
|
Message: "&f&oNone"
|
||||||
|
Loading…
Reference in New Issue
Block a user