flash fix, rares update, and outpost fixes

This commit is contained in:
NewGarbo 2016-03-06 19:55:58 +00:00
parent ae2da31544
commit 7e2086df1c
12 changed files with 202 additions and 102 deletions

View File

@ -7,6 +7,8 @@ import java.util.Random;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.common.collect.Lists;
public class UtilCollections
{
public static Random Random = new Random();
@ -231,4 +233,9 @@ public class UtilCollections
{
return array[Random.nextInt(array.length)];
}
public static <T> Collection<? extends T> toList(T[] array)
{
return Lists.newArrayList(array);
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Location;
@ -19,10 +18,10 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Door;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
@ -62,7 +61,6 @@ import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock;
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
import mineplex.game.clans.core.repository.ClanTerritory;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
public class Outpost implements Listener
{
@ -185,6 +183,19 @@ public class Outpost implements Listener
_nameHolograms.forEach(Hologram::start);
_nameHolograms.forEach(hologram -> {
hologram.setInteraction((player, click) -> {
UtilBlock.getInRadius(hologram.getLocation(), 2, 2).forEach((block, dist) -> {
if (block.getType() == Material.IRON_DOOR)
{
Door door = (Door) block.getState();
door.setOpen(!door.isOpen());
}
});
});
});
_lifetimeLeft.start();
}
}

View File

@ -11,17 +11,17 @@ import com.google.common.collect.Lists;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnByte;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnTimestamp;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.siege.outpost.OutpostManager;
import mineplex.game.clans.clans.siege.outpost.OutpostState;
import mineplex.game.clans.clans.siege.outpost.OutpostType;
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.ColumnByte;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnTimestamp;
import mineplex.serverdata.database.column.ColumnVarChar;
public class OutpostRepository extends RepositoryBase
{
@ -46,7 +46,7 @@ public class OutpostRepository extends RepositoryBase
public OutpostRepository(JavaPlugin plugin, OutpostManager manager)
{
super(plugin, DBPool.getAccount());
super(DBPool.getAccount());
_manager = manager;
}

View File

@ -11,14 +11,14 @@ import com.google.common.collect.Lists;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnTimestamp;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnTimestamp;
import mineplex.serverdata.database.column.ColumnVarChar;
public class SiegeWeaponRepository extends RepositoryBase
{
@ -44,7 +44,7 @@ public class SiegeWeaponRepository extends RepositoryBase
public SiegeWeaponRepository(JavaPlugin plugin, SiegeManager manager)
{
super(plugin, DBPool.getAccount());
super(DBPool.getAccount());
_manager = manager;
}

View File

@ -1,23 +1,22 @@
package mineplex.game.clans.items;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mineplex.core.common.util.UtilInv;
import mineplex.game.clans.items.attributes.AttributeContainer;
import mineplex.game.clans.items.attributes.ItemAttribute;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.game.clans.items.attributes.AttributeContainer;
import mineplex.game.clans.items.attributes.ItemAttribute;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
/**
* Represents a customizable wrapper for an {@link ItemStack}, enabling the
* possession of special abilities, attributes, and triggers on item.
@ -25,7 +24,7 @@ import org.bukkit.inventory.meta.ItemMeta;
* @author MrTwiggy
*
*/
public class CustomItem
public class CustomItem implements Listener
{
private static final ChatColor TITLE_COLOR = ChatColor.GOLD; // Chat color
@ -69,6 +68,8 @@ public class CustomItem
_material = material;
_attributes = new AttributeContainer();
_uuid = UUID.randomUUID().toString();
UtilServer.registerEvents(this);
}
public CustomItem(Material material)

View File

@ -16,6 +16,9 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
@ -59,13 +62,16 @@ import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
import mineplex.game.clans.items.commands.GearCommand;
import mineplex.game.clans.items.economy.GoldToken;
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
import mineplex.game.clans.items.legendaries.ChitauriScepter;
import mineplex.game.clans.items.legendaries.EnergyCrossbow;
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
import mineplex.game.clans.items.legendaries.HyperAxe;
import mineplex.game.clans.items.legendaries.LegendaryItem;
import mineplex.game.clans.items.legendaries.MagneticMaul;
import mineplex.game.clans.items.legendaries.MeridianScepter;
import mineplex.game.clans.items.legendaries.WindBlade;
import mineplex.game.clans.items.rares.Crossbow;
import mineplex.game.clans.items.rares.RareItem;
import mineplex.game.clans.items.rares.RunedPickaxe;
import mineplex.game.clans.items.smelting.SmeltingListener;
import mineplex.game.clans.items.ui.GearShop;
import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
@ -101,18 +107,21 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
// currently in Creative gamemode
// Legendary generation
private WeightSet<Class<? extends LegendaryItem>> _legendaryWeights;
public WeightSet<Class<? extends LegendaryItem>> LegendaryWeights;
// Rare generation
public WeightSet<Class<? extends RareItem>> RareWeights;
// Weapon generation
private WeightSet<Material> _weaponTypes;
public WeightSet<Material> WeaponTypes;
// Armor generation
private WeightSet<Material> _armorTypes;
public WeightSet<Material> ArmorTypes;
// Attribute generation
private WeightSet<Class<? extends ItemAttribute>> _weaponAttributes;
private WeightSet<Class<? extends ItemAttribute>> _armorAttributes;
private WeightSet<Class<? extends ItemAttribute>> _bowAttributes;
public WeightSet<Class<? extends ItemAttribute>> WeaponAttributes;
public WeightSet<Class<? extends ItemAttribute>> ArmorAttributes;
public WeightSet<Class<? extends ItemAttribute>> BowAttributes;
// Attribute Masks
private EnumSet<Material> _maskAttributes;
@ -138,24 +147,26 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
new Weight<ItemType>(23, ItemType.BOW));
// Weapon-based attributes
_weaponAttributes = new WeightSet<Class<? extends ItemAttribute>>(FrostedAttribute.class, SharpAttribute.class, JaggedAttribute.class, HasteAttribute.class, FlamingAttribute.class, ConqueringAttribute.class);
WeaponAttributes = new WeightSet<Class<? extends ItemAttribute>>(FrostedAttribute.class, SharpAttribute.class, JaggedAttribute.class, HasteAttribute.class, FlamingAttribute.class, ConqueringAttribute.class);
// Armor-based attributes
_armorAttributes = new WeightSet<Class<? extends ItemAttribute>>(SlantedAttribute.class, ReinforcedAttribute.class, ConqueringArmorAttribute.class, PaddedAttribute.class, LavaAttribute.class);
ArmorAttributes = new WeightSet<Class<? extends ItemAttribute>>(SlantedAttribute.class, ReinforcedAttribute.class, ConqueringArmorAttribute.class, PaddedAttribute.class, LavaAttribute.class);
// Bow-based attributes
_bowAttributes = new WeightSet<Class<? extends ItemAttribute>>(HeavyArrowsAttribute.class, HuntingAttribute.class, InverseAttribute.class, LeechingAttribute.class, RecursiveAttribute.class, ScorchingAttribute.class, SlayingAttribute.class);
BowAttributes = new WeightSet<Class<? extends ItemAttribute>>(HeavyArrowsAttribute.class, HuntingAttribute.class, InverseAttribute.class, LeechingAttribute.class, RecursiveAttribute.class, ScorchingAttribute.class, SlayingAttribute.class);
// Weapon material types
_weaponTypes = new WeightSet<Material>(Material.DIAMOND_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_AXE, Material.GOLD_AXE, Material.IRON_AXE);
WeaponTypes = new WeightSet<Material>(Material.DIAMOND_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_AXE, Material.GOLD_AXE, Material.IRON_AXE);
// Armor material types
_armorTypes = new WeightSet<Material>(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS);
ArmorTypes = new WeightSet<Material>(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS);
// TODO: Initialize list of attributes and types
// Initialize various LegendaryItem types
_legendaryWeights = new WeightSet<Class<? extends LegendaryItem>>(ChitauriScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
LegendaryWeights = new WeightSet<Class<? extends LegendaryItem>>(MeridianScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
RareWeights = new WeightSet<Class<? extends RareItem>>(RunedPickaxe.class, Crossbow.class);
// TODO: Add rest of legendaries, find better way?
// Register listeners
@ -165,15 +176,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
// Initialize attribute types factory for JSON handling of polymorphism.
RuntimeTypeAdapterFactory<ItemAttribute> attributeFactory = RuntimeTypeAdapterFactory.of(ItemAttribute.class);
for (Class<? extends ItemAttribute> attributeType : _armorAttributes.elements())
for (Class<? extends ItemAttribute> attributeType : ArmorAttributes.elements())
{
attributeFactory.registerSubtype(attributeType);
}
for (Class<? extends ItemAttribute> attributeType : _weaponAttributes.elements())
for (Class<? extends ItemAttribute> attributeType : WeaponAttributes.elements())
{
attributeFactory.registerSubtype(attributeType);
}
for (Class<? extends ItemAttribute> attributeType : _bowAttributes.elements())
for (Class<? extends ItemAttribute> attributeType : BowAttributes.elements())
{
attributeFactory.registerSubtype(attributeType);
}
@ -184,7 +195,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
customItemType.registerSubtype(CustomItem.class);
customItemType.registerSubtype(LegendaryItem.class);
customItemType.registerSubtype(GoldToken.class);
for (Class<? extends CustomItem> itemType : _legendaryWeights.elements())
for (Class<? extends CustomItem> itemType : LegendaryWeights.elements())
{
customItemType.registerSubtype(itemType);
}
@ -240,6 +251,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
}
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
if (_playerGears.get(event.getPlayer().getName()) != null)
{
HandlerList.unregisterAll(_playerGears.get(event.getPlayer().getName()).getWeapon());
}
}
/**
* @param player - the player whose {@link PlayerGear} set is to be fetched.
* @return the cached or newly instantiated {@link PlayerGear} associated
@ -266,15 +286,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
if (itemType == ItemType.LEGENDARY)
{
factory.setLegendary(_legendaryWeights.generateRandom());
factory.setLegendary(LegendaryWeights.generateRandom());
}
else if (itemType == ItemType.ARMOR)
{
factory.setType(_armorTypes.generateRandom());
factory.setType(ArmorTypes.generateRandom());
}
else if (itemType == ItemType.WEAPON)
{
factory.setType(_weaponTypes.generateRandom());
factory.setType(WeaponTypes.generateRandom());
}
else if (itemType == ItemType.BOW)
{
@ -325,13 +345,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
switch (type)
{
case ARMOR:
sampleAttribute = instantiate(_armorAttributes.generateRandom());
sampleAttribute = instantiate(ArmorAttributes.generateRandom());
break;
case WEAPON:
sampleAttribute = instantiate(_weaponAttributes.generateRandom());
sampleAttribute = instantiate(WeaponAttributes.generateRandom());
break;
case BOW:
sampleAttribute = instantiate(_bowAttributes.generateRandom());
sampleAttribute = instantiate(BowAttributes.generateRandom());
break;
default:
break;
@ -551,7 +571,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
}
}
if (ci != null && _legendaryWeights.elements().contains(ci.getClass()))
if (ci != null && LegendaryWeights.elements().contains(ci.getClass()))
{
lore.add(C.cWhite + "Original Owner: " + C.cYellow + (ci.OriginalOwner == null ? "You" : Bukkit.getOfflinePlayer(UUID.fromString(ci.OriginalOwner)).getName()));
}

View File

@ -4,6 +4,8 @@ public enum ItemType
{
LEGENDARY,
RARE,
ARMOR,
WEAPON,

View File

@ -5,6 +5,7 @@ import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.inventory.ItemStack;
@ -29,11 +30,11 @@ public class PlayerGear
private String _playerName; // Name of player who owns the gear
// Cached custom item information for player's gear
private CustomItem weapon;
private CustomItem helmet;
private CustomItem chestplate;
private CustomItem leggings;
private CustomItem boots;
private CustomItem _weapon;
private CustomItem _helmet;
private CustomItem _chestplate;
private CustomItem _leggings;
private CustomItem _boots;
/**
* Class constructor
@ -160,60 +161,61 @@ public class PlayerGear
{
ItemStack weaponItem = getPlayer().getInventory().getItemInHand();
if (!itemsMatch(weapon, weaponItem))
if (!itemsMatch(_weapon, weaponItem))
{
weapon = parseItem(weaponItem);
HandlerList.unregisterAll(_weapon);
_weapon = parseItem(weaponItem);
}
return weapon;
return _weapon;
}
public CustomItem getHelmet()
{
ItemStack helmetItem = getPlayer().getInventory().getHelmet();
if (!itemsMatch(helmet, helmetItem))
if (!itemsMatch(_helmet, helmetItem))
{
helmet = parseItem(helmetItem);
_helmet = parseItem(helmetItem);
}
return helmet;
return _helmet;
}
public CustomItem getChestplate()
{
ItemStack chestplateItem = getPlayer().getInventory().getChestplate();
if (!itemsMatch(chestplate, chestplateItem))
if (!itemsMatch(_chestplate, chestplateItem))
{
chestplate = parseItem(chestplateItem);
_chestplate = parseItem(chestplateItem);
}
return chestplate;
return _chestplate;
}
public CustomItem getLeggings()
{
ItemStack leggingsItem = getPlayer().getInventory().getLeggings();
if (!itemsMatch(leggings, leggingsItem))
if (!itemsMatch(_leggings, leggingsItem))
{
leggings = parseItem(leggingsItem);
_leggings = parseItem(leggingsItem);
}
return leggings;
return _leggings;
}
public CustomItem getBoots()
{
ItemStack bootsItem = getPlayer().getInventory().getBoots();
if (!itemsMatch(boots, bootsItem))
if (!itemsMatch(_boots, bootsItem))
{
boots = parseItem(bootsItem);
_boots = parseItem(bootsItem);
}
return boots;
return _boots;
}
/**

View File

@ -3,9 +3,9 @@ package mineplex.game.clans.items;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.game.clans.items.attributes.ItemAttribute;
import mineplex.game.clans.items.legendaries.LegendaryItem;
import mineplex.game.clans.items.rares.RareItem;
/**
* Quick little guide on how to use this thing:
@ -75,6 +75,28 @@ public class RareItemFactory
return this;
}
public RareItemFactory setRare(Class<? extends RareItem> rare)
{
if (_itemType.equals(ItemType.RARE))
{
try
{
_item = rare.newInstance();
_material = _item.getMaterial();
}
catch (InstantiationException | IllegalAccessException e)
{
e.printStackTrace();
}
}
else
{
throw new RuntimeException("Unexpected call to setRare(RareType)");
}
return this;
}
public RareItemFactory setSuperPrefix(Class<? extends ItemAttribute> superPrefix)
{
_superPrefix = superPrefix;

View File

@ -1,7 +1,5 @@
package mineplex.game.clans.items.legendaries;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -29,16 +27,16 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClansManager;
public class ChitauriScepter extends LegendaryItem
public class MeridianScepter extends LegendaryItem
{
private long _lastFire = System.currentTimeMillis();
private long _interactWait;
private RGBData[] colors = { UtilColor.RgbLightBlue, UtilColor.RgbLightBlue.Lighten(), UtilColor.RgbLightBlue.Darken() };
public ChitauriScepter()
public MeridianScepter()
{
super("Chitauri Scepter", UtilText.splitLinesToArray(new String[] {
super("Meridian Scepter", UtilText.splitLinesToArray(new String[] {
C.cWhite + "Legend says "
+ " ",
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use Scepter."
@ -50,7 +48,7 @@ public class ChitauriScepter extends LegendaryItem
{
if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98)
{
if (Recharge.Instance.use(wielder, "Chitauri Scepter", 4000, true, true))
if (Recharge.Instance.use(wielder, "Meridian Scepter", 4000, true, true))
{
fire(wielder);
@ -95,10 +93,10 @@ public class ChitauriScepter extends LegendaryItem
{
ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, player, null,
DamageCause.CUSTOM, damage, true, true, false,
player.getName(), "Chitauri Scepter");
player.getName(), "Meridian Scepter");
UtilPlayer.message(entity, F.main("Clans", F.elem(entity.getName()) + " hit you with a " + F.elem("Chitauri Scepter") + C.mBody + "."));
UtilPlayer.message(player, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Chitauri Scepter") + C.mBody + "."));
UtilPlayer.message(entity, F.main("Clans", F.elem(entity.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + "."));
UtilPlayer.message(player, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + "."));
}
}
}

View File

@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilCollections;
import mineplex.core.common.util.UtilUI;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
@ -42,13 +43,16 @@ import mineplex.game.clans.items.attributes.weapon.HasteAttribute;
import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
import mineplex.game.clans.items.legendaries.ChitauriScepter;
import mineplex.game.clans.items.legendaries.EnergyCrossbow;
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
import mineplex.game.clans.items.legendaries.HyperAxe;
import mineplex.game.clans.items.legendaries.LegendaryItem;
import mineplex.game.clans.items.legendaries.MagneticMaul;
import mineplex.game.clans.items.legendaries.MeridianScepter;
import mineplex.game.clans.items.legendaries.WindBlade;
import mineplex.game.clans.items.rares.Crossbow;
import mineplex.game.clans.items.rares.RareItem;
import mineplex.game.clans.items.rares.RunedPickaxe;
public class GearPage extends ShopPageBase<GearManager, GearShop>
{
@ -76,6 +80,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
private List<Class<? extends ItemAttribute>> _bowSuffixes;
private List<Class<? extends LegendaryItem>> _legendaryItems;
private List<Class<? extends RareItem>> _rareItems;
private List<Material> _weaponTypes;
private List<Material> _armorTypes;
@ -100,7 +105,9 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
};
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(ChitauriScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(MeridianScepter.class, EnergyCrossbow.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class);
_rareItems = Arrays.<Class<? extends RareItem>> asList(Crossbow.class, RunedPickaxe.class);
_armorSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LavaAttribute.class);
_armorPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(PaddedAttribute.class, ReinforcedAttribute.class, SlantedAttribute.class);
@ -143,7 +150,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{
Triple<Boolean, String, Material> stage2 = doStageTwo();
if (stage2.getLeft())
if (stage2.getLeft().booleanValue())
{
return;
}
@ -158,7 +165,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{
Triple<Boolean, String, Material> stage3 = doStageThree();
if (stage3.getLeft())
if (stage3.getLeft().booleanValue())
{
return;
}
@ -216,8 +223,10 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{
String stageTitle;
int[] indices = UtilUI.getIndicesFor(4, 1, 1);
stageTitle = "1. Select Item Type";
addButton(9 + 1, Material.GOLD_RECORD, 0, C.cGold + "Legendary", new IButton()
addButton(indices[0], Material.GOLD_RECORD, 0, C.cGold + "Legendary", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
@ -227,17 +236,17 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
}, _factory != null && ItemType.LEGENDARY.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.LEGENDARY.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(9 + 3, Material.DIAMOND_AXE, 0, C.cDAqua + "Weapon", new IButton()
addButton(indices[1], Material.RECORD_8, 0, C.cAqua + "Rare", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
_factory = RareItemFactory.begin(ItemType.WEAPON);
_factory = RareItemFactory.begin(ItemType.RARE);
performNext();
buildPage();
}
}, _factory != null && ItemType.WEAPON.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.WEAPON.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
}, _factory != null && ItemType.RARE.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.RARE.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(9 + 5, Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armor", new IButton()
addButton(indices[2], Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armor", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
@ -247,7 +256,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
}, _factory != null && ItemType.ARMOR.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.ARMOR.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(9 + 7, Material.BOW, 0, C.cDGreen + "Bow", new IButton()
addButton(indices[3], Material.BOW, 0, C.cDGreen + "Bow", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
@ -264,15 +273,47 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{
String stageTitle = "Fatal Error";
Material stageMaterial = null;
boolean _return = false;
boolean $return = false;
if (_factory == null || _factory.getItemType() == null)
{
performBack();
return Triple.of(true, stageTitle, stageMaterial);
return Triple.of(Boolean.valueOf(true), stageTitle, stageMaterial);
}
if (_factory.getItemType().equals(ItemType.LEGENDARY))
if (_factory.getItemType().equals(ItemType.RARE))
{
stageTitle = "2. Select Rare Item";
stageMaterial = _factory.getMaterial() == null ? stageMaterial : _factory.getMaterial();
int[] indices = UtilUI.getIndicesFor(_rareItems.size(), 1);
int index = 0;
for (final Class<? extends RareItem> rare : _rareItems)
{
final RareItem item = rare.newInstance();
List<String> lore = new ArrayList<>();
lore.addAll(UtilCollections.toList(item.getDescription()));
lore.add(" ");
lore.add(item.getDisplayName().equals(_factory.getWrapper() == null ? null : _factory.getWrapper().getDisplayName()) ? C.cGreen + "Selected" : C.cRed + "Not Selected");
addButton(indices[index], item.toItemStack().getType(), 0, C.cGold + item.getDisplayName(), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
_factory.setRare(rare);
performNext();
buildPage();
}
}, item.getDisplayName().equals(_factory.getWrapper() == null ? null : _factory.getWrapper().getDisplayName()), lore.toArray(new String[lore.size()]));
index++;
}
}
else if (_factory.getItemType().equals(ItemType.LEGENDARY))
{
stageTitle = "2. Select Legendary Item";
stageMaterial = _factory.getMaterial() == null ? stageMaterial : _factory.getMaterial();
@ -371,13 +412,13 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
_factory.setType(Material.BOW);
_stage = 2;
buildPage();
_return = true;
$return = true;
break;
}
}
}
return Triple.of(_return, stageTitle, stageMaterial);
return Triple.of(Boolean.valueOf($return), stageTitle, stageMaterial);
}
private Triple<Boolean, String, Material> doStageThree() throws InstantiationException, IllegalAccessException
@ -387,7 +428,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
if (_factory.getMaterial() == null)
{
performBack();
return Triple.of(true, null, null);
return Triple.of(Boolean.valueOf(true), null, null);
}
Material stageMaterial = _factory.getMaterial();
@ -483,7 +524,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
}
return Triple.of(false, stageTitle, stageMaterial);
return Triple.of(Boolean.valueOf(false), stageTitle, stageMaterial);
}
private Pair<String, Material> doStageFour() throws InstantiationException, IllegalAccessException

View File

@ -158,15 +158,11 @@ public class Flash extends SkillActive
if(aboveTargetData <= 7) aboveTargetSlabIsBottom = true;
}
// Doors
if (UtilItem.is(newTarget.getBlock(), UtilItem.ItemCategory.DOOR))
break;
if ((!newTargetSlabIsBottom && UtilBlock.fullSolid(newTarget.getBlock())) || (!aboveTargetSlabIsBottom && UtilBlock.fullSolid(aboveTarget.getBlock())))
if ((!newTargetSlabIsBottom && !UtilItem.isBoundless(aboveTarget.getBlock().getType()) || (!aboveTargetSlabIsBottom && !UtilItem.isBoundless(aboveTarget.getBlock().getType()))))
break;
//Progress Forwards
curRange += 0.2;
curRange += 0.1;
//Smoke Trail
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1,