Added the ability to give out game loot.
This commit is contained in:
parent
e83b49d490
commit
e16ee9036a
@ -12,6 +12,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.globalpacket.command.GlobalPacketCommand;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveGems;
|
||||
@ -19,6 +20,9 @@ import mineplex.core.globalpacket.listeners.GlobalGiveItem;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
@ -28,8 +32,9 @@ public class GlobalPacketManager extends MiniPlugin
|
||||
private ServerStatusManager _statusManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private DonationManager _donationManager;
|
||||
private RewardManager _rewardManager;
|
||||
|
||||
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager)
|
||||
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager)
|
||||
{
|
||||
super("Global Packet Manager", plugin);
|
||||
|
||||
@ -38,9 +43,16 @@ public class GlobalPacketManager extends MiniPlugin
|
||||
_inventoryManager = inventoryManager;
|
||||
_donationManager = donationManager;
|
||||
|
||||
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
1500, 2500,
|
||||
6000, 12000,
|
||||
false, false);
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager));
|
||||
|
||||
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.globalpacket.event.GlobalPacketEvent;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardType;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
@ -21,17 +25,21 @@ public class GlobalGiveItem implements Listener
|
||||
{
|
||||
|
||||
private InventoryManager _inventoryManager;
|
||||
private RewardManager _rewardManager;
|
||||
|
||||
public GlobalGiveItem(InventoryManager inventoryManager)
|
||||
public GlobalGiveItem(InventoryManager inventoryManager, RewardManager rewardManager)
|
||||
{
|
||||
_inventoryManager = inventoryManager;
|
||||
_rewardManager = rewardManager;
|
||||
}
|
||||
|
||||
public enum GlobalItem
|
||||
{
|
||||
OLD_CHEST("Old Chest"),
|
||||
ANCIENT_CHEST("Ancient Chest"),
|
||||
MYTHICAL_CHEST("Mythical Chest");
|
||||
MYTHICAL_CHEST("Mythical Chest"),
|
||||
|
||||
GAME_LOOT("Game Loot");
|
||||
|
||||
private String _invName;
|
||||
|
||||
@ -47,7 +55,7 @@ public class GlobalGiveItem implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void giveItem(GlobalPacketEvent e)
|
||||
public void giveItem(final GlobalPacketEvent e)
|
||||
{
|
||||
if (e.getParts() == null || e.getParts().length < 1)
|
||||
return;
|
||||
@ -119,6 +127,25 @@ public class GlobalGiveItem implements Listener
|
||||
}
|
||||
}, p, item.getInvName(), amount);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (item.toString().equalsIgnoreCase("GAME_LOOT"))
|
||||
{
|
||||
for (final Player p : UtilServer.getPlayers())
|
||||
{
|
||||
Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GameLoot, true);
|
||||
reward.giveReward(RewardType.GameLoot, p, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData data)
|
||||
{
|
||||
UtilPlayer.message(p, F.main("Global", "You received " + F.elem("Game Loot") + " from " + F.name(e.getCaller().getName()) + "."));
|
||||
UtilPlayer.message(p, F.main("Global", "You won " + F.elem(data.getFriendlyName()) + "!"));
|
||||
UtilTextMiddle.display(C.cYellow + data.getFriendlyName(), C.cGold + "received from " + e.getCaller().getName() + "!", p);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,9 +147,9 @@ public class Arcade extends JavaPlugin
|
||||
cosmeticManager.setInterfaceSlot(7);
|
||||
cosmeticManager.disableTeamArmor();
|
||||
|
||||
new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager);
|
||||
|
||||
GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager);
|
||||
|
||||
new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, giveawayManager);
|
||||
|
||||
//Arcade Manager
|
||||
PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
|
||||
|
Loading…
Reference in New Issue
Block a user