Reduce a few nickname refresh calls.

This commit is contained in:
KHobbits 2014-06-19 04:02:15 +01:00
parent a800359e0b
commit 1f8b60081e
8 changed files with 26 additions and 6 deletions

View File

@ -19,6 +19,11 @@ public class Commandcustomtext extends EssentialsCommand
@Override @Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 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, "custom", true, ess); final IText input = new TextInput(sender, "custom", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -45,6 +45,7 @@ public class Commandhelp extends EssentialsCommand
} }
else else
{ {
user.setDisplayNick();
output = new KeywordReplacer(input, user.getSource(), ess); output = new KeywordReplacer(input, user.getSource(), ess);
} }
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -18,6 +18,11 @@ public class Commandinfo extends EssentialsCommand
@Override @Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 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 input = new TextInput(sender, "info", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -18,6 +18,11 @@ public class Commandmotd extends EssentialsCommand
@Override @Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 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 input = new TextInput(sender, "motd", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -18,6 +18,11 @@ public class Commandrules extends EssentialsCommand
@Override @Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception 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 input = new TextInput(sender, "rules", true, ess);
final IText output = new KeywordReplacer(input, sender, ess); final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -37,6 +37,7 @@ public class SignInfo extends EssentialsSign
final IText input; final IText input;
try try
{ {
player.setDisplayNick();
input = new TextInput(player.getSource(), "info", true, ess); input = new TextInput(player.getSource(), "info", true, ess);
final IText output = new KeywordReplacer(input, player.getSource(), ess); final IText output = new KeywordReplacer(input, player.getSource(), ess);
final TextPager pager = new TextPager(output); final TextPager pager = new TextPager(output);

View File

@ -66,8 +66,6 @@ public class KeywordReplacer implements IText
if (sender.isPlayer()) if (sender.isPlayer())
{ {
user = ess.getUser(sender.getPlayer()); user = ess.getUser(sender.getPlayer());
//This is just so any displayname lookups below show the correct nickname
user.setDisplayNick();
} }
execTimer.mark("User Grab"); execTimer.mark("User Grab");

View File

@ -134,7 +134,7 @@ public class EssentialsSpawnPlayerListener implements Listener
LOGGER.log(Level.FINE, "New player join"); LOGGER.log(Level.FINE, "New player join");
} }
}); }, 2L);
} }
@ -150,7 +150,7 @@ public class EssentialsSpawnPlayerListener implements Listener
@Override @Override
public void run() public void run()
{ {
if (user.getBase() instanceof OfflinePlayer) if (user.getBase() instanceof OfflinePlayer || !user.getBase().isOnline())
{ {
return; return;
} }