@@ -34,28 +34,24 @@ public static HandlerList getHandlerList() {

/**
* Get the player who is affected by this event.
*
* @return the player
*/
public abstract Player getPlayer();

/**
* Get the player who caused the event (ie, party leader).
*
* @return the player
*/
public abstract Player getBlamer();

/**
* Get the group that is being affected.
*
* @return the group
*/
public abstract Group getGroup();

/**
* Get the type of event that has happened.
*
* @return the group event type
*/
public abstract MMOGroupAction getAction();
@@ -20,6 +20,7 @@
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;

import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;

@@ -36,50 +37,40 @@ public static HandlerList getHandlerList() {

/**
* The player who owns this Info bar
*
* @return the player we're drawing for
*/
public abstract SpoutPlayer getPlayer();

/**
* Check if this token matches us (not including curly braces)
*
* @param token
* the name of the token we're looking for
* @param token the name of the token we're looking for
* @return if the token exists
*/
public abstract boolean isToken(String token);

/**
* Get the optional args for our token
*
* @return an array of args, split by spaces unless within quotes
*/
public abstract String[] getArgs();

/**
* Set the widget we want displayed
*
* @param plugin
* an instance of the plugin this widget is created for
* @param widget
* any widget including a filled Container
* @param plugin an instance of the plugin this widget is created for
* @param widget any widget including a filled Container
*/
public abstract void setWidget(Plugin plugin, Widget widget);

/**
* Get the widget we have set
*
* @return the widget for this token
*/
public abstract Widget getWidget();

/**
* Set the path of the icon we want to display, FileManager cache permitted
*
* @param icon
* the pathname of the icon we're using, either a url, or an
* internal file using mmoSupport
* @param icon the pathname of the icon we're using, either a url, or an
* internal file using mmoSupport
*/
public abstract void setIcon(String icon);

@@ -16,20 +16,48 @@
*/
package mmo.Core;

import javax.xml.bind.TypeConstraintException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.TypeConstraintException;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Flying;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.WaterMob;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;

public class MMO {

/**
* Never want to manually create a new instance - we're static only
*/
@@ -219,7 +247,7 @@ public static String getColor(Player player, LivingEntity target) {

/**
* Get a simple name for a living entity.
* @param target the target we want named
* @param target the target we want named
* @param showOwner if we prefix a pet's name with the owner's name
* @return the full name
*/
@@ -324,7 +352,7 @@ public static String name(String name) {

/**
* Get a coloured name for a player.
* @param name the player name
* @param name the player name
* @param online is they are currently online
* @return a string including colour
*/
@@ -334,7 +362,7 @@ public static String name(String name, boolean online) {

/**
* Get a string health bar etc.
* @param prefix a string to output before the bar
* @param prefix a string to output before the bar
* @param current between 0 and 10
* @return a string with the bar in it
*/
@@ -405,7 +433,7 @@ public static String join(String[] array) {

/**
* Join an array into a string.
* @param array an array of strings
* @param array an array of strings
* @param delimiter the string to place between each word
* @return the final string
*/
@@ -428,7 +456,7 @@ public static String join(List<String> array) {

/**
* Join a list into a string.
* @param array a list of strings
* @param array a list of strings
* @param delimiter the string to place between each word
* @return the final string
*/
@@ -442,7 +470,7 @@ public static String join(List<String> array, String delimiter) {

/**
* Return a player name from a Player or string.
* @param <T> a Player or String
* @param <T> a Player or String
* @param player the player to find
* @return the player name
*/
@@ -458,7 +486,7 @@ public static <T> String nameFromPlayer(T player) {

/**
* Return a Player from a Player or string.
* @param <T> a Player or String
* @param <T> a Player or String
* @param player the player to find
* @return the player name
*/
@@ -474,7 +502,7 @@ public static <T> Player playerFromName(T player) {

/**
* Return a CommandSender from a Player or string.
* @param <T> a Player or String
* @param <T> a Player or String
* @param player the player to find
* @return the player name
*/
@@ -16,7 +16,11 @@
*/
package mmo.Core;

import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.channels.Channels;
@@ -25,10 +29,12 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;

import mmo.Core.SQLibrary.HSQLDB;
import mmo.Core.SQLibrary.MySQL;
import mmo.Core.SQLibrary.SQLite;
import mmo.Core.util.EnumBitSet;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -38,14 +44,19 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.Plugin;

import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;

public class MMOCore extends MMOPlugin implements Listener {

/**
* Task to check for mmoMinecraft updates
*/
@@ -81,8 +92,7 @@ public EnumBitSet mmoSupport(EnumBitSet support) {
public void onEnable() {
super.onEnable();
pm.registerEvents(this, this);
updateTask = server.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {

updateTask = getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
checkVersion();
@@ -19,13 +19,13 @@
import mmo.Core.ChatAPI.Chat;
import mmo.Core.GroupAPI.Group;
import mmo.Core.PartyAPI.Party;

import org.bukkit.plugin.Plugin;

/**
* MMOMinecraft provides access to the various APIs within mmoMinecraft.
*/
public class MMOMinecraft {

/**
* Does mmoChat exist - quicker than isPluginEnabled.
*/
@@ -151,5 +151,4 @@ static public Party getParty() {
static public Group getGroup() {
return mmoGroupAPI;
}

}

Large diffs are not rendered by default.

@@ -45,7 +45,6 @@
* We need some central storage place for stuff, like the shared DB you mentioned.
*/
public class MMOi18n {

private HashMap<String, HashMap<String, String>> locales = new HashMap<String, HashMap<String, String>>();
private String localeDefault = "en";
private HashMap<String, String> localeSelected = null;
@@ -17,10 +17,10 @@
package mmo.Core.PartyAPI;

import java.util.List;

import org.bukkit.entity.Player;

public interface Party {

/**
* Find a Party via a Player.
* @param player the player who's party we are trying to find
@@ -132,7 +132,7 @@ public interface Party {
/**
* Promote a Player to party leader.
* @param leader the person attempting it
* @param name the player to promote
* @param name the player to promote
* @return if they have been promoted
*/
public boolean promote(Player leader, String name);
@@ -147,7 +147,7 @@ public interface Party {
/**
* Leave a party (in an unfriendly way).
* @param leader the Player attempting to do this
* @param name the Player leaving
* @param name the Player leaving
* @return if they left this party
*/
public boolean kick(Player leader, String name);
@@ -175,7 +175,7 @@ public interface Party {
/**
* Invite a player to the party.
* @param leader the Player attempting to do this
* @param name the player to invite
* @param name the player to invite
* @return if the invitation was successful
*/
public boolean invite(Player leader, String name);
@@ -187,7 +187,7 @@ public interface Party {

/**
* Update a single player's party display
* @param player
* @param player
*/
public void update(Player player);

@@ -1,7 +1,7 @@
/**
* Database Handler
* Abstract superclass for all subclass database files.
*
*
* Date Created: 2011-08-26 19:08
* @author PatPeter
*
@@ -21,7 +21,6 @@
import java.util.logging.Logger;

public abstract class DatabaseHandler {

protected static final Logger log = Logger.getLogger("Minecraft");
protected final String prefixDatabase;
protected final String prefix;
@@ -37,7 +36,7 @@ protected enum Statements {
/**
* Create a new DatabaseHandler.
* @param database the name of the database type, ie "MySQL" or "SQLite"
* @param prefix a prefix for any error messages
* @param prefix a prefix for any error messages
*/
public DatabaseHandler(String database, String prefix) {
this.prefixDatabase = database;
@@ -71,7 +70,7 @@ protected void writeInfo(String toWrite) {
/**
* Writes either errors or warnings to the console.
* @param toWrite the text to write to the console
* @param severe whether console output should appear as an error or warning
* @param severe whether console output should appear as an error or warning
*/
protected void writeError(String toWrite, boolean severe) {
if (toWrite != null && !toWrite.isEmpty()) {
@@ -106,12 +105,12 @@ protected Statements getStatement(String query) {
* @param result the ResultSet to convert
* @return a simple Map of the first row
*/
protected Map<String,Object> ResultSetToMap(ResultSet result) {
Map<String,Object> output = new HashMap<String,Object>();
protected Map<String, Object> ResultSetToMap(ResultSet result) {
Map<String, Object> output = new HashMap<String, Object>();
try {
if (result != null && result.next()) {
ResultSetMetaData mtd = result.getMetaData();
for (int i = mtd.getColumnCount(); i>0 ;i--) {
for (int i = mtd.getColumnCount(); i > 0; i--) {
output.put(mtd.getColumnLabel(i), result.getObject(i));
writeInfo(mtd.getColumnLabel(i) + " -> " + result.getObject(i));
}
@@ -154,22 +153,22 @@ protected Map<String,Object> ResultSetToMap(ResultSet result) {
* Sends a query to the SQL database.
* This uses a prepared statement to ensure the safety of the arguments.
* @param query the SQL query to send to the database
* @param vars a list of variables that replace "?" in the query in a secure manner
* @param vars a list of variables that replace "?" in the query in a secure manner
* @return a single row result from the query
*/
abstract public Map<String,Object> query(String query, Object... vars);
abstract public Map<String, Object> query(String query, Object... vars);

/**
* Creates a prepared query for the database.
* @param query the SQL query to prepare to send to the database
* @param vars a list of variables that replace "?" in the query in a secure manner
* @param vars a list of variables that replace "?" in the query in a secure manner
* @return the prepared statement
*/
abstract public PreparedStatement prepare(String query, Object... vars);

/**
* Creates a table in the database based on a specified query.
* @param name the name of the table to create
* @param name the name of the table to create
* @param columns a Map of name to definitions
* @return if it was created successfully
*/
@@ -1,7 +1,7 @@
/**
* HSQLDB
* Inherited subclass for making a connection to a HSQLDB server.
*
*
* Date Created: 2011-10-05
* Rewritten a load of bad stuff
* @author Rycochet
@@ -16,7 +16,6 @@
import java.util.Map;

public class HSQLDB extends DatabaseHandler {

public static final String type = "HSQLDB";
public static final String driver = "org.hsqldb.jdbcDriver";
private String hostname = "localhost";
@@ -26,11 +25,11 @@ public class HSQLDB extends DatabaseHandler {
private String database = "minecraft";

public HSQLDB(String prefix,
String hostname,
String port,
String database,
String username,
String password) {
String hostname,
String port,
String database,
String username,
String password) {
super(type, prefix);
this.hostname = hostname;
this.port = port;
@@ -89,8 +88,8 @@ public boolean checkConnection() {
}

@Override
public Map<String,Object> query(String query, Object... vars) {
Map<String,Object> output = null;
public Map<String, Object> query(String query, Object... vars) {
Map<String, Object> output = null;
PreparedStatement statement = null;
try {
statement = open().prepareStatement(query);
@@ -1,7 +1,7 @@
/**
* MySQL
* Inherited subclass for making a connection to a MySQL server.
*
*
* Date Created: 2011-08-26 19:08
* @author PatPeter
*
@@ -19,7 +19,6 @@
import java.util.Map;

public class MySQL extends DatabaseHandler {

public static final String type = "MySQL";
public static final String driver = "com.mysql.jdbc.Driver";
private String hostname = "localhost";
@@ -29,11 +28,11 @@ public class MySQL extends DatabaseHandler {
private String database = "minecraft";

public MySQL(String prefix,
String hostname,
String port,
String database,
String username,
String password) {
String hostname,
String port,
String database,
String username,
String password) {
super(type, prefix);
this.hostname = hostname;
this.port = port;
@@ -97,8 +96,8 @@ public boolean checkConnection() {
}

@Override
public Map<String,Object> query(String query, Object... vars) {
Map<String,Object> output = null;
public Map<String, Object> query(String query, Object... vars) {
Map<String, Object> output = null;
PreparedStatement statement = null;
try {
statement = open().prepareStatement(query);
@@ -1,7 +1,7 @@
/**
* SQLite
* Inherited subclass for reading and writing to and from an SQLite file.
*
*
* Date Created: 2011-08-26 19:08
* @author PatPeter
*
@@ -20,7 +20,6 @@
import java.util.Map;

public class SQLite extends DatabaseHandler {

public static final String type = "SQLite";
public static final String driver = "org.sqlite.JDBC";
private String file;
@@ -81,8 +80,8 @@ public boolean checkConnection() {
}

@Override
public Map<String,Object> query(String query, Object... vars) {
Map<String,Object> output = new HashMap<String,Object>();
public Map<String, Object> query(String query, Object... vars) {
Map<String, Object> output = new HashMap<String, Object>();
try {
int retry = 10; // Retry at most this number of times in case of a file lock
int index = 1;
@@ -94,11 +93,11 @@ public Map<String,Object> query(String query, Object... vars) {
try {
switch (this.getStatement(query)) {
case SELECT:
// this.writeInfo("executeQuery: " + query);
// this.writeInfo("executeQuery: " + query);
output = ResultSetToMap(statement.executeQuery());
break;
default:
// this.writeInfo("executeUpdate: " + query);
// this.writeInfo("executeUpdate: " + query);
statement.executeUpdate();
break;
}
@@ -163,7 +162,7 @@ public boolean createTable(String name, Map<String, String> columns, String... o

@Override
public boolean checkTable(String table) {
return !query("SELECT name FROM sqlite_master WHERE type='table' AND name='"+table+"'").isEmpty();
return !query("SELECT name FROM sqlite_master WHERE type='table' AND name='" + table + "'").isEmpty();
}

@Override
@@ -48,126 +48,102 @@ public enum TargetType {

/**
* Set the entity using the skill.
*
* @param self
*/
public abstract void setEntity(Entity self);

/**
* Get the entity using the skill.
*
* @return the entity
*/
public abstract Entity getEntity();

/**
* This casts getEntity to Player if possible, otherwise returns null.
*
* @return the player
*/
public abstract Player getPlayer();

/**
* Set the target type (default is under the mouse reticule).
*
* @param type
* the type of target
* @param type the type of target
*/
public abstract void setTargetType(TargetType type);

/**
* Get the target type.
*
* @return the type of target
*/
public abstract TargetType getTargetType();

/**
* Set the entity target of the skill.
*
* @param target
* the target
* @param target the target
*/
public abstract void setTargetEntity(Entity target);

/**
* Get the entity target of the skill.
*
* @return the target
*/
public abstract Entity getTargetEntity();

/**
* Set the block target of the skill.
*
* @param target
* the target block
* @param target the target block
*/
public abstract void setTargetBlock(Block target);

/**
* Get the block target of the skill.
*
* @return the target block
*/
public abstract Block getTargetBlock();

/**
* Set per-id data for this skill - note, only survives until the skill is
* finished.
*
* @param id
* the id to set
* @param data
* the data to be saved
* @param id the id to set
* @param data the data to be saved
*/
public abstract void setData(String id, Object data);

/**
* Get per-id data for this skill, arguments passed to the skill are in
* "<Skill>_<arg>".
*
* @param id
* the id to get
* @param id the id to get
* @return a previously set object
*/
public abstract Object getData(String id);

/**
* Set a delay for this skill - after the delay this skill is called again.
*
* @param seconds
* between calls
* @param seconds between calls
*/
public abstract void setDelay(int seconds);

/**
* Get the current delay for this skill.
*
* @return the delay in seconds.
*/
public abstract int getDelay();

/**
* Get the number of times this skill has run. First run is 0.
*
* @return the number of times
*/
public abstract int getCount();

/**
* Check if a skill is to be used by name.
*
* @param skill
* the name of the skill
* @param skill the name of the skill
* @return if this skill is used
*/
public abstract boolean hasSkill(String skill);

/**
* Check if the skill should make any changes - NEVER do anything except
* check when this is false.
*
* @return if this is not just testing
*/
public abstract boolean isRunning();
@@ -23,7 +23,6 @@
* The default size is 8x8 pixels, but must always be square.
*/
public final class GenericFace extends GenericTexture {

private static String facePath = "http://face.mmo.me.uk/";
private static int defaultSize = 8;
private String name;
@@ -18,12 +18,23 @@

import mmo.Core.MMO;
import mmo.Core.MMOCore;

import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.gui.*;

public class GenericLivingEntity extends GenericContainer {
import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.gui.Container;
import org.getspout.spoutapi.gui.ContainerType;
import org.getspout.spoutapi.gui.GenericContainer;
import org.getspout.spoutapi.gui.GenericGradient;
import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.Gradient;
import org.getspout.spoutapi.gui.Label;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.gui.WidgetAnchor;

public class GenericLivingEntity extends GenericContainer {
private LivingEntity target = null;
private Container _bar;
private Label _label;
@@ -36,31 +47,31 @@ public class GenericLivingEntity extends GenericContainer {
String face = "~";

public GenericLivingEntity() {
this.addChildren(
_bar = (Container) new GenericContainer( // Used for the bar, this.children with an index 1+ are targets
new GenericGradient(new Color(0, 0, 0, 0.75f)) //
this.addChildren(
_bar = (Container) new GenericContainer( // Used for the bar, this.children with an index 1+ are targets
new GenericGradient(new Color(0, 0, 0, 0.75f)) //
.setWidth(def_width) //
.setPriority(RenderPriority.Highest), //
new GenericContainer( //
_top = (Gradient) new GenericGradient(new Color(1f, 0, 0, 0.75f)).setWidth(def_width), //
_bottom = (Gradient) new GenericGradient(new Color(0.75f, 0.75f, 0.75f, 0.75f)).setWidth(def_width) //
).setMargin(1) //
.setPriority(RenderPriority.High), //
new GenericContainer( //
_face = (GenericFace) new GenericFace() //
.setVisible(MMOCore.config_show_player_faces) //
.setMargin(3, 0, 3, 3), //
_label = (Label) new GenericLabel("") //
.setResize(true) //
.setFixed(true) //
.setMargin(3, 3, 1, 3) //
).setLayout(ContainerType.HORIZONTAL) //
).setLayout(ContainerType.OVERLAY) //
.setFixed(true) //
.setWidth(def_width) //
.setPriority(RenderPriority.Highest), //
new GenericContainer( //
_top = (Gradient) new GenericGradient(new Color(1f, 0, 0, 0.75f)).setWidth(def_width), //
_bottom = (Gradient) new GenericGradient(new Color(0.75f, 0.75f, 0.75f, 0.75f)).setWidth(def_width) //
) .setMargin(1) //
.setPriority(RenderPriority.High), //
new GenericContainer( //
_face = (GenericFace) new GenericFace() //
.setVisible(MMOCore.config_show_player_faces) //
.setMargin(3, 0, 3, 3), //
_label = (Label) new GenericLabel("") //
.setResize(true) //
.setFixed(true) //
.setMargin(3, 3, 1, 3) //
) .setLayout(ContainerType.HORIZONTAL) //
) .setLayout(ContainerType.OVERLAY) //
.setFixed(true) //
.setWidth(def_width) //
.setHeight(def_height) //
.setMargin(0, 0, 1, 0) //
) .setAlign(WidgetAnchor.TOP_LEFT) //
.setHeight(def_height) //
.setMargin(0, 0, 1, 0) //
).setAlign(WidgetAnchor.TOP_LEFT) //
.setLayout(ContainerType.VERTICAL) //
.setFixed(true) //
.setWidth(def_width) //
@@ -76,7 +87,7 @@ public GenericLivingEntity setEntity() {
setLabel("");
setFace("");
Widget[] widgets = this.getChildren();
for (int i=1; i<widgets.length; i++) {
for (int i = 1; i < widgets.length; i++) {
this.removeChild(widgets[i]);
}
return this;
@@ -93,7 +104,7 @@ public GenericLivingEntity setEntity(String name) {

/**
* Set the display from a possibly offline player.
* @param name the target
* @param name the target
* @param prefix a string to show before the name
* @return this
*/
@@ -127,7 +138,7 @@ public GenericLivingEntity setEntity(LivingEntity entity, String prefix) {
if (entity != null && entity instanceof LivingEntity) {
target = entity;
setLabel((!"".equals(prefix) ? prefix : "") + MMO.getColor(screen != null ? screen.getPlayer() : null, entity) + MMO.getSimpleName(entity, !(getContainer() instanceof GenericLivingEntity)));
setFace(entity instanceof Player ? ((Player)entity).getName() : "+" + MMO.getSimpleName(entity,false).replaceAll(" ", ""));
setFace(entity instanceof Player ? ((Player) entity).getName() : "+" + MMO.getSimpleName(entity, false).replaceAll(" ", ""));
} else {
setEntity();
}
@@ -152,13 +163,13 @@ public GenericLivingEntity setTargets(LivingEntity... targets) {
if (targets == null) {
targets = new LivingEntity[0]; // zero-length array is easier to handle
}
for (int i=targets.length+1; i<widgets.length; i++) {
for (int i = targets.length + 1; i < widgets.length; i++) {
this.removeChild(widgets[i]);
}
for (int i=0; i<targets.length; i++) {
for (int i = 0; i < targets.length; i++) {
GenericLivingEntity child;
if (widgets.length > i + 1) {
child = (GenericLivingEntity) widgets[i+1];
child = (GenericLivingEntity) widgets[i + 1];
} else {
this.addChild(child = new GenericLivingEntity());
child._bar.setMarginLeft(def_width / 4).setWidth(def_width - (def_width / 4));
@@ -168,7 +179,7 @@ public GenericLivingEntity setTargets(LivingEntity... targets) {
setHeight((targets.length + 1) * (def_height + def_space));
return this;
}

/**
* Get the current top bar (health) value as a percentage.
* @return current health
@@ -23,7 +23,6 @@
* Overrides the .contains(), .indexOf(), .lastIndexOf() and .remove() methods.
*/
public class ArrayListString extends ArrayList<String> {

private static final long serialVersionUID = 6793276940676543571L;

/**
@@ -19,13 +19,11 @@
import java.util.BitSet;

public class EnumBitSet extends BitSet {

/**
* Sets the bit at the specified index to the complement of its
* current value.
*
* @param bitIndex the index of the bit to flip.
* @exception IndexOutOfBoundsException if the specified index is negative.
* @param bitIndex the index of the bit to flip.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public void flip(Enum<?> bitIndex) {
super.flip(bitIndex.ordinal());
@@ -35,33 +33,30 @@ public void flip(Enum<?> bitIndex) {
* Sets each bit from the specified <tt>fromIndex</tt> (inclusive) to the
* specified <tt>toIndex</tt> (exclusive) to the complement of its current
* value.
*
* @param fromIndex index of the first bit to flip.
* @param toIndex index after the last bit to flip.
* @exception IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @param fromIndex index of the first bit to flip.
* @param toIndex index after the last bit to flip.
* @throws IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
*/
public void flip(Enum<?> fromIndex, Enum<?> toIndex) {
super.flip(fromIndex.ordinal(), toIndex.ordinal());
}

/**
* Sets the bit at the specified index to <code>true</code>.
*
* @param bitIndex an enum index.
* @exception IndexOutOfBoundsException if the specified index is negative.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public void set(Enum<?> bitIndex) {
super.set(bitIndex.ordinal());
}

/**
* Sets the bit at the specified index to the specified value.
*
* @param bitIndex a bit index.
* @param value a boolean value to set.
* @exception IndexOutOfBoundsException if the specified index is negative.
* @param bitIndex a bit index.
* @param value a boolean value to set.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public void set(Enum<?> bitIndex, boolean value) {
super.set(bitIndex.ordinal(), value);
@@ -70,12 +65,11 @@ public void set(Enum<?> bitIndex, boolean value) {
/**
* Sets the bits from the specified <tt>fromIndex</tt> (inclusive) to the
* specified <tt>toIndex</tt> (exclusive) to <code>true</code>.
*
* @param fromIndex index of the first bit to be set.
* @param toIndex index after the last bit to be set.
* @exception IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @param fromIndex index of the first bit to be set.
* @param toIndex index after the last bit to be set.
* @throws IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
*/
public void set(Enum<?> fromIndex, Enum<?> toIndex) {
super.set(fromIndex.ordinal(), toIndex.ordinal());
@@ -84,24 +78,22 @@ public void set(Enum<?> fromIndex, Enum<?> toIndex) {
/**
* Sets the bits from the specified <tt>fromIndex</tt> (inclusive) to the
* specified <tt>toIndex</tt> (exclusive) to the specified value.
*
* @param fromIndex index of the first bit to be set.
* @param toIndex index after the last bit to be set
* @param value value to set the selected bits to
* @exception IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @param fromIndex index of the first bit to be set.
* @param toIndex index after the last bit to be set
* @param value value to set the selected bits to
* @throws IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
*/
public void set(Enum<?> fromIndex, Enum<?> toIndex, boolean value) {
super.set(fromIndex.ordinal(), toIndex.ordinal(), value);
}

/**
* Sets the bit specified by the index to <code>false</code>.
*
* @param bitIndex the index of the bit to be cleared.
* @exception IndexOutOfBoundsException if the specified index is negative.
* @since JDK1.0
* @param bitIndex the index of the bit to be cleared.
* @throws IndexOutOfBoundsException if the specified index is negative.
* @since JDK1.0
*/
public void clear(Enum<?> bitIndex) {
super.clear(bitIndex.ordinal());
@@ -110,13 +102,12 @@ public void clear(Enum<?> bitIndex) {
/**
* Sets the bits from the specified <tt>fromIndex</tt> (inclusive) to the
* specified <tt>toIndex</tt> (exclusive) to <code>false</code>.
*
* @param fromIndex index of the first bit to be cleared.
* @param toIndex index after the last bit to be cleared.
* @exception IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @since 1.4
* @param fromIndex index of the first bit to be cleared.
* @param toIndex index after the last bit to be cleared.
* @throws IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @since 1.4
*/
public void clear(Enum<?> fromIndex, Enum<?> toIndex) {
super.clear(fromIndex.ordinal(), toIndex.ordinal());
@@ -127,10 +118,9 @@ public void clear(Enum<?> fromIndex, Enum<?> toIndex) {
* is <code>true</code> if the bit with the index <code>bitIndex</code>
* is currently set in this <code>BitSet</code>; otherwise, the result
* is <code>false</code>.
*
* @param bitIndex the bit index.
* @return the value of the bit with the specified index.
* @exception IndexOutOfBoundsException if the specified index is negative.
* @param bitIndex the bit index.
* @return the value of the bit with the specified index.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public boolean get(Enum<?> bitIndex) {
return super.get(bitIndex.ordinal());
@@ -139,13 +129,12 @@ public boolean get(Enum<?> bitIndex) {
/**
* Returns a new <tt>BitSet</tt> composed of bits from this <tt>BitSet</tt>
* from <tt>fromIndex</tt> (inclusive) to <tt>toIndex</tt> (exclusive).
*
* @param fromIndex index of the first bit to include.
* @param toIndex index after the last bit to include.
* @return a new <tt>BitSet</tt> from a range of this <tt>BitSet</tt>.
* @exception IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
* @param fromIndex index of the first bit to include.
* @param toIndex index after the last bit to include.
* @return a new <tt>BitSet</tt> from a range of this <tt>BitSet</tt>.
* @throws IndexOutOfBoundsException if <tt>fromIndex</tt> is negative,
* or <tt>toIndex</tt> is negative, or <tt>fromIndex</tt> is
* larger than <tt>toIndex</tt>.
*/
public EnumBitSet get(Enum<?> fromIndex, Enum<?> toIndex) {
EnumBitSet result = new EnumBitSet();
@@ -157,18 +146,17 @@ public EnumBitSet get(Enum<?> fromIndex, Enum<?> toIndex) {
* Returns the index of the first bit that is set to <code>true</code>
* that occurs on or after the specified starting index. If no such
* bit exists then -1 is returned.
*
* <p/>
* To iterate over the <code>true</code> bits in a <code>BitSet</code>,
* use the following loop:
*
* <p/>
* <pre>
* for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
* // operate on index i here
* }</pre>
*
* @param fromIndex the index to start checking from (inclusive).
* @return the index of the next set bit.
* @throws IndexOutOfBoundsException if the specified index is negative.
* @param fromIndex the index to start checking from (inclusive).
* @return the index of the next set bit.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public int nextSetBit(Enum<?> fromIndex) {
return super.nextSetBit(fromIndex.ordinal());
@@ -177,10 +165,9 @@ public int nextSetBit(Enum<?> fromIndex) {
/**
* Returns the index of the first bit that is set to <code>false</code>
* that occurs on or after the specified starting index.
*
* @param fromIndex the index to start checking from (inclusive).
* @return the index of the next clear bit.
* @throws IndexOutOfBoundsException if the specified index is negative.
* @param fromIndex the index to start checking from (inclusive).
* @return the index of the next clear bit.
* @throws IndexOutOfBoundsException if the specified index is negative.
*/
public int nextClearBit(Enum<?> fromIndex) {
return super.nextClearBit(fromIndex.ordinal());
@@ -17,14 +17,13 @@
package mmo.Core.util;

import mmo.Core.MMO;

import org.bukkit.entity.Player;

/**
*
* @author Xaymar
*/
public class util {

public static String substitude(String On, String[] What, String[] With) {
if (What.length != With.length) {
throw new java.lang.ArrayIndexOutOfBoundsException();
@@ -57,15 +56,15 @@ public static String colorize(String On) {

public static String parsePlayer(String On, Player plr) {
return colorize(util.substitude(On,
new String[]{
"+n,+name",
"+d,+displayname",
"+w,+world",
"+t,+time",
"+l,+location",
"+x",
"+y",
"+z",}, new String[]{
new String[]{
"+n,+name",
"+d,+displayname",
"+w,+world",
"+t,+time",
"+l,+location",
"+x",
"+y",
"+z",}, new String[]{
plr.getName(),
plr.getDisplayName(),
plr.getWorld().getName(),
@@ -74,7 +73,7 @@ public static String parsePlayer(String On, Player plr) {
String.valueOf(plr.getLocation().getX()),
String.valueOf(plr.getLocation().getY()),
String.valueOf(plr.getLocation().getZ())
}));
}));
}

public static String[] reparseArgs(String[] args) {