mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-08 07:36:42 +02:00
Adjusting default spawn behavior.
Moving option in config file.
This commit is contained in:
@@ -53,7 +53,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
lastLogout = _getLastLogout();
|
lastLogout = _getLastLogout();
|
||||||
lastLoginAddress = _getLastLoginAddress();
|
lastLoginAddress = _getLastLoginAddress();
|
||||||
afk = getAfk();
|
afk = getAfk();
|
||||||
newplayer = getNew();
|
|
||||||
geolocation = _getGeoLocation();
|
geolocation = _getGeoLocation();
|
||||||
isSocialSpyEnabled = _isSocialSpyEnabled();
|
isSocialSpyEnabled = _isSocialSpyEnabled();
|
||||||
isNPC = _isNPC();
|
isNPC = _isNPC();
|
||||||
@@ -736,22 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
}
|
}
|
||||||
private boolean newplayer;
|
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 geolocation;
|
||||||
|
|
||||||
private String _getGeoLocation()
|
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?
|
# If no home is set, send players to spawn when /home is used
|
||||||
respawn-at-home: false
|
|
||||||
|
|
||||||
# If no home is set send you to bed or spawn when /home is used
|
|
||||||
spawn-if-no-home: true
|
spawn-if-no-home: true
|
||||||
|
|
||||||
# Allows people to set their bed at daytime
|
# Allows people to set their bed at daytime
|
||||||
@@ -532,8 +529,11 @@ newbies:
|
|||||||
spawnpoint: newbies
|
spawnpoint: newbies
|
||||||
|
|
||||||
# Set this to lowest, if you want Multiverse to handle the respawning
|
# 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
|
# 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.
|
# 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);
|
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
|
||||||
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
|
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"));
|
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.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
@@ -16,6 +17,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient SpawnStorage spawns;
|
private final transient SpawnStorage spawns;
|
||||||
|
private static final Logger LOGGER = Bukkit.getLogger();
|
||||||
|
|
||||||
public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns)
|
public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns)
|
||||||
{
|
{
|
||||||
@@ -45,8 +47,12 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
|||||||
final Location spawn = spawns.getSpawn(user.getGroup());
|
final Location spawn = spawns.getSpawn(user.getGroup());
|
||||||
if (spawn != null)
|
if (spawn != null)
|
||||||
{
|
{
|
||||||
|
LOGGER.log(Level.INFO, "setting respawn location");
|
||||||
event.setRespawnLocation(spawn);
|
event.setRespawnLocation(spawn);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOGGER.log(Level.INFO, "spawn was null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,20 +60,22 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
if (!user.isNew() || user.getBedSpawnLocation() != null)
|
if (user.hasPlayedBefore())
|
||||||
{
|
{
|
||||||
|
LOGGER.log(Level.FINE, "Old player join");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.setNew(false);
|
|
||||||
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
|
if (!"none".equalsIgnoreCase(ess.getSettings().getNewbieSpawn()))
|
||||||
{
|
{
|
||||||
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user));
|
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getAnnounceNewPlayers())
|
if (ess.getSettings().getAnnounceNewPlayers())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
|
ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGGER.log(Level.FINE, "New player join");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user