Finalizing Poll GUI in Carl's GUI.
This commit is contained in:
parent
85c8e42f53
commit
941e746ca9
@ -115,6 +115,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
private DisguiseManager _disguiseManager;
|
||||
private PartyManager _partyManager;
|
||||
private ForcefieldManager _forcefieldManager;
|
||||
private PollManager _pollManager;
|
||||
private Portal _portal;
|
||||
private StatsManager _statsManager;
|
||||
private GadgetManager _gadgetManager;
|
||||
@ -158,6 +159,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_conditionManager = conditionManager;
|
||||
_donationManager = donationManager;
|
||||
_disguiseManager = disguiseManager;
|
||||
_pollManager = pollManager;
|
||||
|
||||
_portal = portal;
|
||||
|
||||
@ -207,7 +209,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||
|
||||
|
||||
new BonusManager(plugin, clientManager, donationManager, npcManager, hologramManager, rewardManager);
|
||||
new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, rewardManager);
|
||||
|
||||
|
||||
// NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager);
|
||||
|
@ -42,6 +42,7 @@ import mineplex.hub.bonuses.event.CarlSpinnerEvent;
|
||||
import mineplex.hub.bonuses.gui.BonusGui;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import mineplex.hub.bonuses.gui.SpinGui;
|
||||
import mineplex.hub.poll.PollManager;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -111,6 +112,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
private BonusRepository _repository;
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private PollManager _pollManager;
|
||||
private NpcManager _npcManager;
|
||||
private HologramManager _hologramManager;
|
||||
private RewardManager _rewardManager;
|
||||
@ -121,7 +123,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
private StreakRecord _dailyStreak;
|
||||
private StreakRecord _voteStreak;
|
||||
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, NpcManager npcManager, HologramManager hologramManager, RewardManager rewardManager)
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, RewardManager rewardManager)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -130,6 +132,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_npcManager = npcManager;
|
||||
_hologramManager = hologramManager;
|
||||
_rewardManager = rewardManager;
|
||||
_pollManager = pollManager;
|
||||
|
||||
// Hope to god this works!
|
||||
_canVote = true;
|
||||
@ -814,4 +817,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_pendingExplosions.add(obj);
|
||||
_pendingExplosionsPlayers.add(player);
|
||||
}
|
||||
|
||||
public PollManager getPollManager()
|
||||
{
|
||||
return _pollManager;
|
||||
}
|
||||
}
|
@ -5,11 +5,13 @@ import mineplex.core.reward.RewardManager;
|
||||
import mineplex.hub.bonuses.BonusManager;
|
||||
import mineplex.hub.bonuses.gui.buttons.CarlSpinButton;
|
||||
import mineplex.hub.bonuses.gui.buttons.DailyBonusButton;
|
||||
import mineplex.hub.bonuses.gui.buttons.PollButton;
|
||||
import mineplex.hub.bonuses.gui.buttons.RankBonusButton;
|
||||
import mineplex.hub.bonuses.gui.buttons.VoteButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.omg.CORBA._PolicyStub;
|
||||
|
||||
public class BonusGui extends SimpleGui
|
||||
{
|
||||
@ -22,12 +24,14 @@ public class BonusGui extends SimpleGui
|
||||
|
||||
this.manager = manager;
|
||||
|
||||
setItem(11, new VoteButton(plugin, player, this, manager));
|
||||
setItem(10, new VoteButton(plugin, player, this, manager));
|
||||
|
||||
setItem(13, new RankBonusButton(getPlugin(), player, this, manager));
|
||||
setItem(12, new RankBonusButton(getPlugin(), player, this, manager));
|
||||
|
||||
setItem(15, new DailyBonusButton(getPlugin(), player, this, manager));
|
||||
setItem(14, new DailyBonusButton(getPlugin(), player, this, manager));
|
||||
|
||||
setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this));
|
||||
|
||||
setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mineplex.hub.bonuses.gui.buttons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gui.GuiInventory;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
@ -53,9 +55,6 @@ public class PollButton extends SimpleGui implements GuiItem {
|
||||
|
||||
if (_poll != null)
|
||||
{
|
||||
|
||||
// Todo - Fix this!
|
||||
// getButtonMap().putAll(hard);
|
||||
|
||||
setItem(4, getQuestionItem(_poll.getQuestion()));
|
||||
|
||||
@ -63,22 +62,38 @@ public class PollButton extends SimpleGui implements GuiItem {
|
||||
|
||||
for (int i = 0; i < slots.length; i++)
|
||||
{
|
||||
|
||||
setItem(9 * 2 + slots[i], new AnswerItem(_poll, i));
|
||||
|
||||
AnswerItem item = new AnswerItem(_poll, i);
|
||||
setItem(9 * 2 + slots[i], item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getObject()
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
if (_poll == null)
|
||||
return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, "No polls!");
|
||||
{
|
||||
lore.add(C.cRed + "You've already voted on all of the polls!");
|
||||
return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + C.Bold + "Vote on Poll", lore);
|
||||
}
|
||||
else
|
||||
return ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL, (byte) 0, 1, ChatColor.GREEN + _poll.getQuestion());
|
||||
{
|
||||
lore.add(C.cWhite + _poll.getQuestion());
|
||||
lore.add("");
|
||||
int i = 1;
|
||||
for(String str : _poll.getAnswers())
|
||||
{
|
||||
lore.add(C.cAqua + "" + i + ".) " + str);
|
||||
i++;
|
||||
}
|
||||
lore.add("");
|
||||
lore.add(C.cYellow + C.Bold + "Reward: 500 Gems");
|
||||
lore.add("");
|
||||
lore.add(C.cGreen + "Click to go to the vote page!");
|
||||
return ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL, (byte) 0, 1, C.cGreen + C.Bold + "Vote on Poll", lore);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -155,8 +170,9 @@ public class PollButton extends SimpleGui implements GuiItem {
|
||||
_pollManager.answerPoll(getPlayer(), _poll, num);
|
||||
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.EMERALD_BLOCK, (byte) 0, 1, ChatColor.GREEN + "Your anwser:", wrap(getPoll().getAnswers()[num])), ChatColor.GREEN + "Moo", 6 * 9, 50, getMaster()).openInventory();
|
||||
|
||||
getPlayer().closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,7 +64,7 @@ public class PollManager extends MiniDbClientPlugin<PlayerPollData>
|
||||
pollData.setPollCooldown(5000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
/*@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
@ -88,7 +88,7 @@ public class PollManager extends MiniDbClientPlugin<PlayerPollData>
|
||||
pollData.updatePollCooldown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public Poll getNextPoll(PlayerPollData pollData, Rank playerRank)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user