Added possible second option for pulling purchases to Enjin plugin.

This commit is contained in:
Jonathan Williams 2013-08-30 09:45:25 -07:00
parent 6302869c02
commit da08321de4
3 changed files with 30 additions and 0 deletions

View File

@ -3,6 +3,10 @@ main: mineplex.enjinTranslator.EnjinTranslator
version: 0.1 version: 0.1
commands: commands:
enjin_mineplex: enjin_mineplex:
description: Translates enjin commands to mineplex.
usage: Don't use it, you get kicked.
aliases:
pull:
description: Translates enjin commands to mineplex. description: Translates enjin commands to mineplex.
usage: Don't use it, you get kicked. usage: Don't use it, you get kicked.
aliases: aliases:

View File

@ -1,16 +1,25 @@
package mineplex.enjinTranslator; package mineplex.enjinTranslator;
import java.util.List;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.reflect.TypeToken;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.punish.Category; import mineplex.core.punish.Category;
import mineplex.core.punish.Punish; 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 public class Enjin extends MiniPlugin implements CommandExecutor
{ {
@ -18,6 +27,8 @@ public class Enjin extends MiniPlugin implements CommandExecutor
private DonationManager _donationManager; private DonationManager _donationManager;
private Punish _punish; private Punish _punish;
public long _lastPoll = System.currentTimeMillis() - 120000;
public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish) public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish)
{ {
super("Enjin", plugin); super("Enjin", plugin);
@ -27,6 +38,18 @@ public class Enjin extends MiniPlugin implements CommandExecutor
_punish = punish; _punish = punish;
plugin.getCommand("enjin_mineplex").setExecutor(this); 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<EnjinPurchase> purchases = new JsonWebCall("http://www.mineplex.com/api/m-shopping-purchases/m/14702725").Execute(new TypeToken<List<EnjinPurchase>>(){}.getType(), null);
//_lastPoll = System.currentTimeMillis();
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.updater.Updater;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -30,6 +31,8 @@ public class EnjinTranslator extends JavaPlugin
//Main Modules //Main Modules
new Enjin(this, clientManager, donationManager, punish); new Enjin(this, clientManager, donationManager, punish);
new Updater(this);
} }
public String GetWebServerAddress() public String GetWebServerAddress()