Merge branch 'development'

This commit is contained in:
Brianna 2020-03-22 07:00:45 -04:00
commit 3394ff613f
25 changed files with 892 additions and 1733 deletions

View File

@ -1,21 +0,0 @@
stages:
- build
variables:
name: "FabledSkyblock"
path: "/builds/$CI_PROJECT_PATH"
version: "2.1.1"
build:
stage: build
image: maven:3.5.3-jdk-8
script:
- find $path/ -type f -name "*.xml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
- find $path/ -type f -name "*.yml" -print0 | xargs -0 sed -i -e s/maven-version-number/$version/g
- mvn clean package
- find $path/ -depth -path '*original*' -delete
- mv $path/target/*.jar $path/
artifacts:
name: $name-$version
paths:
- "$path/*.jar"

View File

@ -3,8 +3,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId> <artifactId>skyblock</artifactId>
<version>maven-version-number</version> <version>2.1.1</version>
<build> <build>
<defaultGoal>clean install</defaultGoal>
<resources> <resources>
<resource> <resource>
<filtering>true</filtering> <filtering>true</filtering>
@ -13,6 +14,28 @@
</resources> </resources>
<finalName>FabledSkyblock-${project.version}</finalName> <finalName>FabledSkyblock-${project.version}</finalName>
<plugins> <plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>

131
pom.xml
View File

@ -5,8 +5,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId> <artifactId>skyblock</artifactId>
<version>maven-version-number</version> <version>2.1.2</version>
<build> <build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName> <finalName>FabledSkyblock-${project.version}</finalName>
<resources> <resources>
<resource> <resource>
@ -15,6 +16,28 @@
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>
@ -23,18 +46,46 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version> <version>3.1.0</version>
<executions> <executions>
<execution> <execution>
<id>shaded</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </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> </execution>
</executions> </executions>
<configuration />
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@ -76,8 +127,26 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version> <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> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -97,18 +166,6 @@
<version>2.9.2</version> <version>2.9.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </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> <dependency>
<groupId>me.robin</groupId> <groupId>me.robin</groupId>
<artifactId>leaderheads</artifactId> <artifactId>leaderheads</artifactId>
@ -127,52 +184,16 @@
<version>1.4.2</version> <version>1.4.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </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> <dependency>
<groupId>com.sk89q</groupId> <groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId> <artifactId>worldedit</artifactId>
<version>7.0.0</version> <version>7.0.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </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> <dependency>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>songodaupdater</artifactId> <artifactId>SongodaCore</artifactId>
<version>1</version> <version>LATEST</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>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

33
skyblock.iml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<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: 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.sk89q:worldedit:7.0.0" 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; package com.songoda.skyblock;
import java.io.File; import com.songoda.core.SongodaCore;
import com.songoda.core.SongodaPlugin;
import org.bukkit.Bukkit; import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.ChatColor; import com.songoda.core.configuration.Config;
import org.bukkit.command.ConsoleCommandSender; import com.songoda.core.hooks.EconomyManager;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.songoda.skyblock.api.SkyBlockAPI; import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.ban.BanManager; import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.biome.BiomeManager; 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.config.FileManager;
import com.songoda.skyblock.confirmation.ConfirmationTask; import com.songoda.skyblock.confirmation.ConfirmationTask;
import com.songoda.skyblock.cooldown.CooldownManager; import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.generator.GeneratorManager; import com.songoda.skyblock.generator.GeneratorManager;
import com.songoda.skyblock.hologram.HologramManager; import com.songoda.skyblock.hologram.HologramManager;
import com.songoda.skyblock.invite.InviteManager; 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.leaderboard.LeaderboardManager;
import com.songoda.skyblock.levelling.rework.IslandLevelManager; import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.limit.LimitationInstanceHandler; import com.songoda.skyblock.limit.LimitationInstanceHandler;
import com.songoda.skyblock.listeners.Block; import com.songoda.skyblock.listeners.*;
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.localization.LocalizationManager; import com.songoda.skyblock.localization.LocalizationManager;
import com.songoda.skyblock.menus.Rollback; import com.songoda.skyblock.menus.Rollback;
import com.songoda.skyblock.menus.admin.Creator; 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.structure.StructureManager;
import com.songoda.skyblock.upgrade.UpgradeManager; import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.usercache.UserCacheManager; import com.songoda.skyblock.usercache.UserCacheManager;
import com.songoda.skyblock.utils.Metrics;
import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.visit.VisitTask; import com.songoda.skyblock.visit.VisitTask;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import com.songoda.skyblock.world.generator.VoidGenerator; import com.songoda.skyblock.world.generator.VoidGenerator;
import com.songoda.update.Plugin; import org.bukkit.Bukkit;
import com.songoda.update.SongodaUpdate; 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 FileManager fileManager;
private WorldManager worldManager; private WorldManager worldManager;
@ -95,30 +75,31 @@ public class SkyBlock extends JavaPlugin {
private LeaderboardManager leaderboardManager; private LeaderboardManager leaderboardManager;
private PlaceholderManager placeholderManager; private PlaceholderManager placeholderManager;
private MessageManager messageManager; private MessageManager messageManager;
private EconomyManager economyManager;
private HologramManager hologramManager; private HologramManager hologramManager;
private LimitationInstanceHandler limitationHandler; private LimitationInstanceHandler limitationHandler;
private LocalizationManager localizationManager; private LocalizationManager localizationManager;
public static SkyBlock getInstance() { public static SkyBlock getInstance() {
return instance; return INSTANCE;
} }
@Override @Override
public void onEnable() { public void onPluginLoad() {
ConsoleCommandSender console = Bukkit.getConsoleSender(); INSTANCE = this;
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============================="));
instance = this; @Override
public void onPluginEnable() {
// Run Songoda Updater
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
// Load Economy
EconomyManager.load();
fileManager = new FileManager(this); fileManager = new FileManager(this);
localizationManager = new LocalizationManager(); localizationManager = new LocalizationManager();
worldManager = new WorldManager(this); worldManager = new WorldManager(this);
userCacheManager = new UserCacheManager(this); userCacheManager = new UserCacheManager(this);
economyManager = new EconomyManager();
visitManager = new VisitManager(this); visitManager = new VisitManager(this);
banManager = new BanManager(this); banManager = new BanManager(this);
islandManager = new IslandManager(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("EpicSpawners")) pluginManager.registerEvents(new EpicSpawners(this), this);
if (pluginManager.isPluginEnabled("WildStacker")) pluginManager.registerEvents(new WildStacker(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 Rollback(), this);
pluginManager.registerEvents(new Levelling(), this); pluginManager.registerEvents(new Levelling(), this);
@ -190,18 +172,11 @@ public class SkyBlock extends JavaPlugin {
this.getCommand("skyblock").setExecutor(new SkyBlockCommand()); this.getCommand("skyblock").setExecutor(new SkyBlockCommand());
// bStats Metrics SkyBlockAPI.setImplementation(INSTANCE);
new Metrics(this);
// Songoda Updater
Plugin plugin = new Plugin(this, 17);
SongodaUpdate.load(plugin);
SkyBlockAPI.setImplementation(instance);
} }
@Override @Override
public void onDisable() { public void onPluginDisable() {
ConsoleCommandSender console = Bukkit.getConsoleSender(); ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(formatText("&a=============================")); console.sendMessage(formatText("&a============================="));
console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!")); console.sendMessage(formatText("&7FabledSkyBlock " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
@ -239,6 +214,16 @@ public class SkyBlock extends JavaPlugin {
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
} }
@Override
public void onConfigReload() {
}
@Override
public List<Config> getExtraConfig() {
return null;
}
private String formatText(String string) { private String formatText(String string) {
return ChatColor.translateAlternateColorCodes('&', string); return ChatColor.translateAlternateColorCodes('&', string);
} }
@ -331,10 +316,6 @@ public class SkyBlock extends JavaPlugin {
return messageManager; return messageManager;
} }
public EconomyManager getEconomyManager() {
return economyManager;
}
public HologramManager getHologramManager() { public HologramManager getHologramManager() {
return hologramManager; return hologramManager;
} }

View File

@ -1,14 +1,21 @@
package com.songoda.skyblock.command.commands.admin; package com.songoda.skyblock.command.commands.admin;
import com.google.gson.Gson;
import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager; import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData; import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent; import com.songoda.skyblock.utils.ChatComponent;
import com.songoda.skyblock.utils.Compression;
import com.songoda.skyblock.utils.structure.Storage;
import com.songoda.skyblock.utils.structure.Structure;
import com.songoda.skyblock.utils.structure.StructureUtil; import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.Sounds; import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.utils.world.LocationUtil;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
@ -19,7 +26,6 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.io.File;
import java.util.logging.Level; import java.util.logging.Level;
public class StructureCommand extends SubCommand { public class StructureCommand extends SubCommand {
@ -82,6 +88,22 @@ public class StructureCommand extends SubCommand {
ChatColor.translateAlternateColorCodes('&', configLoad.getString( ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Command.Island.Admin.Structure.Save.Info.Message"))) "Command.Island.Admin.Structure.Save.Info.Message")))
.create())).getTextComponent()); .create())).getTextComponent());
player.spigot()
.sendMessage(
new ChatComponent(
prefix.replace("%info",
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Command.Island.Admin.Structure.Convert.Info.Message")))
+ "/island admin structure convert"
+ suffix.replace("%info", ChatColor.translateAlternateColorCodes(
'&',
configLoad.getString(
"Command.Island.Admin.Structure.Save.Convert.Message"))),
false, null, null,
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Command.Island.Admin.Structure.Convert.Info.Message")))
.create())).getTextComponent());
} else { } else {
messageManager.sendMessage(player, helpLines); messageManager.sendMessage(player, helpLines);
} }
@ -176,6 +198,49 @@ public class StructureCommand extends SubCommand {
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} }
} else if (args[0].equalsIgnoreCase("convert")) {
if (args.length == 2) {
File structureFile = new File(new File(skyblock.getDataFolder().toString() + "/structures"), args[1]);
if (!structureFile.exists()) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Invalid.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
byte[] content = new byte[(int) structureFile.length()];
try {
FileInputStream fileInputStream = new FileInputStream(structureFile);
fileInputStream.read(content);
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(structureFile, false);
fileOutputStream.write(Base64.getEncoder().encode(Compression.decompress(content).getBytes()));
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException e) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Converted.Failed.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
e.printStackTrace();
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Converted.Successful.Message")
.replace("%name", args[1]));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Structure.Convert.Invalid.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
}
return; return;
} }
@ -206,6 +271,7 @@ public class StructureCommand extends SubCommand {
@Override @Override
public String[] getArguments() { public String[] getArguments() {
return new String[]{"tool", "save"}; return new String[]{"tool", "save", "convert"};
} }
} }

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island; package com.songoda.skyblock.command.commands.island;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.menus.Upgrade; import com.songoda.skyblock.menus.Upgrade;
@ -27,7 +28,7 @@ public class UpgradeCommand extends SubCommand {
configLoad.getString("Command.Island.Upgrade.Owner.Message")); configLoad.getString("Command.Island.Upgrade.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else { } else {
if (!skyblock.getEconomyManager().isEconomy()) { if (!EconomyManager.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F); soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return; 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,38 +1,8 @@
package com.songoda.skyblock.island; package com.songoda.skyblock.island;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.ChunkSnapshot;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.IllegalPluginAccessException;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandCreateEvent; import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.api.event.island.IslandDeleteEvent;
import com.songoda.skyblock.api.event.island.IslandLoadEvent;
import com.songoda.skyblock.api.event.island.IslandOwnershipTransferEvent;
import com.songoda.skyblock.api.event.island.IslandUnloadEvent;
import com.songoda.skyblock.ban.BanManager; import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config; import com.songoda.skyblock.config.FileManager.Config;
@ -64,6 +34,18 @@ import com.songoda.skyblock.utils.world.WorldBorder;
import com.songoda.skyblock.utils.world.block.BlockDegreesType; import com.songoda.skyblock.utils.world.block.BlockDegreesType;
import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.IllegalPluginAccessException;
public class IslandManager { public class IslandManager {
@ -203,25 +185,24 @@ public class IslandManager {
if (!banManager.hasIsland(island.getOwnerUUID())) banManager.createIsland(island.getOwnerUUID()); if (!banManager.hasIsland(island.getOwnerUUID())) banManager.createIsland(island.getOwnerUUID());
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> { Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")); if (PlayerUtil.getNumberFromPermission(player, "fabledskyblock.size", false, 0) > 0 || player.hasPermission("fabledskyblock.*")) {
FileConfiguration configLoad = config.getFileConfiguration(); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
int minimumSize = configLoad.getInt("Island.Size.Minimum"); int minimumSize = configLoad.getInt("Island.Size.Minimum");
int maximumSize = configLoad.getInt("Island.Size.Maximum"); int maximumSize = configLoad.getInt("Island.Size.Maximum");
if (minimumSize < 0 || minimumSize > 1000) { if (minimumSize < 0 || minimumSize > 1000) {
minimumSize = 50; minimumSize = 50;
} }
if (maximumSize < 0 || maximumSize > 1000) { if (maximumSize < 0 || maximumSize > 1000) {
maximumSize = 100; maximumSize = 100;
} }
for (int i = maximumSize; i > minimumSize; i--) { for (int i = maximumSize; i > minimumSize; i--) {
if (player.hasPermission("fabledskyblock.size." + i) || player.hasPermission("fabledskyblock.*")) {
island.setSize(i); island.setSize(i);
break;
} }
} }
}); });

View File

@ -1,22 +1,19 @@
package com.songoda.skyblock.leaderboard; package com.songoda.skyblock.leaderboard;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.island.IslandWorld; import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.leaderboard.leaderheads.TopBank; import com.songoda.skyblock.leaderboard.leaderheads.TopBank;
import com.songoda.skyblock.leaderboard.leaderheads.TopLevel; import com.songoda.skyblock.leaderboard.leaderheads.TopLevel;
import com.songoda.skyblock.leaderboard.leaderheads.TopVotes; import com.songoda.skyblock.leaderboard.leaderheads.TopVotes;
import com.songoda.skyblock.utils.VaultPermissions;
import com.songoda.skyblock.visit.Visit; import com.songoda.skyblock.visit.Visit;
import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.world.WorldManager; import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.OfflinePlayer;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
public class LeaderboardManager { public class LeaderboardManager {
@ -35,7 +32,6 @@ public class LeaderboardManager {
} }
public void resetLeaderboard() { public void resetLeaderboard() {
EconomyManager economyManager = skyblock.getEconomyManager();
VisitManager visitManager = skyblock.getVisitManager(); VisitManager visitManager = skyblock.getVisitManager();
WorldManager worldManager = skyblock.getWorldManager(); WorldManager worldManager = skyblock.getWorldManager();
@ -50,8 +46,8 @@ public class LeaderboardManager {
boolean enableExemptions = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration() boolean enableExemptions = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Leaderboard.Exemptions.Enable"); .getBoolean("Island.Leaderboard.Exemptions.Enable");
for (UUID ownerUUID : visitManager.getIslands().keySet()) { for (UUID ownerUUID : new LinkedHashSet<>(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; continue;
Visit visit = visitManager.getIslands().get(ownerUUID); Visit visit = visitManager.getIslands().get(ownerUUID);
@ -82,36 +78,36 @@ public class LeaderboardManager {
} }
} }
public int getPlayerIslandLeaderboardPosition(Player player, Leaderboard.Type type) { public int getPlayerIslandLeaderboardPosition(OfflinePlayer offlinePlayer, Leaderboard.Type type) {
VisitManager visitManager = skyblock.getVisitManager(); VisitManager visitManager = skyblock.getVisitManager();
visitManager.loadIslands(); visitManager.loadIslands();
List<LeaderboardPlayer> leaderboardPlayers = new ArrayList<>(visitManager.getIslands().size()); List<LeaderboardPlayer> leaderboardPlayers = new ArrayList<>(visitManager.getIslands().size());
switch (type) { switch (type) {
case Level: case Level:
for (UUID ownerUUID : visitManager.getIslands().keySet()) { for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID); Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel())); leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getLevel().getLevel()));
} }
break; break;
case Bank: case Bank:
for (UUID ownerUUID : visitManager.getIslands().keySet()) { for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID); Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, (long) visit.getBankBalance())); leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, (long) visit.getBankBalance()));
} }
case Votes: case Votes:
for (UUID ownerUUID : visitManager.getIslands().keySet()) { for (UUID ownerUUID : visitManager.getIslands().keySet()) {
Visit visit = visitManager.getIslands().get(ownerUUID); Visit visit = visitManager.getIslands().get(ownerUUID);
leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size())); leaderboardPlayers.add(new LeaderboardPlayer(ownerUUID, visit.getVoters().size()));
} }
break; break;
} }
leaderboardPlayers.sort(Comparator.comparingLong(LeaderboardPlayer::getValue).reversed()); leaderboardPlayers.sort(Comparator.comparingLong(LeaderboardPlayer::getValue).reversed());
for (int i = 0; i < leaderboardPlayers.size(); i++) { for (int i = 0; i < leaderboardPlayers.size(); i++) {
if (leaderboardPlayers.get(i).getUUID().equals(player.getUniqueId())) { if (leaderboardPlayers.get(i).getUUID().equals(offlinePlayer.getUniqueId())) {
return i + 1; return i + 1;
} }
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -63,11 +63,11 @@ public class PlayerDataManager {
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile"); Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile");
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer); GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
Property property = gameProfile.getProperties().get("textures").iterator().next(); 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) { } 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=", "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]); 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") 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())) { && 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 { } else {
if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) { if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) {
PlayerData playerData = getPlayerData(player); PlayerData playerData = getPlayerData(player);
@ -215,7 +216,8 @@ public class PlayerDataManager {
return; return;
} else { } 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") if (banManager.hasIsland(visitIslandList) && fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Visitor.Banning")
&& banManager.getIsland(visitIslandList).isBanned(player.getUniqueId())) { && 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 { } else {
org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(visitIslandList); org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(visitIslandList);
@ -274,7 +277,8 @@ public class PlayerDataManager {
return; return;
} else { } else {
islandManager.unloadIsland(island, Bukkit.getServer().getOfflinePlayer(visitIslandList)); 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));
} }
} }
} }

View File

@ -27,6 +27,7 @@ public class Stackable {
private Materials material; private Materials material;
private int size = 2; private int size = 2;
private ArmorStand display; private ArmorStand display;
private int maxSize;
public Stackable(Location location, Materials material) { public Stackable(Location location, Materials material) {
this.uuid = UUID.randomUUID(); this.uuid = UUID.randomUUID();
@ -37,6 +38,16 @@ public class Stackable {
this.save(); this.save();
} }
public Stackable(Location location, Materials material, int maxSize) {
this.uuid = UUID.randomUUID();
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.material = material;
this.maxSize = maxSize;
this.updateDisplay();
SkyBlock.getInstance().getSoundManager().playSound(location, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
this.save();
}
public Stackable(UUID uuid, Location location, Materials material, int size) { public Stackable(UUID uuid, Location location, Materials material, int size) {
this.uuid = uuid; this.uuid = uuid;
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ()); this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
@ -76,6 +87,14 @@ public class Stackable {
this.save(); this.save();
} }
public int getMaxSize() {
return maxSize;
}
public void setMaxSize(int maxSize) {
this.maxSize = maxSize;
}
public void addOne() { public void addOne() {
this.size++; this.size++;
this.updateDisplay(); this.updateDisplay();
@ -90,6 +109,10 @@ public class Stackable {
this.save(); this.save();
} }
public boolean isMaxSize(){
return size > maxSize;
}
private void updateDisplay() { private void updateDisplay() {
// The chunk needs to be loaded otherwise the getNearbyEntities() in // The chunk needs to be loaded otherwise the getNearbyEntities() in
// removeDisplay() won't find anything // removeDisplay() won't find anything

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,17 @@ public final class StringUtil {
return stringBuilder.toString(); 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) { public static String color(String input) {
return input == null ? null : ChatColor.translateAlternateColorCodes('&', 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

@ -6,6 +6,7 @@ import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.utils.Compression;
import com.songoda.skyblock.utils.version.NMSUtil; import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.utils.world.block.BlockData; import com.songoda.skyblock.utils.world.block.BlockData;
@ -14,6 +15,8 @@ import com.songoda.skyblock.utils.world.block.BlockUtil;
import com.songoda.skyblock.utils.world.entity.EntityData; import com.songoda.skyblock.utils.world.entity.EntityData;
import com.songoda.skyblock.utils.world.entity.EntityUtil; import com.songoda.skyblock.utils.world.entity.EntityUtil;
import java.io.FileInputStream;
import java.util.Base64;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -29,7 +32,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -103,24 +105,37 @@ public final class StructureUtil {
} }
public static Structure loadStructure(File configFile) throws IOException { public static Structure loadStructure(File configFile) throws IOException {
String base64 = getBase64String(configFile);
if (base64 == null) {
base64 = getBase64String(new File(SkyBlock.getInstance().getDataFolder() + "/" + "structures", "default.structure"));
SkyBlock.getInstance().getLogger().log(Level.SEVERE, "Unable to load structure '" + configFile.getAbsolutePath() + "' using default instead.");
}
if (base64 == null) {
throw new IllegalArgumentException("Couldn't load the default structure file.");
}
byte[] content = new byte[(int) configFile.length()];
FileInputStream fileInputStream = new FileInputStream(configFile);
fileInputStream.read(content);
fileInputStream.close();
Storage storage; Storage storage;
try { if (!org.bukkit.craftbukkit.libs.org.apache.commons.codec.binary.Base64.isBase64(content)) {
storage = new Gson().fromJson(new String(Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8))), Storage.class); try {
} catch (JsonSyntaxException e) { storage = new Gson().fromJson(Compression.decompress(content), Storage.class);
e.printStackTrace(); } catch (JsonSyntaxException e) {
return null; e.printStackTrace();
return null;
}
} else {
String base64 = getBase64String(configFile);
if (base64 == null) {
base64 = getBase64String(new File(SkyBlock.getInstance().getDataFolder() + "/" + "structures", "default.structure"));
SkyBlock.getInstance().getLogger().log(Level.SEVERE, "Unable to load structure '" + configFile.getAbsolutePath() + "' using default instead.");
}
if (base64 == null) {
throw new IllegalArgumentException("Couldn't load the default structure file.");
}
try {
storage = new Gson().fromJson(new String(Base64.getDecoder().decode(base64.getBytes(StandardCharsets.UTF_8))), Storage.class);
} catch (JsonSyntaxException e) {
e.printStackTrace();
return null;
}
} }
return new Structure(storage, configFile.getName()); return new Structure(storage, configFile.getName());

View File

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

View File

@ -291,3 +291,5 @@ Island:
Enable: true Enable: true
# fabledskyblock.stackables # fabledskyblock.stackables
RequirePermission: false RequirePermission: false
Limit:
Enable: false

View File

@ -226,6 +226,16 @@ Command:
Message: '&bSkyBlock &8| &cError&8: &eBoth selected positions have to be in the same World.' Message: '&bSkyBlock &8| &cError&8: &eBoth selected positions have to be in the same World.'
Info: Info:
Message: '&f&oCreate Structures for Islands.' Message: '&f&oCreate Structures for Islands.'
Convert:
Info:
Message: '&f&oConverts old Structure files.'
Invalid:
Message: '&bSkyBlock &8| &aInfo&8: &eThe Structure with the name ''&d%name&e'' was not found!'
Converted:
Successful:
Message: '&bSkyBlock &8| &aInfo&8: &eThe Structure with the name ''&d%name&e'' has been converted!'
Failed:
Message: '&bSkyBlock &8| &cError&8: &eAn error occurred when trying to convert the Structure.'
SetSize: SetSize:
Set: Set:
Message: '&bSkyBlock &8| &aInfo&8: &eYou have set &d%player''s &eIsland size to &d%size&e.' Message: '&bSkyBlock &8| &aInfo&8: &eYou have set &d%player''s &eIsland size to &d%size&e.'

View File

@ -1,6 +1,6 @@
name: FabledSkyBlock name: FabledSkyBlock
main: com.songoda.skyblock.SkyBlock main: com.songoda.skyblock.SkyBlock
version: @version@ version: maven-version-number
api-version: 1.13 api-version: 1.13
description: A unique SkyBlock plugin description: A unique SkyBlock plugin
author: Songoda author: Songoda