From c7d1ad03256c890cc1e3ec699a0a06c33665908d Mon Sep 17 00:00:00 2001 From: OmerBenGera Date: Sat, 12 Jun 2021 20:04:00 +0300 Subject: [PATCH] Removed unused code --- .../wildloaders/handlers/NPCHandler.java | 19 +++++++------------ .../wildloaders/npc/NPCIdentifier.java | 9 +++------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/bgsoftware/wildloaders/handlers/NPCHandler.java b/src/main/java/com/bgsoftware/wildloaders/handlers/NPCHandler.java index 33fd0e1..d96b446 100644 --- a/src/main/java/com/bgsoftware/wildloaders/handlers/NPCHandler.java +++ b/src/main/java/com/bgsoftware/wildloaders/handlers/NPCHandler.java @@ -4,7 +4,6 @@ import com.bgsoftware.wildloaders.WildLoadersPlugin; import com.bgsoftware.wildloaders.api.managers.NPCManager; import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC; import com.bgsoftware.wildloaders.npc.NPCIdentifier; -import com.bgsoftware.wildloaders.utils.ServerVersion; import com.bgsoftware.wildloaders.utils.database.Query; import com.google.common.collect.Maps; import org.bukkit.Location; @@ -17,8 +16,6 @@ import java.util.UUID; public final class NPCHandler implements NPCManager { - private static final boolean PER_WORLD_NPCS = /*ServerVersion.isLessThan(ServerVersion.v1_14)*/ false; - private final WildLoadersPlugin plugin; private final Map npcs = Maps.newConcurrentMap(); private final Map npcUUIDs = Maps.newConcurrentMap(); @@ -45,18 +42,16 @@ public final class NPCHandler implements NPCManager { @Override public void killNPC(ChunkLoaderNPC npc) { - if(!PER_WORLD_NPCS){ - NPCIdentifier identifier = new NPCIdentifier(npc.getLocation()); - npcs.remove(identifier); + NPCIdentifier identifier = new NPCIdentifier(npc.getLocation()); + npcs.remove(identifier); - npcUUIDs.remove(identifier); + npcUUIDs.remove(identifier); - Query.DELETE_NPC_IDENTIFIER.insertParameters() - .setLocation(identifier.getSpawnLocation()) - .queue(npc.getUniqueId()); + Query.DELETE_NPC_IDENTIFIER.insertParameters() + .setLocation(identifier.getSpawnLocation()) + .queue(npc.getUniqueId()); - npc.die(); - } + npc.die(); } @Override diff --git a/src/main/java/com/bgsoftware/wildloaders/npc/NPCIdentifier.java b/src/main/java/com/bgsoftware/wildloaders/npc/NPCIdentifier.java index 89c37a1..836a0a5 100644 --- a/src/main/java/com/bgsoftware/wildloaders/npc/NPCIdentifier.java +++ b/src/main/java/com/bgsoftware/wildloaders/npc/NPCIdentifier.java @@ -1,27 +1,24 @@ package com.bgsoftware.wildloaders.npc; import org.bukkit.Location; -import org.bukkit.World; import java.util.Objects; public final class NPCIdentifier { - private static final boolean PER_WORLD_NPCS = /* ServerVersion.isLessThan(ServerVersion.v1_14)*/ false; - private final Object identifier; public NPCIdentifier(Location location){ - this.identifier = PER_WORLD_NPCS ? location.getWorld() : getBlockLocation(location); + this.identifier = getBlockLocation(location); } public Location getSpawnLocation(){ - return PER_WORLD_NPCS ? new Location((World) identifier, 0, 1, 0) : (Location) identifier; + return (Location) identifier; } @Override public String toString() { - return PER_WORLD_NPCS ? ((World) identifier).getName() : identifier.toString(); + return identifier.toString(); } @Override