mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-10 20:29:28 +00:00
Merge pull request #605 from Phryxiil/2.x
Fixed bug when logging in silently
This commit is contained in:
commit
fed250fd74
|
@ -186,19 +186,30 @@ public class EssentialsPlayerListener implements Listener
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
final String joinMessage = event.getJoinMessage();
|
|
||||||
ess.runTaskAsynchronously(new Runnable()
|
ess.runTaskAsynchronously(new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
delayedJoin(event.getPlayer(), joinMessage);
|
delayedJoin(event.getPlayer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
event.setJoinMessage(null);
|
if (ess.getSettings().allowSilentJoinQuit() && event.getPlayer().hasPermission("essentials.silentjoin"))
|
||||||
|
{
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
}
|
||||||
|
if (ess.getSettings().isCustomJoinMessage() && event.getJoinMessage() != null)
|
||||||
|
{
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
ess.getServer().broadcastMessage(
|
||||||
|
ess.getSettings().getCustomJoinMessage()
|
||||||
|
.replace("{PLAYER}", event.getPlayer().getDisplayName())
|
||||||
|
.replace("{USERNAME}", event.getPlayer().getName())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delayedJoin(final Player player, final String message)
|
public void delayedJoin(final Player player)
|
||||||
{
|
{
|
||||||
if (!player.isOnline())
|
if (!player.isOnline())
|
||||||
{
|
{
|
||||||
|
@ -208,7 +219,6 @@ public class EssentialsPlayerListener implements Listener
|
||||||
ess.getBackup().onPlayerJoin();
|
ess.getBackup().onPlayerJoin();
|
||||||
final User user = ess.getUser(player);
|
final User user = ess.getUser(player);
|
||||||
|
|
||||||
|
|
||||||
if (user.isNPC())
|
if (user.isNPC())
|
||||||
{
|
{
|
||||||
user.setNPC(false);
|
user.setNPC(false);
|
||||||
|
@ -249,19 +259,6 @@ public class EssentialsPlayerListener implements Listener
|
||||||
user.setSleepingIgnored(true);
|
user.setSleepingIgnored(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().isCustomJoinMessage())
|
|
||||||
{
|
|
||||||
ess.getServer().broadcastMessage(
|
|
||||||
ess.getSettings().getCustomJoinMessage()
|
|
||||||
.replace("{PLAYER}", player.getDisplayName())
|
|
||||||
.replace("{USERNAME}", player.getName())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (!(ess.getSettings().allowSilentJoinQuit() && user.isAuthorized("esentials.silentjoin")) && message != null)
|
|
||||||
{
|
|
||||||
ess.getServer().broadcastMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
|
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue