Merge pull request #96 from AtlasMediaGroup/FS-218

Adds functionality for a one-time message to be sent to new players (FS-218)
This commit is contained in:
Video 2021-08-10 07:41:42 -06:00 committed by GitHub
commit c8a4382a7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
public class LoginProcess extends FreedomService public class LoginProcess extends FreedomService
{ {
@ -190,6 +191,22 @@ public class LoginProcess extends FreedomService
final FPlayer fPlayer = plugin.pl.getPlayer(player); final FPlayer fPlayer = plugin.pl.getPlayer(player);
final PlayerData playerData = plugin.pl.getData(player); final PlayerData playerData = plugin.pl.getData(player);
// Sends a message to the player if they have never joined before (or simply lack player data).
if (!event.getPlayer().hasPlayedBefore() && ConfigEntry.FIRST_JOIN_INFO_ENABLED.getBoolean())
{
new BukkitRunnable()
{
@Override
public void run()
{
for (String line : ConfigEntry.FIRST_JOIN_INFO.getStringList())
{
player.sendMessage(FUtil.colorize(line));
}
}
}.runTaskLater(plugin, 20);
}
player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60); player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60);
player.setOp(true); player.setOp(true);

View File

@ -165,6 +165,8 @@ public enum ConfigEntry
ADMIN_INFO(List.class, "admininfo"), ADMIN_INFO(List.class, "admininfo"),
VOTING_INFO(List.class, "votinginfo"), VOTING_INFO(List.class, "votinginfo"),
MASTER_BUILDER_INFO(List.class, "masterbuilderinfo"), MASTER_BUILDER_INFO(List.class, "masterbuilderinfo"),
FIRST_JOIN_INFO(List.class, "first_join_info.text"),
FIRST_JOIN_INFO_ENABLED(Boolean.class, "first_join_info.enabled"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"), AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
TOGGLE_CHAT(Boolean.class, "toggle_chat"), TOGGLE_CHAT(Boolean.class, "toggle_chat"),
DEVELOPER_MODE(Boolean.class, "developer_mode"), DEVELOPER_MODE(Boolean.class, "developer_mode"),

View File

@ -590,6 +590,14 @@ masterbuilderinfo:
- ' &2- Template:' - ' &2- Template:'
- '&9https://forum.totalfreedom.me/d/336-master-builder-application-process' - '&9https://forum.totalfreedom.me/d/336-master-builder-application-process'
# What new players will see upon joining for the first time.
first_join_info:
enabled: true
text:
- "&6Welcome to TotalFreedom -- the original Free-OP server!"
- "&eThe server's name doesn't mean we have no rules. Do &6/rules &efor a list of them."
- "&aNeed help getting started? Do &2/help &aor a list of commands!"
# Famous players - cannot be banned by username # Famous players - cannot be banned by username
famous_players: famous_players:
- honeydew - honeydew