Merge pull request #47 in MIN/mineplex from clans_custom_gear to clans-beta
* commit '5cdf31d0e6bbc2074c12ce270f995301b5184c45': Fix bug where players couldn't move items in their inventory to sell gold tokens to shop. Reduce knockback amount on HeavyArrow skill for Ranger class. Prevent players who do not have the Ranger or Assassin class from being able to shoot bows. Add notification message on Smelting feature to reduce confusion among players. Fix bug with Building shop where the listed sell price and actual sell price weren't synced properly. Fix bug with all shops where purchasing items in bulk failed.
This commit is contained in:
commit
c53963448e
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +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.PvpShopButton;
|
||||
import mineplex.game.clans.shop.ShopItemButton;
|
||||
import mineplex.game.clans.shop.mining.MiningPage;
|
||||
|
||||
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)
|
||||
{
|
||||
@ -44,15 +43,4 @@ public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
||||
addShopItem(24, Material.QUARTZ_BLOCK, 75, 15);
|
||||
addShopItem(25, Material.CLAY, 30, 6);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
||||
{
|
||||
addShopItem(slot, material, buyPrice, sellPrice, (byte) 0);
|
||||
}
|
||||
|
||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data)
|
||||
{
|
||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
||||
addButton(slot, item, new ShopItemButton<BuildingPage>(this, item, buyPrice, sellPrice));
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class Spawn extends MiniPlugin
|
||||
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 + 1000))
|
||||
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 600))
|
||||
{
|
||||
UtilTextMiddle.display(null, ChatColor.GREEN + "Safe!", 0, 60, 20, cur);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user