'Hound Caller' fixes.

dev
sigonasr2 11 years ago
parent 9d6428d58e
commit 4b99beaef8
  1. 47
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 127
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -52,6 +52,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.FileConfigurationOptions;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -64,6 +65,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -90,6 +92,8 @@ import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import sig.ItemSets.ColorSet;
import sig.ItemSets.ItemSet;
@ -1964,6 +1968,49 @@ public void runTick() {
}
}
}
if (Main.SERVER_TICK_TIME%60==0) {
if (p.getWorld().getName().compareTo("world")==0) {
List<Entity> nearby = p.getNearbyEntities(30, 30, 30);
Location nearestwolf = null;
int minions=0;
for (int i=0;i<nearby.size();i++) {
if (nearby.get(i).getType()==EntityType.WOLF) {
minions++;
if (nearestwolf==null || nearby.get(i).getLocation().distanceSquared(p.getLocation())<nearestwolf.distanceSquared(p.getLocation())) {
nearestwolf = nearby.get(i).getLocation();
}
Creature l = (Creature)nearby.get(i);
if (Math.random()<=0.4 && l.getCustomName()!=null && l.getCustomName().equalsIgnoreCase(ChatColor.RED+"Hound Caller")) {
Wolf w = (Wolf)nearby.get(i);
if (w.getOwner()==null) {
if (!w.isAngry()) {
w.damage(0,p);
w.setHealth(w.getMaxHealth());
w.setAngry(true);
}
l.setTarget(p);
l.setLastDamage(0.01);
l.setLastDamageCause(new EntityDamageEvent(p, DamageCause.CUSTOM, 0.01));
}
}
}
}
if (minions<5 && nearestwolf!=null) {
if (Math.random()<=0.05) {
Entity entity = p.getWorld().spawnEntity(nearestwolf, EntityType.WOLF);
LivingEntity l = (LivingEntity)entity;
Creature c = (Creature)l;
l.setCustomName(ChatColor.RED+"Wolf Minion");
l.setCustomNameVisible(true);
c.setTarget(p);
Wolf w = (Wolf)l;
w.setBaby();
l.setLastDamageCause(new EntityDamageEvent(p, DamageCause.CUSTOM, 0.01));
l.getLocation().getWorld().playSound(l.getLocation(), Sound.WOLF_HOWL, 0.2f, 0.9f);
}
}
}
}
if (p.getWorld().getName().compareTo("world_nether")==0) {
if (Main.SERVER_TICK_TIME%60==0) {
for (int i=-15;i<=15;i++) {

@ -202,6 +202,9 @@ import com.sk89q.worldedit.data.DataException;
import com.sk89q.worldedit.schematic.SchematicFormat;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import de.kumpelblase2.remoteentities.CreateEntityContext;
import de.kumpelblase2.remoteentities.api.RemoteEntityType;
import me.kaZep.Base.BrewingStandData;
import me.kaZep.Base.FurnaceData;
import me.kaZep.Base.PlayerBuffData;
@ -2578,7 +2581,9 @@ implements Listener
double levelsmult=1.0;
double COUNTER_SLIME_SPAWN_RATE = 0.01,
VIRAL_SPIDER_SPAWN_RATE = 0.2;
VIRAL_SPIDER_SPAWN_RATE = 0.01,
SILENCER_SPAWN_RATE = 0.01,
HOUND_CALLER_SPAWN_RATE = 0.2;
if (totallvs>80*levelsmult) {
//Try to spawn a counter slime.
@ -2597,11 +2602,48 @@ implements Listener
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Viral Spider");
l.setCustomNameVisible(true);
Bukkit.getLogger().info("Viral Spider spawned at "+l.getLocation().toString());
//Bukkit.getLogger().info("Viral Spider spawned at "+l.getLocation().toString());
l.setMaxHealth(85);
l.setHealth(85);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
}
//Try to spawn a Silencer.
if (Math.random()<=SILENCER_SPAWN_RATE) {
Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.SKELETON);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Silencer");
l.setCustomNameVisible(true);
//Bukkit.getLogger().info("Silencer spawned at "+l.getLocation().toString());
l.setMaxHealth(45);
l.setHealth(45);
ItemStack helm = new ItemStack(Material.DIAMOND_HELMET);
helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32);
l.getEquipment().setHelmet(helm);
l.getEquipment().setHelmetDropChance(0.002f);
l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
}
//Try to spawn a Hound Caller.
if (Math.random()<=HOUND_CALLER_SPAWN_RATE) {
Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.WOLF);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Hound Caller");
l.setCustomNameVisible(true);
//Bukkit.getLogger().info("Hound Caller spawned at "+l.getLocation().toString());
l.setMaxHealth(65);
l.setHealth(65);
Wolf w = (Wolf)l;
//helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32);
//l.getEquipment().setHelmet(helm);
//l.getEquipment().setHelmetDropChance(0.002f);
//l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
//w.setAngry(true);
w.setAdult();
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 3));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2));
l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0));
}
}
@ -8759,6 +8801,10 @@ implements Listener
//**********************************//Player buffs begin
if (e.getDamager() instanceof Player) {
Player p = (Player)e.getDamager();
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
e.setCancelled(true);
return;
}
if (p.getItemInHand().getType().name().toLowerCase().contains("axe") && !p.getItemInHand().getType().name().toLowerCase().contains("pickaxe") && this.plugin.hasJobBuff("Woodcutter", p, Job.JOB30A)) {
p.getItemInHand().setDurability((short)0);
}
@ -8786,6 +8832,27 @@ implements Listener
if (e.getEntity() instanceof LivingEntity) {
final LivingEntity l = (LivingEntity)e.getEntity();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Wolf Minion")) {
e.setDamage(e.getDamage()*1.5);
}
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Hound Caller")) {
e.setDamage(e.getDamage()*2.5);
if (Math.random()<=0.33) {
l.getLocation().getWorld().playSound(l.getLocation(), Sound.WOLF_HOWL, 0.2f, 0.9f);
Entity entity = l.getWorld().spawnEntity(l.getLocation().add(Math.random(),0,Math.random()), EntityType.WOLF);
LivingEntity l2 = (LivingEntity)entity;
Creature c = (Creature)l2;
l.setCustomName(ChatColor.RED+"Wolf Minion");
l.setCustomNameVisible(true);
if (e.getDamager() instanceof LivingEntity) {
c.setTarget((LivingEntity)e.getDamager());
}
Wolf w = (Wolf)l2;
w.setAngry(true);
w.setBaby();
//l.setLastDamageCause(new EntityDamageEvent(p, DamageCause.ENTITY_ATTACK, 0.01));
}
}
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Viral Spider")) {
if (e.getDamager() instanceof LivingEntity) {
LivingEntity l2 = (LivingEntity)e.getDamager();
@ -9111,6 +9178,35 @@ implements Listener
}*/
if (e.getEntity().getType()==EntityType.PLAYER) {
final Player p = (Player)e.getEntity();
if (e.getDamager() instanceof Wolf) {
LivingEntity l = (LivingEntity)e.getDamager();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Hound Caller")) {
//e.setDamage(e.getDamage()*2.5);
if (Math.random()<=0.2) {
l.getLocation().getWorld().playSound(l.getLocation(), Sound.WOLF_HOWL, 0.2f, 0.9f);
Entity entity = l.getWorld().spawnEntity(l.getLocation().add(Math.random(),0,Math.random()), EntityType.WOLF);
LivingEntity l2 = (LivingEntity)entity;
Creature c = (Creature)l2;
l.setCustomName(ChatColor.RED+"Wolf Minion");
l.setCustomNameVisible(true);
if (e.getDamager() instanceof LivingEntity) {
c.setTarget((LivingEntity)e.getDamager());
}
Wolf w = (Wolf)l2;
w.setAngry(true);
w.setBaby();
//l.setLastDamageCause(new EntityDamageEvent(p, DamageCause.ENTITY_ATTACK, 0.01));
}
}
}
if (e.getDamager() instanceof Projectile) {
if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) {
LivingEntity l = ((Projectile)e.getDamager()).getShooter();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Silencer")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 90, 64));
}
}
}
if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f && this.plugin.hasJobBuff("Hunter", p, Job.JOB30A)) {
this.plugin.getPlayerData(p).blockstack+=1;
}
@ -10072,17 +10168,19 @@ implements Listener
}
}
}
if (f.getNoDamageTicks()<f.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) {
if (e.getCause()!=DamageCause.CUSTOM && f.getNoDamageTicks()<f.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) {
final double armor_dmg = armor_pen_dmg;
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
if (f.getCustomName()!=null) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+f.getCustomName()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
} else {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
if (enemy_starthp-f.getHealth()+armor_dmg>0.1) {
if (f.getCustomName()!=null) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+f.getCustomName()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
} else {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
}
}
}
},1);
@ -10251,7 +10349,7 @@ implements Listener
}
}
}
if (f.getNoDamageTicks()<f.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) {
if (e.getCause()!=DamageCause.CUSTOM && f.getNoDamageTicks()<f.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) {
final double armor_dmg = armor_pen_dmg;
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
@ -10259,9 +10357,11 @@ implements Listener
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
if (f.getCustomName()!=null) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+f.getCustomName()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
} else {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
if (enemy_starthp-f.getHealth()+armor_dmg>0.1) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+f.getCustomName()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
} else {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
}
}
}
},1);
@ -15713,6 +15813,11 @@ implements Listener
double actMon = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money");
int actHand = (int)Main.economy.getBalance(p.getName());
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
e.setCancelled(true);
return;
}
//******************************//All Job Buff related items go in here.
if (e.getAction()==Action.LEFT_CLICK_BLOCK && this.plugin.hasJobBuff("Woodcutter", p, Job.JOB5)) {
if (e.getClickedBlock().getType()==Material.LEAVES) {

Loading…
Cancel
Save