Fix Bridges Kits not getting their items.

Fix Kits breaking at Level 5
This commit is contained in:
TadahTech 2016-06-16 14:22:44 -05:00 committed by cnr
parent e7d76e2ef4
commit 5ac6249684
4 changed files with 38 additions and 15 deletions

View File

@ -1,5 +1,6 @@
package mineplex.core.progression.gui.buttons;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.gui.guis.KitInformationTrackerMenu;
@ -21,6 +22,11 @@ import static mineplex.core.common.util.UtilServer.getPlugin;
public class KitUpgradeMenuButton extends KitButton
{
private static final ItemStack ITEM_STACK = new ItemBuilder(Material.ENCHANTMENT_TABLE)
.setTitle(C.cYellow + "Upgrade Level")
.setLore(" ", C.cRed + "Upgrades Coming Soon!")
.build();
private ItemStack _item;
private boolean _flash;
private BukkitTask _task;
@ -29,6 +35,7 @@ public class KitUpgradeMenuButton extends KitButton
{
super(kit, null);
_item = ITEM_STACK;
//The current upgrade level out of 5 for this kit
int upgradeLevel = kit.getUpgradeLevel(player.getUniqueId());
//The players level
@ -50,12 +57,6 @@ public class KitUpgradeMenuButton extends KitButton
ChatColor color = Calculations.getColor(level, nextUpgradeLevelPlayer);
ItemBuilder builder = new ItemBuilder(Material.ENCHANTMENT_TABLE);
builder.setTitle(ChatColor.YELLOW + "Upgrade Level");
builder.setLore(" ", ChatColor.RED + "Upgrades Coming Soon!");
_item = builder.build();
}
@Override
@ -75,7 +76,7 @@ public class KitUpgradeMenuButton extends KitButton
this._task = new BukkitRunnable()
{
private ItemStack itemClone = getItemStack().clone();
private ItemStack itemClone = ITEM_STACK.clone();
private ItemStack AIR = new ItemStack(Material.AIR);

View File

@ -659,6 +659,10 @@ public abstract class Game implements Listener
{
for (Kit kit : _kits)
{
if(kit == null)
{
continue;
}
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin());
for (Perk perk : kit.GetPerks())
@ -673,6 +677,11 @@ public abstract class Game implements Listener
{
for (Kit kit : _kits)
{
if(kit == null)
{
continue;
}
HandlerList.unregisterAll(kit);
for (Perk perk : kit.GetPerks())

View File

@ -9,14 +9,6 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
import nautilus.game.arcade.game.games.bridge.kits.KitArcher;
import nautilus.game.arcade.game.games.bridge.kits.KitBeserker;
import nautilus.game.arcade.game.games.bridge.kits.KitBomber;
import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
import nautilus.game.arcade.game.games.bridge.kits.KitMammoth;
import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
import nautilus.game.arcade.kit.Kit;
/**
* SpeedBridges gamemode for Bridges

View File

@ -24,6 +24,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitRunnable;
@ -157,6 +158,26 @@ public class ProgressingKitManager implements Listener
_manager.getKitProgressionManager().getDataManager().remove(playerKit);
}
@EventHandler
public void testCommand(PlayerCommandPreprocessEvent event)
{
//This needs to stay in for testing sakes if the issue arises connor
String message = event.getMessage();
if(!event.getPlayer().getName().equalsIgnoreCase("TadahTech"))
{
return;
}
if(!message.startsWith("/kpsetlevel"))
{
return;
}
event.setCancelled(true);
int level = Integer.parseInt(message.split(" ")[1]);
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
kit.setLevel(level, event.getPlayer().getUniqueId());
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
}
@EventHandler
public void cancelParticles(GameStateChangeEvent event)
{