summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-28 22:42:17 +0100
committersnowleo <schneeleo@gmail.com>2011-11-28 22:42:17 +0100
commit19b803193379c2d5fadc315f66810508dafca5cc (patch)
tree72cd659a99dc2ada2f1590c9e6bbcef09dac7d57
parent99211fd4075a1620f6850ce895089997a71cc65f (diff)
parent91cdff955ab8a8af0ff52474ea5de9584d6377c7 (diff)
downloadEssentials-19b803193379c2d5fadc315f66810508dafca5cc.tar
Essentials-19b803193379c2d5fadc315f66810508dafca5cc.tar.gz
Essentials-19b803193379c2d5fadc315f66810508dafca5cc.tar.lz
Essentials-19b803193379c2d5fadc315f66810508dafca5cc.tar.xz
Essentials-19b803193379c2d5fadc315f66810508dafca5cc.zip
Merge branch 'refs/heads/master' into release
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhelp.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandinfo.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmotd.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrules.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsell.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java30
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/TextPager.java25
-rw-r--r--Essentials/src/messages.properties1
-rw-r--r--Essentials/src/messages_da.properties1
-rw-r--r--Essentials/src/messages_de.properties1
-rw-r--r--Essentials/src/messages_en.properties1
-rw-r--r--Essentials/src/messages_es.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
15 files changed, 47 insertions, 27 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 671f1a479..94a095df4 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -173,7 +173,7 @@ public class EssentialsPlayerListener extends PlayerListener
final IText input = new TextInput(user, "motd", true, ess);
final IText output = new KeywordReplacer(input, user, ess);
final TextPager pager = new TextPager(output, true);
- pager.showPage("1", null, user);
+ pager.showPage("1", null, "motd", user);
}
catch (IOException ex)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
index 24f463740..328f692ea 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
@@ -41,7 +41,7 @@ public class Commandhelp extends EssentialsCommand
output = new KeywordReplacer(input, user, ess);
}
final TextPager pager = new TextPager(output);
- pager.showPage(pageStr, chapterPageStr, user);
+ pager.showPage(pageStr, chapterPageStr, "help", user);
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java
index 2ae348696..e75eeed9a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java
@@ -21,6 +21,6 @@ public class Commandinfo extends EssentialsCommand
final IText input = new TextInput(sender, "info", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
- pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
+ pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "info", sender);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java
index 5d2d6994a..78ca5c306 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java
@@ -21,6 +21,6 @@ public class Commandmotd extends EssentialsCommand
final IText input = new TextInput(sender, "motd", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
- pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
+ pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "motd", sender);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java
index 32cadf69e..a981fb2f1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java
@@ -21,6 +21,6 @@ public class Commandrules extends EssentialsCommand
final IText input = new TextInput(sender, "rules", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
- pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
+ pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, "rules", sender);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
index 07338e096..554bb4a2e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
@@ -155,7 +155,7 @@ public class Commandsell extends EssentialsCommand
//TODO: Prices for Enchantments
final ItemStack ris = is.clone();
- is.setAmount(amount);
+ ris.setAmount(amount);
InventoryWorkaround.removeItem(user.getInventory(), true, ris);
user.updateInventory();
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 863821973..c9970c068 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -116,11 +116,11 @@ public class Commandspawnmob extends EssentialsCommand
}
if (mobData != null)
{
- changeMobData(mob.name, spawnedMob, mobData, user);
+ changeMobData(mob.getType(), spawnedMob, mobData, user);
}
if (spawnedMount != null && mountData != null)
{
- changeMobData(mobMount.name, spawnedMount, mountData, user);
+ changeMobData(mobMount.getType(), spawnedMount, mountData, user);
}
if (args.length == 2)
{
@@ -151,11 +151,11 @@ public class Commandspawnmob extends EssentialsCommand
}
if (mobData != null)
{
- changeMobData(mob.name, spawnedMob, mobData, user);
+ changeMobData(mob.getType(), spawnedMob, mobData, user);
}
if (spawnedMount != null && mountData != null)
{
- changeMobData(mobMount.name, spawnedMount, mountData, user);
+ changeMobData(mobMount.getType(), spawnedMount, mountData, user);
}
}
user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
@@ -179,9 +179,9 @@ public class Commandspawnmob extends EssentialsCommand
}
}
- private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
+ private void changeMobData(CreatureType type, Entity spawned, String data, User user) throws Exception
{
- if ("Slime".equalsIgnoreCase(type))
+ if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
{
try
{
@@ -192,17 +192,17 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("slimeMalformedSize"), e);
}
}
- if (("Sheep".equalsIgnoreCase(type)
- || "Cow".equalsIgnoreCase(type)
- || "Chicken".equalsIgnoreCase(type)
- || "Pig".equalsIgnoreCase(type)
- || "Wolf".equalsIgnoreCase(type))
+ if ((type == CreatureType.SHEEP
+ || type == CreatureType.COW
+ || type == CreatureType.CHICKEN
+ || type == CreatureType.PIG
+ || type == CreatureType.WOLF)
&& data.equalsIgnoreCase("baby"))
{
((Animals)spawned).setAge(-24000);
return;
}
- if ("Sheep".equalsIgnoreCase(type))
+ if (type == CreatureType.SHEEP)
{
try
{
@@ -221,7 +221,7 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("sheepMalformedColor"), e);
}
}
- if ("Wolf".equalsIgnoreCase(type)
+ if (type == CreatureType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("tamed"))
{
final Wolf wolf = ((Wolf)spawned);
@@ -233,7 +233,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
- if ("Wolf".equalsIgnoreCase(type)
+ if (type == CreatureType.WOLF
&& data.toLowerCase(Locale.ENGLISH).startsWith("angry"))
{
((Wolf)spawned).setAngry(true);
@@ -242,7 +242,7 @@ public class Commandspawnmob extends EssentialsCommand
((Animals)spawned).setAge(-24000);
}
}
- if ("Creeper".equalsIgnoreCase(type) && data.equalsIgnoreCase("powered"))
+ if (type == CreatureType.CREEPER && data.equalsIgnoreCase("powered"))
{
((Creeper)spawned).setPowered(true);
}
diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
index dd8422580..c23df734d 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java
@@ -23,7 +23,7 @@ public class TextPager
this.onePage = onePage;
}
- public void showPage(final String pageStr, final String chapterPageStr, final CommandSender sender)
+ public void showPage(final String pageStr, final String chapterPageStr, final String commandName, final CommandSender sender)
{
List<String> lines = text.getLines();
List<String> chapters = text.getChapters();
@@ -45,16 +45,20 @@ public class TextPager
page = 1;
}
- int start = onePage ? 0 : (page - 1) * 9;
+ final int start = onePage ? 0 : (page - 1) * 9;
+ final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
if (!onePage)
{
- int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
sender.sendMessage(_("infoPages", page, pages));
}
for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++)
{
sender.sendMessage(lines.get(i));
}
+ if (!onePage && page < pages)
+ {
+ sender.sendMessage(_("readNextPage", commandName, page + 1));
+ }
return;
}
@@ -108,15 +112,20 @@ public class TextPager
}
}
+ int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
if (!onePage)
{
- int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
+
sender.sendMessage(_("infoPages", page, pages));
}
for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++)
{
sender.sendMessage(lines.get(i));
}
+ if (!onePage && page < pages)
+ {
+ sender.sendMessage(_("readNextPage", commandName, page + 1));
+ }
return;
}
}
@@ -155,15 +164,19 @@ public class TextPager
}
final int start = chapterstart + (onePage ? 0 : chapterpage * 9);
+ final int page = chapterpage + 1;
+ final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
if (!onePage)
{
- final int page = chapterpage + 1;
- final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
sender.sendMessage(_("infoChapterPages", pageStr, page, pages));
}
for (int i = start; i < chapterend && i < start + (onePage ? 20 : 9); i++)
{
sender.sendMessage(lines.get(i));
}
+ if (!onePage && page < pages)
+ {
+ sender.sendMessage(_("readNextPage", commandName, pageStr + " " + (page + 1)));
+ }
}
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index ce9423503..5a4c67173 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled.
powerToolsEnabled=All of your power tools have been enabled.
protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0}
questionFormat=\u00a77[Question]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Reloaded all plugins.
repair=You have successfully repaired your: \u00a7e{0}.
repairAlreadyFixed=\u00a77This item does not need repairing.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index f1345ab62..4dcd2f24a 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -269,6 +269,7 @@ powerToolsDisabled= All of your power tools have been disabled.
powerToolsEnabled= All of your power tools have been enabled.
protectionOwner=\u00a76[EssentialsProtect] Beskyttelses ejer: {0}
questionFormat=\u00a77[Sp\u00f8rgsm\u00e5l]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Genindl\u00e6ste alle tilf\u00f8jelser.
repair=You have successfully repaired your: \u00a7e{0}.
repairAlreadyFixed=\u00a77This item does not need repairing.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 6b2090676..9cc72bff2 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=Alle deine Powertools wurden deaktiviert.
powerToolsEnabled=Alle deine Powertools wurden aktiviert.
protectionOwner=\u00a76[EssentialsProtect] Besitzer dieses Blocks: {0}
questionFormat=\u00a77[Frage]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Alle plugins neu geladen.
repair=Du hast erfolgreich deine {0} repariert.
repairAlreadyFixed=\u00a77Dieser Gegenstand ben\u00f6tigt keine Reparatur.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index a9f4b375c..704cdfb68 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been enabled.
powerToolsEnabled=All of your power tools have been enabled.
protectionOwner=\u00a76[EssentialsProtect] Protection owner: {0}
questionFormat=\u00a77[Question]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Reloaded all plugins.
repair=You have successfully repaired your: \u00a7e{0}.
repairAlreadyFixed=\u00a77This item does not need repairing.
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index ae3b61f4b..c2d6b6ec3 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled.
powerToolsEnabled=All of your power tools have been enabled.
protectionOwner=\u00a76[EssentialsProtect] Due&ntilde;o de la proteccion: {0}
questionFormat=\u00a77[Pregunta]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Todos los plugins recargados.
repair=Has reparado satisfactoriamente tu: \u00a7e{0}.
repairAlreadyFixed=\u00a77Este objeto no necesita de reparado.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index a7b73946d..ae8845bc6 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 retir\u
powerToolsEnabled=Toutes vos commandes assign\u00e9es ont \u00e9t\u00e9 activ\u00e9es.
protectionOwner=\u00a76[EssentialsProtect] Propri\u00e9taire de la protection : {0}
questionFormat=\u00a77[Question]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Toutes les extensions ont \u00e9t\u00e9 recharg\u00e9es.
repair=Vous avez r\u00e9par\u00e9 votre : \u00a7e{0}.
repairAlreadyFixed=\u00a77Cet objet n''a pas besoin de r\u00e9paration.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index d42077923..73a88cbb5 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -269,6 +269,7 @@ powerToolsDisabled=All of your power tools have been disabled.
powerToolsEnabled=All of your power tools have been enabled.
protectionOwner=\u00a76[EssentialsProtect] Beschermingeigenaar: {0}
questionFormat=\u00a77[Vraag]\u00a7f {0}
+readNextPage=Type /{0} {1} to read the next page
reloadAllPlugins=\u00a77Alle plugins zijn herladen.
repair=You have successfully repaired your: \u00a7e{0}.
repairAlreadyFixed=\u00a77This item does not need repairing.