diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index b685072..6d24f5e 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index aab6c0a..9fb6592 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.4.7d1 +version: 3.4.7e commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java new file mode 100644 index 0000000..12ea5e3 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -0,0 +1,68 @@ +package sig.plugin.TwosideKeeper.HelperStructures; + +import java.text.DecimalFormat; + +import org.bukkit.ChatColor; + +public enum ArtifactAbility { + //Enum Structure: + // "Friendly Name", "Description", base value (per point) (-1 means it's a TEMPORARY ability.), decay value (per point), max level, level requirement (The min level required to get this perk) + //Temporary abilities: Work for 1 level and wear off afterward. + + //Weapon Abilities + DAMAGE("Strike","Improves Base Damage by [VAL]",1.0,1.0,100), + ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",1.0,1.0,100,1), + EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",2.0,1.0,100,1), + LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",1.0,1.0,100,1), + + //Armor abilities + DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%",1.0,2.0,100,1), + HEALTH("Health","Increases Maximum Health by [VAL].",1.0,1.0,100,1), + HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",0.5,1.0,100,1), + STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied",0.5,1.0,100,1), + SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consume this ability, removes all debuffs, and leaving you with 1 HP.",-1,0,1,10), + + ; + + String name; + String desc; + double baseval; + double decayval; + int maxlv; + + ArtifactAbility(String name, String desc, double baseval, double decayval, int maxlv) { + this.name=name; + this.desc=desc; + this.baseval=baseval; + this.decayval=decayval; + this.maxlv=maxlv; + } + + public double calculateValue(int lv) { + double sum=0; + for(int i=0;i0) { - //player.sendMessage("How many "+ChatColor.GREEN+shop.GetItemName()+ChatColor.WHITE+" would you like to sell? "+ChatColor.GREEN+"(MAX: "+(shop.GetUnitPrice()*GenericFunctions.CountItems(player, shop.GetItem())<=getPlayerBankMoney(shop.GetOwner())?((GenericFunctions.CountItems(player, shop.GetItem())<=shop.GetAmount())?(GenericFunctions.CountItems(player, shop.GetItem())):shop.GetAmount()):(int)(getPlayerBankMoney(shop.GetOwner())/shop.GetUnitPrice()))+")"); + //player.sendMessage(+ChatColor.GREEN+shop.GetItemName()+ChatColor.WHITE+); - TextComponent message1 = new TextComponent("Creating a shop to buy "); + TextComponent message1 = new TextComponent("How many "); TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+shop.GetItemName()+ChatColor.RESET+""+ChatColor.GREEN+"]"); message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(shop.GetItemName()+WorldShop.GetItemInfo(shop.GetItem())).create())); - TextComponent message3 = new TextComponent("."); + TextComponent message3 = new TextComponent(" would you like to sell? "+ChatColor.GREEN+"(MAX: "+(shop.GetUnitPrice()*GenericFunctions.CountItems(player, shop.GetItem())<=getPlayerBankMoney(shop.GetOwner())?((GenericFunctions.CountItems(player, shop.GetItem())<=shop.GetAmount())?(GenericFunctions.CountItems(player, shop.GetItem())):shop.GetAmount()):(int)(getPlayerBankMoney(shop.GetOwner())/shop.GetUnitPrice()))+")"); TextComponent finalmsg = message1; finalmsg.addExtra(message2); finalmsg.addExtra(message3); @@ -1898,7 +1898,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Initiate buying session. TwosideShops.AddSession(SessionState.SELL, player, s); log("Added a shop session for "+player.getName()+".",4); - shop.sendItemInfo(player); + //shop.sendItemInfo(player); } else { player.sendMessage(ChatColor.GOLD+"Sorry! "+ChatColor.WHITE+"This shop is not buying anymore items! "+ChatColor.LIGHT_PURPLE+shop.GetOwner()+ChatColor.WHITE+" needs to edit the shop!"); } @@ -1997,6 +1997,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TwosideSpleefGames.PassEvent(ev); + if (ev.getBlockPlaced().getType()==Material.CHEST || + ev.getBlockPlaced().getType()==Material.TRAPPED_CHEST) { + //Check for a chest or trapped chest around each side of the block. + for (int x=-1;x<2;x++) { + for (int z=-1;z<2;z++) { + if ((x!=0)^(z!=0) && ev.getBlockPlaced().getLocation().add(x,0,z).getBlock().getType()==ev.getBlockPlaced().getType()) { + //This is the same type of block. Make sure there's no shop sign attached to it. + if (WorldShop.hasShopSignAttached(ev.getBlockPlaced().getLocation().add(x,0,z).getBlock())) { + Sign s = WorldShop.grabShopSign(ev.getBlockPlaced().getLocation().add(x,0,z)); + WorldShop shop = TwosideShops.LoadWorldShopData(s); + if (!shop.GetOwner().equalsIgnoreCase(ev.getPlayer().getName())) { + //This is not allowed! We can't expand shops that are not ours. + ev.getPlayer().sendMessage("There's a shop owned by "+ChatColor.LIGHT_PURPLE+shop.GetOwner()+ChatColor.WHITE+" right next to your chest! You cannot expand others' shops!"); + ev.setCancelled(true); + } + } + } + } + } + } + if (ev.getItemInHand().hasItemMeta() && ev.getItemInHand().getItemMeta().hasLore() && ev.getItemInHand().getItemMeta().getLore().size()==4 && @@ -3210,6 +3231,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //of a new custom damage calculation. DealDamageToMob(p.getInventory().getItemInMainHand(),p,m); if (m instanceof Monster) { + if (m.getType()==EntityType.SPIDER && + p.getEquipment().getItemInMainHand().containsEnchantment(Enchantment.DAMAGE_ARTHROPODS)) { + //Apply just slowness 1 to the spider. Not this slowness IV ridiculousness. + m.removePotionEffect(PotionEffectType.SLOW); + m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,300,0)); + } if (m.getType()==EntityType.ZOMBIE && MonsterController.isZombieLeader(m) && !m.hasPotionEffect(PotionEffectType.GLOWING) /*Make sure it's not being aggro'd already.*/) { @@ -3767,6 +3794,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //This is a world shop. DO NOT allow this to happen. ev.setCancelled(true); } + Inventory destination = ev.getDestination(); + l = destination.getLocation(); + //See if this block is a world shop. + if (WorldShop.grabShopSign(l)!=null) { + //This is a world shop. DO NOT allow this to happen. + ev.setCancelled(true); + } } @EventHandler(priority=EventPriority.LOW) diff --git a/src/sig/plugin/TwosideKeeper/WorldShopManager.java b/src/sig/plugin/TwosideKeeper/WorldShopManager.java index a655cbf..be01bc3 100644 --- a/src/sig/plugin/TwosideKeeper/WorldShopManager.java +++ b/src/sig/plugin/TwosideKeeper/WorldShopManager.java @@ -216,11 +216,11 @@ public class WorldShopManager { sessions.remove(ss); } - public void AddNewPurchase(String owner, Player purchaser, ItemStack item, double price, int amt) { - purchases.add(new ShopPurchase(owner, purchaser, item, price, amt)); + public void AddNewPurchase(String owner, Player purchaser, int shopID, double price, int amt) { + purchases.add(new ShopPurchase(owner, purchaser, shopID, price, amt)); } - public void AddNewPurchase(String owner, Player purchaser, ItemStack item, double price, int amt, boolean sell) { - purchases.add(new ShopPurchase(owner, purchaser, item, price, amt, sell)); + public void AddNewPurchase(String owner, Player purchaser, int shopID, double price, int amt, boolean sell) { + purchases.add(new ShopPurchase(owner, purchaser, shopID, price, amt, sell)); } public boolean PlayerHasPurchases(Player p) { for (int i=0;i