Merge remote-tracking branch 'origin/clans-beta' into clans-beta
This commit is contained in:
commit
6f39c072a4
@ -10,6 +10,7 @@ import java.util.TreeSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -354,10 +355,25 @@ public class UtilAlg
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Vector calculateVelocity(Vector from, Vector to, double heightGain, Entity entity)
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
return calculateVelocity(from, to, heightGain, 1.15);
|
||||
}
|
||||
else
|
||||
{
|
||||
return calculateVelocity(from, to, heightGain, 0.115);
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector calculateVelocity(Vector from, Vector to, double heightGain)
|
||||
{
|
||||
// Gravity of a potion
|
||||
double gravity = 0.115;
|
||||
return calculateVelocity(from, to, heightGain, 0.115);
|
||||
}
|
||||
|
||||
public static Vector calculateVelocity(Vector from, Vector to, double heightGain, double gravity)
|
||||
{
|
||||
// Block locations
|
||||
int endGain = to.getBlockY() - from.getBlockY();
|
||||
|
||||
|
@ -10,6 +10,7 @@ import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -118,7 +119,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> getOpeningPageForPlayer(Player player)
|
||||
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> getOpeningPageForPlayer(HumanEntity player)
|
||||
{
|
||||
return _playerPageMap.get(player.getName());
|
||||
}
|
||||
@ -126,10 +127,19 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (_playerPageMap.containsKey(event.getWhoClicked().getName()) && _playerPageMap.get(event.getWhoClicked().getName()).getName().equalsIgnoreCase(event.getInventory().getName()))
|
||||
if (isPlayerInShop(event.getWhoClicked()))
|
||||
{
|
||||
_playerPageMap.get(event.getWhoClicked().getName()).playerClicked(event);
|
||||
event.setCancelled(true);
|
||||
ShopPageBase<?,?> page = getOpeningPageForPlayer(event.getWhoClicked());
|
||||
|
||||
if (page.matchesInventory(event.getInventory()))
|
||||
{
|
||||
_playerPageMap.get(event.getWhoClicked().getName()).playerClicked(event);
|
||||
|
||||
if (event.getRawSlot() < page.getSize())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +248,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
|
||||
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> buildPagesFor(Player player);
|
||||
|
||||
public boolean isPlayerInShop(Player player)
|
||||
public boolean isPlayerInShop(HumanEntity player)
|
||||
{
|
||||
return _playerPageMap.containsKey(player.getName());
|
||||
}
|
||||
|
@ -135,27 +135,25 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
|
||||
|
||||
public void playerClicked(InventoryClickEvent event)
|
||||
{
|
||||
if (_buttonMap.containsKey(event.getRawSlot()))
|
||||
int rawSlot = event.getRawSlot();
|
||||
|
||||
if (_buttonMap.containsKey(rawSlot))
|
||||
{
|
||||
_buttonMap.get(event.getRawSlot()).onClick(_player, event.getClick());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (event.getRawSlot() != -999)
|
||||
else if (rawSlot != -999 && rawSlot < inventory.getSize())
|
||||
{
|
||||
if (event.getRawSlot() < inventory.getSize())
|
||||
{
|
||||
playDenySound(_player);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
playDenySound(_player);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean matchesInventory(Inventory newInventory)
|
||||
public boolean matchesInventory(Inventory newInventory)
|
||||
{
|
||||
return newInventory.getTitle() == inventory.getInventoryName();
|
||||
return getName().equalsIgnoreCase(newInventory.getName());
|
||||
}
|
||||
|
||||
|
||||
public void playerOpened()
|
||||
{
|
||||
|
||||
|
@ -116,7 +116,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
private Teleport _teleport;
|
||||
private ConditionManager _condition;
|
||||
private ClassCombatShop _classShop;
|
||||
|
||||
private ClassManager _classManager;
|
||||
public ClassManager getClassManager() { return _classManager; }
|
||||
|
||||
private WarManager _warManager;
|
||||
private ProjectileManager _projectileManager;
|
||||
private WorldEventManager _worldEvent;
|
||||
|
@ -4,6 +4,8 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -43,6 +45,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
@ -71,6 +74,23 @@ public class Gameplay extends MiniPlugin
|
||||
_foodDecrease = new WeightSet<Boolean>(new Weight<Boolean>(10, true), new Weight<Boolean>(90, false));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onBowShoot(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player) event.getEntity();
|
||||
ClientClass playerClass = _clansManager.getClassManager().Get(player);
|
||||
|
||||
if (!playerClass.IsGameClass(ClassType.Assassin, ClassType.Ranger))
|
||||
{
|
||||
notify(player, "You cannot use bows without the proper class!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BucketEmpty(PlayerBucketEmptyEvent event)
|
||||
{
|
||||
@ -591,4 +611,9 @@ public class Gameplay extends MiniPlugin
|
||||
{
|
||||
return _damageManager;
|
||||
}
|
||||
|
||||
public static void notify(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", message));
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,11 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
|
||||
|
||||
public class CombatLogNPC
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.game.clans.items.smelting;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -19,7 +21,7 @@ public class Smelter
|
||||
player.getInventory().setItemInHand(returns);
|
||||
}
|
||||
|
||||
// TODO: Notify player of smelt success/failure?
|
||||
notify(player, "You have successfully smelted your item!");
|
||||
}
|
||||
|
||||
public static ItemStack smeltItem(ItemStack item)
|
||||
@ -109,4 +111,9 @@ public class Smelter
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void notify(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Smelter", message));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public abstract class ClansShopPage<T extends ShopBase<ClansManager>> extends ShopPageBase<ClansManager, T>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin
|
||||
* @param shop
|
||||
* @param clientManager
|
||||
* @param donationManager
|
||||
* @param name
|
||||
* @param player
|
||||
* @param slots
|
||||
*/
|
||||
public ClansShopPage(ClansManager plugin, T shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, String name, Player player, int slots)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, slots);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin
|
||||
* @param shop
|
||||
* @param clientManager
|
||||
* @param donationManager
|
||||
* @param name
|
||||
* @param player
|
||||
*/
|
||||
public ClansShopPage(ClansManager plugin, T shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
||||
{
|
||||
addShopItem(slot, material, buyPrice, sellPrice, Clans.prettifyName(material));
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data)
|
||||
{
|
||||
addShopItem(slot, material, buyPrice, sellPrice, Clans.prettifyName(material));
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, String displayName)
|
||||
{
|
||||
addShopItem(slot, material, buyPrice, sellPrice, (byte)0, displayName, 1);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data, String displayName, int amount)
|
||||
{
|
||||
PvpItem item = new PvpItem(material, data, 1, displayName, buyPrice, sellPrice, 64);
|
||||
addButton(slot, item, new ShopItemButton<ClansShopPage<?>>(this, buyPrice, sellPrice, material, data, amount));
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.InventoryUtil;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class PvpShopButton<PageType extends ShopPageBase<ClansManager, ?>> implements IButton
|
||||
{
|
||||
protected PageType Page;
|
||||
protected PvpItem Item;
|
||||
|
||||
public PvpShopButton(PageType page, PvpItem item)
|
||||
{
|
||||
Page = page;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
int balance = Page.getDonationManager().Get(player.getName()).getGold();
|
||||
int cost = Item.getPrice();
|
||||
int tempAmount = Item.getAmount();
|
||||
|
||||
if (clickType == ClickType.SHIFT_LEFT)
|
||||
{
|
||||
cost *= Item.getBulkCount() == -1 ? 1 : Item.getBulkCount();
|
||||
tempAmount = Item.getBulkCount() == -1 ? Item.getAmount() : Item.getBulkCount();
|
||||
}
|
||||
|
||||
final int deliveryAmount = tempAmount;
|
||||
|
||||
if (clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT)
|
||||
{
|
||||
if (cost > balance)
|
||||
{
|
||||
Page.playDenySound(player);
|
||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "You do not have enough funds to purchase " + deliveryAmount + " " + Item.GetName() + "."));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Page.getDonationManager().rewardGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean result)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
Page.playAcceptSound(player);
|
||||
ShopItem item = Item.clone();
|
||||
item.setAmount(deliveryAmount);
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Item.getType(), Item.getData().getData(), Item.getAmount(), Item.GetName(), new String[] {}, player.getName() + " Shop", false));
|
||||
}
|
||||
else
|
||||
{
|
||||
Page.playDenySound(player);
|
||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your purchase."));
|
||||
}
|
||||
}
|
||||
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), -cost);
|
||||
}
|
||||
}
|
||||
else if (clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT)
|
||||
{
|
||||
int removed = 1;
|
||||
ItemStack dumbItem = new ItemStack(Item.getType(), Item.getAmount(), Item.getDurability());
|
||||
|
||||
if (InventoryUtil.first((CraftInventory)player.getInventory(), 36, dumbItem, true) == -1)
|
||||
{
|
||||
Page.playDenySound(player);
|
||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "You do not have " + deliveryAmount + " " + Item.GetName() + " in your inventory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clickType == ClickType.RIGHT)
|
||||
{
|
||||
if (player.getInventory().contains(Item.getType(), Item.getAmount()))
|
||||
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, dumbItem);
|
||||
}
|
||||
else
|
||||
removed = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, dumbItem);
|
||||
|
||||
final int creditAmount = removed * Item.getPrice() / 2;
|
||||
System.out.println("Crediting " + player.getName() + " with " + creditAmount + " gold.");
|
||||
Page.getDonationManager().rewardGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean result)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
Page.playAcceptSound(player);
|
||||
System.out.println("Credited " + player.getName() + " with " + creditAmount + " gold.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Page.playDenySound(player);
|
||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your return."));
|
||||
}
|
||||
}
|
||||
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), creditAmount);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.shop;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -18,15 +19,20 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
{
|
||||
private int _buyPrice;
|
||||
private int _sellPrice;
|
||||
private ItemStack _item;
|
||||
private T _page;
|
||||
private PvpItem _item;
|
||||
|
||||
public ShopItemButton(T page, PvpItem item, int buyPrice, int sellPrice)
|
||||
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material, byte data, int amount)
|
||||
{
|
||||
_page = page;
|
||||
_item = item;
|
||||
_sellPrice = sellPrice;
|
||||
_buyPrice = buyPrice;
|
||||
_item = new ItemStack(material, amount, data);
|
||||
}
|
||||
|
||||
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material)
|
||||
{
|
||||
this(page, buyPrice, sellPrice, material, (byte)0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,9 +43,8 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)
|
||||
{
|
||||
int amount = 1; // # of items removed/sold from inventory
|
||||
ItemStack dumbItem = new ItemStack(_item.getType(), amount);
|
||||
|
||||
if (!hasItem(player, dumbItem))
|
||||
if (!hasItem(player, _item))
|
||||
{
|
||||
_page.playDenySound(player);
|
||||
notify(player, "You do not have any of the appropriate item in your inventory!");
|
||||
@ -48,11 +53,11 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
|
||||
if (shiftClick)
|
||||
{
|
||||
amount = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, dumbItem);
|
||||
amount = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, _item);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, dumbItem);
|
||||
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, _item);
|
||||
}
|
||||
|
||||
int reward = amount * _sellPrice;
|
||||
@ -108,7 +113,8 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
|
||||
private void giftItem(Player player, int amount)
|
||||
{
|
||||
ItemStack item = new ItemStack(_item.getType(), amount);
|
||||
ItemStack item = _item.clone();
|
||||
item.setAmount(amount);
|
||||
player.getInventory().addItem(item);
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,6 @@ import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.PvpShopButton;
|
||||
import mineplex.game.clans.shop.building.BuildingPage;
|
||||
|
||||
public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
||||
{
|
||||
@ -120,11 +117,6 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
||||
ShopItem shopItem = new ShopItem(Material.GOLD_RECORD, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
||||
addButton(3, shopItem, button);
|
||||
}
|
||||
|
||||
public void addPvpItem(int slot, PvpItem item)
|
||||
{
|
||||
addButton(slot, item, new PvpShopButton<BankPage>(this, item));
|
||||
}
|
||||
|
||||
public boolean hasEnoughGold()
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ public class CashInButton implements IButton
|
||||
GoldToken token = (GoldToken) cursorItem;
|
||||
GoldManager.getInstance().cashIn(player, token);
|
||||
player.setItemOnCursor(null); // Delete the gold token on cursor
|
||||
_page.playAcceptSound(player);
|
||||
_page.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -5,11 +5,13 @@ import org.bukkit.Material;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.shop.ClansShopPage;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.PvpShopButton;
|
||||
import mineplex.game.clans.shop.ShopItemButton;
|
||||
|
||||
public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
||||
public class BuildingPage extends ClansShopPage<BuildingShop>
|
||||
{
|
||||
public BuildingPage(ClansManager plugin, BuildingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||
{
|
||||
@ -21,29 +23,24 @@ public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addPvpItem(1, new PvpItem(Material.STONE, (byte)0, 1, "Stone", 100, 20, 64));
|
||||
addPvpItem(2, new PvpItem(Material.SMOOTH_BRICK, (byte)0, 1, "Stone Bricks", 100, 20, 64));
|
||||
addPvpItem(3, new PvpItem(Material.SMOOTH_BRICK, (byte)2, 1, "Cracked Stone Bricks", 25, 5, 64));
|
||||
addPvpItem(4, new PvpItem(Material.COBBLESTONE, (byte)0, 1, "Cobblestone", 25, 5, 64));
|
||||
addShopItem(1, Material.STONE, 100, 20);
|
||||
addShopItem(2, Material.SMOOTH_BRICK, 100, 20);
|
||||
addShopItem(3, Material.SMOOTH_BRICK, 25, 5, (byte)2);
|
||||
addShopItem(4, Material.COBBLESTONE, 25, 5);
|
||||
|
||||
addPvpItem(10, new PvpItem(Material.LOG, (byte)0, 1, "Oak Wood", 50, 10, 64));
|
||||
addPvpItem(11, new PvpItem(Material.LOG, (byte)1, 1, "Spruce Wood", 50, 10, 64));
|
||||
addPvpItem(12, new PvpItem(Material.LOG, (byte)2, 1, "Birch Wood", 50, 10, 64));
|
||||
addPvpItem(13, new PvpItem(Material.LOG, (byte)3, 1, "Jungle Wood", 50, 10, 64));
|
||||
addPvpItem(14, new PvpItem(Material.LOG_2, (byte)0, 1, "Acacia Wood", 50, 10, 64));
|
||||
addPvpItem(15, new PvpItem(Material.LOG_2, (byte)1, 1, "Dark Oak Wood", 50, 10, 64));
|
||||
addShopItem(10, Material.LOG, 50, 10, (byte) 0);
|
||||
addShopItem(11, Material.LOG, 50, 10, (byte) 1);
|
||||
addShopItem(12, Material.LOG, 50, 10, (byte) 2);
|
||||
addShopItem(13, Material.LOG, 50, 10, (byte) 3);
|
||||
addShopItem(14, Material.LOG_2, 50, 10, (byte) 0);
|
||||
addShopItem(15, Material.LOG_2, 50, 10, (byte) 1);
|
||||
|
||||
addPvpItem(19, new PvpItem(Material.SAND, (byte)0, 1, "Sand", 20, 4, 64));
|
||||
addPvpItem(20, new PvpItem(Material.GLASS, (byte)0, 1, "Glass", 30, 6, 64));
|
||||
addPvpItem(21, new PvpItem(Material.SANDSTONE, (byte)0, 1, "Sandstone", 80, 16, 64));
|
||||
addPvpItem(22, new PvpItem(Material.DIRT, (byte)0, 1, "Dirt", 10, 2, 64));
|
||||
addPvpItem(23, new PvpItem(Material.NETHER_BRICK, (byte)0, 1, "Netherbrick", 50, 10, 64));
|
||||
addPvpItem(24, new PvpItem(Material.QUARTZ_BLOCK, (byte)0, 1, "Quartz Block", 75, 15, 64));
|
||||
addPvpItem(25, new PvpItem(Material.CLAY, (byte)0, 1, "Clay Block", 30, 6, 64));
|
||||
}
|
||||
|
||||
public void addPvpItem(int slot, PvpItem item)
|
||||
{
|
||||
addButton(slot, item, new PvpShopButton<BuildingPage>(this, item));
|
||||
addShopItem(19, Material.SAND, 20, 4);
|
||||
addShopItem(20, Material.GLASS, 30, 6);
|
||||
addShopItem(21, Material.SANDSTONE, 80, 16);
|
||||
addShopItem(22, Material.DIRT, 10, 2);
|
||||
addShopItem(23, Material.NETHER_BRICK, 50, 10);
|
||||
addShopItem(24, Material.QUARTZ_BLOCK, 75, 15);
|
||||
addShopItem(25, Material.CLAY, 30, 6);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,12 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.shop.ClansShopPage;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.ShopItemButton;
|
||||
import mineplex.game.clans.shop.mining.MiningShop;
|
||||
|
||||
public class FarmingPage extends ShopPageBase<ClansManager, FarmingShop>
|
||||
public class FarmingPage extends ClansShopPage<FarmingShop>
|
||||
{
|
||||
public FarmingPage(ClansManager plugin, FarmingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||
{
|
||||
@ -38,10 +40,4 @@ public class FarmingPage extends ShopPageBase<ClansManager, FarmingShop>
|
||||
addShopItem(15, Material.ROTTEN_FLESH, 5, 5);
|
||||
addShopItem(16, Material.SPIDER_EYE, 5, 5);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
||||
{
|
||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
||||
addButton(slot, item, new ShopItemButton<FarmingPage>(this, item, buyPrice, sellPrice));
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,11 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.shop.ClansShopPage;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.ShopItemButton;
|
||||
|
||||
public class MiningPage extends ShopPageBase<ClansManager, MiningShop>
|
||||
public class MiningPage extends ClansShopPage<MiningShop>
|
||||
{
|
||||
public MiningPage(ClansManager plugin, MiningShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||
{
|
||||
@ -30,10 +31,4 @@ public class MiningPage extends ShopPageBase<ClansManager, MiningShop>
|
||||
addShopItem(6, Material.REDSTONE, 10, 2);
|
||||
addShopItem(7, Material.LAPIS_BLOCK, 500, 100);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
||||
{
|
||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
||||
addButton(slot, item, new ShopItemButton<MiningPage>(this, item, buyPrice, sellPrice));
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,10 @@ import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.PvpShopButton;
|
||||
import mineplex.game.clans.shop.ClansShopPage;
|
||||
|
||||
public class PvpPage extends ShopPageBase<ClansManager, PvpShop>
|
||||
public class PvpPage extends ClansShopPage<PvpShop>
|
||||
{
|
||||
public PvpPage(ClansManager plugin, PvpShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||
{
|
||||
@ -21,49 +19,45 @@ public class PvpPage extends ShopPageBase<ClansManager, PvpShop>
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addPvpItem(9, new PvpItem(Material.GOLD_HELMET, (byte)0, 1, "Mage Helmet", 875, 175, 4));
|
||||
addPvpItem(18, new PvpItem(Material.GOLD_CHESTPLATE, (byte)0, 1, "Mage Chestplate", 1400, 280, 4));
|
||||
addPvpItem(27, new PvpItem(Material.GOLD_LEGGINGS, (byte)0, 1, "Mage Leggings", 1225, 245, 4));
|
||||
addPvpItem(36, new PvpItem(Material.GOLD_BOOTS, (byte)0, 1, "Mage Boots", 700, 140, 4));
|
||||
|
||||
addPvpItem(10, new PvpItem(Material.LEATHER_HELMET, (byte)0, 1, "Assassin Helmet", 625, 125, 4));
|
||||
addPvpItem(19, new PvpItem(Material.LEATHER_CHESTPLATE, (byte)0, 1, "Assassin Chestplate", 1000, 200, 4));
|
||||
addPvpItem(28, new PvpItem(Material.LEATHER_LEGGINGS, (byte)0, 1, "Assassin Leggings", 875, 125, 4));
|
||||
addPvpItem(37, new PvpItem(Material.LEATHER_BOOTS, (byte)0, 1, "Assassin Boots", 500, 100, 4));
|
||||
|
||||
addPvpItem(11, new PvpItem(Material.CHAINMAIL_HELMET, (byte)0, 1, "Ranger Helmet", 750, 150, 4));
|
||||
addPvpItem(20, new PvpItem(Material.CHAINMAIL_CHESTPLATE, (byte)0, 1, "Ranger Chestplate", 1200, 240, 4));
|
||||
addPvpItem(29, new PvpItem(Material.CHAINMAIL_LEGGINGS, (byte)0, 1, "Ranger Leggings", 1050, 210, 4));
|
||||
addPvpItem(38, new PvpItem(Material.CHAINMAIL_BOOTS, (byte)0, 1, "Ranger Boots", 600, 120, 4));
|
||||
addShopItem(9, Material.GOLD_HELMET, 875, 175, "Mage Helmet");
|
||||
addShopItem(18, Material.GOLD_CHESTPLATE, 1400, 280, "Mage Chestplate");
|
||||
addShopItem(27, Material.GOLD_LEGGINGS, 1225, 245, "Mage Leggings");
|
||||
addShopItem(36, Material.GOLD_BOOTS, 700, 140, "Mage Boots");
|
||||
|
||||
addPvpItem(12, new PvpItem(Material.IRON_HELMET, (byte)0, 1, "Knight Helmet", 750, 150, 4));
|
||||
addPvpItem(21, new PvpItem(Material.IRON_CHESTPLATE, (byte)0, 1, "Knight Chestplate", 1200, 240, 4));
|
||||
addPvpItem(30, new PvpItem(Material.IRON_LEGGINGS, (byte)0, 1, "Knight Leggings", 1050, 210, 4));
|
||||
addPvpItem(39, new PvpItem(Material.IRON_BOOTS, (byte)0, 1, "Knight Boots", 600, 120, 4));
|
||||
addShopItem(10, Material.LEATHER_HELMET, 625, 125, "Assassin Helmet");
|
||||
addShopItem(19, Material.LEATHER_CHESTPLATE, 1000, 200, "Assassin Chestplate");
|
||||
addShopItem(28, Material.LEATHER_LEGGINGS, 875, 125, "Assassin Leggings");
|
||||
addShopItem(37, Material.LEATHER_BOOTS, 500, 100, "Assassin Boots");
|
||||
|
||||
addPvpItem(13, new PvpItem(Material.DIAMOND_HELMET, (byte)0, 1, "Brute Helmet", 1000, 200, 4));
|
||||
addPvpItem(22, new PvpItem(Material.DIAMOND_CHESTPLATE, (byte)0, 1, "Brute Chestplate", 1600, 320, 4));
|
||||
addPvpItem(31, new PvpItem(Material.DIAMOND_LEGGINGS, (byte)0, 1, "Brute Leggings", 1400, 280, 4));
|
||||
addPvpItem(40, new PvpItem(Material.DIAMOND_BOOTS, (byte)0, 1, "Brute Boots", 800, 160, 4));
|
||||
|
||||
addPvpItem(15, new PvpItem(Material.IRON_SWORD, (byte)0, 1, "Iron Sword", 320, 160, 4));
|
||||
addPvpItem(16, new PvpItem(Material.DIAMOND_SWORD, (byte)0, 1, "Power Sword", 800, 400, 4));
|
||||
addPvpItem(17, new PvpItem(Material.GOLD_SWORD, (byte)0, 1, "Booster Sword", 800, 400, 4));
|
||||
|
||||
addPvpItem(24, new PvpItem(Material.IRON_AXE, (byte)0, 1, "Iron Axe", 470, 95, 4));
|
||||
addPvpItem(25, new PvpItem(Material.DIAMOND_AXE, (byte)0, 1, "Power Axe", 800, 400, 4));
|
||||
addPvpItem(26, new PvpItem(Material.GOLD_AXE, (byte)0, 1, "Booster Axe", 800, 400, 4));
|
||||
|
||||
addPvpItem(33, new PvpItem(Material.BOW, (byte)0, 1, "Standard Bow", 175, 35, 4));
|
||||
addPvpItem(34, new PvpItem(Material.ARROW, (byte)0, 16, "Arrows", 10, 2));
|
||||
addShopItem(11, Material.CHAINMAIL_HELMET, 750, 150, "Ranger Helmet");
|
||||
addShopItem(20, Material.CHAINMAIL_CHESTPLATE, 1200, 240, "Ranger Chestplate");
|
||||
addShopItem(29, Material.CHAINMAIL_LEGGINGS, 1050, 210, "Ranger Leggings");
|
||||
addShopItem(38, Material.CHAINMAIL_BOOTS, 600, 120, "Ranger Boots");
|
||||
|
||||
addPvpItem(51, new PvpItem(Material.ENCHANTMENT_TABLE, (byte)0, 1, "Class Shop", 30000));
|
||||
addPvpItem(52, new PvpItem(Material.TNT, (byte)0, 1, "TNT", 30000, 1));
|
||||
addPvpItem(53, new PvpItem(Material.BREWING_STAND_ITEM, (byte)0, 1, "TNT Generator", 300000));
|
||||
addShopItem(12, Material.IRON_HELMET, 750, 150, "Knight Helmet");
|
||||
addShopItem(21, Material.IRON_CHESTPLATE, 1200, 240, "Knight Chestplate");
|
||||
addShopItem(30, Material.IRON_LEGGINGS, 1050, 210, "Knight Leggings");
|
||||
addShopItem(39, Material.IRON_BOOTS, 600, 120, "Knight Boots");
|
||||
|
||||
addShopItem(13, Material.DIAMOND_HELMET, 1000, 200, "Brute Helmet");
|
||||
addShopItem(22, Material.DIAMOND_CHESTPLATE, 1600, 320, "Brute Chestplate");
|
||||
addShopItem(31, Material.DIAMOND_LEGGINGS, 1400, 280, "Brute Leggings");
|
||||
addShopItem(40, Material.DIAMOND_BOOTS, 800, 160, "Brute Boots");
|
||||
|
||||
addShopItem(15, Material.IRON_SWORD, 320, 160, "Iron Sword");
|
||||
addShopItem(16, Material.DIAMOND_SWORD, 800, 400, "Power Sword");
|
||||
addShopItem(17, Material.GOLD_SWORD, 800, 400, "Booster Sword");
|
||||
|
||||
addShopItem(24, Material.IRON_AXE, 470, 95, "Iron Axe");
|
||||
addShopItem(25, Material.DIAMOND_AXE, 800, 400, "Power Axe");
|
||||
addShopItem(26, Material.GOLD_AXE, 800, 400, "Booster Axe");
|
||||
|
||||
addShopItem(33, Material.BOW, 175, 35, "Standard Bow");
|
||||
addShopItem(34, Material.ARROW, 10, 2, (byte)0, "Arrows", 16);
|
||||
|
||||
//addPvpItem(51, new PvpItem(Material.ENCHANTMENT_TABLE, (byte)0, 1, "Class Shop", 30000));
|
||||
//addPvpItem(52, new PvpItem(Material.TNT, (byte)0, 1, "TNT", 30000, 1));
|
||||
//addPvpItem(53, new PvpItem(Material.BREWING_STAND_ITEM, (byte)0, 1, "TNT Generator", 300000));
|
||||
}
|
||||
|
||||
public void addPvpItem(int slot, PvpItem item)
|
||||
{
|
||||
addButton(slot, item, new PvpShopButton<PvpPage>(this, item));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.spawn;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -30,6 +31,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -45,6 +47,7 @@ public class Spawn extends MiniPlugin
|
||||
public static final int SPAWN_RADIUS = 32;
|
||||
public static final int SHOP_RADIUS = 48;
|
||||
public static final String COMBAT_TAG_NAME = "Unsafe";
|
||||
public static final long COMBAT_TAG_DURATION = 15000;
|
||||
|
||||
private static Spawn _instance;
|
||||
public static Spawn getInstance() { return _instance; }
|
||||
@ -103,14 +106,20 @@ public class Spawn extends MiniPlugin
|
||||
if (_clansManager.getClanUtility().isSafe(cur.getLocation()))
|
||||
{
|
||||
long lastDamager = _clansManager.getCombatManager().Get(cur).GetLastCombat();
|
||||
|
||||
if (!UtilTime.elapsed(lastDamager, 15000))
|
||||
long duration = System.currentTimeMillis() - lastDamager;
|
||||
|
||||
if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION))
|
||||
{
|
||||
UtilPlayer.message(cur, F.main("Safe Zone", "You are not safe for " +
|
||||
F.time(UtilTime.convertString(15000 - (System.currentTimeMillis() - lastDamager), 1, TimeUnit.FIT))));
|
||||
|
||||
String message = ChatColor.RED + "Unsafe for "
|
||||
+ ChatColor.YELLOW + F.time(UtilTime.convertString(COMBAT_TAG_DURATION - duration, 1, TimeUnit.FIT));
|
||||
|
||||
UtilTextMiddle.display(null, message, 0, 20, 0, cur);
|
||||
_clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true);
|
||||
}
|
||||
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 600))
|
||||
{
|
||||
UtilTextMiddle.display(null, ChatColor.GREEN + "Safe!", 0, 60, 20, cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,8 +200,6 @@ public class Spawn extends MiniPlugin
|
||||
{
|
||||
int size = event.getDrops().size();
|
||||
event.getDrops().clear();
|
||||
|
||||
System.out.println("Cleared " + size + " to " + event.getDrops().size());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -209,11 +216,9 @@ public class Spawn extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (isInSpawn(event.getBlock().getLocation()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (isInSpawn(event.getPlayer()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
|
||||
|
||||
if (isInSpawn(event.getBlock().getLocation()) || isInSpawn(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -6,10 +6,7 @@ import org.bukkit.Material;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.shop.PvpItem;
|
||||
import mineplex.game.clans.shop.PvpShopButton;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
|
||||
|
@ -474,13 +474,21 @@ public class ClientClass
|
||||
{
|
||||
return _gameClass;
|
||||
}
|
||||
|
||||
public boolean IsGameClass(ClassType type)
|
||||
|
||||
public boolean IsGameClass(ClassType... types)
|
||||
{
|
||||
if (GetGameClass() == null)
|
||||
return false;
|
||||
|
||||
for (ClassType type : types)
|
||||
{
|
||||
if (type == GetGameClass().GetType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return GetGameClass().GetType() == type;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Collection<ISkill> GetSkills()
|
||||
|
@ -100,7 +100,7 @@ public class HeavyArrows extends Skill
|
||||
if (level == 0) return;
|
||||
|
||||
//Knockback
|
||||
event.AddKnockback(GetName(), 1.1 + (0.1 * level));
|
||||
event.AddKnockback(GetName(), 0.55d + (0.1 * level));
|
||||
event.AddMod(GetName(), GetName(), 1 + level, true);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public abstract class WorldEvent implements Listener
|
||||
private List<EventCreature> _creatures;
|
||||
// Block Restore
|
||||
private BlockRestoreMap _blocks;
|
||||
private boolean _instantSchematic;
|
||||
private boolean _isArcade;
|
||||
private double _difficulty = 1;
|
||||
|
||||
public WorldEvent(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager, String name,
|
||||
@ -99,9 +99,9 @@ public abstract class WorldEvent implements Listener
|
||||
_difficulty = difficulty;
|
||||
}
|
||||
|
||||
public void setInstantSchematic(boolean instantSchematic)
|
||||
public void setArcadeGame(boolean isArcade)
|
||||
{
|
||||
_instantSchematic = instantSchematic;
|
||||
_isArcade = isArcade;
|
||||
}
|
||||
|
||||
public void loadMap()
|
||||
@ -289,16 +289,19 @@ public abstract class WorldEvent implements Listener
|
||||
@Override
|
||||
public void run(List<BlockData> data)
|
||||
{
|
||||
for (BlockData blockData : data)
|
||||
if (!_isArcade)
|
||||
{
|
||||
_blocks.addBlockData(blockData);
|
||||
for (BlockData blockData : data)
|
||||
{
|
||||
_blocks.addBlockData(blockData);
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
|
||||
task.setBlocksPerTick(_instantSchematic ? 2000000 : 100);
|
||||
task.setBlocksPerTick(_isArcade ? 2000000 : 100);
|
||||
task.start();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -25,6 +24,7 @@ import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemEarthquake;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemExplodingAura;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemMeleeAttack;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemRupture;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemSlam;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemWallExplode;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
@ -52,6 +52,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
private ArrayList<GolemAbility> _currentAbilities = new ArrayList<GolemAbility>();
|
||||
private double _canCaveIn = 450;
|
||||
private Vector _afkWalk = new Vector();
|
||||
private long _lastSlam;
|
||||
|
||||
public GolemCreature(GolemBoss boss, Location location, double maxHealth)
|
||||
{
|
||||
@ -197,7 +198,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
}
|
||||
}
|
||||
|
||||
{ // Rumble
|
||||
{ // Rupture
|
||||
ArrayList<Player> players = getPlayers(dist, 30);
|
||||
|
||||
if (!players.isEmpty())
|
||||
@ -206,6 +207,15 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
}
|
||||
}
|
||||
|
||||
{ // Slam
|
||||
ArrayList<Player> players = getPlayers(dist, 30);
|
||||
|
||||
if (!players.isEmpty() && UtilTime.elapsed(_lastSlam, 20000))
|
||||
{
|
||||
weight.put(GolemSlam.class, 6);
|
||||
}
|
||||
}
|
||||
|
||||
if (_canCaveIn <= 0) // Cave in
|
||||
{
|
||||
ArrayList<Player> players = getPlayers(dist, 30);
|
||||
@ -318,10 +328,14 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
{
|
||||
_canCaveIn = 450;
|
||||
}
|
||||
else if (ability instanceof GolemSlam)
|
||||
{
|
||||
_lastSlam = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(ability, _boss.getPlugin());
|
||||
|
||||
// Bukkit.broadcastMessage("Ability: " + _currentAbility.getClass().getSimpleName());
|
||||
// Bukkit.broadcastMessage("Prepare fair maidens for " + ability.getClass().getSimpleName() + "!");
|
||||
|
||||
System.out.print("Golem boss is using " + ability.getClass().getSimpleName());
|
||||
|
||||
|
@ -34,6 +34,7 @@ import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -215,6 +216,15 @@ public class GolemCaveIn extends GolemAbility
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysics(BlockPhysicsEvent event)
|
||||
{
|
||||
if (_blocks.contains(event.getBlock()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
@ -243,23 +253,6 @@ public class GolemCaveIn extends GolemAbility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blocks = UtilShapes.getSphereBlocks(l, 3, 3, true);
|
||||
|
||||
for (Location loc : blocks)
|
||||
{
|
||||
if (loc.getBlockY() >= l.getBlockY())
|
||||
{
|
||||
Block b = loc.getBlock();
|
||||
|
||||
if (b.getType() == Material.AIR)
|
||||
{
|
||||
_blocks.add(b);
|
||||
|
||||
b.setType(Material.FENCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_tick % 5 == 0)
|
||||
|
@ -105,7 +105,7 @@ public class GolemExplodingAura extends GolemAbility
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if (_tick < 25 * 25)
|
||||
if (_tick < 25 * 25 && getGolem().getHealth() > 30)
|
||||
{
|
||||
double angle = (2 * Math.PI) / UtilMath.random.nextDouble();
|
||||
double x = 1.7 * Math.cos(angle);
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftIronGolem;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -36,6 +37,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
|
||||
public class GolemRupture extends GolemAbility
|
||||
{
|
||||
@ -191,6 +193,12 @@ public class GolemRupture extends GolemAbility
|
||||
target.setY(loc.getY());
|
||||
|
||||
_ruptures.add(new HashMap.SimpleEntry(loc, target));
|
||||
|
||||
UtilEnt.CreatureLook(getEntity(), player.getLocation());
|
||||
|
||||
EntityIronGolem golem = ((CraftIronGolem) getEntity()).getHandle();
|
||||
|
||||
golem.world.broadcastEntityEffect(golem, (byte) 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1,259 @@
|
||||
package mineplex.minecraft.game.core.boss.ironwizard.abilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemSlam extends GolemAbility
|
||||
{
|
||||
private ArrayList<Item> _items = new ArrayList<Item>();
|
||||
private int _ticksFinished;
|
||||
private int _stage;
|
||||
private Vector _target;
|
||||
private int _ticksJumped;
|
||||
|
||||
public GolemSlam(GolemCreature creature)
|
||||
{
|
||||
super(creature);
|
||||
|
||||
Player target = getTarget();
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
_target = UtilAlg.calculateVelocity(getLocation().toVector(),
|
||||
target.getLocation().toVector().setY(getLocation().getY()), 2, getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMove()
|
||||
{
|
||||
return !UtilEnt.isGrounded(getEntity()) && _stage == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFinished()
|
||||
{
|
||||
return _stage == 2 && --_ticksFinished <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFinished()
|
||||
{
|
||||
for (Item item : _items)
|
||||
{
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
Entity entity = getEntity();
|
||||
|
||||
if (_stage == 0)
|
||||
{
|
||||
UtilEnt.CreatureLook(getEntity(), getLocation().add(_target));
|
||||
|
||||
entity.getWorld().playSound(entity.getLocation(), Sound.IRONGOLEM_THROW, 4, 0);
|
||||
|
||||
entity.setVelocity(_target);
|
||||
_stage++;
|
||||
}
|
||||
else if (_stage == 1)
|
||||
{
|
||||
_ticksJumped++;
|
||||
|
||||
if (_ticksJumped > 4 && getLocation().subtract(0, 0.2, 0).getBlock().getType() != Material.AIR)
|
||||
{
|
||||
explodeRupture(getLocation());
|
||||
|
||||
_stage = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HopperPickup(InventoryPickupItemEvent event)
|
||||
{
|
||||
if (_items.contains(event.getItem()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ItemDestroy(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_items.isEmpty())
|
||||
return;
|
||||
|
||||
Iterator<Item> itemIterator = _items.iterator();
|
||||
|
||||
while (itemIterator.hasNext())
|
||||
{
|
||||
Item item = itemIterator.next();
|
||||
|
||||
if (item.isDead() || !item.isValid())
|
||||
{
|
||||
item.remove();
|
||||
itemIterator.remove();
|
||||
}
|
||||
else if (UtilEnt.isGrounded(item) || item.getTicksLived() > 60)
|
||||
{
|
||||
item.getWorld().playEffect(item.getLocation(), Effect.STEP_SOUND, item.getItemStack().getTypeId());
|
||||
item.remove();
|
||||
itemIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inProgress()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getTarget()
|
||||
{
|
||||
Player target = null;
|
||||
double dist = 0;
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(getLocation(), 30, true))
|
||||
{
|
||||
if (!player.hasLineOfSight(getEntity()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double d = player.getLocation().distance(getLocation());
|
||||
|
||||
if (d < 10)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target == null || dist > d)
|
||||
{
|
||||
target = player;
|
||||
dist = d;
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
private void explodeRupture(Location loc)
|
||||
{
|
||||
loc.add(0, 1.1, 0);
|
||||
loc.setX(loc.getBlockX() + 0.5);
|
||||
loc.setZ(loc.getBlockZ() + 0.5);
|
||||
|
||||
// Fling
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(loc, 3.5);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (cur.equals(getEntity()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Velocity
|
||||
UtilAction.velocity(cur,
|
||||
UtilAlg.getTrajectory2d(loc.toVector().add(new Vector(0.5, 0, 0.5)), cur.getLocation().toVector()),
|
||||
0.8 + 0.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.4, true);
|
||||
|
||||
// Condition
|
||||
getGolem().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
|
||||
|
||||
// Damage Event
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
|
||||
4 * getGolem().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
|
||||
}
|
||||
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
for (int x = -3; x <= 3; x++)
|
||||
{
|
||||
for (int z = -3; z <= 3; z++)
|
||||
{
|
||||
for (int y = 0; y <= 1; y++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (Math.sqrt(x * x + z * z + y * y) <= 3)
|
||||
{
|
||||
blocks.add(loc.clone().add(x, y, z).getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.shuffle(blocks);
|
||||
|
||||
// Blocks
|
||||
int done = 0;
|
||||
Iterator<Block> itel = blocks.iterator();
|
||||
|
||||
while (done < 30 && itel.hasNext())
|
||||
{
|
||||
Block block = itel.next();
|
||||
|
||||
Vector vec = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize();
|
||||
|
||||
if (!UtilBlock.airFoliage(block))
|
||||
continue;
|
||||
|
||||
// Add Directional
|
||||
vec.add(UtilAlg.getTrajectory(loc.getBlock().getLocation(), block.getLocation().add(0.5, 0, 0.5)));
|
||||
|
||||
// Add Up
|
||||
vec.add(new Vector(0, 1.6, 0));
|
||||
|
||||
vec.normalize();
|
||||
|
||||
// Scale
|
||||
vec.multiply(0.1 + 0.3 * Math.random() + 0.6);
|
||||
|
||||
// Block!
|
||||
Item item = loc.getWorld().dropItem(block.getLocation().add(0.5, 0, 0.5), new ItemStack(Material.DIRT.getId(), 0));
|
||||
item.setVelocity(vec);
|
||||
item.setPickupDelay(50000);
|
||||
_items.add(item);
|
||||
|
||||
// Effect
|
||||
loc.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.DIRT.getId());
|
||||
|
||||
done++;
|
||||
}
|
||||
|
||||
_ticksFinished = 20;
|
||||
}
|
||||
}
|
@ -248,6 +248,8 @@ public class BossBattles extends TeamGame
|
||||
bossDisplay.start();
|
||||
bossDisplay.spawnHologram();
|
||||
|
||||
_displays.add(bossDisplay);
|
||||
|
||||
System.out.print(
|
||||
"Registered " + bossDisplay.getClass().getSimpleName());
|
||||
}
|
||||
@ -327,7 +329,7 @@ public class BossBattles extends TeamGame
|
||||
_currentBoss = createInstance(boss.getBoss(),
|
||||
new Location(WorldData.World, 0, 6, 0));
|
||||
|
||||
_currentBoss.setInstantSchematic(true);
|
||||
_currentBoss.setArcadeGame(true);
|
||||
_currentBoss.setDifficulty(0.6);
|
||||
|
||||
_currentBoss.loadMap();
|
||||
|
Loading…
Reference in New Issue
Block a user