From da08321de440b34e67d2ccf305ff009381071469 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 30 Aug 2013 09:45:25 -0700 Subject: [PATCH] Added possible second option for pulling purchases to Enjin plugin. --- Plugins/Mineplex.EnjinTranslator/plugin.yml | 4 ++++ .../src/mineplex/enjinTranslator/Enjin.java | 23 +++++++++++++++++++ .../enjinTranslator/EnjinTranslator.java | 3 +++ 3 files changed, 30 insertions(+) diff --git a/Plugins/Mineplex.EnjinTranslator/plugin.yml b/Plugins/Mineplex.EnjinTranslator/plugin.yml index e1c0ba9a5..ef3eac20a 100644 --- a/Plugins/Mineplex.EnjinTranslator/plugin.yml +++ b/Plugins/Mineplex.EnjinTranslator/plugin.yml @@ -3,6 +3,10 @@ main: mineplex.enjinTranslator.EnjinTranslator version: 0.1 commands: enjin_mineplex: + description: Translates enjin commands to mineplex. + usage: Don't use it, you get kicked. + aliases: + pull: description: Translates enjin commands to mineplex. usage: Don't use it, you get kicked. aliases: \ No newline at end of file diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 8db3cd244..14fc6729d 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -1,16 +1,25 @@ package mineplex.enjinTranslator; +import java.util.List; + import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; +import com.google.common.reflect.TypeToken; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.donation.DonationManager; import mineplex.core.punish.Category; import mineplex.core.punish.Punish; +import mineplex.core.server.remotecall.JsonWebCall; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; public class Enjin extends MiniPlugin implements CommandExecutor { @@ -18,6 +27,8 @@ public class Enjin extends MiniPlugin implements CommandExecutor private DonationManager _donationManager; private Punish _punish; + public long _lastPoll = System.currentTimeMillis() - 120000; + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish) { super("Enjin", plugin); @@ -27,6 +38,18 @@ public class Enjin extends MiniPlugin implements CommandExecutor _punish = punish; plugin.getCommand("enjin_mineplex").setExecutor(this); + plugin.getCommand("pull").setExecutor(this); + } + + @EventHandler + public void pollLastPurchases(UpdateEvent event) + { + if (event.getType() != UpdateType.MIN_01) + return; + + @SuppressWarnings("serial") + //List purchases = new JsonWebCall("http://www.mineplex.com/api/m-shopping-purchases/m/14702725").Execute(new TypeToken>(){}.getType(), null); + //_lastPoll = System.currentTimeMillis(); } @Override diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java index afff848bb..a0df2eeb5 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java @@ -4,6 +4,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.command.CommandCenter; import mineplex.core.donation.DonationManager; import mineplex.core.punish.Punish; +import mineplex.core.updater.Updater; import org.bukkit.plugin.java.JavaPlugin; @@ -30,6 +31,8 @@ public class EnjinTranslator extends JavaPlugin //Main Modules new Enjin(this, clientManager, donationManager, punish); + + new Updater(this); } public String GetWebServerAddress()