Skip to content

Commit

Permalink
Fix: damageableProjectile, see Zrips#448 in parent repo
Browse files Browse the repository at this point in the history
  • Loading branch information
PintaPepo committed May 10, 2020
1 parent 52ef510 commit 15c651b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/bekvon/bukkit/residence/Residence.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
*/
public class Residence extends JavaPlugin {

private Logger log;

private static Residence instance;
public PermissionManager gmanager;
public WorldItemManager imanager;
Expand Down Expand Up @@ -367,6 +369,8 @@ public void onDisable() {
@Override
public void onEnable() {
try {
log = getLogger();
log.setLevel(Level.ALL);
instance = this;

initsuccess = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ public static boolean isMonster(Entity ent) {
}

private static boolean isTamed(Entity ent) {
return (ent instanceof Tameable ? ((Tameable) ent).isTamed() : false);
return (ent instanceof Tameable && ((Tameable) ent).isTamed());
}

private static boolean damageableProjectile(Entity ent) {
if(ent instanceof AbstractArrow){
return true;
}
// TODO improve performance use Set, or directly remove all the checks
if (ent instanceof Projectile && ent.getType().toString().equalsIgnoreCase("Splash_potion")) {
for (PotionEffect one : ((ThrownPotion) ent).getEffects()) {
for (String oneHarm : Residence.getInstance().getConfigManager().getNegativePotionEffects()) {
Expand All @@ -55,7 +59,7 @@ private static boolean damageableProjectile(Entity ent) {
}
}
}
return ent instanceof Arrow || ent instanceof Projectile && (ent.getType().toString().equalsIgnoreCase("Trident"));
return false;
}

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
Expand Down Expand Up @@ -98,8 +102,6 @@ public void AnimalKilling(EntityDamageByEntityEvent event) {
return;
// disabling event on world
Entity entity = event.getEntity();
if (entity == null)
return;
if (plugin.isDisabledWorldListener(entity.getWorld()))
return;
if (!plugin.getNms().isAnimal(entity))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FlagPermissions {
protected Map<String, Map<String, Boolean>> groupFlags = new ConcurrentHashMap<>();
protected Map<String, Boolean> cuboidFlags = new ConcurrentHashMap<>();
protected FlagPermissions parent;

public static void addMaterialToUseFlag(Material mat, Flags flag) {
if (mat == null)
return;
Expand Down

0 comments on commit 15c651b

Please sign in to comment.