mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00:00
Add options to disable join/quit messages and custom join/quit messages
This commit is contained in:
parent
dde8cd8f72
commit
1ae2b094f3
4 changed files with 64 additions and 5 deletions
|
@ -164,9 +164,15 @@ public class EssentialsPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
user.getBase().getOpenInventory().getTopInventory().clear();
|
user.getBase().getOpenInventory().getTopInventory().clear();
|
||||||
}
|
}
|
||||||
if (user.hasPermission("essentials.silentquit"))
|
if (ess.getSettings().isJoinQuitMessagesDisabled())
|
||||||
{
|
{
|
||||||
event.setQuitMessage(null);
|
event.setQuitMessage(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!ess.getSettings().customQuitMessage().equals("none"))
|
||||||
|
{
|
||||||
|
event.setQuitMessage(null);
|
||||||
|
ess.broadcastMessage(ess.getSettings().customQuitMessage());
|
||||||
}
|
}
|
||||||
user.updateActivity(false);
|
user.updateActivity(false);
|
||||||
user.dispose();
|
user.dispose();
|
||||||
|
@ -175,7 +181,11 @@ public class EssentialsPlayerListener implements Listener
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer().hasPermission("essentials.silentjoin"))
|
if (ess.getSettings().isJoinQuitMessagesDisabled())
|
||||||
|
{
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
}
|
||||||
|
if (!ess.getSettings().customJoinMessage().equals("none"))
|
||||||
{
|
{
|
||||||
event.setJoinMessage(null);
|
event.setJoinMessage(null);
|
||||||
}
|
}
|
||||||
|
@ -184,13 +194,21 @@ public class EssentialsPlayerListener implements Listener
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
delayedJoin(event.getPlayer());
|
delayedJoin(event.getPlayer(), event.getJoinMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delayedJoin(final Player player)
|
public void delayedJoin(final Player player, final String message)
|
||||||
{
|
{
|
||||||
|
if (!ess.getSettings().customJoinMessage().equals("none"))
|
||||||
|
{
|
||||||
|
ess.broadcastMessage(ess.getSettings().customJoinMessage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ess.broadcastMessage(message);
|
||||||
|
}
|
||||||
if (!player.isOnline())
|
if (!player.isOnline())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -195,6 +195,12 @@ public interface ISettings extends IConf
|
||||||
Map<String, Object> getListGroupConfig();
|
Map<String, Object> getListGroupConfig();
|
||||||
|
|
||||||
int getMaxNickLength();
|
int getMaxNickLength();
|
||||||
|
|
||||||
int getMaxUserCacheCount();
|
int getMaxUserCacheCount();
|
||||||
|
|
||||||
|
boolean isJoinQuitMessagesDisabled();
|
||||||
|
|
||||||
|
String customJoinMessage();
|
||||||
|
|
||||||
|
String customQuitMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,6 +519,7 @@ public class Settings implements net.ess3.api.ISettings
|
||||||
economyLog = _isEcoLogEnabled();
|
economyLog = _isEcoLogEnabled();
|
||||||
economyLogUpdate = _isEcoLogUpdateEnabled();
|
economyLogUpdate = _isEcoLogUpdateEnabled();
|
||||||
economyDisabled = _isEcoDisabled();
|
economyDisabled = _isEcoDisabled();
|
||||||
|
joinQuitMessagesDisabled = _isJoinQuitMessagesDisabled();
|
||||||
}
|
}
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
@ -1113,6 +1114,31 @@ public class Settings implements net.ess3.api.ISettings
|
||||||
return config.getInt("max-nick-length", 30);
|
return config.getInt("max-nick-length", 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean joinQuitMessagesDisabled;
|
||||||
|
|
||||||
|
public boolean _isJoinQuitMessagesDisabled()
|
||||||
|
{
|
||||||
|
return config.getBoolean("allow-silent-join-quit");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isJoinQuitMessagesDisabled()
|
||||||
|
{
|
||||||
|
return joinQuitMessagesDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String customJoinMessage()
|
||||||
|
{
|
||||||
|
return config.getString("custom-join-message");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String customQuitMessage()
|
||||||
|
{
|
||||||
|
return config.getString("custom-quit-message");
|
||||||
|
}
|
||||||
|
|
||||||
// #easteregg
|
// #easteregg
|
||||||
@Override
|
@Override
|
||||||
public int getMaxUserCacheCount()
|
public int getMaxUserCacheCount()
|
||||||
|
|
|
@ -353,6 +353,15 @@ cancel-afk-on-move: true
|
||||||
# You can disable the death messages of Minecraft here.
|
# You can disable the death messages of Minecraft here.
|
||||||
death-messages: true
|
death-messages: true
|
||||||
|
|
||||||
|
# You can disable join and quit messages here.
|
||||||
|
allow-silent-join-quit: false
|
||||||
|
|
||||||
|
# You can set a custom join message here, set to "none" to disable.
|
||||||
|
custom-join-message: none
|
||||||
|
|
||||||
|
# You can set a custom quit message here, set to "none" to disable.
|
||||||
|
custom-quit-message: none
|
||||||
|
|
||||||
# Add worlds to this list, if you want to automatically disable god mode there.
|
# Add worlds to this list, if you want to automatically disable god mode there.
|
||||||
no-god-in-worlds:
|
no-god-in-worlds:
|
||||||
# - world_nether
|
# - world_nether
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue