mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-27 16:30:04 +02:00
Revert "Bukkit should have fixed this issue, so we can now get a better first join player experience by teleporting them at once with no delay."
This reverts commit f7daa20be8
.
This breaks compatibility with multiverse, and Essentials core.
This commit is contained in:
@@ -3,6 +3,7 @@ package com.earth2me.essentials.spawn;
|
|||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.Kit;
|
import com.earth2me.essentials.Kit;
|
||||||
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.textreader.IText;
|
import com.earth2me.essentials.textreader.IText;
|
||||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
@@ -71,7 +72,18 @@ public class EssentialsSpawnPlayerListener implements Listener
|
|||||||
|
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
ess.scheduleAsyncDelayedTask(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
delayedJoin(event.getPlayer());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delayedJoin(Player player)
|
||||||
|
{
|
||||||
if (player.hasPlayedBefore())
|
if (player.hasPlayedBefore())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.FINE, "Old player join");
|
LOGGER.log(Level.FINE, "Old player join");
|
||||||
@@ -82,18 +94,7 @@ public class EssentialsSpawnPlayerListener implements Listener
|
|||||||
|
|
||||||
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
|
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
|
||||||
{
|
{
|
||||||
try
|
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
|
||||||
{
|
|
||||||
final Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn());
|
|
||||||
if (spawn != null)
|
|
||||||
{
|
|
||||||
user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, _("teleportNewPlayerError"), ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
||||||
@@ -125,4 +126,37 @@ public class EssentialsSpawnPlayerListener implements Listener
|
|||||||
|
|
||||||
LOGGER.log(Level.FINE, "New player join");
|
LOGGER.log(Level.FINE, "New player join");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class NewPlayerTeleport implements Runnable
|
||||||
|
{
|
||||||
|
private final transient User user;
|
||||||
|
|
||||||
|
public NewPlayerTeleport(final User user)
|
||||||
|
{
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (user.getBase() instanceof OfflinePlayer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Location spawn = spawns.getSpawn(ess.getSettings().getNewbieSpawn());
|
||||||
|
if (spawn != null)
|
||||||
|
{
|
||||||
|
user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.WARNING, _("teleportNewPlayerError"), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user