mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-18 08:35:44 +01:00
Added {DATE} and {TIME} to motd
This commit is contained in:
parent
3b0c604de0
commit
bbb47fe6d3
@ -2,6 +2,8 @@ package com.earth2me.essentials.textreader;
|
|||||||
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -24,7 +26,7 @@ public class KeywordReplacer implements IText
|
|||||||
private void replaceKeywords(final CommandSender sender)
|
private void replaceKeywords(final CommandSender sender)
|
||||||
{
|
{
|
||||||
String displayName, ipAddress, balance, mails, world;
|
String displayName, ipAddress, balance, mails, world;
|
||||||
String worlds, online, unique, playerlist;
|
String worlds, online, unique, playerlist, date, time;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(sender);
|
final User user = ess.getUser(sender);
|
||||||
@ -76,6 +78,9 @@ public class KeywordReplacer implements IText
|
|||||||
}
|
}
|
||||||
playerlist = playerlistBuilder.toString();
|
playerlist = playerlistBuilder.toString();
|
||||||
|
|
||||||
|
date = new SimpleDateFormat("MMMM/dd/yyyy").format(new Date());
|
||||||
|
time = new SimpleDateFormat("hh:mm:ss").format(new Date());
|
||||||
|
|
||||||
for (int i = 0; i < input.getLines().size(); i++)
|
for (int i = 0; i < input.getLines().size(); i++)
|
||||||
{
|
{
|
||||||
String line = input.getLines().get(i);
|
String line = input.getLines().get(i);
|
||||||
@ -88,6 +93,8 @@ public class KeywordReplacer implements IText
|
|||||||
line = line.replace("{UNIQUE}", unique);
|
line = line.replace("{UNIQUE}", unique);
|
||||||
line = line.replace("{WORLDS}", worlds);
|
line = line.replace("{WORLDS}", worlds);
|
||||||
line = line.replace("{PLAYERLIST}", playerlist);
|
line = line.replace("{PLAYERLIST}", playerlist);
|
||||||
|
line = line.replace("{TIME}", time);
|
||||||
|
line = line.replace("{DATE}", date);
|
||||||
input.getLines().set(i, line);
|
input.getLines().set(i, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user