Fix Elite Zombies causing players to be kicked. Items dropped will

always be invulnerable.
This commit is contained in:
sigonasr2 2016-08-13 01:55:22 -05:00
parent 692bb92bd1
commit c4e49639c6
4 changed files with 22 additions and 38 deletions

Binary file not shown.

View File

@ -279,12 +279,15 @@ public class EliteMonster {
targetlist.add((Player)damager);
}
if (!participantlist.contains(damager) && (damager instanceof Player)) {
String name = "";
participantlist.add((Player)damager);
}
if (damager instanceof Player) {
Player p = (Player)damager;
if (!p.hasPotionEffect(PotionEffectType.WEAKNESS)) {
p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS,20*2,9),true);
}
}
last_regen_time=TwosideKeeper.getServerTickTime();
double randomrate = 0d;
if (!chasing && NewCombat.getPercentHealthRemaining(m)<=50) {

View File

@ -3352,7 +3352,7 @@ public class GenericFunctions {
TwosideKeeper.log("Dealt "+basedmg+" raw damage.", 5);
//DealDamageToMob(NewCombat.CalculateDamageReduction(basedmg,p,null),(LivingEntity)nearbyentities.get(i),null,null,"Slam");
TwosideKeeperAPI.DealDamageToEntity(NewCombat.CalculateDamageReduction(((fullcalculation)?NewCombat.CalculateWeaponDamage(damager, p):1.0)*basedmg,p,null), (Player)players.get(i), damager);
if (knockup) {
if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack.
p.setVelocity(new Vector(0,knockupamt,0));
}
} else {

View File

@ -3305,25 +3305,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent ev) {
if (DeathManager.deathStructureExists(ev.getPlayer())) {
DeathStructure ds = DeathManager.getDeathStructure(ev.getPlayer());
Location deathloc = ds.deathloc;
Player p = ev.getPlayer();
deathloc.getWorld().loadChunk(deathloc.getChunk());
for (int i=0;i<p.getOpenInventory().getTopInventory().getSize();i++) {
if (p.getOpenInventory().getTopInventory().getItem(i)!=null &&
p.getOpenInventory().getTopInventory().getItem(i).getType()!=Material.AIR) {
deathloc.getWorld().dropItemNaturally(deathloc, p.getOpenInventory().getTopInventory().getItem(i));
log("Dropping "+p.getOpenInventory().getTopInventory().getItem(i).toString()+" at Death location "+deathloc,3);
}
}
DeathManager.removeDeathStructure(p);
DeathManager.removeDeathStructure(ev.getPlayer());
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent ev) {
final Player player = (Player)ev.getWhoClicked();
@ -3737,10 +3718,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
it.setCustomName((it.getItemStack().getItemMeta().hasDisplayName())?it.getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(it.getItemStack()));
it.setCustomNameVisible(true);
}
if (GenericFunctions.isArtifactEquip(it.getItemStack())) {
it.setInvulnerable(true);
}
}
/**
* RECYCLING CENTER CODE!
@ -4662,6 +4641,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
StringBuilder participants_list = new StringBuilder();
for (int i=0;i<participants.size();i++) {
Player pl = participants.get(i);
if (pl!=null && pl.isValid() && pl.isOnline()) {
ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300);
exp.setInvulnerable(true);
GenericFunctions.giveItem(pl,aPlugin.API.getEliteBox());
@ -4680,6 +4660,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
}
Bukkit.getServer().broadcastMessage(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain "+m.getCustomName()+ChatColor.WHITE+"!");
aPlugin.API.discordSendRaw(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" have successfully slain **"+m.getCustomName()+ChatColor.WHITE+"**!");
m.getWorld().spawnEntity(m.getLocation(), EntityType.LIGHTNING);