Added SongodaCore.

This commit is contained in:
Brianna 2020-01-26 14:51:40 -05:00
parent 800b7fda08
commit 8bf48379cd
15 changed files with 212 additions and 1327 deletions

106
pom.xml
View File

@ -46,18 +46,46 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.1.0</version>
<executions>
<execution>
<id>shaded</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.songoda:SongodaCore</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.songoda.core</pattern>
<shadedPattern>${project.groupId}.skyblock.core</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
<configuration />
</plugin>
</plugins>
</build>
@ -99,8 +127,26 @@
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<artifactId>spigot</artifactId>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.OmerBenGera</groupId>
<artifactId>WildStackerAPI</artifactId>
<version>b15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>ultimatestacker</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -120,18 +166,6 @@
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>Reserve</artifactId>
<version>0.1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.robin</groupId>
<artifactId>leaderheads</artifactId>
@ -150,52 +184,16 @@
<version>1.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>ultimatestacker</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.OmerBenGera</groupId>
<artifactId>WildStackerAPI</artifactId>
<version>b15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>songodaupdater</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<artifactId>SongodaCore</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -10,33 +10,24 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.15.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.13-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
<orderEntry type="library" name="Maven: be.maximvdw:MVdWPlaceholderAPI:2.1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.tnemc:Reserve:0.1.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.OmerBenGera:WildStackerAPI:b15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:ultimatestacker:1.3.1" level="project" />
<orderEntry type="library" name="Maven: be.maximvdw:MVdWPlaceholderAPI:2.1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.robin:leaderheads:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:epicspawners:6-pre4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:EpicAnchors:1.4.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.songoda:ultimatestacker:1.3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.OmerBenGera:WildStackerAPI:b15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:worldedit:7.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.0-beta9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.0-beta9" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20190722" level="project" />
<orderEntry type="library" name="Maven: com.songoda:songodaupdater:1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: com.songoda:SongodaCore:2.3.4" level="project" />
</component>
</module>

View File

@ -1,15 +1,10 @@
package com.songoda.skyblock;
import java.io.File;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.songoda.core.SongodaCore;
import com.songoda.core.SongodaPlugin;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.biome.BiomeManager;
@ -18,7 +13,6 @@ import com.songoda.skyblock.command.commands.SkyBlockCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.confirmation.ConfirmationTask;
import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.generator.GeneratorManager;
import com.songoda.skyblock.hologram.HologramManager;
import com.songoda.skyblock.invite.InviteManager;
@ -26,27 +20,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.leaderboard.LeaderboardManager;
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.limit.LimitationInstanceHandler;
import com.songoda.skyblock.listeners.Block;
import com.songoda.skyblock.listeners.Bucket;
import com.songoda.skyblock.listeners.Chat;
import com.songoda.skyblock.listeners.Death;
import com.songoda.skyblock.listeners.Entity;
import com.songoda.skyblock.listeners.EpicSpawners;
import com.songoda.skyblock.listeners.Food;
import com.songoda.skyblock.listeners.Grow;
import com.songoda.skyblock.listeners.Interact;
import com.songoda.skyblock.listeners.Inventory;
import com.songoda.skyblock.listeners.Item;
import com.songoda.skyblock.listeners.Join;
import com.songoda.skyblock.listeners.Move;
import com.songoda.skyblock.listeners.Portal;
import com.songoda.skyblock.listeners.Projectile;
import com.songoda.skyblock.listeners.Quit;
import com.songoda.skyblock.listeners.Respawn;
import com.songoda.skyblock.listeners.Spawner;
import com.songoda.skyblock.listeners.Teleport;
import com.songoda.skyblock.listeners.UltimateStacker;
import com.songoda.skyblock.listeners.WildStacker;
import com.songoda.skyblock.listeners.*;
import com.songoda.skyblock.localization.LocalizationManager;
import com.songoda.skyblock.menus.Rollback;
import com.songoda.skyblock.menus.admin.Creator;
@ -62,17 +36,23 @@ import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.structure.StructureManager;
import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.usercache.UserCacheManager;
import com.songoda.skyblock.utils.Metrics;
import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.visit.VisitTask;
import com.songoda.skyblock.world.WorldManager;
import com.songoda.skyblock.world.generator.VoidGenerator;
import com.songoda.update.Plugin;
import com.songoda.update.SongodaUpdate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginManager;
public class SkyBlock extends JavaPlugin {
import java.io.File;
import java.util.List;
private static SkyBlock instance;
public class SkyBlock extends SongodaPlugin {
private static SkyBlock INSTANCE;
private FileManager fileManager;
private WorldManager worldManager;
@ -95,30 +75,31 @@ public class SkyBlock extends JavaPlugin {
private LeaderboardManager leaderboardManager;
private PlaceholderManager placeholderManager;
private MessageManager messageManager;
private EconomyManager economyManager;
private HologramManager hologramManager;
private LimitationInstanceHandler limitationHandler;
private LocalizationManager localizationManager;
public static SkyBlock getInstance() {
return instance;
return INSTANCE;
}
@Override
public void onEnable() {
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(formatText("&a============================="));
console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
console.sendMessage(formatText("&7Action: &aEnabling&7..."));
console.sendMessage(formatText("&a============================="));
public void onPluginLoad() {
INSTANCE = this;
}
instance = this;
@Override
public void onPluginEnable() {
// Run Songoda Updater
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
// Load Economy
EconomyManager.load();
fileManager = new FileManager(this);
localizationManager = new LocalizationManager();
worldManager = new WorldManager(this);
userCacheManager = new UserCacheManager(this);
economyManager = new EconomyManager();
visitManager = new VisitManager(this);
banManager = new BanManager(this);
islandManager = new IslandManager(this);
@ -181,7 +162,8 @@ public class SkyBlock extends JavaPlugin {
if (pluginManager.isPluginEnabled("EpicSpawners")) pluginManager.registerEvents(new EpicSpawners(this), this);
if (pluginManager.isPluginEnabled("WildStacker")) pluginManager.registerEvents(new WildStacker(this), this);
if (pluginManager.isPluginEnabled("UltimateStacker")) pluginManager.registerEvents(new UltimateStacker(this), this);
if (pluginManager.isPluginEnabled("UltimateStacker"))
pluginManager.registerEvents(new UltimateStacker(this), this);
pluginManager.registerEvents(new Rollback(), this);
pluginManager.registerEvents(new Levelling(), this);
@ -190,18 +172,11 @@ public class SkyBlock extends JavaPlugin {
this.getCommand("skyblock").setExecutor(new SkyBlockCommand());
// bStats Metrics
new Metrics(this);
// Songoda Updater
Plugin plugin = new Plugin(this, 17);
SongodaUpdate.load(plugin);
SkyBlockAPI.setImplementation(instance);
SkyBlockAPI.setImplementation(INSTANCE);
}
@Override
public void onDisable() {
public void onPluginDisable() {
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(formatText("&a============================="));
console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
@ -239,6 +214,16 @@ public class SkyBlock extends JavaPlugin {
HandlerList.unregisterAll(this);
}
@Override
public void onConfigReload() {
}
@Override
public List<Config> getExtraConfig() {
return null;
}
private String formatText(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
@ -331,10 +316,6 @@ public class SkyBlock extends JavaPlugin {
return messageManager;
}
public EconomyManager getEconomyManager() {
return economyManager;
}
public HologramManager getHologramManager() {
return hologramManager;
}

View File

@ -1,9 +1,10 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
@ -22,7 +23,6 @@ public class BankCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
MessageManager messageManager = skyblock.getMessageManager();
EconomyManager economyManager = skyblock.getEconomyManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
@ -100,12 +100,12 @@ public class BankCommand extends SubCommand {
return;
}
if (!economyManager.hasBalance(player, amt)) {
if (!EconomyManager.hasBalance(player, amt)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
economyManager.withdraw(player, amt);
EconomyManager.withdrawBalance(player, amt);
island.addToBank(amt);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Deposit.Message").replace(
"%amount%", NumberUtil.formatNumberByDecimal(amt)));
@ -149,7 +149,7 @@ public class BankCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short2.Message"));
return;
}
economyManager.deposit(player, amt);
EconomyManager.deposit(player, amt);
island.removeFromBank(amt);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Withdraw.Message").replace(
"%amount%", NumberUtil.formatNumberByDecimal(amt)));

View File

@ -1,11 +1,12 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.confirmation.Confirmation;
import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
@ -35,7 +36,6 @@ public class ConfirmCommand extends SubCommand {
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
StructureManager structureManager = skyblock.getStructureManager();
MessageManager messageManager = skyblock.getMessageManager();
EconomyManager economyManager = skyblock.getEconomyManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
@ -127,15 +127,15 @@ public class ConfirmCommand extends SubCommand {
return;
}
if (economyManager.isEconomy() && island.getStructure() != null
if (EconomyManager.isEnabled() && island.getStructure() != null
&& !island.getStructure().isEmpty()
&& structureManager.containsStructure(island.getStructure())) {
Structure structure = structureManager.getStructure(island.getStructure());
double deletionCost = structure.getDeletionCost();
if (deletionCost != 0.0D) {
if (economyManager.hasBalance(player, deletionCost)) {
economyManager.withdraw(player, deletionCost);
if (EconomyManager.hasBalance(player, deletionCost)) {
EconomyManager.withdrawBalance(player, deletionCost);
} else {
messageManager.sendMessage(player,
configLoad.getString(

View File

@ -1,9 +1,10 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
@ -23,7 +24,6 @@ public class UnlockCommand extends SubCommand {
@Override
public void onCommandByPlayer(Player player, String[] args) {
MessageManager messageManager = skyblock.getMessageManager();
EconomyManager economyManager = skyblock.getEconomyManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
@ -69,7 +69,7 @@ public class UnlockCommand extends SubCommand {
double price = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getDouble("Island.World." + islandWorld.name() + ".UnlockPrice");
if (!economyManager.hasBalance(player, price)) {
if (!EconomyManager.hasBalance(player, price)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Money.Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
@ -77,7 +77,7 @@ public class UnlockCommand extends SubCommand {
}
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, price);
EconomyManager.withdrawBalance(player, price);
islandManager.unlockIslandWorld(island, islandWorld);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.menus.Upgrade;
@ -27,7 +28,7 @@ public class UpgradeCommand extends SubCommand {
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
if (!skyblock.getEconomyManager().isEconomy()) {
if (!EconomyManager.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;

View File

@ -1,90 +0,0 @@
package com.songoda.skyblock.economy;
import java.math.BigDecimal;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.songoda.skyblock.api.event.player.PlayerWithdrawMoneyEvent;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import net.tnemc.core.Reserve;
import net.tnemc.core.economy.EconomyAPI;
public class EconomyManager {
// Vault
private Economy vaultEconomy = null;
private Permission vaultPermission = null;
// Reserve
private EconomyAPI reserveEconomy = null;
// private PermissionsAPI reservePermission = null;
public EconomyManager() {
setup();
}
public void setup() {
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
RegisteredServiceProvider<Economy> economyRsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (economyRsp != null) this.vaultEconomy = economyRsp.getProvider();
RegisteredServiceProvider<Permission> permissionRsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
if (permissionRsp != null) this.vaultPermission = permissionRsp.getProvider();
} else if (Bukkit.getServer().getPluginManager().getPlugin("Reserve") != null) {
if (Reserve.instance().economyProvided()) this.reserveEconomy = Reserve.instance().economy();
// if (Reserve.instance().permissionsProvided())
// this.reservePermission = Reserve.instance().permissions();
}
}
public double getBalance(Player player) {
if (this.vaultEconomy != null) return this.vaultEconomy.getBalance(player);
if (this.reserveEconomy != null) return this.reserveEconomy.getHoldings(player.getUniqueId()).doubleValue();
return 0;
}
public boolean hasBalance(Player player, double money) {
return this.getBalance(player) >= money;
}
public void withdraw(Player player, double money) {
if (this.vaultEconomy != null) this.vaultEconomy.withdrawPlayer(player, money);
else if (this.reserveEconomy != null) this.reserveEconomy.removeHoldings(player.getUniqueId(), new BigDecimal(money));
Bukkit.getServer().getPluginManager().callEvent(new PlayerWithdrawMoneyEvent(player, money));
}
public void deposit(Player player, double money) {
if (this.vaultEconomy != null) this.vaultEconomy.depositPlayer(player, money);
else if (this.reserveEconomy != null) this.reserveEconomy.addHoldings(player.getUniqueId(), new BigDecimal(money));
Bukkit.getServer().getPluginManager().callEvent(new PlayerWithdrawMoneyEvent(player, money));
}
public boolean hasPermission(String world, OfflinePlayer offlinePlayer, String perm) {
if (this.vaultPermission != null) return this.vaultPermission.playerHas(world, offlinePlayer, perm);
// if (this.reservePermission != null) {
// // TODO
// }
return false;
}
public boolean isEconomy() {
return this.vaultEconomy != null || this.reserveEconomy != null;
}
public boolean isPermission() {
return this.vaultPermission != null/* || this.reservePermission != null */;
}
}

View File

@ -1,17 +1,16 @@
package com.songoda.skyblock.leaderboard;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.leaderboard.leaderheads.TopBank;
import com.songoda.skyblock.leaderboard.leaderheads.TopLevel;
import com.songoda.skyblock.leaderboard.leaderheads.TopVotes;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.ArrayList;
@ -36,7 +35,6 @@ public class LeaderboardManager {
}
public void resetLeaderboard() {
EconomyManager economyManager = skyblock.getEconomyManager();
VisitManager visitManager = skyblock.getVisitManager();
WorldManager worldManager = skyblock.getWorldManager();
@ -52,7 +50,7 @@ public class LeaderboardManager {
.getBoolean("Island.Leaderboard.Exemptions.Enable");
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
if (enableExemptions && economyManager.hasPermission(worldManager.getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(ownerUUID), "fabledskyblock.top.exempt"))
if (enableExemptions && VaultPermissions.hasPermission(worldManager.getWorld(IslandWorld.Normal).getName(), Bukkit.getOfflinePlayer(ownerUUID), "fabledskyblock.top.exempt"))
continue;
Visit visit = visitManager.getIslands().get(ownerUUID);
@ -90,23 +88,23 @@ public class LeaderboardManager {
List<LeaderboardPlayer> leaderboardPlayers = new ArrayList<>(visitManager.getIslands().size());
switch (type) {
case Level:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel()));
}
break;
case Bank:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, (long) visit.getBankBalance()));
}
case Votes:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size()));
}
break;
case Level:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel()));
}
break;
case Bank:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, (long) visit.getBankBalance()));
}
case Votes:
for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size()));
}
break;
}
leaderboardPlayers.sort(Comparator.comparingLong(LeaderboardPlayer::getValue).reversed());

View File

@ -1,10 +1,11 @@
package com.songoda.skyblock.menus;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandUpgradeEvent;
import com.songoda.skyblock.api.utils.APIUtil;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
@ -51,7 +52,6 @@ public class Upgrade {
SkyBlock skyblock = SkyBlock.getInstance();
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
EconomyManager economyManager = skyblock.getEconomyManager();
MessageManager messageManager = skyblock.getMessageManager();
UpgradeManager upgradeManager = skyblock.getUpgradeManager();
IslandManager islandManager = skyblock.getIslandManager();
@ -61,7 +61,7 @@ public class Upgrade {
FileConfiguration configLoad = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration();
if (!economyManager.isEconomy()) {
if (!EconomyManager.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
@ -72,7 +72,7 @@ public class Upgrade {
Island island = islandManager.getIsland(player);
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
if (!economyManager.isEconomy()) {
if (!EconomyManager.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
@ -118,13 +118,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player,
com.songoda.skyblock.upgrade.Upgrade.Type.Speed, true);
@ -173,13 +173,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Jump,
true);
@ -223,13 +223,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Crop,
true);
@ -274,13 +274,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Fly,
true);
@ -326,13 +326,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Drops,
true);
@ -370,14 +370,14 @@ public class Upgrade {
.replace("%tier", "" + tier)))) {
if (upgrade.getValue() > island.getSize()
&& upgrade.getValue() != island.getSize()) {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message").replace(
"%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F,
1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setSize(upgrade.getValue());
islandManager.updateBorder(island);
@ -431,13 +431,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
economyManager.withdraw(player, upgrade.getCost());
EconomyManager.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner,
true);
@ -499,7 +499,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Speed))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
@ -550,7 +550,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Jump))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
@ -586,7 +586,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Crop))},
null, null), 3);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
@ -622,7 +622,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Fly))},
null, null), 4);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
@ -658,7 +658,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Drops))},
null, null), 5);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
@ -703,7 +703,7 @@ public class Upgrade {
new Placeholder("%size", "" + upgrade.getValue())},
null, null), 7);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(
nInv.createItem(new ItemStack(Material.BEACON),
ChatColor.translateAlternateColorCodes('&',
@ -754,7 +754,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner))},
null, null), 8);
} else {
if (economyManager.hasBalance(player, upgrade.getCost())) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),

View File

@ -63,11 +63,11 @@ public class PlayerDataManager {
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile");
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
Property property = gameProfile.getProperties().get("textures").iterator().next();
playerTexture = new String[] { property.getSignature(), property.getValue() };
playerTexture = new String[]{property.getSignature(), property.getValue()};
} catch (Exception e) {
playerTexture = new String[] {
playerTexture = new String[]{
"K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=",
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19" };
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"};
}
configLoad.set("Texture.Signature", playerTexture[0]);
@ -154,7 +154,8 @@ public class PlayerDataManager {
if (banManager.hasIsland(island.getOwnerUUID()) && fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& banManager.getIsland(island.getOwnerUUID()).isBanned(player.getUniqueId())) {
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player", targetPlayerName));
if (messageManager != null)
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player", targetPlayerName));
} else {
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) {
PlayerData playerData = getPlayerData(player);
@ -215,7 +216,8 @@ public class PlayerDataManager {
return;
} else {
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
if (messageManager != null)
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
}
}
@ -242,7 +244,8 @@ public class PlayerDataManager {
if (banManager.hasIsland(visitIslandList) && fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& banManager.getIsland(visitIslandList).isBanned(player.getUniqueId())) {
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player", targetPlayerName));
if (messageManager != null)
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Banned.Island.Message").replace("%player", targetPlayerName));
} else {
org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(visitIslandList);
@ -274,7 +277,8 @@ public class PlayerDataManager {
return;
} else {
islandManager.unloadIsland(island, Bukkit.getServer().getOfflinePlayer(visitIslandList));
if (messageManager != null) messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
if (messageManager != null)
messageManager.sendMessage(player, configLoad.getString("Island.Visit.Closed.Island.Message").replace("%player", targetPlayerName));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,17 @@ public final class StringUtil {
return stringBuilder.toString();
}
public static String capitalizeWord(String str){
String words[]=str.split("\\s");
String capitalizeWord="";
for(String w:words){
String first=w.substring(0,1);
String afterfirst=w.substring(1);
capitalizeWord+=first.toUpperCase()+afterfirst+" ";
}
return capitalizeWord.trim();
}
public static String color(String input) {
return input == null ? null : ChatColor.translateAlternateColorCodes('&', input);
}

View File

@ -0,0 +1,24 @@
package com.songoda.skyblock.utils;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.RegisteredServiceProvider;
public class VaultPermissions {
// Vault
private static Permission vaultPermission = null;
static {
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
RegisteredServiceProvider<Permission> permissionRsp = Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
if (permissionRsp != null) vaultPermission = permissionRsp.getProvider();
}
}
public static boolean hasPermission(String world, OfflinePlayer offlinePlayer, String perm) {
if (vaultPermission != null) return vaultPermission.playerHas(world, offlinePlayer, perm);
return false;
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.utils.version;
import org.apache.commons.lang3.text.WordUtils;
import com.songoda.skyblock.utils.StringUtil;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.inventory.ItemStack;
@ -96,7 +96,7 @@ public enum SBiome {
public String getFormattedBiomeName() {
if (!this.isAvailable())
return null;
return WordUtils.capitalizeFully(this.getBiome().name().replaceAll("_", " "));
return StringUtil.capitalizeWord(this.getBiome().name().replaceAll("_", " "));
}
/**