Removed unused code

This commit is contained in:
OmerBenGera 2021-06-12 20:04:00 +03:00
parent 63ace6a84b
commit c7d1ad0325
2 changed files with 10 additions and 18 deletions

View File

@ -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<NPCIdentifier, ChunkLoaderNPC> npcs = Maps.newConcurrentMap();
private final Map<NPCIdentifier, UUID> 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

View File

@ -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