mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-25 08:51:33 +01:00
Coop message, leaderboard tiny code cleanup, coop saving, version
This commit is contained in:
parent
cd5cdba69b
commit
eb4c4c9d6f
@ -2,7 +2,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
||||
apply plugin: 'java'
|
||||
|
||||
group 'com.songoda.fabledskyblock'
|
||||
version 'Build-77'
|
||||
version 'Build-78'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
|
@ -102,6 +102,12 @@ public class CoopCommand extends SubCommand {
|
||||
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Coop.Added.Message")
|
||||
.replace("%player", targetPlayerName));
|
||||
|
||||
if (targetPlayer != null) {
|
||||
messageManager.sendMessage(targetPlayer, configLoad.getString("Command.Island.Coop.AddedTarget.Message")
|
||||
.replace("%player", player.getName()));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -445,10 +445,12 @@ public class Island {
|
||||
|
||||
public void addCoopPlayer(UUID uuid) {
|
||||
coopPlayers.add(uuid);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, this::save);
|
||||
}
|
||||
|
||||
public void removeCoopPlayer(UUID uuid) {
|
||||
coopPlayers.remove(uuid);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(skyblock, this::save);
|
||||
}
|
||||
|
||||
public boolean isCoopPlayer(UUID uuid) {
|
||||
|
@ -49,9 +49,7 @@ public class LeaderboardManager {
|
||||
boolean enableExemptions = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml"))
|
||||
.getFileConfiguration().getBoolean("Island.Leaderboard.Exemptions.Enable");
|
||||
|
||||
for (int i = 0; i < visitManager.getIslands().size(); i++) {
|
||||
UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i];
|
||||
|
||||
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
||||
if (enableExemptions && economyManager.hasPermission(worldManager.getWorld(IslandWorld.Normal).getName(),
|
||||
Bukkit.getOfflinePlayer(ownerUUID),
|
||||
"fabledskyblock.top.exempt"))
|
||||
@ -93,21 +91,18 @@ public class LeaderboardManager {
|
||||
|
||||
switch (type) {
|
||||
case Level:
|
||||
for (int i = 0; i < visitManager.getIslands().size(); i++) {
|
||||
UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i];
|
||||
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
||||
Visit visit = visitManager.getIslands().get(ownerUUID);
|
||||
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel()));
|
||||
}
|
||||
break;
|
||||
case Bank:
|
||||
for (int i = 0; i < visitManager.getIslands().size(); i++) {
|
||||
UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i];
|
||||
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
||||
Visit visit = visitManager.getIslands().get(ownerUUID);
|
||||
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, (long)visit.getBankBalance()));
|
||||
}
|
||||
case Votes:
|
||||
for (int i = 0; i < visitManager.getIslands().size(); i++) {
|
||||
UUID ownerUUID = (UUID) visitManager.getIslands().keySet().toArray()[i];
|
||||
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
|
||||
Visit visit = visitManager.getIslands().get(ownerUUID);
|
||||
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size()));
|
||||
}
|
||||
@ -150,14 +145,9 @@ public class LeaderboardManager {
|
||||
}
|
||||
|
||||
public Leaderboard getLeaderboardFromPosition(Leaderboard.Type type, int position) {
|
||||
for (Leaderboard leaderboardPlayerList : leaderboardStorage) {
|
||||
if (leaderboardPlayerList.getType() == type) {
|
||||
if (leaderboardPlayerList.getPosition() == position) {
|
||||
return leaderboardPlayerList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Leaderboard leaderboardPlayerList : leaderboardStorage)
|
||||
if (leaderboardPlayerList.getType() == type && leaderboardPlayerList.getPosition() == position)
|
||||
return leaderboardPlayerList;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -198,6 +198,7 @@ public class Interact implements Listener {
|
||||
}
|
||||
|
||||
level.setMaterialAmount(materials.name(), materialAmount + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (block.getType() == Materials.SWEET_BERRY_BUSH.parseMaterial()) {
|
||||
|
@ -325,6 +325,8 @@ Command:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eYou cannot coop yourself because you''re already a Member of the Island.'
|
||||
Added:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou have cooped &d%player&e.'
|
||||
AddedTarget:
|
||||
Message: '&bSkyBlock &8| &aInfo&8: &eYou have been cooped on &d%player''s&e island.'
|
||||
Banned:
|
||||
Message: '&bSkyBlock &8| &cError&8: &eYou cannot coop a banned player.'
|
||||
Permission:
|
||||
|
Loading…
Reference in New Issue
Block a user