Hot fixes.

This commit is contained in:
TadahTech 2016-06-16 03:42:33 -05:00 committed by cnr
parent d6d8d288ca
commit e7d76e2ef4
9 changed files with 134 additions and 203 deletions

View File

@ -5,7 +5,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.gui.Menu;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -72,7 +71,5 @@ public class KitIconButton extends KitButton
public void onClick(Player player)
{
getKit().onSelected(player.getUniqueId());
Menu.remove(player.getUniqueId());
player.closeInventory();
}
}

View File

@ -41,8 +41,6 @@ public class KitPermanentDefaultButton extends KitButton
{
getKit().onSelected(player.getUniqueId());
getKit().setDefault(!getKit().isDefault(player.getUniqueId()), player.getUniqueId());
getKit().onSetDefault(player.getUniqueId());
}

View File

@ -4,7 +4,6 @@ import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.gui.Menu;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
@ -35,9 +34,5 @@ public class KitSelectButton extends KitButton
public void onClick(Player player)
{
getKit().onSelected(player.getUniqueId());
Menu.remove(player.getUniqueId());
player.closeInventory();
}
}

View File

@ -700,9 +700,6 @@ public abstract class Game implements Listener
team.AddPlayer(player, in);
// Ensure Valid Kit
ValidateKit(player, team);
// Game Scoreboard
Scoreboard.SetPlayerTeam(player, team.GetName().toUpperCase());
@ -711,6 +708,9 @@ public abstract class Game implements Listener
// Save Tournament Team
Manager.GetGameTournamentManager().setTournamentTeam(player, team);
// Ensure Valid Kit
ValidateKit(player, team);
}
public GameTeam ChooseTeam(Player player)

View File

@ -1,75 +1,9 @@
package nautilus.game.arcade.game.games.bridge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -82,21 +16,34 @@ import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
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.game.games.bridge.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
import nautilus.game.arcade.stats.*;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import java.util.*;
public class Bridge extends TeamGame implements OreObsfucation
{
@ -186,7 +133,8 @@ public class Bridge extends TeamGame implements OreObsfucation
new Kit[]
{
new KitApple(manager),
new KitBeserker(manager),
new KitBerserker(manager),
new KitBrawler(manager),
new KitMammoth(manager),
new KitArcher(manager),
new KitMiner(manager),
@ -201,6 +149,23 @@ public class Bridge extends TeamGame implements OreObsfucation
"The last team alive wins!"
});
boolean foundBrawler = false;
for(int i = 0; i < GetKits().length; i++)
{
Kit kit = GetKits()[i];
if(kit.GetName().equalsIgnoreCase("Brawler"))
{
if(!foundBrawler)
{
foundBrawler = true;
}
else
{
GetKits()[i] = null;
}
}
}
_ore = new OreHider();
// Flags

View File

@ -1,49 +0,0 @@
package nautilus.game.arcade.game.games.bridge.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitBeserker extends Kit
{
public KitBeserker(ArcadeManager manager)
{
super(manager, "Beserker", KitAvailability.Free,
new String[]
{
"Agile warrior trained in the ways of axe combat."
},
new Perk[]
{
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
new PerkAxeman(),
},
EntityType.ZOMBIE,
new ItemStack(Material.STONE_AXE));
}
@Override
public void GiveItems(Player player)
{
if(!(Manager.GetGame() instanceof Bridge))
{
return;
}
Bridge bridge = (Bridge) Manager.GetGame();
if(!bridge.hasUsedRevive(player))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
}
}

View File

@ -1,8 +1,11 @@
package nautilus.game.arcade.kit;
import com.google.common.collect.Lists;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.Donor;
import mineplex.core.progression.ProgressiveKit;
@ -11,7 +14,9 @@ import mineplex.core.progression.data.PlayerKit;
import mineplex.core.progression.data.PlayerKitDataManager;
import mineplex.core.progression.gui.Menu;
import mineplex.core.progression.math.Calculations;
import mineplex.core.shop.page.ConfirmationPage;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_8_R3.EntityFireworks;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_8_R3.World;
@ -163,6 +168,10 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
@Override
public void onSelected(UUID player)
{
if(!canEquipKit(Bukkit.getPlayer(player)))
{
return;
}
_dataManager.get(player).setCurrentKit(getInternalName());
Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true);
Manager.getProgressionKitManager().displayParticles(this, player);
@ -171,6 +180,13 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
@Override
public void onSetDefault(UUID player)
{
if(!canEquipKit(Bukkit.getPlayer(player)))
{
return;
}
setDefault(!isDefault(player), player);
Player bukkitPlayer = Bukkit.getPlayer(player);
bukkitPlayer.sendMessage(F.main("Kit", "Set " + C.cYellowB + getDisplayName() + C.cGray + " as your default kit."));
@ -271,6 +287,41 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
return circleblocks;
}
public boolean canEquipKit(Player player)
{
Donor donor = Manager.GetDonation().Get(player);
if (this.GetAvailability() == KitAvailability.Free ||
Manager.hasKitsUnlocked(player) ||
(this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) ||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + this.GetName()) ||
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) ||
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament)
{
return true;
}
else if (this.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.GEM) >= this.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), () -> {
if (player.isOnline())
{
Manager.GetGame().SetKit(player, this, true);
}
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), this), CurrencyType.GEM, player));
}
else if (this.GetAvailability() == KitAvailability.Achievement)
{
UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + "."));
}
else
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
}
return false;
}
public static String leap()
{

View File

@ -1,28 +1,31 @@
package nautilus.game.arcade.managers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilBlockText.TextAlign;
import mineplex.core.donation.Donor;
import mineplex.core.elo.EloManager.EloDivision;
import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -37,40 +40,8 @@ import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlockText;
import mineplex.core.common.util.UtilBlockText.TextAlign;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
import mineplex.core.donation.Donor;
import mineplex.core.elo.EloManager.EloDivision;
import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.booster.BoosterPodium;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import java.util.*;
import java.util.Map.Entry;
public class GameLobbyManager implements Listener
{
@ -562,6 +533,10 @@ public class GameLobbyManager implements Listener
ArrayList<Kit> kits = new ArrayList<Kit>();
for (Kit kit : game.GetKits())
{
if (kit == null)
{
continue;
}
if (kit.GetAvailability() != KitAvailability.Hide)
kits.add(kit);
}

View File

@ -20,7 +20,6 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitProgressionData;
import nautilus.game.arcade.kit.ProgressingKit;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -62,21 +61,18 @@ public class ProgressingKitManager implements Listener
_tasks.remove(player).cancel();
}
Game storedGame = _manager.GetGame();
Location storedLocation = kit.getLivingEntity().getLocation();
_tasks.put(player, new BukkitRunnable()
{
@Override
public void run()
{
if (!_manager.GetGame().GetName().equalsIgnoreCase(storedGame.GetName()))
if(kit.getLivingEntity() == null)
{
cancel();
_tasks.remove(player);
return;
}
if (kit.getLivingEntity() == null || !kit.getLivingEntity().getLocation().equals(storedLocation))
if(Bukkit.getPlayer(player) == null)
{
cancel();
_tasks.remove(player);
@ -116,6 +112,10 @@ public class ProgressingKitManager implements Listener
//Shouldn't ever happen, but we'll be careful.
return;
}
if(!((ProgressingKit) kit).canEquipKit(player))
{
return;
}
new KitDisplayMenu((ProgressingKit) kit).open(player);
}
@ -301,6 +301,5 @@ public class ProgressingKitManager implements Listener
_data.put(player.getUniqueId(), new KitProgressionData(kit, game, xpGained));
}
}