summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Kit.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/Mob.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java64
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/TimedTeleport.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandheal.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrepair.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/metrics/Metrics.java333
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/BookInput.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/BookPager.java34
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/TextInput.java4
-rw-r--r--Essentials/src/messages.properties10
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties8
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties6
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_ro.properties2
-rw-r--r--Essentials/src/messages_se.properties2
-rw-r--r--Essentials/src/messages_zh.properties2
-rw-r--r--Essentials/src/messages_zh_HK.properties2
-rw-r--r--Essentials/src/messages_zh_TW.properties2
-rw-r--r--Essentials/src/plugin.yml8
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java19
-rw-r--r--lib/bukkit.jarbin4870820 -> 4890921 bytes
-rw-r--r--lib/craftbukkit.jarbin12973435 -> 15233037 bytes
35 files changed, 413 insertions, 162 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 9689ea923..d9bb6fc2c 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -73,7 +73,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
- public static final int BUKKIT_VERSION = 2763;
+ public static final int BUKKIT_VERSION = 2794;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 5ce948027..062e2461a 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -27,7 +27,7 @@ public interface ISettings extends IConf
long getBackupInterval();
- MessageFormat getChatFormat(String group);
+ String getChatFormat(String group);
int getChatRadius();
diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java
index 39fc0fc66..e06727dfb 100644
--- a/Essentials/src/com/earth2me/essentials/Kit.java
+++ b/Essentials/src/com/earth2me/essentials/Kit.java
@@ -194,7 +194,8 @@ public class Kit
}
final Map<Integer, ItemStack> overfilled;
- if (user.isAuthorized("essentials.oversizedstacks"))
+ final boolean allowOversizedStacks = user.isAuthorized("essentials.oversizedstacks");
+ if (allowOversizedStacks)
{
overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack());
}
@@ -204,7 +205,14 @@ public class Kit
}
for (ItemStack itemStack : overfilled.values())
{
- user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
+ int spillAmount = itemStack.getAmount();
+ if (!allowOversizedStacks) {
+ itemStack.setAmount(spillAmount < itemStack.getMaxStackSize() ? spillAmount : itemStack.getMaxStackSize());
+ }
+ while (spillAmount > 0) {
+ user.getWorld().dropItemNaturally(user.getLocation(), itemStack);
+ spillAmount -= itemStack.getAmount();
+ }
spew = true;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java
index 3afcf1b85..4af62d37f 100644
--- a/Essentials/src/com/earth2me/essentials/Mob.java
+++ b/Essentials/src/com/earth2me/essentials/Mob.java
@@ -21,6 +21,7 @@ public enum Mob
CREEPER("Creeper", Enemies.ENEMY, EntityType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, EntityType.GHAST),
GIANT("Giant", Enemies.ENEMY, EntityType.GIANT),
+ HORSE("Horse", Enemies.FRIENDLY, EntityType.HORSE),
PIG("Pig", Enemies.FRIENDLY, EntityType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP),
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index b8790ab00..3e00839e6 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -92,13 +92,13 @@ public class OfflinePlayer implements Player
}
@Override
- public int getHealth()
+ public double getHealth()
{
return 0;
}
@Override
- public void setHealth(int i)
+ public void setHealth(double d)
{
}
@@ -307,13 +307,13 @@ public class OfflinePlayer implements Player
}
@Override
- public void damage(int i)
+ public void damage(double d)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
- public void damage(int i, Entity entity)
+ public void damage(double d, Entity entity)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@@ -349,13 +349,13 @@ public class OfflinePlayer implements Player
}
@Override
- public int getLastDamage()
+ public double getLastDamage()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
- public void setLastDamage(int i)
+ public void setLastDamage(double d)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@@ -762,7 +762,7 @@ public class OfflinePlayer implements Player
}
@Override
- public int getMaxHealth()
+ public double getMaxHealth()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1161,7 +1161,7 @@ public class OfflinePlayer implements Player
}
@Override
- public void setMaxHealth(int i)
+ public void setMaxHealth(double i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1231,4 +1231,52 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public int _INVALID_getLastDamage()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void _INVALID_setLastDamage(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void _INVALID_damage(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void _INVALID_damage(int i, Entity entity)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int _INVALID_getHealth()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void _INVALID_setHealth(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int _INVALID_getMaxHealth()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void _INVALID_setMaxHealth(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 62a8e9813..211fa31e9 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -402,25 +402,26 @@ public class Settings implements ISettings
{
return config.getString("backup.command", null);
}
- private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
+ private Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<String, String>());
@Override
- public MessageFormat getChatFormat(String group)
+ public String getChatFormat(String group)
{
- MessageFormat mFormat = chatFormats.get(group);
+ String mFormat = chatFormats.get(group);
if (mFormat == null)
{
- String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
+ mFormat = config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&r {DISPLAYNAME}&7:&r {MESSAGE}"));
- format = FormatUtil.replaceFormat(format);
- format = format.replace("{DISPLAYNAME}", "%1$s");
- format = format.replace("{GROUP}", "{0}");
- format = format.replace("{MESSAGE}", "%2$s");
- format = format.replace("{WORLDNAME}", "{1}");
- format = format.replace("{SHORTWORLDNAME}", "{2}");
- format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
- format = "§r".concat(format);
- mFormat = new MessageFormat(format);
+ mFormat = FormatUtil.replaceFormat(mFormat);
+ mFormat = mFormat.replace("{DISPLAYNAME}", "%1$s");
+ mFormat = mFormat.replace("{MESSAGE}", "%2$s");
+ mFormat = mFormat.replace("{GROUP}", "{0}");
+ mFormat = mFormat.replace("{WORLDNAME}", "{1}");
+ mFormat = mFormat.replace("{SHORTWORLDNAME}", "{2}");
+ mFormat = mFormat.replace("{TEAMPREFIX}", "{3}");
+ mFormat = mFormat.replace("{TEAMSUFFIX}", "{4}");
+ mFormat = mFormat.replace("{TEAMNAME}", "{5}");
+ mFormat = "§r".concat(mFormat);
chatFormats.put(group, mFormat);
}
return mFormat;
diff --git a/Essentials/src/com/earth2me/essentials/TimedTeleport.java b/Essentials/src/com/earth2me/essentials/TimedTeleport.java
index f8a6d9d75..66867ea14 100644
--- a/Essentials/src/com/earth2me/essentials/TimedTeleport.java
+++ b/Essentials/src/com/earth2me/essentials/TimedTeleport.java
@@ -15,7 +15,7 @@ public class TimedTeleport implements Runnable
private int timer_task = -1;
private long timer_started; // time this task was initiated
private long timer_delay; // how long to delay the teleportPlayer
- private int timer_health;
+ private double timer_health;
// note that I initially stored a clone of the location for reference, but...
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
// so, the X/Y/Z values are stored instead and rounded off
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
index 7a1ede603..52816ba4a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
@@ -90,7 +90,7 @@ public class Commandheal extends EssentialsCommand
throw new Exception(_("healDead"));
}
- final int amount = player.getMaxHealth() - player.getHealth();
+ final double amount = player.getMaxHealth() - player.getHealth();
final EntityRegainHealthEvent erhe = new EntityRegainHealthEvent(player, amount, RegainReason.CUSTOM);
ess.getServer().getPluginManager().callEvent(erhe);
if (erhe.isCancelled())
@@ -98,7 +98,7 @@ public class Commandheal extends EssentialsCommand
throw new QuietAbortException();
}
- int newAmount = player.getHealth() + erhe.getAmount();
+ double newAmount = player.getHealth() + erhe.getAmount();
if (newAmount > player.getMaxHealth())
{
newAmount = player.getMaxHealth();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
index 32b4fd5ee..824ff6678 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
@@ -61,7 +61,7 @@ public class Commandrepair extends EssentialsCommand
repairItem(item);
charge.charge(user);
-
+ user.updateInventory();
user.sendMessage(_("repair", itemName.replace('_', ' ')));
}
@@ -74,7 +74,8 @@ public class Commandrepair extends EssentialsCommand
{
repairItems(user.getInventory().getArmorContents(), user, repaired);
}
-
+
+ user.updateInventory();
if (repaired.isEmpty())
{
throw new Exception(_("repairNone"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
index 12cf46ecc..7796806b6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java
@@ -49,7 +49,7 @@ public class Commandsocialspy extends EssentialsToggleCommand
{
if (enabled == null)
{
- throw new NotEnoughArgumentsException();
+ enabled = !user.isSocialSpyEnabled();
}
user.setSocialSpyEnabled(enabled);
diff --git a/Essentials/src/com/earth2me/essentials/metrics/Metrics.java b/Essentials/src/com/earth2me/essentials/metrics/Metrics.java
index 77e68a9d6..4f0c588f0 100644
--- a/Essentials/src/com/earth2me/essentials/metrics/Metrics.java
+++ b/Essentials/src/com/earth2me/essentials/metrics/Metrics.java
@@ -23,6 +23,7 @@ package com.earth2me.essentials.metrics;
* The views and conclusions contained in the software and documentation are those of the authors and contributors and
* should not be interpreted as representing official policies, either expressed or implied, of anybody else.
*/
+
import java.io.*;
import java.net.Proxy;
import java.net.URL;
@@ -30,6 +31,7 @@ import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.*;
import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -37,71 +39,64 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
-
-/**
- * <p> The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. </p> <p>
- * Public methods provided by this class: </p>
- * <code>
- * Graph createGraph(String name); <br/>
- * void addCustomData(Metrics.Plotter plotter); <br/>
- * void start(); <br/>
- * </code>
- */
public class Metrics
{
+
/**
* The current revision number
*/
- private final static int REVISION = 6;
+ private final static int REVISION = 7;
+
/**
* The base url of the metrics domain
*/
- private static final String BASE_URL = "http://metrics.essentials3.net";
+ private static final String BASE_URL = "http://report-metrics.essentials3.net";
+
/**
* The url used to report a server's status
*/
- private static final String REPORT_URL = "/report/%s";
- /**
- * The separator to use for custom data. This MUST NOT change unless you are hosting your own version of metrics and
- * want to change it.
- */
- private static final String CUSTOM_DATA_SEPARATOR = "~~";
+ private static final String REPORT_URL = "/plugin/%s";
+
/**
* Interval of time to ping (in minutes)
*/
- private static final int PING_INTERVAL = 10;
+ private static final int PING_INTERVAL = 15;
+
/**
* The plugin this metrics submits for
*/
private final Plugin plugin;
+
/**
* All of the custom graphs to submit to metrics
*/
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
- /**
- * The default graph, used for addCustomData when you don't want a specific graph
- */
- private final Graph defaultGraph = new Graph("Default");
+
/**
* The plugin configuration file
*/
private final YamlConfiguration configuration;
+
/**
* The plugin configuration file
*/
private final File configurationFile;
+
/**
* Unique server id
*/
private final String guid;
+
/**
* Debug mode
*/
private final boolean debug;
+
/**
* Lock for synchronization
*/
private final Object optOutLock = new Object();
+
/**
* The scheduled task
*/
@@ -162,22 +157,18 @@ public class Metrics
}
/**
- * Adds a custom data plotter to the default graph
+ * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
*
- * @param plotter The plotter to use to plot custom data
+ * @param graph The name of the graph
*/
- public void addCustomData(final Plotter plotter)
+ public void addGraph(final Graph graph)
{
- if (plotter == null)
+ if (graph == null)
{
- throw new IllegalArgumentException("Plotter cannot be null");
+ throw new IllegalArgumentException("Graph cannot be null");
}
- // Add the plotter to the graph o/
- defaultGraph.addPlotter(plotter);
-
- // Ensure the default graph is included in the submitted graphs
- graphs.add(defaultGraph);
+ graphs.add(graph);
}
/**
@@ -195,6 +186,12 @@ public class Metrics
return;
}
+ // Is metrics already running?
+ if (task != null)
+ {
+ return;
+ }
+
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable()
{
@@ -278,7 +275,7 @@ public class Metrics
/**
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
*
- * @throws IOException
+ * @throws java.io.IOException
*/
public void enable() throws IOException
{
@@ -303,7 +300,7 @@ public class Metrics
/**
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
*
- * @throws IOException
+ * @throws java.io.IOException
*/
public void disable() throws IOException
{
@@ -360,14 +357,14 @@ public class Metrics
// END server software specific section -- all code below does not use any code outside of this class / Java
// Construct the post data
- final StringBuilder data = new StringBuilder();
+ StringBuilder json = new StringBuilder(1024);
+ json.append('{');
// The plugin's description file containg all of the plugin data such as name, version, author, etc
- data.append(encode("guid")).append('=').append(encode(guid));
- encodeDataPair(data, "version", pluginVersion);
- encodeDataPair(data, "server", serverVersion);
- encodeDataPair(data, "players", Integer.toString(playersOnline));
- encodeDataPair(data, "revision", String.valueOf(REVISION));
+ appendJSONPair(json, "guid", guid);
+ appendJSONPair(json, "plugin_version", pluginVersion);
+ appendJSONPair(json, "server_version", serverVersion);
+ appendJSONPair(json, "players_online", Integer.toString(playersOnline));
// New data as of R6
String osname = System.getProperty("os.name");
@@ -382,48 +379,69 @@ public class Metrics
osarch = "x86_64";
}
- encodeDataPair(data, "osname", osname);
- encodeDataPair(data, "osarch", osarch);
- encodeDataPair(data, "osversion", osversion);
- encodeDataPair(data, "cores", Integer.toString(coreCount));
- encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
- encodeDataPair(data, "java_version", java_version);
+ appendJSONPair(json, "osname", osname);
+ appendJSONPair(json, "osarch", osarch);
+ appendJSONPair(json, "osversion", osversion);
+ appendJSONPair(json, "cores", Integer.toString(coreCount));
+ appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
+ appendJSONPair(json, "java_version", java_version);
// If we're pinging, append it
if (isPing)
{
- encodeDataPair(data, "ping", "true");
+ appendJSONPair(json, "ping", "1");
}
- // Acquire a lock on the graphs, which lets us make the assumption we also lock everything
- // inside of the graph (e.g plotters)
- synchronized (graphs)
+ if (graphs.size() > 0)
{
- final Iterator<Graph> iter = graphs.iterator();
-
- while (iter.hasNext())
+ synchronized (graphs)
{
- final Graph graph = iter.next();
+ json.append(',');
+ json.append('"');
+ json.append("graphs");
+ json.append('"');
+ json.append(':');
+ json.append('{');
+
+ boolean firstGraph = true;
- for (Plotter plotter : graph.getPlotters())
+ final Iterator<Graph> iter = graphs.iterator();
+
+ while (iter.hasNext())
{
- // The key name to send to the metrics server
- // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top
- // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME
- final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName());
+ Graph graph = iter.next();
+
+ StringBuilder graphJson = new StringBuilder();
+ graphJson.append('{');
+
+ for (Plotter plotter : graph.getPlotters())
+ {
+ appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
+ }
- // The value to send, which for the foreseeable future is just the string
- // value of plotter.getValue()
- final String value = Integer.toString(plotter.getValue());
+ graphJson.append('}');
- // Add it to the http post data :)
- encodeDataPair(data, key, value);
+ if (!firstGraph)
+ {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(graph.getName()));
+ json.append(':');
+ json.append(graphJson);
+
+ firstGraph = false;
}
+
+ json.append('}');
}
}
+ // close json
+ json.append('}');
+
// Create the url
- URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName)));
+ URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
// Connect to the website
URLConnection connection;
@@ -439,29 +457,55 @@ public class Metrics
connection = url.openConnection();
}
+
+ byte[] uncompressed = json.toString().getBytes();
+ byte[] compressed = gzip(json.toString());
+
+ // Headers
+ connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
+ connection.addRequestProperty("Content-Type", "application/json");
+ connection.addRequestProperty("Content-Encoding", "gzip");
+ connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
+ connection.addRequestProperty("Accept", "application/json");
+ connection.addRequestProperty("Connection", "close");
+
connection.setDoOutput(true);
+ if (debug)
+ {
+ System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
+ }
+
// Write the data
- final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
- writer.write(data.toString());
- writer.flush();
+ OutputStream os = connection.getOutputStream();
+ os.write(compressed);
+ os.flush();
// Now read the response
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- final String response = reader.readLine();
+ String response = reader.readLine();
// close resources
- writer.close();
+ os.close();
reader.close();
- if (response == null || response.startsWith("ERR"))
+ if (response == null || response.startsWith("ERR") || response.startsWith("7"))
{
- throw new IOException(response); //Throw the exception
+ if (response == null)
+ {
+ response = "null";
+ }
+ else if (response.startsWith("7"))
+ {
+ response = response.substring(response.startsWith("7,") ? 2 : 1);
+ }
+
+ throw new IOException(response);
}
else
{
// Is this the first update this hour?
- if (response.contains("OK This is your first update this hour"))
+ if (response.equals("1") || response.contains("This is your first update this hour"))
{
synchronized (graphs)
{
@@ -482,6 +526,43 @@ public class Metrics
}
/**
+ * GZip compress a string of bytes
+ *
+ * @param input
+ * @return
+ */
+ public static byte[] gzip(String input)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GZIPOutputStream gzos = null;
+
+ try
+ {
+ gzos = new GZIPOutputStream(baos);
+ gzos.write(input.getBytes("UTF-8"));
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (gzos != null)
+ {
+ try
+ {
+ gzos.close();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ }
+
+ return baos.toByteArray();
+ }
+
+ /**
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
*
* @return true if mineshafter is installed on the server
@@ -500,21 +581,95 @@ public class Metrics
}
/**
- * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first key/value pair
- * MUST be included manually, e.g:</p>
- * <code>
- * StringBuffer data = new StringBuffer();
- * data.append(encode("guid")).append('=').append(encode(guid));
- * encodeDataPair(data, "version", description.getVersion());
- * </code>
+ * Appends a json encoded key/value pair to the given string builder.
+ *
+ * @param json
+ * @param key
+ * @param value
+ * @throws UnsupportedEncodingException
+ */
+ private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException
+ {
+ boolean isValueNumeric;
+
+ try
+ {
+ Double.parseDouble(value);
+ isValueNumeric = true;
+ }
+ catch (NumberFormatException e)
+ {
+ isValueNumeric = false;
+ }
+
+ if (json.charAt(json.length() - 1) != '{')
+ {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(key));
+ json.append(':');
+
+ if (isValueNumeric)
+ {
+ json.append(value);
+ }
+ else
+ {
+ json.append(escapeJSON(value));
+ }
+ }
+
+ /**
+ * Escape a string to create a valid JSON string
*
- * @param buffer the stringbuilder to append the data pair onto
- * @param key the key value
- * @param value the value
+ * @param text
+ * @return
*/
- private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException
+ private static String escapeJSON(String text)
{
- buffer.append('&').append(encode(key)).append('=').append(encode(value));
+ StringBuilder builder = new StringBuilder();
+
+ builder.append('"');
+ for (int index = 0; index < text.length(); index++)
+ {
+ char chr = text.charAt(index);
+
+ switch (chr)
+ {
+ case '"':
+ case '\\':
+ builder.append('\\');
+ builder.append(chr);
+ break;
+ case '\b':
+ builder.append("\\b");
+ break;
+ case '\t':
+ builder.append("\\t");
+ break;
+ case '\n':
+ builder.append("\\n");
+ break;
+ case '\r':
+ builder.append("\\r");
+ break;
+ default:
+ if (chr < ' ')
+ {
+ String t = "000" + Integer.toHexString(chr);
+ builder.append("\\u" + t.substring(t.length() - 4));
+ }
+ else
+ {
+ builder.append(chr);
+ }
+ break;
+ }
+ }
+ builder.append('"');
+
+ return builder.toString();
}
/**
@@ -523,7 +678,7 @@ public class Metrics
* @param text the text to encode
* @return the encoded text, as UTF-8
*/
- private static String encode(final String text) throws UnsupportedEncodingException
+ private static String urlEncode(final String text) throws UnsupportedEncodingException
{
return URLEncoder.encode(text, "UTF-8");
}
@@ -582,7 +737,7 @@ public class Metrics
/**
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
*
- * @return an unmodifiable {@link Set} of the plotter objects
+ * @return an unmodifiable {@link java.util.Set} of the plotter objects
*/
public Set<Plotter> getPlotters()
{
@@ -608,7 +763,7 @@ public class Metrics
}
/**
- * Called when the server owner decides to opt-out of Metrics while the server is running.
+ * Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
*/
protected void onOptOut()
{
diff --git a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java
index b0fedbf86..4a138ae16 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java
@@ -80,7 +80,8 @@ public class BookInput implements IText
}
if (readFromfile)
{
- final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
+ final Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
+ final BufferedReader bufferedReader = new BufferedReader(reader);
try
{
int lineNumber = 0;
@@ -102,6 +103,7 @@ public class BookInput implements IText
}
finally
{
+ reader.close();
bufferedReader.close();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/textreader/BookPager.java b/Essentials/src/com/earth2me/essentials/textreader/BookPager.java
index 3f974fe32..aacd3a038 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/BookPager.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/BookPager.java
@@ -55,14 +55,31 @@ public class BookPager
while (pointer < lineLength)
{
Character letter = pageLine.charAt(pointer);
-
+
+ if (pageLine.charAt(start) == ' ')
+ {
+ start++;
+ pointer++;
+ continue;
+ }
+
if (length >= max || (letter == '\u00a7' && length + 1 >= max))
{
+ int pos = pointer;
+ while (pos > start && pageLine.charAt(pos) != ' ' && pageLine.charAt(pos) != "\n".charAt(0))
+ {
+ pos--;
+ }
+ if (pos != start)
+ {
+ pointer = pos;
+ }
+
tempLine = pageLine.substring(start, pointer);
pageLines.add(tempLine);
start = pointer;
length = 0;
- }
+ }
if (letter == '\u00a7' && pointer + 1 < lineLength)
{
@@ -77,7 +94,15 @@ public class BookPager
}
pointer++;
}
- else if (letter == ' ')
+ else if (letter == 'i' || letter == '.' || letter == ',')
+ {
+ length += (0.4 * weight);
+ }
+ else if (letter == 'l')
+ {
+ length += (0.6 * weight);
+ }
+ else if (letter == ' ' || letter == 't')
{
length += (0.7 * weight);
}
@@ -87,6 +112,7 @@ public class BookPager
}
pointer++;
}
+
if (length > 0)
{
tempLine = pageLine.substring(start, lineLength);
@@ -100,7 +126,7 @@ public class BookPager
StringBuilder newPage = new StringBuilder();
for (int i = count; i < count + 12 && i < pageLines.size(); i++)
{
- newPage.append("\n").append(pageLines.get(i));
+ newPage.append(pageLines.get(i)).append("\n");
}
pages.add(newPage.toString());
diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
index cd7ee6ec4..71146e5eb 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java
@@ -61,7 +61,8 @@ public class TextInput implements IText
}
if (readFromfile)
{
- final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
+ final Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
+ final BufferedReader bufferedReader = new BufferedReader(reader);
try
{
int lineNumber = 0;
@@ -83,6 +84,7 @@ public class TextInput implements IText
}
finally
{
+ reader.close();
bufferedReader.close();
}
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index 335035dd8..adce901d0 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -134,7 +134,6 @@ geoIpUrlEmpty=GeoIP download url is empty.
geoIpUrlInvalid=GeoIP download url is invalid.
geoipJoinFormat=\u00a76Player \u00a7c{0} \u00a76comes from \u00a7c{1}\u00a76.
giveSpawn=\u00a76Giving\u00a7c {0} \u00a76of\u00a7c {1} to\u00a7c {2}\u00a76.
-giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost.
godDisabledFor=\u00a74disabled\u00a76 for\u00a7c {0}
godEnabledFor=\u00a7aenabled\u00a76 for\u00a7c {0}
godMode=\u00a76God mode\u00a7c {0}\u00a76.
@@ -229,7 +228,7 @@ lightningUse=\u00a76Smiting\u00a7c {0}
listAfkTag= \u00a77[AFK]\u00a7r
listAmount= \u00a76There are \u00a7c{0}\u00a76 out of maximum \u00a7c{1}\u00a76 players online.
listAmountHidden= \u00a76There are \u00a7c{0}\u00a76/{1}\u00a76 out of maximum \u00a7c{2}\u00a76 players online.
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag= \u00a77[HIDDEN]\u00a7r
loadWarpError=\u00a74Failed to load warp {0}.
localFormat=[L]<{0}> {1}
@@ -481,10 +480,10 @@ unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Error while upgrading the files.
uptime=\u00a76Uptime:\u00a7c {0}
-userAFK=\u00a75{0} \u00a75is currently AFK and may not respond.
+userAFK=\u00a77{0} \u00a75is currently AFK and may not respond.
userDoesNotExist=\u00a74The user\u00a7c {0} \u00a74does not exist.
-userIsAway=\u00a75{0} \u00a75is now AFK.
-userIsNotAway=\u00a75{0} \u00a75is no longer AFK.
+userIsAway=\u00a77* {0} \u00a77is now AFK.
+userIsNotAway=\u00a77* {0} \u00a77is no longer AFK.
userJailed=\u00a76You have been jailed!
userUnknown=\u00a74Warning: The user ''\u00a7c{0}\u00a74'' has never joined this server.
userUsedPortal={0} used an existing exit portal.
@@ -535,6 +534,7 @@ youAreHealed=\u00a76You have been healed.
youHaveNewMail=\u00a76You have\u00a7c {0} \u00a76messages! Type \u00a7c/mail read\u00a76 to view your mail.
whoisHunger=\u00a76 - Hunger:\u00a7r {0}/20 (+{1} saturation)
kitDelay=\u00a7m{0}\u00a7r
+giveSpawnFailure=\u00a74Not enough space, \u00a7c{0} \u00a7c{1} \u00a74was lost.
noKitGroup=\u00a74You do not have access to this kit.
inventoryClearingFromAll=\u00a76Clearing the inventory of all users...
inventoryClearingAllItems=\u00a76Cleared all inventory items from {0}\u00a76.
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index e320df02c..2eba56be2 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -232,7 +232,7 @@ lightningUse=\u00a77Zasadil jsi bleskem hrace {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Je zde \u00a7c{0}\u00a79 z maxima \u00a7c{1}\u00a79 hracu online.
listAmountHidden = \u00a79Je zde \u00a7c{0}\u00a77/{1}\u00a79 z maxima \u00a7c{2}\u00a79 hracu online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[SKRYTY]\u00a7f
loadWarpError=Chyba pri nacitani warpu: {0}
localFormat=Jazyk: <{0}> {1}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index 2d7f82514..e5912fcec 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77Kaster lyn efter {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spillere online.
listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0}
localFormat=Local: <{0}> {1}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index ee7c0cff5..71f8d0f29 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77Peinige {0}
listAfkTag = \u00a77[Inaktiv]\u00a7f
listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spielern online.
listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[Versteckt]\u00a7f
loadWarpError=Fehler beim Laden von Warp-Punkt {0}
localFormat=Lokal: <{0}> {1}
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 95f284296..adce901d0 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a76Smiting\u00a7c {0}
listAfkTag= \u00a77[AFK]\u00a7r
listAmount= \u00a76There are \u00a7c{0}\u00a76 out of maximum \u00a7c{1}\u00a76 players online.
listAmountHidden= \u00a76There are \u00a7c{0}\u00a76/{1}\u00a76 out of maximum \u00a7c{2}\u00a76 players online.
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag= \u00a77[HIDDEN]\u00a7r
loadWarpError=\u00a74Failed to load warp {0}.
localFormat=[L]<{0}> {1}
@@ -480,10 +480,10 @@ unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Error while upgrading the files.
uptime=\u00a76Uptime:\u00a7c {0}
-userAFK=\u00a75{0} \u00a75is currently AFK and may not respond.
+userAFK=\u00a77{0} \u00a75is currently AFK and may not respond.
userDoesNotExist=\u00a74The user\u00a7c {0} \u00a74does not exist.
-userIsAway=\u00a75{0} \u00a75is now AFK.
-userIsNotAway=\u00a75{0} \u00a75is no longer AFK.
+userIsAway=\u00a77* {0} \u00a77is now AFK.
+userIsNotAway=\u00a77* {0} \u00a77is no longer AFK.
userJailed=\u00a76You have been jailed!
userUnknown=\u00a74Warning: The user ''\u00a7c{0}\u00a74'' has never joined this server.
userUsedPortal={0} used an existing exit portal.
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index 7f5830e1a..74a275d59 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77Golpeando a {0}
listAfkTag = \u00a77[Lejos]\u00a7f
listAmount = \u00a79Hay \u00a7c{0}\u00a79 jugadores de un maximo de \u00a7c{1}\u00a79 jugadores online.
listAmountHidden = \u00a79Hay \u00a7c{0}\u00a79 jugadores de un maximo de \u00a7c{1}\u00a79 jugadores online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[ESCONDIDO]\u00a7f
loadWarpError=Error al cargar el teletransporte {0}
localFormat=Local: <{0}> {1}
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index 57c5ded02..79fc8d1dd 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77Salamoidaan {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Pelaajia palvelimella \u00a7c{0}\u00a79 / \u00a7c{1}\u00a79.
listAmountHidden = \u00a79Pelaajia palvelimella \u00a7c{0}\u00a77/{1}\u00a79 / \u00a7c{2}\u00a79.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Virhe ladattaessa warppia {0}
localFormat=Paikallinen: <{0}> {1}
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index f2657c17a..572932d1f 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9.
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Il y a \u00a7c{0}\u00a79 joueurs en ligne sur \u00a7c{1}\u00a79 au total.
listAmountHidden = \u00a79Il y a \u00a7c{0}\u00a77/{1}\u00a79 sur un maximum de \u00a7c{2}\u00a79 joueurs en ligne.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f
loadWarpError=\u00c9chec du chargement du warp {0}.
localFormat=Local : <{0}> {1}
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index fad89e4ff..47609469f 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77{0} e'' stato folgorato!
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Ci sono \u00a7c{0}\u00a79 players online su un massimo di \u00a7c{1}.
listAmountHidden = \u00a79Ci sono \u00a7c{0}\u00a77/{1}\u00a79 players online su un massimo di \u00a7c{2}.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Impossibile caricare il warp {0}
localFormat=Formato locale: <{0}> {1}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 1ba54ad07..52c4d405a 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77 {0} is geraakt door bliksem.
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Er zijn \u00a7c{0}\u00a79 van het maximum \u00a7c{1}\u00a79 spelers online.
listAmountHidden = \u00a79Er zijn \u00a7c{0}\u00a77/{1}\u00a79 van het maximum \u00a7c{2}\u00a79 spelers online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[VERBORGEN]\u00a7f
loadWarpError=Fout bij het laden van warp {0}\u00a7f.
localFormat=Lokaal: <{0}> {1}
@@ -396,8 +396,8 @@ requestDeniedFrom=\u00a77{0} Heeft uw teleporteer aanvraag geweigerd.
requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77.
requestTimedOut=\u00a7cTeleportatie verzoek is verlopen.
requiredBukkit=* ! * U heeft op zijn minst build {0} van CraftBukkit nodig, download het vanaf http://dl.bukkit.org/downloads/craftbukkit/
-resetBal=\u00a76Saldo is teruggezet naar §a{0} §6 voor alle online spelers.
-resetBalAll=\u00a76Saldo is teruggezet naar §a{0} §6 voor alle spelers.
+resetBal=\u00a76Saldo is teruggezet naar \u00c2\u00a7a{0} \u00c2\u00a76 voor alle online spelers.
+resetBalAll=\u00a76Saldo is teruggezet naar \u00c2\u00a7a{0} \u00c2\u00a76 voor alle spelers.
returnPlayerToJailError=Fout tijdens het terugzetten van {0} in gevangenis: {1}
runningPlayerMatch=\u00a76Zoeken naar spelers die ''\u00a7c{0}\u00a76'' matchen (Dit kan even duren)
second=seconde
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 80fa7ea34..a86686117 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77Uderzono piorunem\u00a7c {0}\u00a77.
listAfkTag= \u00a77[AFK]\u00a7f
listAmount= \u00a77Na serwerze jest \u00a7c{0}\u00a77 graczy z maksimum \u00a7c{1}\u00a77 online.
listAmountHidden= \u00a77Na serwerze jest \u00a7c{0}\u00a77/{1}\u00a77 graczy z maksimum \u00a7c{2}\u00a77 online.
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag= \u00a77[UKRYTY]\u00a7r
loadWarpError=\u00a74Blad przy wczytywaniu warpu {0}.
localFormat=[L]<{0}> {1}
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index adf9a10d0..e3b199595 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a76Castigando\u00a7c {0}
listAfkTag= \u00a77[AFK]\u00a7r
listAmount= \u00a76H\u00c3\u00a1 \u00a7c{0}\u00a76 de no m\u00c3\u00a1ximo \u00a7c{1}\u00a76 jogadores online.
listAmountHidden= \u00a76H\u00c3\u00a1 \u00a7c{0}\u00a76/{1}\u00a76 de no m\u00c3\u00a1ximo \u00a7c{2}\u00a76 jogadores online.
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag= \u00a77[ESCONDIDO]\u00a7r
loadWarpError=\u00a74Falha ao carregar o warp {0}.
localFormat=[L]<{0}> {1}
diff --git a/Essentials/src/messages_ro.properties b/Essentials/src/messages_ro.properties
index 680f77748..35c1620ca 100644
--- a/Essentials/src/messages_ro.properties
+++ b/Essentials/src/messages_ro.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a76L-ai fulgerat pe\u00a7c {0}
listAfkTag= \u00a77[AFK]\u00a7r
listAmount= \u00a76Sunt \u00a7c{0}\u00a76 din maxim \u00a7c{1}\u00a76 jucatori online.
listAmountHidden= \u00a76Sunt \u00a7c{0}\u00a76/{1}\u00a76 din maxim \u00a7c{2}\u00a76 jucatori online.
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag= \u00a77[Ascuns]\u00a7r
loadWarpError=\u00a74Incarcarea teleportarii a esuat {0}.
localFormat=[L]<{0}> {1}
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index 7fa2eceb5..a91c3a25f 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -228,7 +228,7 @@ lightningUse=\u00a77En blixt kommer sl\u00e5 ner p\u00e5 {0}
listAfkTag = \u00a77[AFK]\u00a7f
listAmount = \u00a79Det \u00e4r \u00a7c{0}\u00a79 av maximalt \u00a7c{1}\u00a79 spelare online.
listAmountHidden = \u00a79Det \u00e4r \u00a7c{0}\u00a77/{1}\u00a79 Av maximalt \u00a7c{2}\u00a79 spelare online.
-listGroupTag={0}\u00a7f:
+listGroupTag=\u00a76{0}\u00a7f:
listHiddenTag = \u00a77[G\u00d6MD]\u00a7f
loadWarpError=Kunde inte ladda warp {0}
localFormat=Lokal: <{0}> {1}
diff --git a/Essentials/src/messages_zh.properties b/Essentials/src/messages_zh.properties
index 231aebcd7..a08779d38 100644
--- a/Essentials/src/messages_zh.properties
+++ b/Essentials/src/messages_zh.properties
@@ -229,7 +229,7 @@ lightningUse=\u00a76\u96f7\u51fb\u4e2d\u4e86\u00a7c {0}
listAfkTag = \u00a77[\u79bb\u5f00]\u00a7r
listAmount = \u00a76\u5f53\u524d\u6709 \u00a7c{0}\u00a76 \u4e2a\u73a9\u5bb6\u5728\u7ebf,\u6700\u5927\u5728\u7ebf\u4eba\u6570\u4e3a \u00a7c{1}\u00a76 \u4e2a\u73a9\u5bb6.
listAmountHidden = \u00a76\u5f53\u524d\u6709 \u00a7c{0}\u00a76/{1}\u00a76 \u4e2a\u73a9\u5bb6\u5728\u7ebf,\u6700\u5927\u5728\u7ebf\u4eba\u6570 \u00a7c{2}\u00a76 \u4e2a\u73a9\u5bb6
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag = \u00a77[\u9690\u8eab]\u00a7r
loadWarpError=\u00a74\u52a0\u8f7d\u5730\u6807 {0} \u5931\u8d25
localFormat=\u4f4d\u7f6e:<{0}> {1}
diff --git a/Essentials/src/messages_zh_HK.properties b/Essentials/src/messages_zh_HK.properties
index 8c5a1c115..68b98a3a3 100644
--- a/Essentials/src/messages_zh_HK.properties
+++ b/Essentials/src/messages_zh_HK.properties
@@ -230,7 +230,7 @@ lightningUse=\u00a76\u96f7\u64ca\u4e2d\u4e86\u00a7c {0}
listAfkTag = \u00a77[\u96e2\u958b]\u00a7r
listAmount = \u00a76\u7576\u524d\u6709 \u00a7c{0}\u00a76 \u500b\u73a9\u5bb6\u5728\u7dda,\u6700\u5927\u5728\u7dda\u4eba\u6578\u70ba \u00a7c{1}\u00a76 \u500b\u73a9\u5bb6.
listAmountHidden = \u00a76\u7576\u524d\u6709 \u00a7c{0}\u00a76/{1}\u00a76 \u500b\u73a9\u5bb6\u5728\u7dda,\u6700\u5927\u5728\u7dda\u4eba\u6578 \u00a7c{2}\u00a76 \u500b\u73a9\u5bb6
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag = \u00a77[\u96b1\u8eab]\u00a7r
loadWarpError=\u00a74\u52a0\u8f09\u5730\u6a19 {0} \u5931\u6557
localFormat=\u4f4d\u7f6e:<{0}> {1}
diff --git a/Essentials/src/messages_zh_TW.properties b/Essentials/src/messages_zh_TW.properties
index 7b0be1004..5db9393d7 100644
--- a/Essentials/src/messages_zh_TW.properties
+++ b/Essentials/src/messages_zh_TW.properties
@@ -230,7 +230,7 @@ lightningUse=\u00a76\u96f7\u64ca\u4e2d\u4e86\u00a7c {0}
listAfkTag = \u00a77[\u96e2\u958b]\u00a7r
listAmount = \u00a76\u7576\u524d\u6709 \u00a7c{0}\u00a76 \u500b\u73a9\u5bb6\u5728\u7dda,\u6700\u5927\u5728\u7dda\u4eba\u6578\u70ba \u00a7c{1}\u00a76 \u500b\u73a9\u5bb6.
listAmountHidden = \u00a76\u7576\u524d\u6709 \u00a7c{0}\u00a76/{1}\u00a76 \u500b\u73a9\u5bb6\u5728\u7dda,\u6700\u5927\u5728\u7dda\u4eba\u6578 \u00a7c{2}\u00a76 \u500b\u73a9\u5bb6
-listGroupTag={0}\u00a7r:
+listGroupTag=\u00a76{0}\u00a7r:
listHiddenTag = \u00a77[\u96b1\u8eab]\u00a7r
loadWarpError=\u00a74\u8f09\u5165\u5730\u6a19 {0} \u5931\u6557
localFormat=\u4f4d\u7f6e:<{0}> {1}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index c315098c2..a57baa5f9 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -113,7 +113,7 @@ commands:
aliases: [eat,eeat,efeed]
fly:
description: Take off, and soar!
- usage: /<command> [player [on|off]]
+ usage: /<command> [player] [on|off]
aliases: [efly]
fireball:
description: Throw a fireball.
@@ -141,7 +141,7 @@ commands:
aliases: [egive]
god:
description: Enables your godly powers.
- usage: /<command> [player [on|off]]
+ usage: /<command> [player] [on|off]
aliases: [egod,godmode,egodmode,tgm,etgm]
hat:
description: Get some cool new headgear.
@@ -336,7 +336,7 @@ commands:
aliases: [esetworth]
socialspy:
description: Toggles if you can see msg/mail commands in chat.
- usage: /<command> [player]
+ usage: /<command> [player] [on|off]
aliases: [esocialspy]
spawner:
description: Change the mob type of a spawner.
@@ -424,7 +424,7 @@ commands:
aliases: [etppos]
tptoggle:
description: Blocks all forms of teleportation.
- usage: /<command> [player [on|off]]
+ usage: /<command> [player] [on|off]
aliases: [etptoggle]
tree:
description: Spawn a tree where you are looking.
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
index a86dcd14f..156a570f8 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -11,6 +11,8 @@ import org.bukkit.Server;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
+import org.bukkit.scoreboard.Scoreboard;
+import org.bukkit.scoreboard.Team;
public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
@@ -48,13 +50,18 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
event.setMessage(FormatUtil.formatMessage(user, "essentials.chat", event.getMessage()));
String group = user.getGroup();
String world = user.getWorld().getName();
- MessageFormat format = ess.getSettings().getChatFormat(group);
+ Team team = user.getScoreboard().getPlayerTeam(user);
+
+ String format = ess.getSettings().getChatFormat(group);
+ format = format.replace("{0}", group);
+ format = format.replace("{1}", world);
+ format = format.replace("{2}", world.substring(0, 1).toUpperCase(Locale.ENGLISH));
+ format = format.replace("{3}", team == null ? "" : team.getPrefix());
+ format = format.replace("{4}", team == null ? "" : team.getSuffix());
+ format = format.replace("{5}", team == null ? "" : team.getDisplayName());
synchronized (format)
- {
- event.setFormat(format.format(new Object[]
- {
- group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH)
- }));
+ {
+ event.setFormat(format);
}
}
}
diff --git a/lib/bukkit.jar b/lib/bukkit.jar
index 319866585..943b6335a 100644
--- a/lib/bukkit.jar
+++ b/lib/bukkit.jar
Binary files differ
diff --git a/lib/craftbukkit.jar b/lib/craftbukkit.jar
index 5ded45df9..193475bbc 100644
--- a/lib/craftbukkit.jar
+++ b/lib/craftbukkit.jar
Binary files differ