diff --git a/pom.xml b/pom.xml index 7a0736c..3d20a35 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 EconomyLite EconomyLite - 1.0.1 + 1.0.2 jar EconomyLite An economy plugin for Sponge diff --git a/src/me/Flibio/EconomyLite/Commands/AddCommand.java b/src/me/Flibio/EconomyLite/Commands/AddCommand.java index 8be8c18..bbdeab6 100644 --- a/src/me/Flibio/EconomyLite/Commands/AddCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/AddCommand.java @@ -18,7 +18,7 @@ public class AddCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BalanceCommand.java b/src/me/Flibio/EconomyLite/Commands/BalanceCommand.java index 5c1122d..bfb2def 100644 --- a/src/me/Flibio/EconomyLite/Commands/BalanceCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BalanceCommand.java @@ -22,7 +22,7 @@ public class BalanceCommand implements CommandExecutor{ private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessDeleteCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessDeleteCommand.java index 0bd4d5a..b5bb88e 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessDeleteCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessDeleteCommand.java @@ -22,7 +22,7 @@ public class BusinessDeleteCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessInviteAcceptCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessInviteAcceptCommand.java index c21c622..a8bcbf9 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessInviteAcceptCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessInviteAcceptCommand.java @@ -19,7 +19,7 @@ public class BusinessInviteAcceptCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessInviteCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessInviteCommand.java index 3f03376..0a45540 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessInviteCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessInviteCommand.java @@ -21,7 +21,7 @@ public class BusinessInviteCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessLeaveCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessLeaveCommand.java index 8bd492d..c8be1a4 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessLeaveCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessLeaveCommand.java @@ -19,7 +19,7 @@ public class BusinessLeaveCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessOwnersCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessOwnersCommand.java index 658d13f..df102e6 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessOwnersCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessOwnersCommand.java @@ -23,7 +23,7 @@ public class BusinessOwnersCommand implements CommandExecutor{ private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessRegisterCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessRegisterCommand.java index 7a9c25d..8349b33 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessRegisterCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessRegisterCommand.java @@ -19,7 +19,7 @@ public class BusinessRegisterCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/BusinessTransferCommand.java b/src/me/Flibio/EconomyLite/Commands/BusinessTransferCommand.java index 1bd8cdc..a6fc721 100644 --- a/src/me/Flibio/EconomyLite/Commands/BusinessTransferCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/BusinessTransferCommand.java @@ -21,7 +21,7 @@ public class BusinessTransferCommand implements CommandExecutor{ private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/PayCommand.java b/src/me/Flibio/EconomyLite/Commands/PayCommand.java index 82b9e98..4936f82 100644 --- a/src/me/Flibio/EconomyLite/Commands/PayCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/PayCommand.java @@ -21,10 +21,10 @@ public class PayCommand implements CommandExecutor{ private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override - public CommandResult execute(CommandSource source, CommandContext args) + public CommandResult execute(final CommandSource source, final CommandContext args) throws CommandException { //Run in a seperate thread taskBuilder.execute(new Runnable() { diff --git a/src/me/Flibio/EconomyLite/Commands/PayOverrideCommand.java b/src/me/Flibio/EconomyLite/Commands/PayOverrideCommand.java index 3940347..b042952 100644 --- a/src/me/Flibio/EconomyLite/Commands/PayOverrideCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/PayOverrideCommand.java @@ -22,7 +22,7 @@ public class PayOverrideCommand implements CommandExecutor{ private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); private BusinessManager businessManager = new BusinessManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/RemoveCommand.java b/src/me/Flibio/EconomyLite/Commands/RemoveCommand.java index 6212c30..9f3cc03 100644 --- a/src/me/Flibio/EconomyLite/Commands/RemoveCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/RemoveCommand.java @@ -18,7 +18,7 @@ public class RemoveCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Commands/SetCommand.java b/src/me/Flibio/EconomyLite/Commands/SetCommand.java index 1b89dea..95008b2 100644 --- a/src/me/Flibio/EconomyLite/Commands/SetCommand.java +++ b/src/me/Flibio/EconomyLite/Commands/SetCommand.java @@ -18,7 +18,7 @@ public class SetCommand implements CommandExecutor { private TextUtils textUtils = new TextUtils(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Override public CommandResult execute(CommandSource source, CommandContext args) diff --git a/src/me/Flibio/EconomyLite/Listeners/PlayerJoinListener.java b/src/me/Flibio/EconomyLite/Listeners/PlayerJoinListener.java index a79a406..9fbc0e8 100644 --- a/src/me/Flibio/EconomyLite/Listeners/PlayerJoinListener.java +++ b/src/me/Flibio/EconomyLite/Listeners/PlayerJoinListener.java @@ -26,7 +26,7 @@ public class PlayerJoinListener { private FileManager fileManager = new FileManager(); private ScoreboardUtils scoreboardUtils = new ScoreboardUtils(); private PlayerManager playerManager = new PlayerManager(); - private TaskBuilder taskBuilder = Main.access.game.getScheduler().getTaskBuilder(); + private TaskBuilder taskBuilder = Main.access.game.getScheduler().createTaskBuilder(); @Subscribe public void onPlayerJoin(PlayerJoinEvent event) { diff --git a/src/me/Flibio/EconomyLite/Main.java b/src/me/Flibio/EconomyLite/Main.java index 8b36cf4..059b959 100644 --- a/src/me/Flibio/EconomyLite/Main.java +++ b/src/me/Flibio/EconomyLite/Main.java @@ -43,7 +43,7 @@ import com.google.common.base.Optional; import com.google.inject.Inject; -@Plugin(id = "EconomyLite", name = "EconomyLite", version = "1.0.1") +@Plugin(id = "EconomyLite", name = "EconomyLite", version = "1.0.2") public class Main { @Inject @@ -113,7 +113,7 @@ public void onServerInitialize(InitializationEvent event) { logger.error("Error enabling plugin metrics!"); } //Reset business confirmations - game.getScheduler().getTaskBuilder().execute(new Runnable() { + game.getScheduler().createTaskBuilder().execute(new Runnable() { public void run() { fileManager.loadFile(FileType.BUSINESS_DATA); ConfigurationNode root = fileManager.getFile(FileType.BUSINESS_DATA); @@ -133,6 +133,8 @@ public void onServerStarted(ServerStartedEvent event) { //Check for an update String latest = httpUtils.requestData("https://api.github.com/repos/Flibio/EconomyLite/releases/latest"); String version = jsonUtils.getVersion(latest).replace("v", ""); + String changes = httpUtils.requestData("https://flibio.github.io/EconomyLite/changelogs/"+version.replaceAll("\\.", "-")+".txt"); + String[] iChanges = changes.split(";"); String url = jsonUtils.getUrl(latest); boolean prerelease = jsonUtils.isPreRelease(latest); //Make sure the latest update is not a prerelease @@ -142,6 +144,11 @@ public void onServerStarted(ServerStartedEvent event) { if(textUtils.versionCompare(version, currentVersion)>0) { logger.info("EconomyLite v"+version+" is now available to download!"); logger.info(url); + for(String change : iChanges) { + if(!change.trim().isEmpty()) { + logger.info("+ "+change); + } + } } } } diff --git a/src/me/Flibio/EconomyLite/Runnables/UpdateRunnable.java b/src/me/Flibio/EconomyLite/Runnables/UpdateRunnable.java index fe05672..3290fed 100644 --- a/src/me/Flibio/EconomyLite/Runnables/UpdateRunnable.java +++ b/src/me/Flibio/EconomyLite/Runnables/UpdateRunnable.java @@ -1,6 +1,5 @@ package me.Flibio.EconomyLite.Runnables; - import me.Flibio.EconomyLite.Main; import me.Flibio.EconomyLite.Utils.HttpUtils; import me.Flibio.EconomyLite.Utils.JsonUtils; @@ -25,6 +24,8 @@ public void run() { //Get the data String latest = httpUtils.requestData("https://api.github.com/repos/Flibio/EconomyLite/releases/latest"); String version = jsonUtils.getVersion(latest).replace("v", ""); + String changes = httpUtils.requestData("https://flibio.github.io/EconomyLite/changelogs/"+version.replaceAll("\\.", "-")+".txt"); + String[] iChanges = changes.split(";"); String url = jsonUtils.getUrl(latest); boolean prerelease = jsonUtils.isPreRelease(latest); //Make sure the latest update is not a prerelease @@ -33,6 +34,11 @@ public void run() { String currentVersion = Main.access.version; if(textUtils.versionCompare(version, currentVersion)>0) { player.sendMessage(textUtils.updateAvailable(version, url)); + for(String change : iChanges) { + if(!change.trim().isEmpty()) { + player.sendMessage(textUtils.change(change)); + } + } } } } diff --git a/src/me/Flibio/EconomyLite/Utils/ScoreboardUtils.java b/src/me/Flibio/EconomyLite/Utils/ScoreboardUtils.java index c544be2..857f83e 100644 --- a/src/me/Flibio/EconomyLite/Utils/ScoreboardUtils.java +++ b/src/me/Flibio/EconomyLite/Utils/ScoreboardUtils.java @@ -35,8 +35,8 @@ public ScoreboardUtils() { * @return Completed scoreboard */ public Scoreboard createScoreboard(String objectiveName, Text displayName, HashMap objectiveValues) { - Scoreboard board = game.getRegistry().getScoreboardBuilder().build(); - Objective obj = game.getRegistry().getObjectiveBuilder().name(objectiveName).criterion(Criteria.DUMMY).displayName(displayName).build(); + Scoreboard board = game.getRegistry().createScoreboardBuilder().build(); + Objective obj = game.getRegistry().createObjectiveBuilder().name(objectiveName).criterion(Criteria.DUMMY).displayName(displayName).build(); for(Text name : objectiveValues.keySet()) { int value = objectiveValues.get(name); obj.getScore(name).setScore(value); diff --git a/src/me/Flibio/EconomyLite/Utils/TextUtils.java b/src/me/Flibio/EconomyLite/Utils/TextUtils.java index 17e94e3..56c55bc 100644 --- a/src/me/Flibio/EconomyLite/Utils/TextUtils.java +++ b/src/me/Flibio/EconomyLite/Utils/TextUtils.java @@ -268,6 +268,14 @@ public Text owner(String owner) { return text; } + public Text change(String change) { + Text text = Texts.builder(" + ").color(TextColors.YELLOW).build(); + + text = text.builder().append(basicText(change,TextColors.GREEN)).build(); + + return text; + } + public String getDownloadUrl(String jsonRelease) { return jsonRelease.split("browser_download_url")[1].split("}",2)[0].replaceAll("\"", "").replaceFirst(":", "").trim(); }