Revert "Implement new selector"

This reverts commit 959b8b774f.
This commit is contained in:
fullwall 2012-09-23 13:07:30 +08:00
parent 959b8b774f
commit 491f566e2a
3 changed files with 5 additions and 13 deletions

View File

@ -14,7 +14,6 @@ import net.citizensnpcs.api.event.CitizensReloadEvent;
import net.citizensnpcs.api.exception.NPCLoadException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPCRegistry;
import net.citizensnpcs.api.npc.NPCSelector;
import net.citizensnpcs.api.scripting.EventRegistrar;
import net.citizensnpcs.api.scripting.ObjectProvider;
import net.citizensnpcs.api.scripting.ScriptCompiler;
@ -37,7 +36,7 @@ import net.citizensnpcs.command.exception.WrappedCommandException;
import net.citizensnpcs.editor.Editor;
import net.citizensnpcs.npc.CitizensNPCRegistry;
import net.citizensnpcs.npc.CitizensTraitFactory;
import net.citizensnpcs.npc.CitizensNPCSelector;
import net.citizensnpcs.npc.NPCSelector;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.Messaging;
import net.citizensnpcs.util.StringHelper;
@ -121,10 +120,6 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
return new File(getDataFolder(), "scripts");
}
public NPCSelector getSelector() {
return selector;
}
@Override
public TraitFactory getTraitFactory() {
return traitFactory;
@ -216,7 +211,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
npcRegistry = new CitizensNPCRegistry(saves);
traitFactory = new CitizensTraitFactory();
selector = new CitizensNPCSelector(this);
selector = new NPCSelector(this);
CitizensAPI.setImplementation(this);
getServer().getPluginManager().registerEvents(new EventListen(), this);

View File

@ -9,7 +9,6 @@ import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.PlayerCreateNPCEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPCRegistry;
import net.citizensnpcs.api.npc.NPCSelector;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.trait.MobType;
import net.citizensnpcs.api.trait.trait.Owner;
@ -22,6 +21,7 @@ import net.citizensnpcs.command.Requirements;
import net.citizensnpcs.command.exception.CommandException;
import net.citizensnpcs.command.exception.NoPermissionsException;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.NPCSelector;
import net.citizensnpcs.trait.Age;
import net.citizensnpcs.trait.Behaviour;
import net.citizensnpcs.trait.Controllable;

View File

@ -8,7 +8,6 @@ import net.citizensnpcs.api.event.NPCRemoveEvent;
import net.citizensnpcs.api.event.NPCRightClickEvent;
import net.citizensnpcs.api.event.NPCSelectEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.npc.NPCSelector;
import net.citizensnpcs.api.trait.trait.Owner;
import net.citizensnpcs.editor.Editor;
import net.citizensnpcs.util.Messaging;
@ -25,16 +24,15 @@ import org.bukkit.plugin.Plugin;
import com.google.common.collect.Lists;
public class CitizensNPCSelector implements Listener, NPCSelector {
public class NPCSelector implements Listener {
private int consoleSelectedNPC = -1;
private final Plugin plugin;
public CitizensNPCSelector(Plugin plugin) {
public NPCSelector(Plugin plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@Override
public NPC getSelected(CommandSender sender) {
if (sender instanceof Player) {
List<MetadataValue> metadata = ((Player) sender).getMetadata("selected");
@ -83,7 +81,6 @@ public class CitizensNPCSelector implements Listener, NPCSelector {
}
}
@Override
public void select(CommandSender sender, NPC npc) {
// Remove existing selection if any
List<Object> selectors = npc.data().get("selectors", Lists.newArrayList());