Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Listener rewrite & more config readability
- Loading branch information
Showing
10 changed files
with
200 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
name: DropHeads | ||
main: net.evmodder.DropHeads.DropHeads | ||
author: EvModder/EvilWitchdoctor | ||
version: 3.2.8 #8=stable 1.14 release | ||
version: 3.2.10 #10=item renaming,wither drop rate fix | ||
api-version: 1.13 | ||
|
||
commands: | ||
spawnhead: | ||
description: Get a player or mob head | ||
usage: /gethead [name] | ||
aliases: [gethead,dhspawn,spawn-head,head,phspawn,skull] | ||
permission: evp.dropheads.spawn | ||
permission: dropheads.spawn | ||
permission-message: You do not have permission to do this. | ||
|
||
debug_all_heads: | ||
description: Place all heads into the world around the player | ||
usage: /debug_all_heads | ||
permission: evp.dropheads.debug | ||
permission: dropheads.debug | ||
permission-message: You do not have permission to do this. | ||
|
||
permissions: | ||
evp.dropheads.alwaysbehead: | ||
dropheads.alwaysbehead: | ||
description: This player will get heads 100% of the time | ||
default: false | ||
|
||
evp.dropheads.canbehead: | ||
dropheads.canbehead: | ||
description: This player will be able to get heads | ||
default: true | ||
|
||
evp.dropheads.spawn: | ||
dropheads.spawn: | ||
description: Permission to spawn heads with a command | ||
default: op | ||
|
||
evp.dropheads.debug: | ||
dropheads.debug: | ||
description: Permission to spawn all the heads in a big cube | ||
default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/net/evmodder/DropHeads/listeners/EntityDamageListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.evmodder.DropHeads.listeners; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.entity.Projectile; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.EntityDamageByEntityEvent; | ||
import org.bukkit.metadata.FixedMetadataValue; | ||
import net.evmodder.DropHeads.DropHeads; | ||
|
||
public class EntityDamageListener implements Listener{ | ||
final DropHeads pl; | ||
final boolean allowProjectileKills; | ||
|
||
// Only enabled if drop-for-indirect-kills is TRUE | ||
public EntityDamageListener(){ | ||
pl = DropHeads.getPlugin(); | ||
allowProjectileKills = pl.getConfig().getBoolean("drop-for-ranged-kills", false); | ||
} | ||
@EventHandler(priority = EventPriority.HIGH) | ||
public void entityDamageEvent(EntityDamageByEntityEvent evt){ | ||
if(evt.isCancelled()) return; | ||
if(evt.getDamager() instanceof Player || (allowProjectileKills && evt.getDamager() instanceof Projectile | ||
&& ((Projectile)evt.getDamager()).getShooter() instanceof Player)){ | ||
evt.getEntity().setMetadata("PlayerDamage", new FixedMetadataValue(pl, System.currentTimeMillis())); | ||
} | ||
} | ||
} |
Oops, something went wrong.