Add in custom poison functionality to allow all mobs to be poisoned via
mob heads.
This commit is contained in:
parent
8eadef2e35
commit
56bcfde492
@ -203,6 +203,7 @@ public class Main extends JavaPlugin
|
|||||||
public List<ReviveInventory> revive_inventory_list = null;
|
public List<ReviveInventory> revive_inventory_list = null;
|
||||||
public List<PoweredMob> powered_mob_list = null;
|
public List<PoweredMob> powered_mob_list = null;
|
||||||
public List<Chunk> chunk_queue_list = null;
|
public List<Chunk> chunk_queue_list = null;
|
||||||
|
public List<MobManager> mob_list = null;
|
||||||
public static List<RecyclingCenterNode> recycling_center_list = null;
|
public static List<RecyclingCenterNode> recycling_center_list = null;
|
||||||
public static List<BonusEnchantment> bonus_enchantment_list = null;
|
public static List<BonusEnchantment> bonus_enchantment_list = null;
|
||||||
public DamageAPI DMGCALC = null;
|
public DamageAPI DMGCALC = null;
|
||||||
@ -355,6 +356,7 @@ public class Main extends JavaPlugin
|
|||||||
chunk_queue_list = new ArrayList<Chunk>();
|
chunk_queue_list = new ArrayList<Chunk>();
|
||||||
bonus_enchantment_list = new ArrayList<BonusEnchantment>();
|
bonus_enchantment_list = new ArrayList<BonusEnchantment>();
|
||||||
powered_mob_list = new ArrayList<PoweredMob>();
|
powered_mob_list = new ArrayList<PoweredMob>();
|
||||||
|
mob_list = new ArrayList<MobManager>();
|
||||||
|
|
||||||
recycling_center_list = new ArrayList<RecyclingCenterNode>();
|
recycling_center_list = new ArrayList<RecyclingCenterNode>();
|
||||||
|
|
||||||
@ -1863,6 +1865,14 @@ public void runTick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Main.SERVER_TICK_TIME%20==0) {
|
if (Main.SERVER_TICK_TIME%20==0) {
|
||||||
|
List<MobHead> playerheads = getMobHeads(p);
|
||||||
|
int creeperrareheads = getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true,MobHeadRareType.RARE_TYPE_B), playerheads);
|
||||||
|
int creeperpoweredheads = getMobHeadAmt(new MobHead(MobHeadType.CREEPER,false,true), playerheads);
|
||||||
|
int creeperpoweredrareheads = getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true,true), playerheads);
|
||||||
|
int aoedmg = 0;
|
||||||
|
aoedmg+=creeperrareheads;
|
||||||
|
aoedmg+=creeperpoweredheads;
|
||||||
|
aoedmg+=creeperpoweredrareheads*3;
|
||||||
for (int j=0;j<powered_mob_list.size();j++) {
|
for (int j=0;j<powered_mob_list.size();j++) {
|
||||||
if (powered_mob_list.get(j).power_time+1200<Main.SERVER_TICK_TIME) {
|
if (powered_mob_list.get(j).power_time+1200<Main.SERVER_TICK_TIME) {
|
||||||
powered_mob_list.remove(j);
|
powered_mob_list.remove(j);
|
||||||
@ -2119,8 +2129,38 @@ public void runTick() {
|
|||||||
for (int i=0;i<nearby.size();i++) {
|
for (int i=0;i<nearby.size();i++) {
|
||||||
//EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER};
|
//EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER};
|
||||||
boolean contains=nearby.get(i) instanceof LivingEntity;
|
boolean contains=nearby.get(i) instanceof LivingEntity;
|
||||||
|
boolean containsmonster=nearby.get(i) instanceof Monster;
|
||||||
|
if (containsmonster && aoedmg>0) {
|
||||||
|
if (nearby.get(i).getLocation().distance(p.getLocation())<=9) {
|
||||||
|
//p.sendMessage("AOE Damage is "+aoedmg);
|
||||||
|
LivingEntity l = (LivingEntity)nearby.get(i);
|
||||||
|
l.damage(aoedmg);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (contains) {
|
if (contains) {
|
||||||
LivingEntity l = (LivingEntity)nearby.get(i);
|
LivingEntity l = (LivingEntity)nearby.get(i);
|
||||||
|
/*
|
||||||
|
if (l.hasPotionEffect(PotionEffectType.POISON)) {
|
||||||
|
Collection<PotionEffect> pots = l.getActivePotionEffects();
|
||||||
|
int poison_power=0;
|
||||||
|
for (PotionEffect effect : pots) {
|
||||||
|
if (effect.getType().getName().equalsIgnoreCase("poison")) {
|
||||||
|
poison_power = effect.getAmplifier();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l.damage(poison_power+1);
|
||||||
|
}*/
|
||||||
|
for (int j=0;j<mob_list.size();j++) {
|
||||||
|
if (mob_list.get(j).id.compareTo(l.getUniqueId())==0) {
|
||||||
|
if (mob_list.get(j).getPoisonTicks()>0) {
|
||||||
|
l.damage(1);
|
||||||
|
} else {
|
||||||
|
mob_list.remove(j);
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (l.getCustomName()!=null && l.hasLineOfSight(p)) {
|
if (l.getCustomName()!=null && l.hasLineOfSight(p)) {
|
||||||
if (!lineofsight_check.contains(l.getUniqueId())) {
|
if (!lineofsight_check.contains(l.getUniqueId())) {
|
||||||
l.setCustomNameVisible(true);
|
l.setCustomNameVisible(true);
|
||||||
@ -2320,6 +2360,10 @@ public void runTick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Main.SERVER_TICK_TIME%36000==0) {
|
||||||
|
//Every 30 minutes, clear out the list of poisoned mobs, in case some are non-existent now.
|
||||||
|
mob_list.clear();
|
||||||
|
}
|
||||||
if (Main.SERVER_TICK_TIME%600==0) {
|
if (Main.SERVER_TICK_TIME%600==0) {
|
||||||
saveAccountsConfig(); //Save account data once every 30 seconds.
|
saveAccountsConfig(); //Save account data once every 30 seconds.
|
||||||
if (turnedon==false && Bukkit.getWorld("world").getTime()>13000) {
|
if (turnedon==false && Bukkit.getWorld("world").getTime()>13000) {
|
||||||
@ -6271,6 +6315,7 @@ public void payDay(int time)
|
|||||||
public static void playFirework(Location loc)
|
public static void playFirework(Location loc)
|
||||||
{
|
{
|
||||||
Random gen = new Random();
|
Random gen = new Random();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Firework fw = loc.getWorld().spawn(loc, Firework.class);
|
Firework fw = loc.getWorld().spawn(loc, Firework.class);
|
||||||
@ -6509,7 +6554,7 @@ public void payDay(int time)
|
|||||||
//Check the lore for a valid mob head.
|
//Check the lore for a valid mob head.
|
||||||
if (getMobHead(item)!=null) {
|
if (getMobHead(item)!=null) {
|
||||||
mobheadlist.add(getMobHead(item));
|
mobheadlist.add(getMobHead(item));
|
||||||
Bukkit.getLogger().info("Mob head "+getMobHead(item).toString()+" added.");
|
//Bukkit.getLogger().info("Mob head "+getMobHead(item).toString()+" added.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
61
BankEconomyMod/src/me/kaZep/Base/MobManager.java
Normal file
61
BankEconomyMod/src/me/kaZep/Base/MobManager.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package me.kaZep.Base;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The MobManager class handles a certain mob in the game.
|
||||||
|
* It will allow you to define new properties for mobs
|
||||||
|
* to keep track of. This is similar to the PlayerData
|
||||||
|
* class for players.
|
||||||
|
*/
|
||||||
|
public class MobManager {
|
||||||
|
UUID id;
|
||||||
|
long poison_time;
|
||||||
|
/**
|
||||||
|
* Adds a new mob to be tracked.
|
||||||
|
* @param id The UUID of the mob.
|
||||||
|
*/
|
||||||
|
public MobManager(UUID id) {
|
||||||
|
this.id=id;
|
||||||
|
this.poison_time=Main.SERVER_TICK_TIME;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* If there are already poison ticks on this mob,
|
||||||
|
* adds to the duration in ticks for the poison
|
||||||
|
* to last. Otherwise works just like setPoison().
|
||||||
|
* @param ticks
|
||||||
|
*/
|
||||||
|
public void addPoison(long ticks) {
|
||||||
|
if (poison_time>=Main.SERVER_TICK_TIME) {
|
||||||
|
poison_time+=ticks;
|
||||||
|
} else {
|
||||||
|
setPoison(ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets the poison ticks directly, overwriting
|
||||||
|
* any previous poison tick data.
|
||||||
|
* @param ticks
|
||||||
|
*/
|
||||||
|
public void setPoison(long ticks) {
|
||||||
|
poison_time=Main.SERVER_TICK_TIME+ticks;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Removes the poison ticks from this mob.
|
||||||
|
*/
|
||||||
|
public void removePoison() {
|
||||||
|
poison_time=Main.SERVER_TICK_TIME;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the number of ticks of poison
|
||||||
|
* left on this mob.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long getPoisonTicks() {
|
||||||
|
if (poison_time>=Main.SERVER_TICK_TIME) {
|
||||||
|
return poison_time-Main.SERVER_TICK_TIME;
|
||||||
|
} else {
|
||||||
|
return 0; //0 ticks, since the stored time is smaller.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10155,7 +10155,7 @@ implements Listener
|
|||||||
l2.setHealth(l2.getHealth()-dmg);
|
l2.setHealth(l2.getHealth()-dmg);
|
||||||
if (l2 instanceof Player) {
|
if (l2 instanceof Player) {
|
||||||
Player p = (Player)l2;
|
Player p = (Player)l2;
|
||||||
p.playSound(p.getLocation(), Sound.HURT, 0.5f, 1.0f);
|
p.playSound(p.getLocation(), Sound.HURT_FLESH, 0.5f, 1.0f);
|
||||||
DecimalFormat df = new DecimalFormat("#0.0");
|
DecimalFormat df = new DecimalFormat("#0.0");
|
||||||
DecimalFormat df2 = new DecimalFormat("#0");
|
DecimalFormat df2 = new DecimalFormat("#0");
|
||||||
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
|
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
|
||||||
@ -10955,10 +10955,74 @@ implements Listener
|
|||||||
final Player p = (Player) e.getDamager();
|
final Player p = (Player) e.getDamager();
|
||||||
if (e.getEntity() instanceof Monster) {
|
if (e.getEntity() instanceof Monster) {
|
||||||
Monster m = (Monster)e.getEntity();
|
Monster m = (Monster)e.getEntity();
|
||||||
|
|
||||||
|
List<MobHead> playerheads = this.plugin.getMobHeads(p);
|
||||||
|
int creeperheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER), playerheads);
|
||||||
|
int creeperrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true), playerheads);
|
||||||
|
int creeperpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,false,true), playerheads);
|
||||||
|
int creeperpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true,true), playerheads);
|
||||||
|
int aoedmg = 0;
|
||||||
|
|
||||||
|
aoedmg+=creeperheads*5;
|
||||||
|
aoedmg+=creeperrareheads*20;
|
||||||
|
aoedmg+=creeperpoweredheads*5;
|
||||||
|
aoedmg+=creeperpoweredrareheads*30;
|
||||||
|
|
||||||
|
|
||||||
|
int spiderheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER), playerheads);
|
||||||
|
int spiderrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true), playerheads);
|
||||||
|
int spiderpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,false,true), playerheads);
|
||||||
|
int spiderpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true,true), playerheads);
|
||||||
|
int slowdownpct = 0;
|
||||||
|
|
||||||
|
slowdownpct+=spiderheads*5;
|
||||||
|
slowdownpct+=spiderrareheads*15;
|
||||||
|
slowdownpct+=spiderpoweredheads*5;
|
||||||
|
slowdownpct+=spiderpoweredrareheads*30;
|
||||||
|
|
||||||
|
spiderrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true,MobHeadRareType.RARE_TYPE_B), playerheads);
|
||||||
|
int poisondur = 0; //Amount of poison duration (seconds) to add to the current poison amount.
|
||||||
|
|
||||||
|
poisondur+=spiderrareheads*2;
|
||||||
|
poisondur+=spiderpoweredheads*1;
|
||||||
|
poisondur+=spiderpoweredrareheads*5;
|
||||||
|
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,60,slowdownpct/15,true));
|
||||||
|
|
||||||
|
int poisonduration=0;
|
||||||
|
//First see if the mob is already a poisoned mob.
|
||||||
|
boolean found=false;
|
||||||
|
for (int i=0;i<this.plugin.mob_list.size();i++) {
|
||||||
|
if (this.plugin.mob_list.get(i).id.compareTo(m.getUniqueId())==0) {
|
||||||
|
//We found it. Add onto current poison duration.
|
||||||
|
this.plugin.mob_list.get(i).addPoison(poisondur*20);
|
||||||
|
found=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
//We didn't find it, so add a new entry to the poison list.
|
||||||
|
MobManager newm = new MobManager(m.getUniqueId());
|
||||||
|
newm.addPoison(poisondur*20);
|
||||||
|
this.plugin.mob_list.add(newm);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Entity> nearby_mobs = m.getNearbyEntities(2, 2, 2);
|
||||||
|
for (int i=0;i<nearby_mobs.size();i++) {
|
||||||
|
if (!(nearby_mobs.get(i) instanceof Monster)) {
|
||||||
|
nearby_mobs.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<nearby_mobs.size();i++) {
|
||||||
|
if (!nearby_mobs.get(i).getUniqueId().equals(m)) {
|
||||||
|
LivingEntity m2 = (LivingEntity)nearby_mobs.get(i);
|
||||||
|
m2.damage(e.getDamage()*(aoedmg/100.0d));
|
||||||
|
}
|
||||||
|
}
|
||||||
/*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) {
|
/*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) {
|
||||||
m.removePotionEffect(PotionEffectType.SLOW);
|
m.removePotionEffect(PotionEffectType.SLOW);
|
||||||
}*/
|
}*/
|
||||||
List<MobHead> playerheads = this.plugin.getMobHeads(p);
|
|
||||||
int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads);
|
int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads);
|
||||||
int witherskeletonrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true), playerheads);
|
int witherskeletonrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true), playerheads);
|
||||||
int witherskeletonpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,false,true), playerheads);
|
int witherskeletonpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,false,true), playerheads);
|
||||||
@ -11061,13 +11125,13 @@ implements Listener
|
|||||||
//int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
|
//int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
|
||||||
int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads);
|
int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads);
|
||||||
int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads);
|
int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads);
|
||||||
Bukkit.getLogger().info("Head counts are "+zombieheads+", "+zombierareaheads+", "+zombiepoweredheads+", "+zombiepoweredrareheads);
|
//Bukkit.getLogger().info("Head counts are "+zombieheads+", "+zombierareaheads+", "+zombiepoweredheads+", "+zombiepoweredrareheads);
|
||||||
Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
|
//Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
|
||||||
life_steal+=zombieheads;
|
life_steal+=zombieheads;
|
||||||
life_steal+=zombiepoweredheads;
|
life_steal+=zombiepoweredheads;
|
||||||
life_steal+=zombierareaheads*3;
|
life_steal+=zombierareaheads*3;
|
||||||
life_steal+=zombiepoweredrareheads*5;
|
life_steal+=zombiepoweredrareheads*5;
|
||||||
Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
|
//Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
|
||||||
if (this.plugin.getPlayerData(p).furytime!=0) {
|
if (this.plugin.getPlayerData(p).furytime!=0) {
|
||||||
attack_speed+=this.plugin.getPlayerData(p).furyamt;
|
attack_speed+=this.plugin.getPlayerData(p).furyamt;
|
||||||
}
|
}
|
||||||
@ -11199,11 +11263,124 @@ implements Listener
|
|||||||
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
|
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
|
||||||
ItemStack item = p.getItemInHand();
|
ItemStack item = p.getItemInHand();
|
||||||
double critical_chance=0,armor_pen=0,life_steal=0,attack_speed=0,dmg=0,armor_pen_dmg=0;
|
double critical_chance=0,armor_pen=0,life_steal=0,attack_speed=0,dmg=0,armor_pen_dmg=0;
|
||||||
List<MobHead> player_mobheads = this.plugin.getMobHeads(p);
|
|
||||||
int skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON), player_mobheads);
|
List<MobHead> playerheads = this.plugin.getMobHeads(p);
|
||||||
int powered_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, false, true), player_mobheads);
|
if (e.getEntity() instanceof Monster) {
|
||||||
int rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A), player_mobheads);
|
Monster m = (Monster)e.getEntity();
|
||||||
int powered_rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A, true), player_mobheads);
|
int creeperheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER), playerheads);
|
||||||
|
int creeperrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true), playerheads);
|
||||||
|
int creeperpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,false,true), playerheads);
|
||||||
|
int creeperpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.CREEPER,true,true), playerheads);
|
||||||
|
int aoedmg = 0;
|
||||||
|
|
||||||
|
aoedmg+=creeperheads*5;
|
||||||
|
aoedmg+=creeperrareheads*20;
|
||||||
|
aoedmg+=creeperpoweredheads*5;
|
||||||
|
aoedmg+=creeperpoweredrareheads*30;
|
||||||
|
|
||||||
|
|
||||||
|
int spiderheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER), playerheads);
|
||||||
|
int spiderrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true), playerheads);
|
||||||
|
int spiderpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,false,true), playerheads);
|
||||||
|
int spiderpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true,true), playerheads);
|
||||||
|
int slowdownpct = 0;
|
||||||
|
|
||||||
|
slowdownpct+=spiderheads*5;
|
||||||
|
slowdownpct+=spiderrareheads*15;
|
||||||
|
slowdownpct+=spiderpoweredheads*5;
|
||||||
|
slowdownpct+=spiderpoweredrareheads*30;
|
||||||
|
|
||||||
|
spiderrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SPIDER,true,MobHeadRareType.RARE_TYPE_B), playerheads);
|
||||||
|
int poisondur = 0; //Amount of poison duration (seconds) to add to the current poison amount.
|
||||||
|
|
||||||
|
poisondur+=spiderrareheads*2;
|
||||||
|
poisondur+=spiderpoweredheads*1;
|
||||||
|
poisondur+=spiderpoweredrareheads*5;
|
||||||
|
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,60,slowdownpct/15,true));
|
||||||
|
|
||||||
|
|
||||||
|
int poisonduration=0;
|
||||||
|
//First see if the mob is already a poisoned mob.
|
||||||
|
boolean found=false;
|
||||||
|
for (int i=0;i<this.plugin.mob_list.size();i++) {
|
||||||
|
if (this.plugin.mob_list.get(i).id.compareTo(m.getUniqueId())==0) {
|
||||||
|
//We found it. Add onto current poison duration.
|
||||||
|
this.plugin.mob_list.get(i).addPoison(poisondur*20);
|
||||||
|
found=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
//We didn't find it, so add a new entry to the poison list.
|
||||||
|
MobManager newm = new MobManager(m.getUniqueId());
|
||||||
|
newm.addPoison(poisondur*20);
|
||||||
|
this.plugin.mob_list.add(newm);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Entity> nearby_mobs = m.getNearbyEntities(2, 2, 2);
|
||||||
|
for (int i=0;i<nearby_mobs.size();i++) {
|
||||||
|
if (!(nearby_mobs.get(i) instanceof Monster)) {
|
||||||
|
nearby_mobs.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<nearby_mobs.size();i++) {
|
||||||
|
if (!nearby_mobs.get(i).getUniqueId().equals(m)) {
|
||||||
|
LivingEntity m2 = (LivingEntity)nearby_mobs.get(i);
|
||||||
|
m2.damage(e.getDamage()*(aoedmg/100.0d));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads);
|
||||||
|
int witherskeletonrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true), playerheads);
|
||||||
|
int witherskeletonpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,false,true), playerheads);
|
||||||
|
int witherskeletonpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true,true), playerheads);
|
||||||
|
int witherduration = 0, witheramplifier = 0;
|
||||||
|
try {
|
||||||
|
Iterator<PotionEffect> effects = m.getActivePotionEffects().iterator();
|
||||||
|
//Figure out potion effects when player joins.
|
||||||
|
while (effects.hasNext()) {
|
||||||
|
PotionEffect nexteffect = effects.next();
|
||||||
|
//Bukkit.getLogger().info("Effect Type is "+nexteffect.getType().getName()+", amplifier is "+nexteffect.getAmplifier()+", duration is "+nexteffect.getDuration());
|
||||||
|
if (witherskeletonheads+witherskeletonrareheads+witherskeletonpoweredheads+witherskeletonpoweredrareheads>0 && nexteffect.getType().getName().compareTo(PotionEffectType.WITHER.getName())==0) {
|
||||||
|
witherduration=nexteffect.getDuration();
|
||||||
|
witheramplifier=nexteffect.getAmplifier();
|
||||||
|
}
|
||||||
|
if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0 && nexteffect.getAmplifier()==6 && nexteffect.getDuration()<=60) {
|
||||||
|
m.removePotionEffect(PotionEffectType.SLOW);
|
||||||
|
//Bukkit.getLogger().info("Removed slow.");
|
||||||
|
//p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, nexteffect.getAmplifier()+1, true));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) {
|
||||||
|
p.removePotionEffect(PotionEffectType.JUMP);
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true));
|
||||||
|
}*/
|
||||||
|
effects.remove();
|
||||||
|
}
|
||||||
|
} catch (ConcurrentModificationException ex_e) {
|
||||||
|
Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to remove slow debuff.");
|
||||||
|
}
|
||||||
|
if (witherskeletonpoweredrareheads>0) {
|
||||||
|
if (witherduration==0) {witherduration=400;}
|
||||||
|
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier "+(witheramplifier+2*witherskeletonpoweredrareheads)+" + duration "+witherduration);
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration,witheramplifier+2*witherskeletonpoweredrareheads),true);
|
||||||
|
} else if (witherskeletonpoweredheads>0) {
|
||||||
|
if (witherduration==0) {witherduration=100;}
|
||||||
|
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier "+(witheramplifier+1*witherskeletonpoweredrareheads)+" + duration "+witherduration);
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration,witheramplifier+1*witherskeletonpoweredrareheads),true);
|
||||||
|
} else if (witherskeletonrareheads>0) {
|
||||||
|
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier 2 + duration "+(witherduration+300*witherskeletonrareheads));
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration+300*witherskeletonrareheads,2),true);
|
||||||
|
} else if (witherskeletonheads>0) {
|
||||||
|
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier 0 + duration "+(witherduration+100*witherskeletonrareheads));
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration+100*witherskeletonrareheads,0),true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON), playerheads);
|
||||||
|
int powered_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, false, true), playerheads);
|
||||||
|
int rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A), playerheads);
|
||||||
|
int powered_rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A, true), playerheads);
|
||||||
/*if (skeleton_heads>0) {
|
/*if (skeleton_heads>0) {
|
||||||
Bukkit.getLogger().info("Found "+skeleton_heads+" skeleton mob heads.");
|
Bukkit.getLogger().info("Found "+skeleton_heads+" skeleton mob heads.");
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ public String convertToItemName(String val) {
|
|||||||
f.getInventory().addItem(i);
|
f.getInventory().addItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("regen_chunk")) {
|
if (args[0].equalsIgnoreCase("regen_chunk") && 0==1 /*DISABLED to prevent accidental execution.*/) {
|
||||||
if (p.hasPermission("maintenance-mode-admin")) {
|
if (p.hasPermission("maintenance-mode-admin")) {
|
||||||
//boolean result=p.getWorld().regenerateChunk(p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16);
|
//boolean result=p.getWorld().regenerateChunk(p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16);
|
||||||
//Bukkit.getLogger().info("Chunk regenerated: "+result+" ("+p.getLocation().getBlockX()/16+","+p.getLocation().getBlockZ()/16+")");
|
//Bukkit.getLogger().info("Chunk regenerated: "+result+" ("+p.getLocation().getBlockX()/16+","+p.getLocation().getBlockZ()/16+")");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user