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
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 output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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;
}