Skip to content

Commit

Permalink
Converting contains check to hashmap
Browse files Browse the repository at this point in the history
Convert entity checking to use the new hashmap instead of previous arraylist
  • Loading branch information
CoolLord22 committed Mar 30, 2023
1 parent 63de3f8 commit 27d09a2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onTeleport(PlayerTeleportEvent event) {

for(Entity ent : event.getFrom().getWorld().getNearbyEntities(event.getFrom(), radius, radius, radius)) {
plugin.log.logInfo("[Ent-" + ent.getEntityId() + "] Found a(n) " + ent.getType() + ". Checking if type is allowed.", Verbosity.HIGH);
if(plugin.config.allowedEnts.contains(ent.getType())) {
if(plugin.config.entityMap.get(ent.getType()) != null && plugin.config.entityMap.get(ent.getType())) {
plugin.log.logInfo("[Ent-" + ent.getEntityId() + "] Entity-type check passed, checking player permissions.", Verbosity.HIGHEST);
if(ent instanceof LivingEntity && event.getPlayer().hasPermission("otheranimalteleport.player.teleportleashed")) {
plugin.log.logInfo("[Ent-" + ent.getEntityId() + "] Player leashed permissions check passed, checking leash owner.", Verbosity.HIGHEST);
Expand Down

0 comments on commit 27d09a2

Please sign in to comment.