diff options
author | KHobbits <rob@khobbits.co.uk> | 2014-06-19 04:02:15 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-06-19 04:02:15 +0100 |
commit | fd2e4a03cec2ec4892f37fea411d5387f36c0b3c (patch) | |
tree | 829da24e1fa23c626a3719a1ec5415e07cfaa56e | |
parent | 1f630b3de2a893faf4bef6037fe3e6bb94bf3308 (diff) | |
download | Essentials-fd2e4a03cec2ec4892f37fea411d5387f36c0b3c.tar Essentials-fd2e4a03cec2ec4892f37fea411d5387f36c0b3c.tar.gz Essentials-fd2e4a03cec2ec4892f37fea411d5387f36c0b3c.tar.lz Essentials-fd2e4a03cec2ec4892f37fea411d5387f36c0b3c.tar.xz Essentials-fd2e4a03cec2ec4892f37fea411d5387f36c0b3c.zip |
Reduce a few nickname refresh calls.
8 files changed, 26 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java index 7e3acd643..8f08e3ce0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandcustomtext.java @@ -18,8 +18,13 @@ public class Commandcustomtext extends EssentialsCommand @Override protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception - { - final IText input = new TextInput(sender, "custom", true, ess); + { + if (sender.isPlayer()) + { + ess.getUser(sender.getPlayer()).setDisplayNick(); + } + + final IText input = new TextInput(sender, "custom", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); String chapter = commandLabel; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 87e2c5b15..d037c3c79 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -45,6 +45,7 @@ public class Commandhelp extends EssentialsCommand } else { + user.setDisplayNick(); output = new KeywordReplacer(input, user.getSource(), ess); } final TextPager pager = new TextPager(output); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java index a8b10cf36..2ee915f7c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java @@ -18,6 +18,11 @@ public class Commandinfo extends EssentialsCommand @Override protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { + if (sender.isPlayer()) + { + ess.getUser(sender.getPlayer()).setDisplayNick(); + } + final IText input = new TextInput(sender, "info", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java index bbab26ab0..58c8da669 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java @@ -18,6 +18,11 @@ public class Commandmotd extends EssentialsCommand @Override public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { + if (sender.isPlayer()) + { + ess.getUser(sender.getPlayer()).setDisplayNick(); + } + final IText input = new TextInput(sender, "motd", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java index 2a3e7a464..51ca08053 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java @@ -18,6 +18,11 @@ public class Commandrules extends EssentialsCommand @Override public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { + if (sender.isPlayer()) + { + ess.getUser(sender.getPlayer()).setDisplayNick(); + } + final IText input = new TextInput(sender, "rules", true, ess); final IText output = new KeywordReplacer(input, sender, ess); final TextPager pager = new TextPager(output); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java index 9d6ef8da0..d890b521d 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java @@ -37,6 +37,7 @@ public class SignInfo extends EssentialsSign final IText input; try { + player.setDisplayNick(); input = new TextInput(player.getSource(), "info", true, ess); final IText output = new KeywordReplacer(input, player.getSource(), ess); final TextPager pager = new TextPager(output); diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index 73dbf0538..683a1fe00 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -66,8 +66,6 @@ public class KeywordReplacer implements IText if (sender.isPlayer()) { user = ess.getUser(sender.getPlayer()); - //This is just so any displayname lookups below show the correct nickname - user.setDisplayNick(); } execTimer.mark("User Grab"); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 648ba33e3..67ef6c28e 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -134,7 +134,7 @@ public class EssentialsSpawnPlayerListener implements Listener LOGGER.log(Level.FINE, "New player join"); } - }); + }, 2L); } @@ -150,7 +150,7 @@ public class EssentialsSpawnPlayerListener implements Listener @Override public void run() { - if (user.getBase() instanceof OfflinePlayer) + if (user.getBase() instanceof OfflinePlayer || !user.getBase().isOnline()) { return; } |