mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-21 23:51:42 +01:00
Adjusting default spawn behavior.
Moving option in config file.
This commit is contained in:
parent
4884bed117
commit
256d202d50
@ -53,7 +53,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
lastLogout = _getLastLogout();
|
||||
lastLoginAddress = _getLastLoginAddress();
|
||||
afk = getAfk();
|
||||
newplayer = getNew();
|
||||
geolocation = _getGeoLocation();
|
||||
isSocialSpyEnabled = _isSocialSpyEnabled();
|
||||
isNPC = _isNPC();
|
||||
@ -736,22 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
}
|
||||
private boolean newplayer;
|
||||
|
||||
private boolean getNew()
|
||||
{
|
||||
return config.getBoolean("newplayer", true);
|
||||
}
|
||||
|
||||
public boolean isNew()
|
||||
{
|
||||
return newplayer;
|
||||
}
|
||||
|
||||
public void setNew(boolean set)
|
||||
{
|
||||
newplayer = set;
|
||||
config.setProperty("newplayer", set);
|
||||
config.save();
|
||||
}
|
||||
private String geolocation;
|
||||
|
||||
private String _getGeoLocation()
|
||||
|
@ -253,10 +253,7 @@ register-back-in-listener: false
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
|
||||
# When users die, should they respawn at their first home, instead of the spawnpoint or bed?
|
||||
respawn-at-home: false
|
||||
|
||||
# If no home is set send you to bed or spawn when /home is used
|
||||
# If no home is set, send players to spawn when /home is used
|
||||
spawn-if-no-home: true
|
||||
|
||||
# Allows people to set their bed at daytime
|
||||
@ -532,8 +529,11 @@ newbies:
|
||||
spawnpoint: newbies
|
||||
|
||||
# Set this to lowest, if you want Multiverse to handle the respawning
|
||||
# Set this to normal, if you want EssentialsSpawn to handle the respawning
|
||||
# Set this to high, if you want EssentialsSpawn to handle the respawning
|
||||
# Set this to highest, if you want to force EssentialsSpawn to handle the respawning
|
||||
respawn-listener-priority: normal
|
||||
respawn-listener-priority: high
|
||||
|
||||
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
|
||||
respawn-at-home: false
|
||||
|
||||
# End of File <-- No seriously, you're done with configuration.
|
||||
|
@ -39,7 +39,7 @@ public class EssentialsSpawn extends JavaPlugin
|
||||
|
||||
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
|
||||
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
|
||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
|
||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, ess.getSettings().getRespawnPriority(), this);
|
||||
|
||||
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -16,6 +17,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
private final transient SpawnStorage spawns;
|
||||
private static final Logger LOGGER = Bukkit.getLogger();
|
||||
|
||||
public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns)
|
||||
{
|
||||
@ -26,7 +28,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
||||
|
||||
@Override
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||
{
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (ess.getSettings().getRespawnAtHome())
|
||||
@ -45,8 +47,12 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
||||
final Location spawn = spawns.getSpawn(user.getGroup());
|
||||
if (spawn != null)
|
||||
{
|
||||
LOGGER.log(Level.INFO, "setting respawn location");
|
||||
event.setRespawnLocation(spawn);
|
||||
}
|
||||
else {
|
||||
LOGGER.log(Level.INFO, "spawn was null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,20 +60,22 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (!user.isNew() || user.getBedSpawnLocation() != null)
|
||||
if (user.hasPlayedBefore())
|
||||
{
|
||||
LOGGER.log(Level.FINE, "Old player join");
|
||||
return;
|
||||
}
|
||||
user.setNew(false);
|
||||
}
|
||||
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user));
|
||||
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
|
||||
}
|
||||
|
||||
if (ess.getSettings().getAnnounceNewPlayers())
|
||||
{
|
||||
ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
|
||||
}
|
||||
|
||||
LOGGER.log(Level.FINE, "New player join");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user