Fix permission issue, add placeholder fabledskyblock_island_votes

This commit is contained in:
Esophose 2019-03-22 22:36:31 -06:00
parent d6c409cccc
commit 18ba514e3d
3 changed files with 76 additions and 67 deletions

View File

@ -34,7 +34,6 @@ public class TeleportCommand extends SubCommand {
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 1) {
if (player.hasPermission("fabledskyblock.teleport") || player.hasPermission("fabledskyblock.*")) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
UUID islandOwnerUUID = null;
String targetPlayerName;
@ -95,12 +94,6 @@ public class TeleportCommand extends SubCommand {
configLoad.getString("Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Permission.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
} else if (args.length != 0) {

View File

@ -1,24 +1,25 @@
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.config.FileManager.Config;
import me.goodandevil.skyblock.invite.Invite;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.leaderboard.Leaderboard;
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 {
@ -61,6 +62,7 @@ public class PlaceholderManager {
public String getPlaceholder(Player player, String placeholder) {
IslandManager islandManager = skyblock.getIslandManager();
VisitManager visitManager = skyblock.getVisitManager();
Island island = islandManager.getIsland(player);
@ -112,6 +114,15 @@ public class PlaceholderManager {
configLoad.getString("Placeholder.fabledskyblock_island_points.Non-empty.Message")
.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")) {
if (island == null) {
return ChatColor.translateAlternateColorCodes('&',

View File

@ -1115,6 +1115,11 @@ Placeholder:
Message: "&c0"
Non-empty:
Message: "&f%placeholder"
fabledskyblock_island_votes:
Empty:
Message: "&c0"
Non-empty:
Message: "&f%placeholder"
fabledskyblock_island_role:
Empty:
Message: "&f&oNone"