Browse files

Release v1.2

  • Loading branch information...
1 parent 37dafc3 commit 5b4e6aef9fa8bc4fafb1cfd982fc1882e5b67505 aPunch committed Apr 5, 2012
View
8 CHANGELOG
@@ -136,4 +136,10 @@ By fullwall and aPunch
*ADDED
-added ability to execute some quest commands in the console
*FIXED
--various quest fixes/changes
+-various quest fixes/changes
+
+*--- v1.2 ---
+*KEY FEATURES
+-updated to CraftBukkit Recommended Build 1.2.5-R1.0
+*REMOVED
+-Web error reporting.
View
12 README
@@ -2,14 +2,14 @@
By fullwall and aPunch
Supports:
--Minecraft Beta 1.2.4
--CraftBukkit 2126
+-Minecraft 1.2.5
+-CraftBukkit 1.2.5-R1.0
-PermissionsBukkit
-bPermissions
-PermissionsEx
--iConomy 4, 5, & 6
--BOSEconomy 6 & 7
--EssentialsEco 2.5.8+
+-iConomy
+-BOSEconomy
+-EssentialsEco
-MultiCurrency
Download:
@@ -22,7 +22,7 @@ is still available on our wiki in the Citizens1 category: http://wiki.citizensnp
Bugs and Features:
Feature requests will likely be incorporated into Citizens2, the complete recode of this
-plugin which is currently in beta testing. Bugs for Citizens1 can be reported on the github issue tracker.
+plugin which is currently in beta testing. Bugs for Citizens1 can be reported on the GitHub issue tracker.
It is imperative that you follow these guidelines if you don't want your bug report to be ignored:
View
57 build.xml
@@ -16,7 +16,6 @@
<property name="wizard" location="build/wizard" />
<property name="dist" location="dist" />
<property name="libs" location="libs" />
- <property name="releases" location="releases" />
<target name="init">
<!-- Create neccesary folders -->
<mkdir dir="${build}" />
@@ -39,10 +38,10 @@
<javac srcdir="${src}/core" destdir="${core}" debug="on" debuglevel="lines,vars,source" includeantruntime="false" encoding="Cp1252">
<classpath>
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<!-- Finish compiling the core early because the NPC types require the core! -->
@@ -54,10 +53,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="distblacksmith" />
@@ -67,10 +66,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="distguard" />
@@ -80,10 +79,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="disthealer" />
@@ -93,10 +92,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="distquester" />
@@ -106,10 +105,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="disttrader" />
@@ -119,10 +118,10 @@
<classpath>
<pathelement path="${core}" />
<pathelement path="${libs}" />
- <pathelement location="${libs}/bukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/craftbukkit-1.2.2-SNAPSHOT.jar" />
- <pathelement location="${libs}/WorldGuard.jar" />
- <pathelement location="${libs}/Vault.jar" />
+ <pathelement location="${libs}/bukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/craftbukkit-1.2.5-R1.0.jar" />
+ <pathelement location="${libs}/WorldGuard.jar" />
+ <pathelement location="${libs}/Vault.jar" />
</classpath>
</javac>
<antcall target="distwizard" />
View
BIN libs/bukkit-1.2.2-SNAPSHOT.jar → libs/bukkit-1.2.5-R1.0.jar
Binary file not shown.
View
BIN libs/craftbukkit-1.2.2-SNAPSHOT.jar → libs/craftbukkit-1.2.5-R1.0.jar
Binary file not shown.
View
2 plugin.yml
@@ -1,6 +1,6 @@
name: Citizens
main: net.citizensnpcs.Citizens
-version: 1.1.6
+version: 1.2
authors: [fullwall, aPunch]
softdepend: [Vault]
commands:
View
BIN releases/Citizens.jar
Binary file not shown.
View
40 releases/Citizens/citizens.yml
@@ -1,40 +0,0 @@
-range:
- look: 5
- pathfinding: 16.0
-items:
- select-items: '*'
- talk-items: 340,
-ticks:
- saving:
- save-often: true
- use-task: true
- delay: 72000
- pathing:
- max-stationary: -1
- max-pathing: -1
- waypoints:
- right-click-pause: 70
-economy:
- prices:
- basic:
- creation: 100
- use-economy: true
-debug:
- enable-error-reporting: true
- debug-mode: false
- error-reporting-ident: Anonymous
-general:
- defaults:
- enable-following: true
- talk-when-close: false
- quick-select: false
- colors:
- use-npc-colours: true
- npc-colour: f
- notify-updates: true
- chat:
- space-char: /
- selection-message: <g>You selected <y><npc><g> (ID <y><npcid><g>).
- default-text: Hello.;How are you today?;Having a nice day?;Good weather today.;Stop hitting me!;I'm bored.;
- creation-message: <g>The NPC <y><npc><g> was born!
- format: '[%name%]: '
View
15 releases/Citizens/mobs.yml
@@ -1,15 +0,0 @@
-evil:
- spawn:
- spawn: false
- max: 2
- chance: 100
- items:
- tame-item: 354
- drops: 260,357,2256,
- misc:
- failed-tame-messages: Ha! You can't tame me!;Nice try, <name>!;Muahahaha, I am evil!;
- names: Evil_aPunch,Evil_fullwall,Evil_Notch,Herobrine,
- tame-chance: 5
-general:
- spawn:
- delay: 200
View
158 releases/Citizens/quests.yml
@@ -1,158 +0,0 @@
-# ----- Quest Design Guide -----
-#
-# First, let's cover the basic fields in a quest.
-# Each root node is the quest name - below, the two quest names are 'example' and 'example2'.
-# This is what you will use ingame to identify each quest.
-# Inside this, we see the text nodes - pretty self-explanatory. Note that you can use
-# <br> to denote a line break.
-#
-# The repeats option allows a quest to be completed a certain number of times. It acts as a limit. -1 denotes an
-# unlimited completion times limit. Let's take an example. A limit of 1 would allow the quest to be completed once.
-#
-# Now we move on to the configuration of the two main configuration options - objectives and rewards.
-#
-# --- Objectives ---
-#
-# Thus far, objectives have a set structure - a number of different 'steps' and a number of objectives
-# within each step. This allows for more freeform quest design. Note that each step should be marked
-# by an ascending number, *with quotes* around it. Each objective within a step is incremented concurrently.
-#
-# The message variable is sent to the player on completion of each objective.
-#
-# --- Objective types ---
-#
-# To aid with generic objective design, each objective can use one of a common set of variables
-# - amount, string, materialid, location, string, item and npcdestination (destination NPC ID).
-# Each objective type may use one or more of these variables - a reference is provided below.
-#
-# - Specifying item and locations -
-# Item nodes have three sub-nodes, two that must be included and one optional.
-# The id sub-node designates the item/block ID.
-# The amount sub-node specifies the item amount.
-# The optional data sub-node specifies the item data value to be used.
-#
-# Location nodes have 4 required sub-nodes, two optional.
-# The world node specifies the world name of the location.
-# The x ,y and z nodes specifies the x,y and z values.
-# The pitch/yaw optional nodes specify the rotation (think aeroplanes) of the location.
-#
-# Example syntax:
-# location:
-# x: 123
-# y: 124
-# z: 111
-# world: 'world'
-#
-# Block destroy quest (destroy block) - break a certain amount of blocks.
-# Uses: amount - the amount of blocks to break. materialid - the block ID to break.
-#
-# Build quest (build) - place a certain number of blocks
-# Uses: materialid - the block ID to place. amount - the amount that must be placed.
-#
-# Combat quest (player combat) - kill a certain number of players.
-# Uses: amount - the amount of players to kill. string - a list of which players should be targeted. '*' signifies all, '-' as the first character signifies a
-# whitelist, g:group specifies a group to target.
-#
-# Collect quest (collect) - pick up a certain number of items.
-# Uses: amount - the number of items to pick up. materialid - the ID to pick up.
-#
-# Delivery quest (delivery)- deliver an item to an npc.
-# Uses: npcdestination - the NPC ID to deliver to. materialid - the material that must be in hand.
-# amount - the amount of the material that must be in hand.
-#
-# Distance quest (move distance)- walk a certain number of blocks.
-# Uses: amount - the amount of blocks to walk.
-#
-# Hunt quest (hunt) - kill a certain number of monsters.
-# Uses: amount - the number of monsters to kill. string - which monsters to kill. '*' signifies all, '-' at
-# the start signifies that monsters not in the list will be counted.
-#
-# Location quest (move location)- be within a certain range of a location.
-# Uses: location - the base location to move to. amount - the amount in blocks that the player can be away from the location before finishing.
-#
-#
-# --- Rewards ---
-#
-# These can be used as both rewards *and* requirements to start a quest.
-# As rewards, they can be either give rewards, or take rewards. As requirements, they can only be used
-# to take from a player.
-#
-# Rank reward (rank) - grants a group ('rank') to a player.
-# Specified by the rank: node.
-#
-# Permission reward (permission) - grants a permission to a player.
-# Specified by the permission: node.
-#
-# Quest reward (quest) - grants a quest to a player. Note that it cannot be taken away from a player.
-# Specified by the quest: node.
-#
-# Item reward (item) - gives an item to a player.
-# Loaded from the item: nodes.
-#
-# Health reward (health) - gives health to a player.
-# Loaded from the amount: node.
-#
-# Money reward (money) - gives money to a player.
-# Loaded from the money: node.
-
-example:
- texts:
- description: A build quest
- completion: <g>You win! Here's some stone.
- acceptance: <g>Challenge <y>accepted<g>.
- requirements:
- '0':
- type: rank
- rank: 'your-rank-here'
- repeats: -1
- objectives:
- '0':
- '0':
- type: build
- materialid: 1
- amount: 3
- message: Built. Now come back here!
- rewards:
- '0':
- type: item
- id: 1
- amount: 64
- take: false
-example2:
- texts:
- description: A fetch quest
- completion: <g>You win! Give me that stone.
- acceptance: <g>Challenge <y>accepted<g>.
- repeats: 1
- objectives:
- '0':
- '0':
- type: collect
- materialid: 1
- amount: 3
- message: A voice echoes... "I want that stone now!"
- rewards:
- '0':
- type: item
- id: 1
- amount: 3
- take: true
-example3:
- texts:
- description: A mob quest - kill any 3 of zombie, pig or chicken
- completion: <g>You win!
- acceptance: <g>Challenge <y>accepted<g>.
- repeats: 2
- objectives:
- '0':
- '0':
- type: hunt
- string: 'zombie, pig, chicken'
- amount: 3
- message: Monsters slain \o/.
- rewards:
- '0':
- type: item
- id: 1
- amount: 3
- take: true
View
89 src/alchemist/net/citizensnpcs/alchemists/Alchemist.java
@@ -1,89 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.citizensnpcs.Citizens;
-import net.citizensnpcs.npctypes.CitizensNPC;
-import net.citizensnpcs.npctypes.CitizensNPCType;
-import net.citizensnpcs.permissions.PermissionManager;
-import net.citizensnpcs.properties.Storage;
-import net.citizensnpcs.resources.npclib.HumanNPC;
-import net.citizensnpcs.utils.MessageUtils;
-import net.citizensnpcs.utils.Messaging;
-import net.citizensnpcs.utils.StringUtils;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
-public class Alchemist extends CitizensNPC {
- private Map<Integer, String> recipes = new HashMap<Integer, String>();
- private int currentRecipeID = 0;
-
- public Map<Integer, String> getRecipes() {
- return recipes;
- }
-
- public void setRecipes(Map<Integer, String> recipes) {
- this.recipes = recipes;
- }
-
- public String getRecipe(int itemID) {
- return recipes.get(itemID);
- }
-
- public void addRecipe(int itemID, String recipe) {
- this.recipes.put(itemID, recipe);
- }
-
- public int getCurrentRecipeID() {
- return this.currentRecipeID;
- }
-
- public void setCurrentRecipeID(int currentRecipeID) {
- this.currentRecipeID = currentRecipeID;
- }
-
- @Override
- public void onRightClick(Player player, HumanNPC npc) {
- if (!PermissionManager.hasPermission(player, "citizens.alchemist.use.interact")) {
- Messaging.sendError(player, MessageUtils.noPermissionsMessage);
- return;
- }
- if (!AlchemistManager.hasClickedOnce(player.getName())) {
- if (recipes.size() == 0) {
- Messaging.sendError(player, npc.getName() + " has no recipes.");
- return;
- }
- if (AlchemistManager.sendRecipeMessage(player, npc, 1)) {
- player.sendMessage(ChatColor.GREEN + "Type " + StringUtils.wrap("/alchemist view (page)")
- + " for more ingredients.");
- player.sendMessage(ChatColor.GREEN + "Right-click again to craft.");
- }
- AlchemistManager.setClickedOnce(player.getName(), true);
- return;
- }
- AlchemistTask task = new AlchemistTask(npc);
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Citizens.plugin, task, 2, 1);
- player.openInventory(npc.getInventory());
- AlchemistManager.setClickedOnce(player.getName(), false);
- // TODO requires inventory events to cancel tasks when inventory closes
- }
-
- @Override
- public CitizensNPCType getType() {
- return new AlchemistType();
- }
-
- @Override
- public void save(Storage profiles, int UID) {
- profiles.setInt(UID + ".alchemist.recipes.current", currentRecipeID);
- }
-
- @Override
- public void load(Storage profiles, int UID) {
- currentRecipeID = profiles.getInt(UID + ".alchemist.recipes.current", 0);
-
- }
-}
View
202 src/alchemist/net/citizensnpcs/alchemists/AlchemistCommands.java
@@ -1,202 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import java.util.Map;
-
-import net.citizensnpcs.commands.CommandHandler;
-import net.citizensnpcs.permissions.PermissionManager;
-import net.citizensnpcs.resources.npclib.HumanNPC;
-import net.citizensnpcs.resources.sk89q.Command;
-import net.citizensnpcs.resources.sk89q.CommandContext;
-import net.citizensnpcs.resources.sk89q.CommandPermissions;
-import net.citizensnpcs.resources.sk89q.CommandRequirements;
-import net.citizensnpcs.resources.sk89q.ServerCommand;
-import net.citizensnpcs.utils.HelpUtils;
-import net.citizensnpcs.utils.MessageUtils;
-import net.citizensnpcs.utils.Messaging;
-import net.citizensnpcs.utils.PageUtils;
-import net.citizensnpcs.utils.PageUtils.PageInstance;
-import net.citizensnpcs.utils.StringUtils;
-
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-@CommandRequirements(
- requireSelected = true,
- requireOwnership = true,
- requiredType = "alchemist")
-public class AlchemistCommands extends CommandHandler {
- public static final AlchemistCommands INSTANCE = new AlchemistCommands();
-
- private AlchemistCommands() {
- }
-
- @CommandRequirements()
- @ServerCommand()
- @Command(
- aliases = { "alchemist", "alch" },
- usage = "help",
- desc = "view the alchemist help page",
- modifiers = "help",
- min = 1,
- max = 1)
- @CommandPermissions("alchemist.use.help")
- public static void alchemistHelp(CommandContext args, CommandSender sender,
- HumanNPC npc) {
- INSTANCE.sendHelpPage(sender);
- }
-
- @CommandRequirements(requireSelected = true, requiredType = "alchemist")
- @Command(
- aliases = { "alchemist", "alch" },
- usage = "recipes (page)",
- desc = "view an alchemist's list of recipes",
- modifiers = "recipes",
- min = 1,
- max = 2)
- @CommandPermissions("alchemist.use.recipes.view")
- public static void recipes(CommandContext args, Player player, HumanNPC npc) {
- Map<Integer, String> recipes = ((Alchemist) npc.getType("alchemist"))
- .getRecipes();
- if (recipes.size() == 0) {
- Messaging.sendError(player, npc.getName()
- + " has no recipes.");
- return;
- }
- PageInstance instance = PageUtils.newInstance(player);
- int page = 1;
- if (args.argsLength() == 2) {
- if (!StringUtils.isNumber(args.getString(1))) {
- Messaging.sendError(player, "That is not a valid number.");
- return;
- }
- page = args.getInteger(1);
- }
- instance.header(ChatColor.GREEN
- + StringUtils.listify(StringUtils.wrap(npc.getName()
- + "'s Recipes " + ChatColor.WHITE + "<%x/%y>")));
- for (int entry : recipes.keySet()) {
- instance.push(" - "
- + StringUtils.wrap(MessageUtils.getMaterialName(entry))
- + " (ID: " + entry + ")");
- }
- instance.push(ChatColor.GREEN + "Type "
- + StringUtils.wrap("/alchemist select [itemID]")
- + " to select a recipe.");
- instance.push(ChatColor.GREEN + "Type "
- + StringUtils.wrap("/alchemist view")
- + " to view ingredients for the recipe.");
- instance.process(page);
- }
-
- @CommandRequirements(requireSelected = true, requiredType = "alchemist")
- @Command(
- aliases = { "alchemist", "alch" },
- usage = "view (page)",
- desc = "view the selected alchemist recipe",
- modifiers = "view",
- min = 1,
- max = 2)
- @CommandPermissions("alchemist.use.recipes.view")
- public static void view(CommandContext args, Player player, HumanNPC npc) {
- int page = 1;
- if (args.argsLength() == 2) {
- if (!StringUtils.isNumber(args.getString(1))) {
- Messaging.sendError(player, "That is not a valid number.");
- return;
- }
- page = args.getInteger(1);
- }
- AlchemistManager.sendRecipeMessage(player, npc, page);
- }
-
- @Command(
- aliases = { "alchemist", "alch" },
- usage = "add [itemID] [itemID(:amt),]",
- desc = "add a custom recipe to an alchemist",
- modifiers = "add",
- min = 3,
- max = 3)
- @CommandPermissions("alchemist.modify.recipes.add")
- public static void add(CommandContext args, Player player, HumanNPC npc) {
- if (!AlchemistManager.checkValidID(player, args.getString(1))) {
- return;
- }
- int itemID = args.getInteger(1);
- Alchemist alchemist = npc.getType("alchemist");
- String recipe = args.getString(2);
- String[] items = recipe.split(",");
- for (String item : items) {
- String[] split = item.split(":");
- switch (split.length) {
- case 1:
- if (Material.getMaterial(StringUtils.parse(split[0])) == null) {
- Messaging.sendError(player,
- MessageUtils.invalidItemIDMessage);
- }
- break;
- case 2:
- if (!StringUtils.isNumber(split[1])) {
- Messaging.sendError(player,
- "The amount specified is not a proper number.");
- }
- break;
- }
- }
- alchemist.addRecipe(itemID, recipe);
- alchemist.setCurrentRecipeID(itemID);
- player.sendMessage(StringUtils.wrap(npc.getName())
- + " has changed the recipe for "
- + StringUtils.wrap(MessageUtils.getMaterialName(itemID)) + ".");
- }
-
- @CommandRequirements(requireSelected = true, requiredType = "alchemist")
- @Command(
- aliases = { "alchemist", "alch" },
- usage = "select [itemID]",
- desc = "select a recipe",
- modifiers = "select",
- min = 2,
- max = 2)
- @CommandPermissions("alchemist.use.recipes.select")
- public static void select(CommandContext args, Player player, HumanNPC npc) {
- if (!AlchemistManager.checkValidID(player, args.getString(1))) {
- return;
- }
- int itemID = args.getInteger(1);
- Alchemist alchemist = npc.getType("alchemist");
- if (alchemist.getRecipe(itemID) == null) {
- Messaging.sendError(player, npc.getName()
- + " does not have that recipe.");
- return;
- }
- alchemist.setCurrentRecipeID(itemID);
- player.sendMessage(StringUtils.wrap(npc.getName() + "'s")
- + " recipe has been set to "
- + StringUtils.wrap(MessageUtils.getMaterialName(itemID)) + ".");
- }
-
- @Override
- public void addPermissions() {
- PermissionManager.addPermission("alchemist.use.help");
- PermissionManager.addPermission("alchemist.use.recipes.select");
- PermissionManager.addPermission("alchemist.use.recipes.view");
- PermissionManager.addPermission("alchemist.modify.recipes");
- PermissionManager.addPermission("alchemist.use.interact");
- }
-
- @Override
- public void sendHelpPage(CommandSender sender) {
- HelpUtils.header(sender, "Alchemist", 1, 1);
- HelpUtils.format(sender, "alchemist", "recipes",
- "view all of an alchemist's recipes");
- HelpUtils.format(sender, "alchemist", "select [itemID]",
- "select a recipe");
- HelpUtils.format(sender, "alchemist", "view (page)",
- "view an alchemist's selected recipe");
- HelpUtils.format(sender, "alchemist", "add [itemID] [itemID(:amt),]",
- "add a recipe to an alchemist");
- HelpUtils.footer(sender);
- }
-}
View
79 src/alchemist/net/citizensnpcs/alchemists/AlchemistManager.java
@@ -1,79 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.citizensnpcs.resources.npclib.HumanNPC;
-import net.citizensnpcs.utils.MessageUtils;
-import net.citizensnpcs.utils.Messaging;
-import net.citizensnpcs.utils.StringUtils;
-
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import net.citizensnpcs.utils.PageUtils;
-import net.citizensnpcs.utils.PageUtils.PageInstance;
-
-public class AlchemistManager {
-
- private static List<String> hasClickedOnce = new ArrayList<String>();
-
- public static boolean hasClickedOnce(String name) {
- return hasClickedOnce.contains(name);
- }
-
- public static void setClickedOnce(String name, boolean clicked) {
- if (clicked) {
- hasClickedOnce.add(name);
- } else {
- hasClickedOnce.remove(name);
- }
- }
-
- public static boolean sendRecipeMessage(Player player, HumanNPC npc,
- int page) {
- Alchemist alchemist = npc.getType("alchemist");
- int currentRecipe = alchemist.getCurrentRecipeID();
- PageInstance instance = PageUtils.newInstance(player);
- instance.header(ChatColor.GREEN
- + StringUtils.listify(StringUtils.wrap("Ingredients for "
- + MessageUtils.getMaterialName(currentRecipe)
- + ChatColor.WHITE + " <%x/%y>")));
- if (alchemist.getRecipe(currentRecipe) == null) {
- Messaging.sendError(player, npc.getName()
- + " has no recipes.");
- }
- for (String item : alchemist.getRecipe(currentRecipe).split(",")) {
- instance.push(" - " + ChatColor.GREEN
- + MessageUtils.getStackString(getStackByString(item)));
- }
- instance.process(page);
- return true;
- }
-
- public static ItemStack getStackByString(String string) {
- String[] required = string.split(":");
- int itemID = StringUtils.parse(required[0]);
- int amount = 1;
- if (required.length == 2) {
- amount = StringUtils.parse(required[1]);
- }
- return new ItemStack(itemID, amount);
- }
-
- public static boolean checkValidID(Player player, String itemID) {
- if (!StringUtils.isNumber(itemID)) {
- Messaging.sendError(player, "That is not a valid number.");
- return false;
- }
- int id = Integer.parseInt(itemID);
- if (Material.getMaterial(id) == null
- || Material.getMaterial(id) == Material.AIR) {
- Messaging.sendError(player, MessageUtils.invalidItemIDMessage);
- return false;
- }
- return true;
- }
-}
View
97 src/alchemist/net/citizensnpcs/alchemists/AlchemistProperties.java
@@ -1,97 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import net.citizensnpcs.Settings.SettingsType;
-import net.citizensnpcs.properties.Node;
-import net.citizensnpcs.properties.Properties;
-import net.citizensnpcs.properties.PropertyManager;
-import net.citizensnpcs.resources.npclib.HumanNPC;
-
-import com.google.common.collect.Lists;
-
-public class AlchemistProperties extends PropertyManager implements Properties {
-
- public static final AlchemistProperties INSTANCE = new AlchemistProperties();
-
- private AlchemistProperties() {
- }
-
- private void saveRecipes(int UID, Map<Integer, String> recipeMap) {
- for (Entry<Integer, String> entry : recipeMap.entrySet()) {
- profiles.setString(UID + recipes + "." + entry.getKey(),
- entry.getValue());
- }
- }
-
- private Map<Integer, String> getRecipes(int UID) {
- Map<Integer, String> recipeMap = new HashMap<Integer, String>();
- if (profiles.getIntegerKeys(UID + recipes).size() == 0) {
- return recipeMap;
- }
- for (int key : profiles.getIntegerKeys(UID + recipes)) {
- recipeMap.put(key, profiles.getString(UID + recipes + "." + key));
- }
- return recipeMap;
- }
-
- @Override
- public void saveState(HumanNPC npc) {
- if (exists(npc)) {
- boolean is = npc.isType("alchemist");
- setEnabled(npc, is);
- if (is) {
- Alchemist alchemist = npc.getType("alchemist");
- alchemist.save(profiles, npc.getUID());
- saveRecipes(npc.getUID(), alchemist.getRecipes());
- }
- }
- }
-
- @Override
- public void loadState(HumanNPC npc) {
- if (!npc.isType("alchemist"))
- npc.registerType("alchemist");
- Alchemist alchemist = npc.getType("alchemist");
- alchemist.load(profiles, npc.getUID());
- alchemist.setRecipes(getRecipes(npc.getUID()));
-
- saveState(npc);
- }
-
- @Override
- public void setEnabled(HumanNPC npc, boolean value) {
- profiles.setBoolean(npc.getUID() + isAlchemist, value);
- }
-
- @Override
- public boolean isEnabled(HumanNPC npc) {
- return profiles.getBoolean(npc.getUID() + isAlchemist);
- }
-
- @Override
- public List<Node> getNodes() {
- List<Node> nodes = new ArrayList<Node>();
- nodes.add(new Node("AlchemistFailedCraftChance", SettingsType.GENERAL,
- "alchemists.failed-craft-chance", 10));
- nodes.add(new Node("AlchemistFailedCraftItem", SettingsType.GENERAL,
- "alchemists.failed-craft-item", 263));
- return nodes;
- }
-
- @Override
- public Collection<String> getNodesForCopy() {
- return nodesForCopy;
- }
-
- private static final List<String> nodesForCopy = Lists.newArrayList(
- "alchemist.toggle", "alchemist.recipes");
-
- private static final String isAlchemist = ".alchemist.toggle";
- private static final String recipes = ".alchemist.recipes";
-}
View
54 src/alchemist/net/citizensnpcs/alchemists/AlchemistTask.java
@@ -1,54 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.PlayerInventory;
-
-import net.citizensnpcs.Settings;
-import net.citizensnpcs.resources.npclib.HumanNPC;
-
-public class AlchemistTask implements Runnable {
- private HumanNPC npc;
-
- public AlchemistTask(HumanNPC npc) {
- this.npc = npc;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!npc.isType("alchemist")) {
- return;
- }
- Alchemist alchemist = npc.getType("alchemist");
- ArrayList<ItemStack> required = new ArrayList<ItemStack>();
- for (String item : alchemist.getRecipe(alchemist.getCurrentRecipeID())
- .split(",")) {
- required.add(AlchemistManager.getStackByString(item));
- }
- PlayerInventory npcInv = npc.getInventory();
- for (ItemStack i : required) {
- if (!npcInv.contains(i)) {
- return;
- }
- }
- // clear all ingredients from the inventory
- for (ItemStack toRemove : required) {
- npcInv.remove(toRemove);
- }
- // make sure list is empty for next iteration
- required.clear();
- // add the resulting item into the inventory
- int result;
- if (new Random().nextInt(100) <= Settings
- .getInt("AlchemistFailedCraftChance")) {
- result = alchemist.getCurrentRecipeID();
- } else {
- result = Settings.getInt("AlchemistFailedCraftItem");
- }
- npcInv.addItem(new ItemStack(result, 1));
- npc.getPlayer().updateInventory();
- }
-}
View
29 src/alchemist/net/citizensnpcs/alchemists/AlchemistType.java
@@ -1,29 +0,0 @@
-package net.citizensnpcs.alchemists;
-
-import net.citizensnpcs.commands.CommandHandler;
-import net.citizensnpcs.npctypes.CitizensNPC;
-import net.citizensnpcs.npctypes.CitizensNPCType;
-import net.citizensnpcs.properties.Properties;
-
-public class AlchemistType extends CitizensNPCType {
-
- @Override
- public String getName() {
- return "alchemist";
- }
-
- @Override
- public Properties getProperties() {
- return AlchemistProperties.INSTANCE;
- }
-
- @Override
- public CommandHandler getCommands() {
- return AlchemistCommands.INSTANCE;
- }
-
- @Override
- public CitizensNPC getInstance() {
- return new Alchemist();
- }
-}
View
1 src/alchemist/type.info
@@ -1 +0,0 @@
-main: net.citizensnpcs.alchemists.AlchemistType
View
17 src/core/net/citizensnpcs/Citizens.java
@@ -46,7 +46,6 @@
import net.citizensnpcs.utils.Metrics;
import net.citizensnpcs.utils.Metrics.Plotter;
import net.citizensnpcs.utils.StringUtils;
-import net.citizensnpcs.utils.Web;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -58,7 +57,7 @@
import com.google.common.base.Joiner;
-/**
+/*
* Citizens - NPCs for Bukkit
*/
public class Citizens extends JavaPlugin {
@@ -103,9 +102,6 @@ public int getValue() {
}
}.start();
- // initialize error reporting
- Web.initErrorReporting();
-
// register events per type
for (String loaded : loadedTypes) {
NPCTypeManager.getType(loaded).registerEvents();
@@ -144,7 +140,7 @@ public void run() {
}, Settings.getInt("SavingDelay"), Settings.getInt("SavingDelay"));
}
- Messaging.log("version [" + localVersion() + "] loaded.");
+ Messaging.log("version [" + getDescription().getVersion() + "] loaded.");
// reinitialize existing NPCs
// Scheduled tasks run once all plugins are loaded (multiworld support)
if (getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@@ -153,7 +149,6 @@ public void run() {
setupNPCs();
// call enable event, can be used for initialization of
// type-specific things
- // TODO remove when types are made into plugins
Bukkit.getServer().getPluginManager().callEvent(new CitizensEnableEvent());
}
}) == -1) {
@@ -163,23 +158,17 @@ public void run() {
}
}
- public static String localVersion() {
- return Version.VERSION;
- }
-
@Override
public void onDisable() {
// save the local copy of our files to disk
- Web.disableErrorReporting();
PropertyManager.saveState();
NPCManager.despawnAll(NPCRemoveReason.UNLOAD);
CreatureTask.despawnAll(NPCRemoveReason.UNLOAD);
// call disable event
- // TODO remove when types are made into plugins
Bukkit.getServer().getPluginManager().callEvent(new CitizensDisableEvent());
- Messaging.log("version [" + localVersion() + "] disabled.");
+ Messaging.log("version [" + getDescription().getVersion() + "] disabled.");
}
@Override
View
314 src/core/net/citizensnpcs/Settings.java
@@ -12,191 +12,147 @@
import net.citizensnpcs.utils.Messaging;
public class Settings {
- private static List<Node> nodes = new ArrayList<Node>();
- private static Map<String, Node> loadedNodes = new HashMap<String, Node>();
+ private static List<Node> nodes = new ArrayList<Node>();
+ private static Map<String, Node> loadedNodes = new HashMap<String, Node>();
- public enum SettingsType {
- /**
- * citizens.yml
- */
- GENERAL,
- /**
- * mobs.yml
- */
- MOB;
- }
+ public enum SettingsType {
+ /*
+ * citizens.yml
+ */
+ GENERAL,
+ /*
+ * mobs.yml
+ */
+ MOB;
+ }
- public static String getPath(String key) {
- return loadedNodes.get(key).getPath();
- }
+ public static String getPath(String key) {
+ return loadedNodes.get(key).getPath();
+ }
- public static boolean getBoolean(String name) {
- try {
- return (Boolean) loadedNodes.get(name).getValue();
- } catch (NullPointerException e) {
- Messaging.log("Report this error ASAP.");
- e.printStackTrace();
- return false;
- }
- }
+ public static boolean getBoolean(String name) {
+ try {
+ return (Boolean) loadedNodes.get(name).getValue();
+ } catch (NullPointerException e) {
+ Messaging.log("Report this error ASAP.");
+ e.printStackTrace();
+ return false;
+ }
+ }
- public static int getInt(String name) {
- try {
- return (Integer) loadedNodes.get(name).getValue();
- } catch (NullPointerException e) {
- Messaging.log("Report this error ASAP.");
- e.printStackTrace();
- return 0;
- }
- }
+ public static int getInt(String name) {
+ try {
+ return (Integer) loadedNodes.get(name).getValue();
+ } catch (NullPointerException e) {
+ Messaging.log("Report this error ASAP.");
+ e.printStackTrace();
+ return 0;
+ }
+ }
- public static String getString(String name) {
- try {
- return (String) loadedNodes.get(name).getValue();
- } catch (NullPointerException e) {
- Messaging.log("Report this error ASAP.");
- e.printStackTrace();
- return "";
- }
- }
+ public static String getString(String name) {
+ try {
+ return (String) loadedNodes.get(name).getValue();
+ } catch (NullPointerException e) {
+ Messaging.log("Report this error ASAP.");
+ e.printStackTrace();
+ return "";
+ }
+ }
- public static double getDouble(String name) {
- try {
- Object value = loadedNodes.get(name).getValue();
- if (value instanceof Float) {
- return (Float) value;
- } else if (value instanceof Double) {
- return (Double) value;
- } else {
- return (Integer) value;
- }
- } catch (NullPointerException e) {
- Messaging.log("Report this error ASAP.");
- e.printStackTrace();
- return 0;
- }
- }
+ public static double getDouble(String name) {
+ try {
+ Object value = loadedNodes.get(name).getValue();
+ if (value instanceof Float) {
+ return (Float) value;
+ } else if (value instanceof Double) {
+ return (Double) value;
+ } else {
+ return (Integer) value;
+ }
+ } catch (NullPointerException e) {
+ Messaging.log("Report this error ASAP.");
+ e.printStackTrace();
+ return 0;
+ }
+ }
- /**
- * Sets up miscellaneous variables, mostly reading from property files.
- */
- public static void setupVariables() {
- PropertyManager.registerProperties();
- Storage local = null;
- // Only load settings for loaded NPC types
- for (String t : Citizens.loadedTypes) {
- nodes.add(new Node("", SettingsType.GENERAL, "economy.prices." + t
- + ".creation", 100));
- if (NPCTypeManager.getType(t).getProperties().getNodes() == null) {
- continue;
- }
- for (Node node : NPCTypeManager.getType(t).getProperties()
- .getNodes()) {
- nodes.add(node);
- }
- }
- for (Node node : nodes) {
- local = node.getFile();
- if (!local.keyExists(node.getPath())) {
- Messaging
- .log("Writing default setting " + node.getPath() + ".");
- local.setRaw(node.getPath(), node.getValue());
- } else {
- node.set(local.getRaw(node.getPath()));
- }
- loadedNodes.put(node.getName(), node);
- local.save();
- }
- }
+ /*
+ * Sets up miscellaneous variables, mostly reading from property files.
+ */
+ public static void setupVariables() {
+ PropertyManager.registerProperties();
+ Storage local = null;
+ // Only load settings for loaded NPC types
+ for (String t : Citizens.loadedTypes) {
+ nodes.add(new Node("", SettingsType.GENERAL, "economy.prices." + t + ".creation", 100));
+ if (NPCTypeManager.getType(t).getProperties().getNodes() == null) {
+ continue;
+ }
+ for (Node node : NPCTypeManager.getType(t).getProperties().getNodes()) {
+ nodes.add(node);
+ }
+ }
+ for (Node node : nodes) {
+ local = node.getFile();
+ if (!local.keyExists(node.getPath())) {
+ Messaging.log("Writing default setting " + node.getPath() + ".");
+ local.setRaw(node.getPath(), node.getValue());
+ } else {
+ node.set(local.getRaw(node.getPath()));
+ }
+ loadedNodes.put(node.getName(), node);
+ local.save();
+ }
+ }
- static {
- // citizens.yml
- nodes.add(new Node("MinArrowRange", SettingsType.GENERAL,
- "range.arrow.min", 3));
- nodes.add(new Node("MaxArrowRange", SettingsType.GENERAL,
- "range.arrow.max", 13));
- nodes.add(new Node("MaxStationaryTicks", SettingsType.GENERAL,
- "ticks.pathing.max-stationary", -1));
- nodes.add(new Node("MaxPathingTicks", SettingsType.GENERAL,
- "ticks.pathing.max-pathing", -1));
- nodes.add(new Node("SavingDelay", SettingsType.GENERAL,
- "ticks.saving.delay", 72000));
- nodes.add(new Node("RightClickPause", SettingsType.GENERAL,
- "ticks.waypoints.right-click-pause", 70));
- nodes.add(new Node("SavingDelay", SettingsType.GENERAL,
- "ticks.saving.delay", 72000));
- nodes.add(new Node("NPCRange", SettingsType.GENERAL, "range.look", 5));
- nodes.add(new Node("ChatFormat", SettingsType.GENERAL,
- "general.chat.format", "[%name%]: "));
- nodes.add(new Node(
- "DefaultText",
- SettingsType.GENERAL,
- "general.chat.default-text",
- "Hello.;How are you today?;Having a nice day?;Good weather today.;Stop hitting me!;I'm bored.;"));
- nodes.add(new Node("NPCColor", SettingsType.GENERAL,
- "general.colors.npc-colour", "f"));
- nodes.add(new Node("RealisticPathing", SettingsType.GENERAL,
- "general.pathing.realistic", false));
- nodes.add(new Node("TalkItems", SettingsType.GENERAL,
- "items.talk-items", "340,"));
- nodes.add(new Node("SelectItems", SettingsType.GENERAL,
- "items.select-items", "*"));
- nodes.add(new Node("SelectionMessage", SettingsType.GENERAL,
- "general.chat.selection-message",
- "<g>You selected <y><npc><g> (ID <y><npcid><g>)."));
- nodes.add(new Node("CreationMessage", SettingsType.GENERAL,
- "general.chat.creation-message",
- "<g>The NPC <y><npc><g> was born!"));
- nodes.add(new Node("SpaceChar", SettingsType.GENERAL,
- "general.chat.space-char", "/"));
- nodes.add(new Node("DefaultLookAt", SettingsType.GENERAL,
- "general.defaults.enable-following", true));
- nodes.add(new Node("SaveOften", SettingsType.GENERAL,
- "ticks.saving.save-often", true));
- nodes.add(new Node("UseNPCColors", SettingsType.GENERAL,
- "general.colors.use-npc-colours", true));
- nodes.add(new Node("UseSaveTask", SettingsType.GENERAL,
- "ticks.saving.use-task", true));
- nodes.add(new Node("QuickSelect", SettingsType.GENERAL,
- "general.quick-select", false));
- nodes.add(new Node("DebugMode", SettingsType.GENERAL,
- "debug.debug-mode", false));
- nodes.add(new Node("NotifyUpdates", SettingsType.GENERAL,
- "general.notify-updates", true));
- nodes.add(new Node("DefaultTalkClose", SettingsType.GENERAL,
- "general.defaults.talk-when-close", false));
- nodes.add(new Node("DenyBlockedPVPTargets", SettingsType.GENERAL,
- "general.pvp.deny.attack-disabled-pvp-players", true));
- nodes.add(new Node("PathfindingRange", SettingsType.GENERAL,
- "range.pathfinding", 16F));
- nodes.add(new Node("UseEconomy", SettingsType.GENERAL,
- "economy.use-economy", true));
- nodes.add(new Node("", SettingsType.GENERAL,
- "economy.prices.basic.creation", 100));
- nodes.add(new Node("ErrorReporting", SettingsType.GENERAL,
- "debug.enable-error-reporting", true));
- nodes.add(new Node("ErrorReportingIdent", SettingsType.GENERAL,
- "debug.error-reporting-ident", "Anonymous"));
- // mobs.yml
- nodes.add(new Node("CreatureNPCSpawnDelay", SettingsType.MOB,
- "general.spawn.delay", 200));
- nodes.add(new Node("EvilTameItem", SettingsType.MOB,
- "evil.items.tame-item", 354));
- nodes.add(new Node("EvilTameChance", SettingsType.MOB,
- "evil.misc.tame-chance", 5));
- nodes.add(new Node("MaxEvils", SettingsType.MOB, "evil.spawn.max", 2));
- nodes.add(new Node("EvilSpawnChance", SettingsType.MOB,
- "evil.spawn.chance", 100));
- nodes.add(new Node("EvilNames", SettingsType.MOB, "evil.misc.names",
- "Evil_aPunch,Evil_fullwall,Evil_Notch,Herobrine,"));
- nodes.add(new Node("EvilHealth", SettingsType.MOB, "evil.misc.health",
- 20));
- nodes.add(new Node("EvilDrops", SettingsType.MOB, "evil.items.drops",
- "260,357,2256,"));
- nodes.add(new Node("SpawnEvils", SettingsType.MOB, "evil.spawn.spawn",
- false));
- nodes.add(new Node("EvilFailedTameMessages", SettingsType.MOB,
- "evil.misc.failed-tame-messages",
- "Ha! You can't tame me!;Nice try, <name>!;Muahahaha, I am evil!;"));
- }
+ static {
+ // citizens.yml
+ nodes.add(new Node("MinArrowRange", SettingsType.GENERAL, "range.arrow.min", 3));
+ nodes.add(new Node("MaxArrowRange", SettingsType.GENERAL, "range.arrow.max", 13));
+ nodes.add(new Node("MaxStationaryTicks", SettingsType.GENERAL, "ticks.pathing.max-stationary", -1));
+ nodes.add(new Node("MaxPathingTicks", SettingsType.GENERAL, "ticks.pathing.max-pathing", -1));
+ nodes.add(new Node("SavingDelay", SettingsType.GENERAL, "ticks.saving.delay", 72000));
+ nodes.add(new Node("RightClickPause", SettingsType.GENERAL, "ticks.waypoints.right-click-pause", 70));
+ nodes.add(new Node("SavingDelay", SettingsType.GENERAL, "ticks.saving.delay", 72000));
+ nodes.add(new Node("NPCRange", SettingsType.GENERAL, "range.look", 5));
+ nodes.add(new Node("ChatFormat", SettingsType.GENERAL, "general.chat.format", "[%name%]: "));
+ nodes.add(new Node("DefaultText", SettingsType.GENERAL, "general.chat.default-text",
+ "Hello.;How are you today?;Having a nice day?;Good weather today.;Stop hitting me!;I'm bored.;"));
+ nodes.add(new Node("NPCColor", SettingsType.GENERAL, "general.colors.npc-colour", "f"));
+ nodes.add(new Node("RealisticPathing", SettingsType.GENERAL, "general.pathing.realistic", false));
+ nodes.add(new Node("TalkItems", SettingsType.GENERAL, "items.talk-items", "340,"));
+ nodes.add(new Node("SelectItems", SettingsType.GENERAL, "items.select-items", "*"));
+ nodes.add(new Node("SelectionMessage", SettingsType.GENERAL, "general.chat.selection-message",
+ "<g>You selected <y><npc><g> (ID <y><npcid><g>)."));
+ nodes.add(new Node("CreationMessage", SettingsType.GENERAL, "general.chat.creation-message",
+ "<g>The NPC <y><npc><g> was born!"));
+ nodes.add(new Node("SpaceChar", SettingsType.GENERAL, "general.chat.space-char", "/"));
+ nodes.add(new Node("DefaultLookAt", SettingsType.GENERAL, "general.defaults.enable-following", true));
+ nodes.add(new Node("SaveOften", SettingsType.GENERAL, "ticks.saving.save-often", true));
+ nodes.add(new Node("UseNPCColors", SettingsType.GENERAL, "general.colors.use-npc-colours", true));
+ nodes.add(new Node("UseSaveTask", SettingsType.GENERAL, "ticks.saving.use-task", true));
+ nodes.add(new Node("QuickSelect", SettingsType.GENERAL, "general.quick-select", false));
+ nodes.add(new Node("DebugMode", SettingsType.GENERAL, "debug.debug-mode", false));
+ nodes.add(new Node("NotifyUpdates", SettingsType.GENERAL, "general.notify-updates", true));
+ nodes.add(new Node("DefaultTalkClose", SettingsType.GENERAL, "general.defaults.talk-when-close", false));
+ nodes.add(new Node("DenyBlockedPVPTargets", SettingsType.GENERAL,
+ "general.pvp.deny.attack-disabled-pvp-players", true));
+ nodes.add(new Node("PathfindingRange", SettingsType.GENERAL, "range.pathfinding", 16F));
+ nodes.add(new Node("UseEconomy", SettingsType.GENERAL, "economy.use-economy", true));
+ nodes.add(new Node("", SettingsType.GENERAL, "economy.prices.basic.creation", 100));
+ // mobs.yml
+ nodes.add(new Node("CreatureNPCSpawnDelay", SettingsType.MOB, "general.spawn.delay", 200));
+ nodes.add(new Node("EvilTameItem", SettingsType.MOB, "evil.items.tame-item", 354));
+ nodes.add(new Node("EvilTameChance", SettingsType.MOB, "evil.misc.tame-chance", 5));
+ nodes.add(new Node("MaxEvils", SettingsType.MOB, "evil.spawn.max", 2));
+ nodes.add(new Node("EvilSpawnChance", SettingsType.MOB, "evil.spawn.chance", 100));
+ nodes.add(new Node("EvilNames", SettingsType.MOB, "evil.misc.names",
+ "Evil_aPunch,Evil_fullwall,Evil_Notch,Herobrine,"));
+ nodes.add(new Node("EvilHealth", SettingsType.MOB, "evil.misc.health", 20));
+ nodes.add(new Node("EvilDrops", SettingsType.MOB, "evil.items.drops", "260,357,2256,"));
+ nodes.add(new Node("SpawnEvils", SettingsType.MOB, "evil.spawn.spawn", false));
+ nodes.add(new Node("EvilFailedTameMessages", SettingsType.MOB, "evil.misc.failed-tame-messages",
+ "Ha! You can't tame me!;Nice try, <name>!;Muahahaha, I am evil!;"));
+ }
}
View
9 src/core/net/citizensnpcs/Version.java
@@ -1,9 +0,0 @@
-package net.citizensnpcs;
-
-public final class Version {
- /*
- * This will be replaced by Jenkins automatically when it builds, see
- * http://www.citizensnpcs.net/dev/Version.php
- */
- public static String VERSION = "1.1.5";
-}
View
120 src/core/net/citizensnpcs/commands/BasicCommands.java
@@ -57,14 +57,20 @@ public static void add(CommandContext args, Player player, HumanNPC npc) {
@CommandRequirements()
public static void citizens(CommandContext args, CommandSender sender, HumanNPC npc) {
sender.sendMessage(ChatColor.GREEN + StringUtils.listify(StringUtils.wrap("Citizens")));
- sender.sendMessage(ChatColor.GREEN + " Version: " + StringUtils.wrap(Citizens.localVersion()));
+ sender.sendMessage(ChatColor.GREEN + " Version: "
+ + StringUtils.wrap(Citizens.plugin.getDescription().getVersion()));
sender.sendMessage(ChatColor.GREEN + " Authors: ");
sender.sendMessage(ChatColor.YELLOW + " - fullwall");
sender.sendMessage(ChatColor.YELLOW + " - aPunch");
}
- @Command(aliases = "citizens", usage = "help (page)", desc = "view the Citizens help page", modifiers = "help",
- min = 1, max = 2)
+ @Command(
+ aliases = "citizens",
+ usage = "help (page)",
+ desc = "view the Citizens help page",
+ modifiers = "help",
+ min = 1,
+ max = 2)
@CommandPermissions("basic.use.help")
@CommandRequirements()
@ServerCommand()
@@ -98,8 +104,13 @@ public static void clean(CommandContext args, CommandSender sender, HumanNPC npc
sender.sendMessage(ChatColor.GREEN + "Done. Removed " + StringUtils.wrap(count) + " orphaned NPCs.");
}
- @Command(aliases = "npc", usage = "color [color-code]", desc = "set the name color of an NPC", modifiers = "color",
- min = 2, max = 2)
+ @Command(
+ aliases = "npc",
+ usage = "color [color-code]",
+ desc = "set the name color of an NPC",
+ modifiers = "color",
+ min = 2,
+ max = 2)
@CommandPermissions("basic.modify.color")
public static void color(CommandContext args, Player player, HumanNPC npc) {
if (!args.getString(1).substring(0, 1).equals("&")) {
@@ -178,8 +189,13 @@ public static void create(CommandContext args, Player player, HumanNPC npc) {
}
@CommandRequirements()
- @Command(aliases = "citizens", usage = "debug", desc = "toggle debug mode for Citizens", modifiers = "debug",
- min = 1, max = 1)
+ @Command(
+ aliases = "citizens",
+ usage = "debug",
+ desc = "toggle debug mode for Citizens",
+ modifiers = "debug",
+ min = 1,
+ max = 1)
@ServerCommand()
@CommandPermissions("admin.debug")
public static void debug(CommandContext args, CommandSender sender, HumanNPC npc) {
@@ -231,8 +247,13 @@ public static void equip(CommandContext args, Player player, HumanNPC npc) {
}
@CommandRequirements()
- @Command(aliases = "npc", usage = "list (name) (page)", desc = "view a list of NPCs for a player",
- modifiers = "list", min = 1, max = 3)
+ @Command(
+ aliases = "npc",
+ usage = "list (name) (page)",
+ desc = "view a list of NPCs for a player",
+ modifiers = "list",
+ min = 1,
+ max = 3)
@CommandPermissions("basic.use.list")
public static void list(CommandContext args, Player player, HumanNPC npc) {
switch (args.argsLength()) {
@@ -260,8 +281,13 @@ public static void list(CommandContext args, Player player, HumanNPC npc) {
}
}
- @Command(aliases = "npc", usage = "lookat", desc = "set an NPC's look-when-close setting", modifiers = "lookat",
- min = 1, max = 1)
+ @Command(
+ aliases = "npc",
+ usage = "lookat",
+ desc = "set an NPC's look-when-close setting",
+ modifiers = "lookat",
+ min = 1,
+ max = 1)
@CommandPermissions("basic.modify.lookat")
public static void lookAt(CommandContext args, Player player, HumanNPC npc) {
npc.getNPCData().setLookClose(!npc.getNPCData().isLookClose());
@@ -272,8 +298,13 @@ public static void lookAt(CommandContext args, Player player, HumanNPC npc) {
}
}
- @Command(aliases = "npc", usage = "money (give|take) (amount)", desc = "control an npc's balance",
- modifiers = "money", min = 1, max = 3)
+ @Command(
+ aliases = "npc",
+ usage = "money (give|take) (amount)",
+ desc = "control an npc's balance",
+ modifiers = "money",
+ min = 1,
+ max = 3)
public static void money(CommandContext args, Player player, HumanNPC npc) {
switch (args.argsLength()) {
case 1:
@@ -347,8 +378,13 @@ public static void move(CommandContext args, Player player, HumanNPC npc) {
npc.getNPCData().setLocation(player.getLocation());
}
- @Command(aliases = "npc", usage = "moveto [x y z] (world pitch yaw)", desc = "move an NPC to a location",
- modifiers = "moveto", min = 4, max = 7)
+ @Command(
+ aliases = "npc",
+ usage = "moveto [x y z] (world pitch yaw)",
+ desc = "move an NPC to a location",
+ modifiers = "moveto",
+ min = 4,
+ max = 7)
@CommandPermissions("basic.modify.moveto")
public static void moveTo(CommandContext args, Player player, HumanNPC npc) {
double x = 0, y = 0, z = 0;
@@ -395,8 +431,13 @@ public static void npc(CommandContext args, CommandSender sender, HumanNPC npc)
}
@CommandRequirements()
- @Command(aliases = "npc", usage = "help (page)", desc = "view the Basic NPC help page", modifiers = "help",
- min = 1, max = 2)
+ @Command(
+ aliases = "npc",
+ usage = "help (page)",
+ desc = "view the Basic NPC help page",
+ modifiers = "help",
+ min = 1,
+ max = 2)
@CommandPermissions("basic.use.help")
@ServerCommand()
public static void npcHelp(CommandContext args, CommandSender sender, HumanNPC npc) {
@@ -490,8 +531,13 @@ public static void reset(CommandContext args, Player player, HumanNPC npc) {
}
@CommandRequirements()
- @Command(aliases = "citizens", usage = "save", desc = "force a save of Citizens files", modifiers = "save",
- min = 1, max = 1)
+ @Command(
+ aliases = "citizens",
+ usage = "save",
+ desc = "force a save of Citizens files",
+ modifiers = "save",
+ min = 1,
+ max = 1)
@ServerCommand()
@CommandPermissions("admin.save")
public static void save(CommandContext args, CommandSender sender, HumanNPC npc) {
@@ -508,8 +554,13 @@ public static void save(CommandContext args, CommandSender sender, HumanNPC npc)
sender.sendMessage(ChatColor.GREEN + "[" + StringUtils.wrap("Citizens") + "] Saved.");
}
- @Command(aliases = "npc", usage = "select [id]", desc = "select an NPC by its ID", modifiers = "select", min = 2,
- max = 2)
+ @Command(
+ aliases = "npc",
+ usage = "select [id]",
+ desc = "select an NPC by its ID",
+ modifiers = "select",
+ min = 2,
+ max = 2)
@CommandPermissions("basic.use.select")
@CommandRequirements()
public static void select(CommandContext args, Player player, HumanNPC npc) {
@@ -534,8 +585,13 @@ public static void set(CommandContext args, Player player, HumanNPC npc) {
}
@CommandRequirements()
- @Command(aliases = "npc", usage = "setowner [name]", desc = "set the owner of an NPC", modifiers = "setowner",
- min = 2, max = 2)
+ @Command(
+ aliases = "npc",
+ usage = "setowner [name]",
+ desc = "set the owner of an NPC",
+ modifiers = "setowner",
+ min = 2,
+ max = 2)
public static void setOwner(CommandContext args, Player player, HumanNPC npc) {
if ((!NPCManager.isOwner(player, npc.getUID()) && PermissionManager.hasPermission(player,
"citizens.admin.override.setowner"))
@@ -549,8 +605,13 @@ public static void setOwner(CommandContext args, Player player, HumanNPC npc) {
Messaging.sendError(player, MessageUtils.noPermissionsMessage);
}
- @Command(aliases = "npc", usage = "talkclose", desc = "toggle an NPC's talk-when-close setting",
- modifiers = "talkclose", min = 1, max = 1)
+ @Command(
+ aliases = "npc",
+ usage = "talkclose",
+ desc = "toggle an NPC's talk-when-close setting",
+ modifiers = "talkclose",
+ min = 1,
+ max = 1)
@CommandPermissions("basic.modify.talkclose")
public static void talkClose(CommandContext args, Player player, HumanNPC npc) {
npc.getNPCData().setTalkClose(!npc.getNPCData().isTalkClose());
@@ -561,8 +622,13 @@ public static void talkClose(CommandContext args, Player player, HumanNPC npc) {
}
}
- @Command(aliases = "npc", usage = "tp", desc = "teleport to an NPC", modifiers = { "tp", "teleport" }, min = 1,
- max = 1)
+ @Command(
+ aliases = "npc",
+ usage = "tp",
+ desc = "teleport to an NPC",
+ modifiers = { "tp", "teleport" },
+ min = 1,
+ max = 1)
@CommandPermissions("basic.use.teleport")
public static void teleport(CommandContext args, Player player, HumanNPC npc) {
player.teleport(npc.getNPCData().getLocation());
View
120 src/core/net/citizensnpcs/utils/Web.java
@@ -1,120 +0,0 @@
-package net.citizensnpcs.utils;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.Map;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import net.citizensnpcs.Citizens;
-import net.citizensnpcs.Settings;
-
-import org.bukkit.Bukkit;
-
-import com.google.common.collect.Maps;
-
-public class Web {
- private static final Handler handler = new LogHandler();
-
- public static void initErrorReporting() {
- if (!Settings.getBoolean("ErrorReporting")) {
- return;
- }
- Bukkit.getLogger().addHandler(handler);
- }
-
- public static void disableErrorReporting() {
- if (!Settings.getBoolean("ErrorReporting")) {
- return;
- }
- Bukkit.getLogger().removeHandler(handler);
- }
-
- private static void report(String error) {
- try {
- Messaging.log("An error has occurred, please wait while it is sent to the developers...");
- // Construct data
- String data = URLEncoder.encode("Exception", "UTF-8") + "=" + URLEncoder.encode(error, "UTF-8");
- data += "&" + URLEncoder.encode("Version", "UTF-8") + "="
- + URLEncoder.encode(Citizens.localVersion(), "UTF-8");
- data += "&" + URLEncoder.encode("Ident", "UTF-8") + "="
- + URLEncoder.encode(Settings.getString("ErrorReportingIdent"), "UTF-8");
- // Send data
- URL url = new URL("http://errorreport.citizensnpcs.net");
- URLConnection conn = url.openConnection();
- conn.setConnectTimeout(10000);
- conn.setDoOutput(true);
- OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
- wr.write(data);
- wr.flush();
-
- // Get the response
- BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-
- String line;
- while ((line = rd.readLine()) != null) {
- Messaging.log(line);
- }
-
- wr.close();
- rd.close();
- } catch (Exception e) {
- Messaging.log("An error occurred whilst sending your error report.");
- } finally {
- Messaging
- .log("Below is the stacktrace that has been transmitted to the developers, no other information has been included other than Citizens version information.");
- }
- }
-
- private static String stackToString(Throwable e) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- e.printStackTrace(pw);
- return sw.toString();
- } catch (Exception e2) {
- return "Invalid stacktrace";
- }
- }
-
- private static class LogHandler extends ConsoleHandler {
- @Override
- public void publish(final LogRecord record) {
- if (record.getMessage() == null || record.getThrown() == null || record.getLevel() != Level.SEVERE
- || !record.getMessage().contains("Citizens"))
- return;
- for (String pattern : illegalStacks.keySet()) {
- if (record.getMessage().matches(pattern)) {
- if (!illegalStacks.get(pattern).isEmpty())
- Messaging.log(illegalStacks.get(pattern));
- return;
- }
- }
- new Thread() {
- @Override
- public void run() {
- report(stackToString(record.getThrown()));
- }
- }.start();
- }
- }
-
- private static Map<String, String> illegalStacks = Maps.newHashMap();
- static {
- illegalStacks.put("org.yaml.snakeyaml", "Something went wrong with config.");
- illegalStacks.put("NoSuchFieldError", "A bukkit update has changed obfuscation, wait for a Citizens update.");
- illegalStacks.put("OutOfMemoryError",
- "Uh oh - your server is out of memory - can you report this on the forums?");
- illegalStacks
- .put("NoClassDefFoundError",
- "A required class is missing - usually, the type JARs are incompatible with the core Citizens JAR or there's an economy/permissions class missing.");
- }
-}

0 comments on commit 5b4e6ae

Please sign in to comment.