diff --git a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java index 03c1006f9..a004700b6 100644 --- a/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java +++ b/Plugins/mineplex-game-gemhunters/src/mineplex/gemhunters/economy/EconomyModule.java @@ -11,18 +11,26 @@ import mineplex.core.MiniClientPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.F; +import mineplex.core.donation.DonationManager; +import mineplex.core.donation.Donor; import mineplex.gemhunters.death.event.PlayerCustomRespawnEvent; import mineplex.gemhunters.economy.command.GiveGemsCommand; +import mineplex.gemhunters.spawn.event.PlayerTeleportIntoMapEvent; @ReflectivelyCreateMiniPlugin public class EconomyModule extends MiniClientPlugin { private static final float GEM_KILL_FACTOR = 0.5F; - + private static final int GEM_START_COST = 100; + + private final DonationManager _donation; + public EconomyModule() { super("Economy"); + + _donation = require(DonationManager.class); } @Override @@ -34,7 +42,19 @@ public class EconomyModule extends MiniClientPlugin @EventHandler public void respawn(PlayerCustomRespawnEvent event) { - addToStore(event.getPlayer(), null, 100); + addToStore(event.getPlayer(), null, GEM_START_COST); + } + + @EventHandler + public void teleportIn(PlayerTeleportIntoMapEvent event) + { + Player player = event.getPlayer(); + Donor donor = _donation.Get(event.getPlayer()); + + if (donor.getBalance(GlobalCurrency.GEM) >= GEM_START_COST) + { + _donation.purchaseUnknownSalesPackage(player, "Gem Hunters Access", GlobalCurrency.GEM, GEM_START_COST, false, null); + } } @EventHandler