Skip to content

Commit

Permalink
more consistent mob drop logic. mob-equivalent of Issue #6 fixed (ver…
Browse files Browse the repository at this point in the history
…y similar code)
  • Loading branch information
crashdemons committed Sep 13, 2018
1 parent 0f9aca7 commit 80bca67
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ private void MobDeathHelper(EntityDeathEvent event, TexturedSkullType type, Doub
Double dropchance = prng.nextDouble();
Player killer = event.getEntity().getKiller();

if ((dropchance >= droprate) && ((killer == null) || !killer.hasPermission("playerheads.alwaysbeheadmob"))) {
return;
}
if (plugin.configFile.getBoolean("mobpkonly") && ((killer == null) || !killer.hasPermission("playerheads.canbeheadmob"))) {
return;

if(killer!=null){//mob was PK'd
if(!killer.hasPermission("playerheads.canbeheadmob")) return;//killer does not have permission to behead mobs in any case
if(killer.hasPermission("playerheads.alwaysbeheadmob")) dropchance=0.0;//alwaysbehead should only modify drop chances
}else{//mob was killed by mob
if(plugin.configFile.getBoolean("mobpkonly")) return;//mobs must only be beheaded by players
}
if(dropchance >= droprate) return;

boolean usevanillaskull = plugin.configFile.getBoolean("dropvanillaheads");

Expand Down

0 comments on commit 80bca67

Please sign in to comment.