diff --git a/README b/README index 962cec948..08cb1782c 100644 --- a/README +++ b/README @@ -1,4 +1,9 @@ ---------- Citizens2 README ---------- Citizens is an NPC plugin for the Bukkit API. It was first released on March 5, 2011, and has since seen numerous updates. Citizens -provides an API itself, which developers can use to create their own NPC characters. \ No newline at end of file +provides an API itself, which developers can use to create their own NPC characters. + +Compatible With: +-CitizensAPI 2.0 +-Bukkit 1.1-R5 +-CraftBukkit 1.1-R5 \ No newline at end of file diff --git a/build.xml b/build.xml index 7dd91d1ac..7a983149c 100644 --- a/build.xml +++ b/build.xml @@ -1,6 +1,6 @@ <project name="Citizens" default="dist" basedir="."> <description> - Citizens build file + Build file used for testing purposes </description> <!-- set global properties for this build --> <property name="src" location="src" /> @@ -16,8 +16,8 @@ <javac srcdir="${src}" destdir="${build}" debug="on" debuglevel="lines,vars,source" includeantruntime="false" encoding="Cp1252"> <classpath> <pathelement path="${lib}" /> - <pathelement location="${lib}/bukkit-1.1-R3.jar" /> - <pathelement location="${lib}/craftbukkit-1.1-R3.jar" /> + <pathelement location="${lib}/bukkit-1.1-R5-SNAPSHOT.jar" /> + <pathelement location="${lib}/craftbukkit-1.1-R5-SNAPSHOT.jar" /> <pathelement location="${lib}/CitizensAPI.jar" /> <pathelement location="${lib}/hamcrest.jar" /> <pathelement location="${lib}/junit-dep-4.10.jar" /> diff --git a/lib/CitizensAPI.jar b/lib/CitizensAPI.jar index 2105c17d5..94c9799f9 100644 Binary files a/lib/CitizensAPI.jar and b/lib/CitizensAPI.jar differ diff --git a/lib/bukkit-1.1-R3.jar b/lib/bukkit-1.1-R5-SNAPSHOT.jar similarity index 81% rename from lib/bukkit-1.1-R3.jar rename to lib/bukkit-1.1-R5-SNAPSHOT.jar index aa26f4f35..2d36ad09d 100644 Binary files a/lib/bukkit-1.1-R3.jar and b/lib/bukkit-1.1-R5-SNAPSHOT.jar differ diff --git a/lib/craftbukkit-1.1-R3.jar b/lib/craftbukkit-1.1-R5-SNAPSHOT.jar similarity index 87% rename from lib/craftbukkit-1.1-R3.jar rename to lib/craftbukkit-1.1-R5-SNAPSHOT.jar index 2efe7866a..dae75f276 100644 Binary files a/lib/craftbukkit-1.1-R3.jar and b/lib/craftbukkit-1.1-R5-SNAPSHOT.jar differ diff --git a/src/net/citizensnpcs/Citizens.java b/src/net/citizensnpcs/Citizens.java index a1eed9e86..5157feb33 100644 --- a/src/net/citizensnpcs/Citizens.java +++ b/src/net/citizensnpcs/Citizens.java @@ -44,7 +44,7 @@ import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -267,8 +267,7 @@ public class Citizens extends JavaPlugin { throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'."); String type = key.getString("traits.type").toUpperCase(); - NPC npc = npcManager.createNPC(type.equalsIgnoreCase("DEFAULT") ? null : CreatureType.valueOf(type), id, - key.getString("name"), null); + NPC npc = npcManager.createNPC(EntityType.valueOf(type), id, key.getString("name"), null); try { npc.load(key); } catch (NPCException ex) { diff --git a/src/net/citizensnpcs/command/command/NPCCommands.java b/src/net/citizensnpcs/command/command/NPCCommands.java index 32a03a6eb..3a4461b64 100644 --- a/src/net/citizensnpcs/command/command/NPCCommands.java +++ b/src/net/citizensnpcs/command/command/NPCCommands.java @@ -18,7 +18,7 @@ import net.citizensnpcs.util.Messaging; import net.citizensnpcs.util.StringHelper; import org.bukkit.ChatColor; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -56,10 +56,10 @@ public class NPCCommands { Messaging.sendError(player, "NPC names cannot be longer than 16 characters. The name has been shortened."); name = name.substring(0, 15); } - CreatureType type = null; + EntityType type = EntityType.PLAYER; if (args.hasValueFlag("type")) try { - type = CreatureType.valueOf(args.getFlag("type").toUpperCase().replace('-', '_')); + type = EntityType.valueOf(args.getFlag("type").toUpperCase().replace('-', '_')); } catch (IllegalArgumentException ex) { Messaging.sendError(player, "'" + args.getFlag("type") + "' is not a valid mob type. Using default NPC."); @@ -84,7 +84,7 @@ public class NPCCommands { create.addTrait(new Owner(player.getName())); // Set the mob type - create.addTrait(new MobType(type == null ? "DEFAULT" : type.toString())); + create.addTrait(new MobType(type.toString())); create.spawn(player.getLocation()); npcManager.selectNPC(player, create); diff --git a/src/net/citizensnpcs/npc/CitizensNPCManager.java b/src/net/citizensnpcs/npc/CitizensNPCManager.java index b9d46f701..f3754e6bd 100644 --- a/src/net/citizensnpcs/npc/CitizensNPCManager.java +++ b/src/net/citizensnpcs/npc/CitizensNPCManager.java @@ -14,8 +14,8 @@ import net.citizensnpcs.api.util.Storage; import net.citizensnpcs.util.ByIdArray; import net.citizensnpcs.util.NPCBuilder; -import org.bukkit.entity.CreatureType; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import com.google.common.collect.HashMultimap; @@ -31,7 +31,7 @@ public class CitizensNPCManager implements NPCManager { this.saves = saves; } - public NPC createNPC(CreatureType type, int id, String name, Character character) { + public NPC createNPC(EntityType type, int id, String name, Character character) { if (npcs.contains(id)) throw new IllegalArgumentException("An NPC already has the ID '" + id + "'."); @@ -42,12 +42,12 @@ public class CitizensNPCManager implements NPCManager { } @Override - public NPC createNPC(CreatureType type, String name) { + public NPC createNPC(EntityType type, String name) { return createNPC(type, name, null); } @Override - public NPC createNPC(CreatureType type, String name, Character character) { + public NPC createNPC(EntityType type, String name, Character character) { return createNPC(type, generateUniqueId(), name, character); } diff --git a/src/net/citizensnpcs/util/NPCBuilder.java b/src/net/citizensnpcs/util/NPCBuilder.java index 60a4ce27d..b6700dc9e 100644 --- a/src/net/citizensnpcs/util/NPCBuilder.java +++ b/src/net/citizensnpcs/util/NPCBuilder.java @@ -30,38 +30,38 @@ import net.citizensnpcs.npc.entity.CitizensVillagerNPC; import net.citizensnpcs.npc.entity.CitizensWolfNPC; import net.citizensnpcs.npc.entity.CitizensZombieNPC; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; public class NPCBuilder { - private static final Map<CreatureType, Class<? extends CitizensNPC>> types = new HashMap<CreatureType, Class<? extends CitizensNPC>>(); + private static final Map<EntityType, Class<? extends CitizensNPC>> types = new HashMap<EntityType, Class<? extends CitizensNPC>>(); static { - types.put(CreatureType.BLAZE, CitizensBlazeNPC.class); - types.put(CreatureType.CAVE_SPIDER, CitizensCaveSpiderNPC.class); - types.put(CreatureType.CHICKEN, CitizensChickenNPC.class); - types.put(CreatureType.COW, CitizensCowNPC.class); - types.put(CreatureType.CREEPER, CitizensCreeperNPC.class); - types.put(CreatureType.ENDER_DRAGON, CitizensEnderDragonNPC.class); - types.put(CreatureType.ENDERMAN, CitizensEndermanNPC.class); - types.put(CreatureType.GHAST, CitizensGhastNPC.class); - types.put(CreatureType.GIANT, CitizensGiantNPC.class); - types.put(CreatureType.MAGMA_CUBE, CitizensMagmaCubeNPC.class); - types.put(CreatureType.MUSHROOM_COW, CitizensMushroomCowNPC.class); - types.put(CreatureType.PIG, CitizensPigNPC.class); - types.put(CreatureType.PIG_ZOMBIE, CitizensPigZombieNPC.class); - types.put(CreatureType.SHEEP, CitizensSheepNPC.class); - types.put(CreatureType.SILVERFISH, CitizensSilverfishNPC.class); - types.put(CreatureType.SKELETON, CitizensSkeletonNPC.class); - types.put(CreatureType.SLIME, CitizensSlimeNPC.class); - types.put(CreatureType.SNOWMAN, CitizensSnowmanNPC.class); - types.put(CreatureType.SPIDER, CitizensSpiderNPC.class); - types.put(CreatureType.SQUID, CitizensSquidNPC.class); - types.put(CreatureType.VILLAGER, CitizensVillagerNPC.class); - types.put(CreatureType.WOLF, CitizensWolfNPC.class); - types.put(CreatureType.ZOMBIE, CitizensZombieNPC.class); + types.put(EntityType.BLAZE, CitizensBlazeNPC.class); + types.put(EntityType.CAVE_SPIDER, CitizensCaveSpiderNPC.class); + types.put(EntityType.CHICKEN, CitizensChickenNPC.class); + types.put(EntityType.COW, CitizensCowNPC.class); + types.put(EntityType.CREEPER, CitizensCreeperNPC.class); + types.put(EntityType.ENDER_DRAGON, CitizensEnderDragonNPC.class); + types.put(EntityType.ENDERMAN, CitizensEndermanNPC.class); + types.put(EntityType.GHAST, CitizensGhastNPC.class); + types.put(EntityType.GIANT, CitizensGiantNPC.class); + types.put(EntityType.MAGMA_CUBE, CitizensMagmaCubeNPC.class); + types.put(EntityType.MUSHROOM_COW, CitizensMushroomCowNPC.class); + types.put(EntityType.PIG, CitizensPigNPC.class); + types.put(EntityType.PIG_ZOMBIE, CitizensPigZombieNPC.class); + types.put(EntityType.SHEEP, CitizensSheepNPC.class); + types.put(EntityType.SILVERFISH, CitizensSilverfishNPC.class); + types.put(EntityType.SKELETON, CitizensSkeletonNPC.class); + types.put(EntityType.SLIME, CitizensSlimeNPC.class); + types.put(EntityType.SNOWMAN, CitizensSnowmanNPC.class); + types.put(EntityType.SPIDER, CitizensSpiderNPC.class); + types.put(EntityType.SQUID, CitizensSquidNPC.class); + types.put(EntityType.VILLAGER, CitizensVillagerNPC.class); + types.put(EntityType.WOLF, CitizensWolfNPC.class); + types.put(EntityType.ZOMBIE, CitizensZombieNPC.class); } - public CitizensNPC getByType(CreatureType type, CitizensNPCManager npcManager, int id, String name) { + public CitizensNPC getByType(EntityType type, CitizensNPCManager npcManager, int id, String name) { Class<? extends CitizensNPC> npcClass = types.get(type); if (npcClass == null) npcClass = CitizensHumanNPC.class;