->Fixed explosion damage to not scale infinitely bsaed on distance.
->Fixed explosion damage calculation. ->Modified Elite Zombie targeting algorithm to follow proper detection rules like regular monsters. ->Fixed a bug that never moved an Elite Zombie's spawn when spawn camping occurred. ->Fixed players from getting kicked from the server on death. ->Tipper Arrows properly display their custom effects when linked now. ->All custom items that used Luck of the Sea just for glowing purposes now hide the enchantment. ->Enchantments on vials properly display now. ->Added CustomPotion class to handle random generation of vials. ->Added setItemTier(),isUpgradeShard(),getUpgradeShardTier(), and setUpgradeShardTier() to API.
This commit is contained in:
parent
645c34a330
commit
698da2eb25
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: TwosideKeeper
|
||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||
version: 3.8.5
|
||||
version: 3.8.5a
|
||||
commands:
|
||||
money:
|
||||
description: Tells the player the amount of money they are holding.
|
||||
|
@ -995,9 +995,11 @@ public class CustomDamage {
|
||||
if (p!=null) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.iframetime=0;
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,1,1), true);
|
||||
p.removePotionEffect(PotionEffectType.GLOWING);
|
||||
int level = GenericFunctions.getPotionEffectLevel(PotionEffectType.NIGHT_VISION, p);
|
||||
if (level==64) {
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,1,1), true);
|
||||
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
}
|
||||
}
|
||||
|
@ -311,12 +311,14 @@ public class EliteMonster {
|
||||
}
|
||||
|
||||
private void retargetInAir() {
|
||||
if (Math.random()<=0.02) {
|
||||
if (Math.random()<=0.08 ) {
|
||||
Player p = ChooseRandomTarget();
|
||||
//p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,20*5,-31));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,20*5,-1));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*1,7));
|
||||
if (Math.random()<=0.25) {
|
||||
m.setTarget(p);
|
||||
}
|
||||
p.setFlying(false);
|
||||
p.setVelocity(new Vector(0,-1,0));
|
||||
p.removePotionEffect(PotionEffectType.LEVITATION);
|
||||
|
@ -36,6 +36,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
@ -3126,6 +3127,55 @@ public class GenericFunctions {
|
||||
}
|
||||
UpdateOldRangerPieces(item);
|
||||
UpdateArtifactDust(item);
|
||||
UpdateVials(item);
|
||||
UpdateHuntersCompass(item);
|
||||
UpdateUpgradeShard(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
private static void UpdateHuntersCompass(ItemStack item) {
|
||||
if (item.getType()==Material.COMPASS &&
|
||||
item.containsEnchantment(Enchantment.LUCK)) {
|
||||
item.setItemMeta(TwosideKeeper.HUNTERS_COMPASS.getItemStack().getItemMeta());
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateUpgradeShard(ItemStack item) {
|
||||
if (isUpgradeShard(item)) {
|
||||
item.setItemMeta(TwosideKeeper.UPGRADE_SHARD.getItemStack().getItemMeta());
|
||||
getUpgradeShardTier(item); //This forces the tier to appear.
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateVials(ItemStack item) {
|
||||
if (item.getType()==Material.POTION) {
|
||||
if (item.getItemMeta().hasLore() &&
|
||||
item.getItemMeta().getLore().contains("A fantastic potion, it comes straight")) {
|
||||
//This is a special potion. Attempt to update it.
|
||||
boolean newpotion=false;
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GRAY+"")) {
|
||||
newpotion=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!newpotion) {
|
||||
item = AddCustomPotionTag(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ItemStack AddCustomPotionTag(ItemStack item) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
PotionMeta pm = (PotionMeta)item.getItemMeta();
|
||||
for (int i=0;i<pm.getCustomEffects().size();i++) {
|
||||
lore.add(0,ChatColor.GRAY+UserFriendlyPotionEffectTypeName(pm.getCustomEffects().get(i).getType())+" "+WorldShop.toRomanNumeral(pm.getCustomEffects().get(i).getAmplifier()+1)+" ("+WorldShop.toReadableDuration(pm.getCustomEffects().get(i).getDuration())+")");
|
||||
}
|
||||
pm.setLore(lore);
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
item.setItemMeta(pm);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -3250,11 +3300,13 @@ public class GenericFunctions {
|
||||
TwosideKeeper.log("In here", 5);
|
||||
//We cleared the non-living entities, deal damage to the rest.
|
||||
for (int i=0;i<nearbyentities.size();i++) {
|
||||
double damage_mult = 2.0d/(l.distance(nearbyentities.get(i).getLocation())+1.0);
|
||||
TwosideKeeper.log("dmg mult is "+damage_mult,5);
|
||||
//double damage_mult = 2.0d/(l.distance(nearbyentities.get(i).getLocation())+1.0);
|
||||
double dmg = basedmg * Math.max(0d, 1 - l.distanceSquared(nearbyentities.get(i).getLocation())/range);
|
||||
double damage_mult=1.0d;
|
||||
damage_mult*=TwosideKeeper.EXPLOSION_DMG_MULT;
|
||||
damage_mult*=CalculateBlastResistance((LivingEntity)nearbyentities.get(i));
|
||||
double dmg = basedmg * damage_mult;
|
||||
TwosideKeeper.log("dmg mult is "+damage_mult,5);
|
||||
dmg = basedmg * damage_mult;
|
||||
if (nearbyentities.get(i) instanceof Player) {TwosideKeeper.log("Damage is "+dmg, 5);}
|
||||
CustomDamage.ApplyDamage(dmg, null, (LivingEntity)nearbyentities.get(i), null, "Explosion", CustomDamage.NONE);
|
||||
//subtractHealth((LivingEntity)nearbyentities.get(i),null,NewCombat.CalculateDamageReduction(dmg, (LivingEntity)nearbyentities.get(i), null));
|
||||
@ -3581,4 +3633,50 @@ public class GenericFunctions {
|
||||
}
|
||||
return testloc.getBlock().getLocation().add(0.5, 1.0, 0.5);
|
||||
}
|
||||
|
||||
public static boolean isUpgradeShard(ItemStack item) {
|
||||
return (item.getType()==Material.PRISMARINE_SHARD &&
|
||||
item.containsEnchantment(Enchantment.LUCK));
|
||||
}
|
||||
|
||||
public static int getUpgradeShardTier(ItemStack item) {
|
||||
if (item!=null && isUpgradeShard(item)) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GOLD+""+ChatColor.BOLD+"T")) {
|
||||
return Integer.valueOf(ChatColor.stripColor(lore.get(i).split(" ")[0].replace("T", "")));
|
||||
}
|
||||
}
|
||||
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T1 Set Upgrade Shard");
|
||||
lore.add(1,"");
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setUpgradeShardTier(ItemStack item, int tier) {
|
||||
if (item!=null && isUpgradeShard(item)) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
boolean found=false;
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GOLD+""+ChatColor.BOLD+"T")) {
|
||||
//return Integer.valueOf(ChatColor.stripColor(lore.get(i).split(" ")[0].replace("T", "")));
|
||||
lore.set(i, ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Set Upgrade Shard");
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Set Upgrade Shard");
|
||||
lore.add(1,"");
|
||||
}
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class CustomItem {
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return item.clone();
|
||||
return getItemStack(1);
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(int amt) {
|
||||
|
@ -0,0 +1,40 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
public class CustomPotion extends CustomItem{
|
||||
|
||||
int max_amplifier;
|
||||
int min_amplifier;
|
||||
List<PotionEffect> effects;
|
||||
|
||||
public CustomPotion(ItemStack item,List<PotionEffect> effects, int min_amplifier, int max_amplifier) {
|
||||
super(item);
|
||||
this.min_amplifier=min_amplifier;
|
||||
this.max_amplifier=max_amplifier;
|
||||
this.effects=effects;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(int amt) {
|
||||
ItemStack temp = item.clone();
|
||||
temp.setAmount(amt);
|
||||
if (temp.getItemMeta() instanceof PotionMeta) {
|
||||
PotionMeta pm = (PotionMeta)temp.getItemMeta();
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
PotionEffect pe = effects.get(i);
|
||||
pm.addCustomEffect(new PotionEffect(pe.getType(),pe.getDuration(),(int)((Math.random()*(max_amplifier-min_amplifier)))+min_amplifier),true);
|
||||
}
|
||||
temp.setItemMeta(pm);
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return this.getItemStack(1);
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
@ -65,7 +66,7 @@ public enum ItemSet {
|
||||
}
|
||||
|
||||
public static int GetTier(ItemStack item) {
|
||||
if (GenericFunctions.isEquip(item) &&
|
||||
if (isSetItem(item) &&
|
||||
item.getItemMeta().hasLore()) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
@ -79,6 +80,31 @@ public enum ItemSet {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void SetTier(ItemStack item, int tier) {
|
||||
boolean found=false;
|
||||
if (isSetItem(item) &&
|
||||
item.getItemMeta().hasLore()) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
for (int i=0;i<lore.size();i++) {
|
||||
if (lore.get(i).contains(ChatColor.GOLD+""+ChatColor.BOLD+"T")) {
|
||||
//This is the tier line.
|
||||
int oldtier=GetTier(item);
|
||||
//TwosideKeeper.log("In lore: "+lore.get(i)+". Old tier: "+oldtier,2);
|
||||
lore.set(i, lore.get(i).replace("T"+oldtier, "T"+tier));
|
||||
GenericFunctions.UpdateItemLore(item); //Update this item now that we upgraded the tier.
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ItemMeta m = item.getItemMeta();
|
||||
m.setLore(lore);
|
||||
item.setItemMeta(m);
|
||||
}
|
||||
if (!found) {
|
||||
TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBaseAmount(ItemSet set, int tier, int stat) {
|
||||
//stat will be 1 for the base value, 2 for the 2-piece set bonus, 3 for the 3-piece set bonus, and 4 for the 4-piece set bonus.
|
||||
switch (stat) {
|
||||
|
@ -197,8 +197,7 @@ public enum MonsterDifficulty {
|
||||
new LootStructure(Material.LEATHER_BOOTS),
|
||||
},
|
||||
new LootStructure[]{ //Legendary Loot
|
||||
new LootStructure(Material.PRISMARINE_SHARD),
|
||||
new LootStructure(Material.POTION),
|
||||
new LootStructure(Material.END_CRYSTAL),
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -118,11 +118,13 @@ public class WorldShop {
|
||||
item.getItemMeta().hasDisplayName()) {
|
||||
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType())+"\n";
|
||||
}
|
||||
if (item.hasItemMeta() && !item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS)) {
|
||||
for (int i=0;i<Enchantment.values().length;i++) {
|
||||
if (item.containsEnchantment(Enchantment.values()[i])) {
|
||||
message+="\n"+ChatColor.GRAY+getRealName(Enchantment.values()[i])+" "+toRomanNumeral(item.getEnchantmentLevel(Enchantment.getByName(Enchantment.values()[i].getName()))); //This is an enchantment we have.
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.getType()==Material.ENCHANTED_BOOK) {
|
||||
if (item.getItemMeta() instanceof EnchantmentStorageMeta) {
|
||||
EnchantmentStorageMeta e = (EnchantmentStorageMeta)item.getItemMeta();
|
||||
@ -143,7 +145,7 @@ public class WorldShop {
|
||||
message+="\n"+ChatColor.GRAY+book.getPageCount()+" page"+(book.getPageCount()!=1?"s":"");
|
||||
}
|
||||
}
|
||||
if (item.getType()==Material.POTION || item.getType()==Material.SPLASH_POTION || item.getType()==Material.LINGERING_POTION) {
|
||||
if (item.getType()==Material.POTION || item.getType()==Material.SPLASH_POTION || item.getType()==Material.LINGERING_POTION || item.getType()==Material.TIPPED_ARROW) {
|
||||
if (item.getItemMeta() instanceof PotionMeta) {
|
||||
PotionMeta pot = (PotionMeta)item.getItemMeta();
|
||||
if (!pot.getItemFlags().contains(ItemFlag.HIDE_POTION_EFFECTS)) {
|
||||
@ -151,7 +153,7 @@ public class WorldShop {
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
DecimalFormat df = new DecimalFormat("00");
|
||||
message+="\n"+ChatColor.GRAY+GenericFunctions.UserFriendlyPotionEffectTypeName(effects.get(i).getType())+" "+toRomanNumeral(effects.get(i).getAmplifier()+1)+ ((effects.get(i).getAmplifier()+1>0)?" ":"")+"("+effects.get(i).getDuration()/1200+":"+df.format((effects.get(i).getDuration()/20)%60)+")";
|
||||
message+="\n"+ChatColor.GRAY+GenericFunctions.UserFriendlyPotionEffectTypeName(effects.get(i).getType())+" "+toRomanNumeral(effects.get(i).getAmplifier()+1)+ ((effects.get(i).getAmplifier()+1>0)?" ":"")+"("+toReadableDuration(effects.get(i).getDuration())+")";
|
||||
}
|
||||
|
||||
if (effects.size()==0) { //Try this instead. It might be a legacy potion.
|
||||
@ -470,6 +472,11 @@ public class WorldShop {
|
||||
return message;
|
||||
}
|
||||
|
||||
public static String toReadableDuration(int duration) {
|
||||
DecimalFormat df = new DecimalFormat("00");
|
||||
return duration/1200+":"+df.format((duration/20)%60);
|
||||
}
|
||||
|
||||
private static String obfuscateAllMagicCodes(String message) {
|
||||
StringBuilder newstring = new StringBuilder("");
|
||||
boolean isMagic=false;
|
||||
@ -488,11 +495,11 @@ public class WorldShop {
|
||||
isColorCode=false;
|
||||
}
|
||||
if (col!=null) {
|
||||
TwosideKeeper.log("Col is "+col.name()+", char is "+message.charAt(i), 2);
|
||||
TwosideKeeper.log("Col is "+col.name()+", char is "+message.charAt(i), 5);
|
||||
}
|
||||
if (col!=null &&
|
||||
col == ChatColor.MAGIC) {
|
||||
TwosideKeeper.log("Found a Magic Char at Line "+(linenumb+1)+", Character "+(charnumb+1), 2);
|
||||
TwosideKeeper.log("Found a Magic Char at Line "+(linenumb+1)+", Character "+(charnumb+1), 5);
|
||||
WillBeMagic=true;
|
||||
}
|
||||
if (col!=null &&
|
||||
|
@ -149,6 +149,7 @@ import org.bukkit.event.world.WorldSaveEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
@ -191,6 +192,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomPotion;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
|
||||
@ -261,9 +263,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
public static CustomItem HUNTERS_COMPASS;
|
||||
public static CustomItem UPGRADE_SHARD;
|
||||
public static CustomItem STRENGTHENING_VIAL;
|
||||
public static CustomItem LIFE_VIAL;
|
||||
public static CustomItem HARDENING_VIAL;
|
||||
public static CustomPotion STRENGTHENING_VIAL;
|
||||
public static CustomPotion LIFE_VIAL;
|
||||
public static CustomPotion HARDENING_VIAL;
|
||||
|
||||
public static final int DODGE_COOLDOWN=100;
|
||||
public static final int DEATHMARK_COOLDOWN=240;
|
||||
@ -635,7 +637,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
int level=0;
|
||||
PotionEffectType type=null;
|
||||
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
|
||||
if (GenericFunctions.isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType()) && Iterables.get(p.getActivePotionEffects(), i1).getDuration()>longestdur) {
|
||||
if (GenericFunctions.isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType()) && Math.random()<=0.5) {
|
||||
longestdur=Iterables.get(p.getActivePotionEffects(), i1).getDuration();
|
||||
type=Iterables.get(p.getActivePotionEffects(), i1).getType();
|
||||
level=Iterables.get(p.getActivePotionEffects(), i1).getAmplifier();
|
||||
@ -940,49 +942,71 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}, 20l, 20l);
|
||||
}
|
||||
|
||||
private CustomItem DefineHardeningVial() {
|
||||
private CustomPotion DefineHardeningVial() {
|
||||
ItemStack HARDENING_VIAL = new ItemStack(Material.POTION);
|
||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||
effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,0));
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("A fantastic potion, it comes straight");
|
||||
lore.add("from the elixir of the gods.");
|
||||
PotionMeta pm = (PotionMeta)HARDENING_VIAL.getItemMeta();
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,(int)(Math.random()*3+6)), true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("A fantastic potion, it comes straight");
|
||||
lore.add("from the elixir of the gods.");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName("Hardening Vial");
|
||||
pm.setDisplayName(ChatColor.GREEN+"Hardening Vial");
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
HARDENING_VIAL.setItemMeta(pm);
|
||||
return new CustomItem(HARDENING_VIAL);
|
||||
return new CustomPotion(HARDENING_VIAL,effects,6,9);
|
||||
}
|
||||
|
||||
private CustomItem DefineLifeVial() {
|
||||
private CustomPotion DefineLifeVial() {
|
||||
ItemStack LIFE_VIAL = new ItemStack(Material.POTION);
|
||||
PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta();
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,(int)(Math.random()*50+50)), true);
|
||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||
effects.add(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,0));
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("A fantastic potion, it comes straight");
|
||||
lore.add("from the elixir of the gods.");
|
||||
PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta();
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName("Life Vial");
|
||||
pm.setDisplayName(ChatColor.GREEN+"Life Vial");
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
LIFE_VIAL.setItemMeta(pm);
|
||||
return new CustomItem(LIFE_VIAL);
|
||||
return new CustomPotion(LIFE_VIAL,effects,50,100);
|
||||
}
|
||||
|
||||
private CustomItem DefineStrengtheningVial() {
|
||||
private CustomPotion DefineStrengtheningVial() {
|
||||
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
|
||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||
effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,0));
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("A fantastic potion, it comes straight");
|
||||
lore.add("from the elixir of the gods.");
|
||||
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName(ChatColor.GREEN+"Strengthing Vial");
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
STRENGTHENING_VIAL.setItemMeta(pm);
|
||||
return new CustomPotion(STRENGTHENING_VIAL,effects,20,40);
|
||||
/*//LEGACY CODE
|
||||
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
|
||||
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,(int)(Math.random()*20+20)), true);
|
||||
int val=(int)(Math.random()*20+20);
|
||||
pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,val+1), true);
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(ChatColor.GRAY+"Strength "+WorldShop.toRomanNumeral(val)+" ("+WorldShop.toReadableDuration(20*60*15)+")");
|
||||
lore.add("");
|
||||
lore.add("A fantastic potion, it comes straight");
|
||||
lore.add("from the elixir of the gods.");
|
||||
pm.setLore(lore);
|
||||
pm.setDisplayName("Strengthing Vial");
|
||||
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
STRENGTHENING_VIAL.setItemMeta(pm);
|
||||
return new CustomItem(STRENGTHENING_VIAL);
|
||||
return new CustomItem(STRENGTHENING_VIAL);*/
|
||||
}
|
||||
|
||||
private CustomItem DefineUpgradeShard() {
|
||||
ItemStack UPGRADE_SHARD = new ItemStack(Material.PRISMARINE_SHARD);
|
||||
ItemMeta meta = UPGRADE_SHARD.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GREEN+"Upgrade Shard");
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
List<String> UPGRADE_SHARD_lore = new ArrayList<String>();
|
||||
UPGRADE_SHARD_lore.add("An eerie glow radiates from");
|
||||
UPGRADE_SHARD_lore.add("this item. It seems to possess");
|
||||
@ -997,6 +1021,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ItemStack temp = new ItemStack(Material.COMPASS);
|
||||
temp.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||
ItemMeta m = temp.getItemMeta();
|
||||
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
m.setDisplayName(ChatColor.RED+"Hunter's Compass");
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("A compass for the true hunter.");
|
||||
@ -1109,8 +1134,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (args.length>0) {
|
||||
((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().setAbsorptionHearts(Float.valueOf(args[0]));
|
||||
}*/
|
||||
Monster m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||
m.setHealth(m.getMaxHealth()/16d);
|
||||
/*Monster m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||
m.setHealth(m.getMaxHealth()/16d);*/
|
||||
//p.getWorld().dropItemNaturally(p.getLocation(), UPGRADE_SHARD.getItemStack());
|
||||
//p.sendMessage("This is tier "+GenericFunctions.getUpgradeShardTier(p.getEquipment().getItemInMainHand()));
|
||||
//ItemSet.SetTier(p.getEquipment().getItemInMainHand(), 7);
|
||||
//p.getWorld().dropItemNaturally(p.getLocation(), STRENGTHENING_VIAL.getItemStack(50));
|
||||
//TwosideKeeperAPI.spawnAdjustedMonster(MonsterType.GIANT, p.getLocation());
|
||||
//TwosideKeeper.log("This is from set "+ItemSet.GetSet(p.getEquipment().getItemInMainHand())+" T"+ItemSet.GetTier(p.getEquipment().getItemInMainHand()),2);
|
||||
/*Skeleton s = (Skeleton)p.getWorld().spawnEntity(p.getLocation(), EntityType.SKELETON);
|
||||
@ -4341,35 +4370,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (em.targetlist.size()==0) {
|
||||
if (em!=null && (ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) {
|
||||
Player p = (Player)ev.getTarget();
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime()) {
|
||||
if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime() && !CustomDamage.isInIframe(p)) {
|
||||
em.targetlist.add((Player)ev.getTarget());
|
||||
m.setTarget(ev.getTarget());
|
||||
} else {
|
||||
log("This should trigger",5);
|
||||
em.randomlyTeleport();
|
||||
em.randomlyTeleport();
|
||||
em.randomlyTeleport();
|
||||
em.myspawn=m.getLocation();
|
||||
m.setTarget(null);
|
||||
em.targetlist.remove((Player)ev.getTarget());
|
||||
ev.setCancelled(true);
|
||||
}
|
||||
}
|
||||
m.setTarget(ev.getTarget());
|
||||
} else {
|
||||
if (ev.getReason()!=TargetReason.CUSTOM &&
|
||||
ev.getReason()!=TargetReason.UNKNOWN) {
|
||||
ev.setCancelled(true);
|
||||
log("Unknown Targeting reason occurred for "+GenericFunctions.GetEntityDisplayName(m)+". Targeting: "+GenericFunctions.GetEntityDisplayName(m),1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log("This monster is "+MonsterController.getMonsterDifficulty(m).name(),5);
|
||||
if (MonsterController.getMonsterDifficulty(m)==MonsterDifficulty.ELITE) {
|
||||
EliteMonster em = new EliteMonster(m);
|
||||
if (em!=null && (ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) {
|
||||
Player p = (Player)ev.getTarget();
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime()) {
|
||||
em.randomlyTeleport();
|
||||
}
|
||||
ev.setCancelled(true);
|
||||
}
|
||||
ms.SetElite(true);
|
||||
elitemonsters.add(em);
|
||||
}
|
||||
}
|
||||
@ -4705,6 +4735,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (DeathManager.getDeathStructure(p)!=null) {
|
||||
DeathManager.continueAction(p);
|
||||
}
|
||||
p.setVelocity(new Vector(0,0,0));
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,Integer.MAX_VALUE,255));
|
||||
CustomDamage.setAbsorptionHearts(p, 0.0f);
|
||||
GenericFunctions.addIFrame(p, Integer.MAX_VALUE);
|
||||
@ -4723,6 +4754,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setRespawnLocation(newloc.add(0,10,0));
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void KickEvent(PlayerKickEvent ev) {
|
||||
if (ev.getReason()==null || (!ev.getReason().contains("ADMINKICK") && !ev.getReason().contains("Kicked by an operator."))) {
|
||||
log("Tried to kick "+ev.getPlayer().getName()+" for reason "+ev.getReason(),1);
|
||||
ev.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
public void updateHealthbarHealEvent(EntityRegainHealthEvent ev) {
|
||||
Entity e = ev.getEntity();
|
||||
|
@ -312,6 +312,18 @@ public final class TwosideKeeperAPI {
|
||||
public static int getItemTier(ItemStack item) {
|
||||
return ItemSet.GetTier(item);
|
||||
}
|
||||
public static void setItemTier(ItemStack item,int tier) {
|
||||
ItemSet.SetTier(item, tier);
|
||||
}
|
||||
public static boolean isUpgradeShard(ItemStack item) {
|
||||
return GenericFunctions.isUpgradeShard(item);
|
||||
}
|
||||
public static int getUpgradeShardTier(ItemStack item) {
|
||||
return GenericFunctions.getUpgradeShardTier(item);
|
||||
}
|
||||
public static void setUpgradeShardTier(ItemStack item, int tier) {
|
||||
GenericFunctions.setUpgradeShardTier(item, tier);
|
||||
}
|
||||
|
||||
//Localization COMMANDS.
|
||||
public static String getLocalizedItemName(ItemStack i) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user