Merge branch 'development' into 'master'

Build-78.1, convert project to gradle modules

See merge request Songoda/fabledskyblock!20
This commit is contained in:
Esophose 2019-07-25 17:09:00 +00:00
commit 571b913119
278 changed files with 603 additions and 539 deletions

2
.gitignore vendored
View File

@ -25,5 +25,5 @@ hs_err_pid*
/.gradle/
/.settings/
/.idea/
/build/
**/build/
/bin/

View File

@ -0,0 +1,62 @@
import org.apache.tools.ant.filters.ReplaceTokens
configurations {
extraLibs
}
dependencies {
// Project Dependencies
compile project(':FabledSkyBlock-Legacy')
// PlaceholderAPI
compileOnly (group: 'be.maximvdw', name: 'placeholderapi', version: '2.5.1')
compileOnly (group: 'me.clip', name: 'placeholderapi', version: '2.10.2')
// Vault
compileOnly (group: 'net.milkbowl', name: 'vault', version: '1.7.1')
// Leaderheads
compileOnly (group: 'me.robin', name: 'leaderheads', version: '1.0')
// EpicSpawners
compileOnly (group: 'com.songoda', name: 'epicspawners', version: '6-pre4')
// EpicAnchors
compileOnly (group: 'com.songoda', name: 'epicanchors', version: '1.2.5')
// UltimateStacker
compileOnly (group: 'com.songoda', name: 'ultimatestacker', version: '1.3.1')
// WildStacker
compileOnly (group: 'com.bgsoftware', name: 'wildstacker-api', version: 'b15')
// WorldEdit
compileOnly (group: 'com.sk89q', name: 'worldedit', version: '7.0.0')
// Apache Commons
extraLibs (group: 'org.apache.commons', name: 'commons-lang3', version: '3.0')
extraLibs (group: 'commons-io', name: 'commons-io', version: '2.5')
// Spigot
compileOnly (group: 'org.spigotmc', name: 'spigot', version: '1.14.1')
// Songoda Updater
extraLibs (group: 'com.songoda', name: 'songodaupdater', version: '1')
configurations.compileOnly.extendsFrom(configurations.extraLibs)
}
processResources {
from (sourceSets.main.resources.srcDirs) {
include '**/*.yml'
filter ReplaceTokens, tokens: ["version": project.property("version")]
}
}
jar {
from {
configurations.extraLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}

View File

@ -40,12 +40,14 @@ public class RefreshHologramsCommand extends SubCommand {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
LeaderboardManager leaderboardManager = skyblock.getLeaderboardManager();
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
leaderboardManager.setupLeaderHeads();
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
LeaderboardManager leaderboardManager = skyblock.getLeaderboardManager();
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
leaderboardManager.setupLeaderHeads();
skyblock.getHologramManager().resetHologram();
Bukkit.getScheduler().runTask(skyblock, () -> skyblock.getHologramManager().resetHologram());
});
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RefreshHolograms.Refreshed.Message"));
soundManager.playSound(sender, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);

View File

@ -90,11 +90,13 @@ public class ReloadCommand extends SubCommand {
levellingManager.unregisterMaterials();
levellingManager.registerMaterials();
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
leaderboardManager.setupLeaderHeads();
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
leaderboardManager.clearLeaderboard();
leaderboardManager.resetLeaderboard();
leaderboardManager.setupLeaderHeads();
hologramManager.resetHologram();
Bukkit.getScheduler().runTask(skyblock, () -> skyblock.getHologramManager().resetHologram());
});
limitManager.reload();

View File

@ -0,0 +1,146 @@
package me.goodandevil.skyblock.command.commands.island;
import me.goodandevil.skyblock.ban.Ban;
import me.goodandevil.skyblock.command.SubCommand;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.island.IslandWorld;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.UUID;
public class BanCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
MessageManager messageManager = skyblock.getMessageManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 1) {
Island island = islandManager.getIsland(player);
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Visitor.Banning")) {
if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Ban").getStatus())) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
if (targetPlayer != null && targetPlayer.hasPermission("fabledskyblock.bypass.ban"))
return;
UUID targetPlayerUUID = null;
String targetPlayerName = null;
if (targetPlayer == null) {
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
targetPlayerUUID = targetPlayerOffline.getUniqueId();
targetPlayerName = targetPlayerOffline.getName();
if (skyblock.getEconomyManager().hasPermission(skyblock.getWorldManager().getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(targetPlayerUUID), "fabledskyblock.bypass.ban"))
return;
} else {
targetPlayerUUID = targetPlayer.getUniqueId();
targetPlayerName = targetPlayer.getName();
}
if (targetPlayerUUID == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Found.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Member, targetPlayerUUID)
|| island.hasRole(IslandRole.Operator, targetPlayerUUID)
|| island.hasRole(IslandRole.Owner, targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Member.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (island.getBan().isBanned(targetPlayerUUID)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Already.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ban.Banned.Sender.Message").replace("%player",
targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
if (island.isCoopPlayer(targetPlayerUUID)) {
island.removeCoopPlayer(targetPlayerUUID);
}
Ban ban = island.getBan();
ban.addBan(player.getUniqueId(), targetPlayerUUID);
ban.save();
if (targetPlayer != null) {
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
messageManager.sendMessage(targetPlayer,
configLoad.getString("Command.Island.Ban.Banned.Target.Message")
.replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
LocationUtil.teleportPlayerToSpawn(targetPlayer);
}
}
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ban.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
}
});
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
sender.sendMessage("SkyBlock | Error: You must be a player to perform that command.");
}
@Override
public String getName() {
return "ban";
}
@Override
public String getInfoMessagePath() {
return "Command.Island.Ban.Info.Message";
}
@Override
public String[] getAliases() {
return new String[0];
}
@Override
public String[] getArguments() {
return new String[0];
}
}

View File

@ -0,0 +1,287 @@
package me.goodandevil.skyblock.command.commands.island;
import me.goodandevil.skyblock.api.event.island.IslandKickEvent;
import me.goodandevil.skyblock.api.utils.APIUtil;
import me.goodandevil.skyblock.command.SubCommand;
import me.goodandevil.skyblock.config.FileManager;
import me.goodandevil.skyblock.config.FileManager.Config;
import me.goodandevil.skyblock.island.Island;
import me.goodandevil.skyblock.island.IslandManager;
import me.goodandevil.skyblock.island.IslandRole;
import me.goodandevil.skyblock.island.IslandWorld;
import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.scoreboard.Scoreboard;
import me.goodandevil.skyblock.scoreboard.ScoreboardManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import java.util.UUID;
public class KickCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
MessageManager messageManager = skyblock.getMessageManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
PlayerData playerData = playerDataManager.getPlayerData(player);
Config languageConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
if (args.length == 1) {
Island island = islandManager.getIsland(player);
if (island == null) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (island.hasRole(IslandRole.Owner, player.getUniqueId())
|| (island.hasRole(IslandRole.Operator, player.getUniqueId())
&& island.getSetting(IslandRole.Operator, "Kick").getStatus())) {
UUID targetPlayerUUID = null;
String targetPlayerName = null;
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
if (targetPlayer != null && targetPlayer.hasPermission("fabledskyblock.bypass.ban"))
return;
Set<UUID> islandMembers = island.getRole(IslandRole.Member),
islandOperators = island.getRole(IslandRole.Operator),
islandVisitors = islandManager.getVisitorsAtIsland(island);
if (targetPlayer == null) {
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[0]);
targetPlayerUUID = targetPlayerOffline.getUniqueId();
targetPlayerName = targetPlayerOffline.getName();
if (skyblock.getEconomyManager().hasPermission(skyblock.getWorldManager().getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(targetPlayerUUID), "fabledskyblock.bypass.ban"))
return;
} else {
targetPlayerUUID = targetPlayer.getUniqueId();
targetPlayerName = targetPlayer.getName();
}
if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Yourself.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (islandOperators.contains(player.getUniqueId())
&& islandOperators.contains(targetPlayerUUID)) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Role.Operator.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (island.getOwnerUUID().equals(targetPlayerUUID)) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Role.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else if (island.isOpen() && islandVisitors.contains(targetPlayerUUID) && targetPlayer != null) {
if (island.isCoopPlayer(targetPlayerUUID)) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Cooped.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(),
APIUtil.fromImplementation(IslandRole.Visitor),
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
if (!islandKickEvent.isCancelled()) {
LocationUtil.teleportPlayerToSpawn(targetPlayer);
messageManager.sendMessage(player,
languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Kicked.Sender.Message")
.replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
messageManager.sendMessage(targetPlayer,
languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Kicked.Target.Message")
.replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
}
}
} else if (islandMembers.contains(targetPlayerUUID) || islandOperators.contains(targetPlayerUUID)) {
IslandRole islandRole = IslandRole.Member;
if (islandOperators.contains(targetPlayerUUID)) {
islandRole = IslandRole.Operator;
}
IslandKickEvent islandKickEvent = new IslandKickEvent(island.getAPIWrapper(),
APIUtil.fromImplementation(islandRole),
Bukkit.getServer().getOfflinePlayer(targetPlayerUUID), player);
Bukkit.getScheduler().runTask(skyblock, () -> Bukkit.getServer().getPluginManager().callEvent(islandKickEvent));
if (!islandKickEvent.isCancelled()) {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Kicked.Sender.Message")
.replace("%player", targetPlayerName));
soundManager.playSound(player, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
if (targetPlayer == null) {
Config config = fileManager
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/player-data"),
targetPlayerUUID.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();
configLoad.set("Statistics.Island.Playtime", null);
configLoad.set("Statistics.Island.Join", null);
configLoad.set("Island.Owner", null);
try {
configLoad.save(config.getFile());
} catch (IOException e) {
e.printStackTrace();
}
} else {
messageManager.sendMessage(targetPlayer,
languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Kicked.Target.Message")
.replace("%player", player.getName()));
soundManager.playSound(targetPlayer, Sounds.IRONGOLEM_HIT.bukkitSound(), 1.0F, 1.0F);
if (islandManager.isPlayerAtIsland(island, targetPlayer)) {
LocationUtil.teleportPlayerToSpawn(targetPlayer);
}
if (scoreboardManager != null) {
Scoreboard scoreboard = scoreboardManager.getScoreboard(targetPlayer);
scoreboard.cancel();
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', languageConfig
.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
.getStringList("Scoreboard.Tutorial.Displaylines"));
scoreboard.run();
}
playerData = playerDataManager.getPlayerData(targetPlayer);
playerData.setPlaytime(0);
playerData.setMemberSince(null);
playerData.setOwner(null);
playerData.setChat(false);
playerData.save();
}
if (islandMembers.contains(targetPlayerUUID)) {
island.removeRole(IslandRole.Member, targetPlayerUUID);
} else if (islandOperators.contains(targetPlayerUUID)) {
island.removeRole(IslandRole.Operator, targetPlayerUUID);
}
island.save();
Set<UUID> islandMembersOnline = islandManager.getMembersOnline(island);
if (islandMembersOnline.size() == 1) {
for (UUID islandMembersOnlineList : islandMembersOnline) {
if (!islandMembersOnlineList.equals(player.getUniqueId())) {
targetPlayer = Bukkit.getServer().getPlayer(islandMembersOnlineList);
PlayerData targetPlayerData = playerDataManager.getPlayerData(targetPlayer);
if (targetPlayerData.isChat()) {
targetPlayerData.setChat(false);
messageManager.sendMessage(targetPlayer, fileManager
.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Chat.Untoggled.Message"));
}
}
}
}
if (scoreboardManager != null) {
if (island.getRole(IslandRole.Member).size() == 0
&& island.getRole(IslandRole.Operator).size() == 0) {
Scoreboard scoreboard = scoreboardManager.getScoreboard(player);
scoreboard.cancel();
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', languageConfig
.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
.getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
} else {
scoreboard.setDisplayList(languageConfig.getFileConfiguration()
.getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
}
scoreboard.run();
}
}
}
} else {
if (island.isOpen()) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Occupant.Visit.Open.Message"));
} else {
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Occupant.Visit.Closed.Message"));
}
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
}
} else {
if (island.isOpen()) {
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Permission.Visit.Open.Message"));
} else {
messageManager.sendMessage(player, languageConfig.getFileConfiguration()
.getString("Command.Island.Kick.Permission.Visit.Closed.Message"));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
} else {
messageManager.sendMessage(player,
languageConfig.getFileConfiguration().getString("Command.Island.Kick.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
}
});
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
sender.sendMessage("SkyBlock | Error: You must be a player to perform that command.");
}
@Override
public String getName() {
return "kick";
}
@Override
public String getInfoMessagePath() {
return "Command.Island.Kick.Info.Message";
}
@Override
public String[] getAliases() {
return new String[0];
}
@Override
public String[] getArguments() {
return new String[0];
}
}

Some files were not shown because too many files have changed in this diff Show More