Added support for the new number utilities in SongodaCore.

This commit is contained in:
Brianna 2020-09-25 12:13:26 -05:00
parent d6c599c770
commit 6e8183c7bd
28 changed files with 98 additions and 121 deletions

View File

@ -140,7 +140,7 @@
</repository>
<repository>
<id>public</id>
<url>http://repo.songoda.com/artifactory/public/</url>
<url>http://repo.songoda.com/repository/public/</url>
</repository>
</repositories>
<dependencies>
@ -229,7 +229,7 @@
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>2.4.8</version>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -9,7 +9,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -109,7 +109,7 @@ public class SetMaxMembers extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetMaxMembers.Set.Message")
.replace("%player", targetPlayerName)
.replace("%maxMembers", NumberUtil.formatNumberByDecimal(maxMembers)));
.replace("%maxMembers", NumberUtils.formatNumber(maxMembers)));
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {

View File

@ -9,7 +9,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -109,7 +109,7 @@ public class SetSizeCommand extends SubCommand {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.SetSize.Set.Message")
.replace("%player", targetPlayerName)
.replace("%size", NumberUtil.formatNumberByDecimal(size)));
.replace("%size", NumberUtils.formatNumber(size)));
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
}
} else {

View File

@ -13,6 +13,7 @@ import com.songoda.skyblock.menus.Creator;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.structure.Structure;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -16,6 +16,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;

View File

@ -14,6 +14,7 @@ import com.songoda.skyblock.menus.Levelling;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.visit.Visit;
@ -68,7 +69,7 @@ public class LevelCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Level.Level.Message")
.replace("%player", targetPlayerName).replace("%level",
"" + NumberUtil.formatNumberByDecimal(visit.getLevel().getLevel())));
"" + NumberUtils.formatNumber(visit.getLevel().getLevel())));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
return;

View File

@ -17,6 +17,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import net.md_5.bungee.api.ChatColor;

View File

@ -10,7 +10,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -71,7 +71,7 @@ public class UnlockCommand extends SubCommand {
if (!economy.hasBalance(player, price)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Money.Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
"%cost%", NumberUtils.formatNumber(price)));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;
}

View File

@ -8,7 +8,7 @@ import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.levelling.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -41,7 +41,7 @@ public class ValueCommand extends SubCommand {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
.replace("%points", "" + worth).replace("%level", "" + NumberUtil.formatNumberByDecimal(level)));
.replace("%points", "" + worth).replace("%level", "" + NumberUtils.formatNumber(level)));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.None.Message"));

View File

@ -12,7 +12,7 @@ import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
@ -123,7 +123,7 @@ public class GuiBankSelector extends Gui {
case SUCCESS:
soundManager.playSound(event.player, CompatibleSound.ENTITY_EXPERIENCE_ORB_PICKUP.getSound(), 1f, 1f);
messageManager.sendMessage(event.player, Objects.requireNonNull(languageLoad.getString("Command.Island.Bank." + finalAction + ".Message")).replace(
"%amount%", NumberUtil.formatNumberByDecimal(amount)));
"%amount%", NumberUtils.formatNumber(amount)));
break;
}
@ -180,7 +180,7 @@ public class GuiBankSelector extends Gui {
case SUCCESS:
soundManager.playSound(event.player, CompatibleSound.ENTITY_EXPERIENCE_ORB_PICKUP.getSound(), 1f, 1f);
messageManager.sendMessage(e.player, Objects.requireNonNull(languageLoad.getString("Command.Island.Bank." + finalAction + ".Message")).replace(
"%amount%", NumberUtil.formatNumberByDecimal(amount)));
"%amount%", NumberUtils.formatNumber(amount)));
break;
}

View File

@ -18,6 +18,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -15,7 +15,7 @@ import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.world.WorldManager;
@ -957,7 +957,7 @@ public class Island {
messageManager.sendMessage(player,
this.plugin.getLanguage()
.getString("Island.Unlock." + type.name() + ".Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
"%cost%", NumberUtils.formatNumber(price)));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
if(type.equals(IslandWorld.End)){

View File

@ -18,7 +18,7 @@ import com.songoda.skyblock.limit.impl.BlockLimitation;
import com.songoda.skyblock.permission.PermissionManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.version.CompatibleSpawners;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
@ -339,7 +339,7 @@ public class BlockListeners implements Listener {
}
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);

View File

@ -16,7 +16,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager;
@ -113,7 +113,7 @@ public class InteractListeners implements Listener {
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getItem().getType());
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);
@ -195,7 +195,7 @@ public class InteractListeners implements Listener {
if (limits.isBlockLimitExceeded(block, limit)) {
plugin.getMessageManager().sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);

View File

@ -15,6 +15,7 @@ import com.songoda.skyblock.permission.PermissionManager;
import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.SBiome;

View File

@ -12,6 +12,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.structure.Structure;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import org.bukkit.Bukkit;

View File

@ -8,7 +8,7 @@ import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
@ -302,7 +302,7 @@ public class Leaderboard {
new Placeholder("%position", "" + (leaderboard.getPosition() + 1)),
new Placeholder("%owner", playerName),
new Placeholder("%level", "" + visit.getLevel().getLevel()),
new Placeholder("%balance", NumberUtil.formatNumberByDecimal(visit.getBankBalance())),
new Placeholder("%balance", NumberUtils.formatNumber(visit.getBankBalance())),
new Placeholder("%votes", "" + visit.getVoters().size()),
new Placeholder("%members", "" + visit.getMembers())},
null, null),

View File

@ -17,6 +17,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
@ -210,7 +211,7 @@ public class Levelling {
new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 3, 5);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING), configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Statistics.Lore"),
new Placeholder[]{new Placeholder("%level_points", NumberUtil.formatNumberByDecimal(level.getPoints())), new Placeholder("%level", NumberUtil.formatNumberByDecimal(level.getLevel()))}, null, null),
new Placeholder[]{new Placeholder("%level_points", NumberUtils.formatNumber(level.getPoints())), new Placeholder("%level", NumberUtils.formatNumber(level.getLevel()))}, null, null),
4);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -275,11 +276,11 @@ public class Levelling {
long finalMaterialAmountCounted = materialAmountCounted;
List<String> lore = configLoad.getStringList("Menu.Levelling.Item.Material.Lore");
lore.replaceAll(x -> x.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned)).replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount))
.replace("%material", name).replace("%counted", NumberUtil.formatNumberByDecimal(finalMaterialAmountCounted)));
lore.replaceAll(x -> x.replace("%points", NumberUtils.formatNumber(pointsEarned)).replace("%blocks", NumberUtils.formatNumber(materialAmount))
.replace("%material", name).replace("%counted", NumberUtils.formatNumber(finalMaterialAmountCounted)));
nInv.addItem(nInv.createItem(is, configLoad.getString("Menu.Levelling.Item.Material.Displayname").replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned))
.replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name).replace("%counted", NumberUtil.formatNumberByDecimal(finalMaterialAmountCounted))
nInv.addItem(nInv.createItem(is, configLoad.getString("Menu.Levelling.Item.Material.Displayname").replace("%points", NumberUtils.formatNumber(pointsEarned))
.replace("%blocks", NumberUtils.formatNumber(materialAmount)).replace("%material", name).replace("%counted", NumberUtils.formatNumber(finalMaterialAmountCounted))
, lore, null, null, null), inventorySlot);
}

View File

@ -12,6 +12,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.item.SkullUtil;

View File

@ -15,7 +15,7 @@ import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.Bukkit;
@ -532,7 +532,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Speed))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
@ -543,7 +543,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
} else {
nInv.addItem(nInv.createItem(potion,
@ -551,7 +551,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Speed.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
}
}
@ -585,7 +585,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Jump))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
@ -596,7 +596,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
} else {
nInv.addItem(nInv.createItem(potion,
@ -604,7 +604,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Jump.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
}
}
@ -623,7 +623,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Crop))},
null, null), 3);
@ -634,7 +634,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 3);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
@ -642,7 +642,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 3);
}
}
@ -661,7 +661,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Fly))},
null, null), 4);
@ -672,7 +672,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 4);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
@ -680,7 +680,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Fly.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 4);
}
}
@ -699,7 +699,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Drops))},
null, null), 5);
@ -710,7 +710,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 5);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
@ -718,7 +718,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Drops.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 5);
}
}
@ -746,7 +746,7 @@ public class Upgrade {
"" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Members.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%maxMembers", "" + upgrade.getValue())},
null, null), 6);
@ -760,7 +760,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Upgrade.Item.Members.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%maxMembers", "" + upgrade.getValue())},
null, null),
@ -774,7 +774,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Upgrade.Item.Members.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%maxMembers", "" + upgrade.getValue())},
null, null),
@ -808,7 +808,7 @@ public class Upgrade {
"" + tier)),
configLoad.getStringList("Menu.Upgrade.Item.Size.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue())},
null, null), 7);
@ -822,7 +822,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Upgrade.Item.Size.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue())},
null, null),
@ -836,7 +836,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Upgrade.Item.Size.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost())),
NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%tier", "" + tier),
new Placeholder("%size", "" + upgrade.getValue())},
null, null),
@ -861,7 +861,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status",
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner))},
null, null), 8);
@ -872,7 +872,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 8);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
@ -880,7 +880,7 @@ public class Upgrade {
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Unclaimable.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 8);
}
}

View File

@ -15,7 +15,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
@ -347,10 +347,10 @@ public class Visit {
configLoad.getString("Menu.Visit.Item.Statistics.Displayname"),
configLoad.getStringList("Menu.Visit.Item.Statistics.Lore"),
new Placeholder[]{
new Placeholder("%islands_open", NumberUtil.formatNumberByDecimal(visitIslands.size())),
new Placeholder("%islands_open", NumberUtils.formatNumber(visitIslands.size())),
new Placeholder("%islands_closed",
NumberUtil.formatNumberByDecimal(totalIslands - visitIslands.size())),
new Placeholder("%islands", NumberUtil.formatNumberByDecimal(totalIslands))},
NumberUtils.formatNumber(totalIslands - visitIslands.size())),
new Placeholder("%islands", NumberUtils.formatNumber(totalIslands))},
null, null), 4);
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Visit.Item.Sort.Displayname"),

View File

@ -12,6 +12,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;

View File

@ -13,7 +13,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.NMSUtil;
@ -134,7 +134,7 @@ public class Levelling implements Listener {
.replace("%material", material.getMaterials().name())),
configLoad.getStringList("Menu.Admin.Levelling.Item.Material.Lore"),
new Placeholder[]{new Placeholder("%points",
NumberUtil.formatNumberByDecimal(material.getPoints()))},
NumberUtils.formatNumber(material.getPoints()))},
null, null),
inventorySlot);
}
@ -220,7 +220,7 @@ public class Levelling implements Listener {
messageManager.sendMessage(player,
configLoad.getString("Island.Admin.Levelling.Division.Message")
.replace("%division", NumberUtil.formatNumberByDecimal(pointDivision)));
.replace("%division", NumberUtils.formatNumber(pointDivision)));
soundManager.playSound(player, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
@ -322,7 +322,7 @@ public class Levelling implements Listener {
messageManager.sendMessage(player, configLoad
.getString("Island.Admin.Levelling.Points.Message")
.replace("%material", materials.name()).replace("%points",
NumberUtil.formatNumberByDecimal(materialPoints)));
NumberUtils.formatNumber(materialPoints)));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
1.0F);
player.closeInventory();

View File

@ -12,7 +12,7 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.Bukkit;
@ -270,7 +270,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Speed.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Speed.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
@ -288,7 +288,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Jump.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Jump.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
@ -298,7 +298,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Crop.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, null), 2);
@ -308,7 +308,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Fly.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Fly.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, null), 3);
@ -318,7 +318,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Drops.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Drops.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, null), 4);
@ -356,7 +356,7 @@ public class Upgrade {
plugin.formatText(configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Lore"),
new Placeholder[]{
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost())),
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost())),
new Placeholder("%status", getStatus(upgrade))},
null, null), 6);
@ -783,7 +783,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Admin.Upgrade.Size.Item.Tier.Lore"),
new Placeholder[]{new Placeholder("%size", "" + upgrade.getValue()),
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
NumberUtils.formatNumber(upgrade.getCost()))},
null, null), i + 3);
}
}
@ -1210,7 +1210,7 @@ public class Upgrade {
configLoad.getStringList("Menu.Admin.Upgrade.Members.Item.Tier.Lore"),
new Placeholder[]{new Placeholder("%maxMembers", "" + upgrade.getValue()),
new Placeholder("%cost",
NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
NumberUtils.formatNumber(upgrade.getCost()))},
null, null), i + 3);
}
}

View File

@ -10,7 +10,7 @@ import com.songoda.skyblock.leaderboard.Leaderboard;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.levelling.IslandLevelManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
@ -123,7 +123,7 @@ public class PlaceholderProcessor {
} else {
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_island_level_formatted.Non-empty").replace(
"{PLACEHOLDER}", "" + NumberUtil.formatNumberBySuffix(island.getLevel().getLevel())));
"{PLACEHOLDER}", "" + NumberUtils.formatWithSuffix(island.getLevel().getLevel())));
}
break;
case "fabledskyblock_island_points":
@ -318,7 +318,7 @@ public class PlaceholderProcessor {
} else {
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_island_bank_balance.Non-empty"))
.replace("{PLACEHOLDER}", "" + NumberUtil.formatNumberByDecimal(island.getBankBalance()));
.replace("{PLACEHOLDER}", "" + NumberUtils.formatNumber(island.getBankBalance()));
}
break;
case "fabledskyblock_island_bank_balance_formatted":
@ -328,7 +328,7 @@ public class PlaceholderProcessor {
} else {
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_island_bank_balance_formatted.Non-empty"))
.replace("{PLACEHOLDER}", "" + NumberUtil.formatNumberBySuffix((long) island.getBankBalance()));
.replace("{PLACEHOLDER}", "" + NumberUtils.formatWithSuffix((long) island.getBankBalance()));
}
break;
}
@ -362,7 +362,7 @@ public class PlaceholderProcessor {
placeholdersLoad.getString("Placeholders.fabledskyblock_leaderboard_votes.Non-empty")
.replace("{POSITION}", "" + (value))
.replace("{PLAYER}", islandOwnerName)
.replace("{VOTES}", NumberUtil.formatNumberByDecimal(visit.getVoters().size())));
.replace("{VOTES}", NumberUtils.formatNumber(visit.getVoters().size())));
} else {
returnValue = TextUtils.formatText(
@ -396,7 +396,7 @@ public class PlaceholderProcessor {
placeholdersLoad.getString("Placeholders.fabledskyblock_leaderboard_bank.Non-empty")
.replace("{POSITION}", "" + (value))
.replace("{PLAYER}", islandOwnerName)
.replace("{BALANCE}", NumberUtil.formatNumberByDecimal(visit.getBankBalance())));
.replace("{BALANCE}", NumberUtils.formatNumber(visit.getBankBalance())));
} else {
returnValue = TextUtils.formatText(
@ -431,8 +431,8 @@ public class PlaceholderProcessor {
placeholdersLoad.getString("Placeholders.fabledskyblock_leaderboard_level.Non-empty")
.replace("{POSITION}", "" + (value))
.replace("{PLAYER}", islandOwnerName)
.replace("{LEVEL}", NumberUtil.formatNumberByDecimal(level.getLevel()))
.replace("{POINTS}", NumberUtil.formatNumberByDecimal(level.getPoints())));
.replace("{LEVEL}", NumberUtils.formatNumber(level.getLevel()))
.replace("{POINTS}", NumberUtils.formatNumber(level.getPoints())));
} else {
returnValue = TextUtils.formatText(
@ -482,7 +482,7 @@ public class PlaceholderProcessor {
long blockCount = island.getLevel().getMaterialAmount(materials.name());
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_island_level_block_count.Non-empty")
.replace("{PLACEHOLDER}", NumberUtil.formatNumberByDecimal(blockCount)));
.replace("{PLACEHOLDER}", NumberUtils.formatNumber(blockCount)));
}
}
} else if (placeholder.toLowerCase().startsWith("fabledskyblock_island_level_block_points_")) {
@ -499,7 +499,7 @@ public class PlaceholderProcessor {
long blockPoints = island.getLevel().getMaterialPoints(materials.name());
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_island_level_block_points.Non-empty")
.replace("{PLACEHOLDER}", NumberUtil.formatNumberByDecimal(blockPoints)));
.replace("{PLACEHOLDER}", NumberUtils.formatNumber(blockPoints)));
}
}
} else if (placeholder.toLowerCase().startsWith("fabledskyblock_level_block_value_")) {
@ -512,7 +512,7 @@ public class PlaceholderProcessor {
double blockValue = levellingManager.getWorth(materials);
returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_level_block_value.Non-empty")
.replace("{PLACEHOLDER}", NumberUtil.formatNumberByDecimal(blockValue)));
.replace("{PLACEHOLDER}", NumberUtils.formatNumber(blockValue)));
}
} else if (placeholder.toLowerCase().startsWith("fabledskyblock_island_has_upgrade_")) {
Upgrade.Type type;

View File

@ -4,7 +4,7 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -184,6 +184,6 @@ public class Stackable {
private String getCustomName() {
return ChatColor
.translateAlternateColorCodes('&', SkyBlock.getInstance().getLanguage().getString("Hologram.Stackable.Message"))
.replace("%block", SkyBlock.getInstance().getLocalizationManager().getLocalizationFor(CompatibleMaterial.class).getLocale(material)).replace("%amount", NumberUtil.formatNumber(this.size));
.replace("%block", SkyBlock.getInstance().getLocalizationManager().getLocalizationFor(CompatibleMaterial.class).getLocale(material)).replace("%amount", NumberUtils.formatNumber(this.size));
}
}

View File

@ -9,7 +9,7 @@ import com.songoda.skyblock.hologram.HologramType;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.leaderboard.Leaderboard;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.core.utils.NumberUtils;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.visit.Visit;
@ -119,22 +119,22 @@ public class HologramTask extends BukkitRunnable {
languageConfigLoad.getString("Hologram.Leaderboard." + type.name() + ".Claimed")
.replace("%position", "" + (i + 1))
.replace("%player", islandOwnerName)
.replace("%level", NumberUtil.formatNumberByDecimal(level.getLevel()))
.replace("%points", NumberUtil.formatNumberByDecimal(level.getPoints()))));
.replace("%level", NumberUtils.formatNumber(level.getLevel()))
.replace("%points", NumberUtils.formatNumber(level.getPoints()))));
} else if (type == HologramType.Bank) {
hologramLines.add(TextUtils.formatText(
languageConfigLoad.getString("Hologram.Leaderboard." + type.name() + ".Claimed")
.replace("%position", "" + (i + 1))
.replace("%player", islandOwnerName)
.replace("%balance",
"" + NumberUtil.formatNumberByDecimal(visit.getBankBalance()))));
"" + NumberUtils.formatNumber(visit.getBankBalance()))));
} else if (type == HologramType.Votes) {
hologramLines.add(TextUtils.formatText(
languageConfigLoad.getString("Hologram.Leaderboard." + type.name() + ".Claimed")
.replace("%position", "" + (i + 1))
.replace("%player", islandOwnerName)
.replace("%votes",
"" + NumberUtil.formatNumberByDecimal(visit.getVoters().size()))));
"" + NumberUtils.formatNumber(visit.getVoters().size()))));
}
}

View File

@ -1,42 +1,9 @@
package com.songoda.skyblock.utils;
import java.text.DecimalFormat;
import java.util.Date;
public final class NumberUtil {
public static String formatNumber(long number) {
return String.format("%,d", number);
}
public static String formatNumberByDecimal(double number) {
String withoutDecimal = new DecimalFormat("0.#").format(number).replace(",", "."), withDecimal = "";
if (withoutDecimal.contains(".")) {
withDecimal = "." + withoutDecimal.split("\\.")[1];
withoutDecimal = withoutDecimal.replace(withDecimal, "");
}
if (withDecimal.equals(".0")) {
withDecimal = "";
}
long itemCostWithoutDecimalValue = Long.valueOf(withoutDecimal);
return formatNumber(itemCostWithoutDecimalValue) + withDecimal;
}
public static String formatNumberBySuffix(long number) {
if (number < 1000) {
return "" + number;
}
int exp = (int) (Math.log(number) / Math.log(1000));
return String.format("%.1f%c", number / Math.pow(1000, exp), "kMGTPE".charAt(exp - 1));
}
public static long[] getDuration(int time) {
long seconds = time % 60;
long minutes = time % 3600 / 60;