summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/IEssentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java31
3 files changed, 34 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 80fbd7265..dc2f46259 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -597,4 +597,10 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return userMap;
}
+
+ @Override
+ public I18n getI18n()
+ {
+ return i18n;
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java
index ef54b0776..a56fc790c 100644
--- a/Essentials/src/com/earth2me/essentials/IEssentials.java
+++ b/Essentials/src/com/earth2me/essentials/IEssentials.java
@@ -18,6 +18,8 @@ public interface IEssentials extends Plugin
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix);
User getUser(Object base);
+
+ I18n getI18n();
User getOfflineUser(String name);
diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
index 84cd63f68..79710a822 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
@@ -1,14 +1,16 @@
package com.earth2me.essentials.textreader;
+import com.earth2me.essentials.DescParseTickFormat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import java.text.SimpleDateFormat;
+import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
public class KeywordReplacer implements IText
@@ -27,6 +29,7 @@ public class KeywordReplacer implements IText
{
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist, date, time;
+ String worldTime12, worldTime24, worldDate, plugins;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
@@ -35,10 +38,13 @@ public class KeywordReplacer implements IText
balance = Double.toString(user.getMoney());
mails = Integer.toString(user.getMails().size());
world = user.getLocation().getWorld().getName();
+ worldTime12 = DescParseTickFormat.format12(user.getWorld().getTime());
+ worldTime24 = DescParseTickFormat.format24(user.getWorld().getTime());
+ worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getTime()));
}
else
{
- displayName = ipAddress = balance = mails = world = "";
+ displayName = ipAddress = balance = mails = world = worldTime12 = worldTime24= worldDate = "";
}
int playerHidden = 0;
@@ -77,9 +83,20 @@ public class KeywordReplacer implements IText
playerlistBuilder.append(p.getDisplayName());
}
playerlist = playerlistBuilder.toString();
-
- date = new SimpleDateFormat("MMMM/dd/yyyy").format(new Date());
- time = new SimpleDateFormat("hh:mm:ss").format(new Date());
+
+ final StringBuilder pluginlistBuilder = new StringBuilder();
+ for (Plugin p : ess.getServer().getPluginManager().getPlugins())
+ {
+ if (pluginlistBuilder.length() > 0)
+ {
+ pluginlistBuilder.append(", ");
+ }
+ pluginlistBuilder.append(p.getDescription().getName());
+ }
+ plugins = pluginlistBuilder.toString();
+
+ date = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date());
+ time = DateFormat.getTimeInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(new Date());
for (int i = 0; i < input.getLines().size(); i++)
{
@@ -95,6 +112,10 @@ public class KeywordReplacer implements IText
line = line.replace("{PLAYERLIST}", playerlist);
line = line.replace("{TIME}", time);
line = line.replace("{DATE}", date);
+ line = line.replace("{WORLDTIME12}", worldTime12);
+ line = line.replace("{WORLDTIME24}", worldTime24);
+ line = line.replace("{WORLDDATE}", worldDate);
+ line = line.replace("{PLUGINS}", plugins);
input.getLines().set(i, line);
}
}