mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Cache join/quit messages.
This commit is contained in:
parent
1ae2b094f3
commit
c57c791e69
5 changed files with 58 additions and 24 deletions
|
@ -164,15 +164,16 @@ public class EssentialsPlayerListener implements Listener
|
|||
{
|
||||
user.getBase().getOpenInventory().getTopInventory().clear();
|
||||
}
|
||||
if (ess.getSettings().isJoinQuitMessagesDisabled())
|
||||
|
||||
if (ess.getSettings().allowSilentJoinQuit())
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
|
||||
}
|
||||
if (!ess.getSettings().customQuitMessage().equals("none"))
|
||||
if (ess.getSettings().isCustomQuitMessage())
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
ess.broadcastMessage(ess.getSettings().customQuitMessage());
|
||||
ess.broadcastMessage(ess.getSettings().getCustomQuitMessage());
|
||||
}
|
||||
user.updateActivity(false);
|
||||
user.dispose();
|
||||
|
@ -181,11 +182,11 @@ public class EssentialsPlayerListener implements Listener
|
|||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
if (ess.getSettings().isJoinQuitMessagesDisabled())
|
||||
if (ess.getSettings().allowSilentJoinQuit())
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
}
|
||||
if (!ess.getSettings().customJoinMessage().equals("none"))
|
||||
if (ess.getSettings().isCustomJoinMessage())
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
}
|
||||
|
@ -201,14 +202,15 @@ public class EssentialsPlayerListener implements Listener
|
|||
|
||||
public void delayedJoin(final Player player, final String message)
|
||||
{
|
||||
if (!ess.getSettings().customJoinMessage().equals("none"))
|
||||
if (ess.getSettings().isCustomJoinMessage())
|
||||
{
|
||||
ess.broadcastMessage(ess.getSettings().customJoinMessage());
|
||||
ess.broadcastMessage(ess.getSettings().getCustomJoinMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.broadcastMessage(message);
|
||||
}
|
||||
|
||||
if (!player.isOnline())
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -198,9 +198,13 @@ public interface ISettings extends IConf
|
|||
|
||||
int getMaxUserCacheCount();
|
||||
|
||||
boolean isJoinQuitMessagesDisabled();
|
||||
boolean allowSilentJoinQuit();
|
||||
|
||||
String customJoinMessage();
|
||||
boolean isCustomJoinMessage();
|
||||
|
||||
String customQuitMessage();
|
||||
String getCustomJoinMessage();
|
||||
|
||||
boolean isCustomQuitMessage();
|
||||
|
||||
String getCustomQuitMessage();
|
||||
}
|
||||
|
|
|
@ -519,7 +519,11 @@ public class Settings implements net.ess3.api.ISettings
|
|||
economyLog = _isEcoLogEnabled();
|
||||
economyLogUpdate = _isEcoLogUpdateEnabled();
|
||||
economyDisabled = _isEcoDisabled();
|
||||
joinQuitMessagesDisabled = _isJoinQuitMessagesDisabled();
|
||||
allowSilentJoin = _isJoinQuitMessagesDisabled();
|
||||
customJoinMessage = _getCustomJoinMessage();
|
||||
isCustomJoinMessage = !customJoinMessage.equals("none");
|
||||
customQuitMessage = _getCustomQuitMessage();
|
||||
isCustomQuitMessage = !customQuitMessage.equals("none");
|
||||
}
|
||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||
|
||||
|
@ -1113,8 +1117,7 @@ public class Settings implements net.ess3.api.ISettings
|
|||
{
|
||||
return config.getInt("max-nick-length", 30);
|
||||
}
|
||||
|
||||
private boolean joinQuitMessagesDisabled;
|
||||
private boolean allowSilentJoin;
|
||||
|
||||
public boolean _isJoinQuitMessagesDisabled()
|
||||
{
|
||||
|
@ -1122,21 +1125,47 @@ public class Settings implements net.ess3.api.ISettings
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isJoinQuitMessagesDisabled()
|
||||
public boolean allowSilentJoinQuit()
|
||||
{
|
||||
return joinQuitMessagesDisabled;
|
||||
return allowSilentJoin;
|
||||
}
|
||||
private String customJoinMessage;
|
||||
private boolean isCustomJoinMessage;
|
||||
|
||||
public String _getCustomJoinMessage()
|
||||
{
|
||||
return config.getString("custom-join-message", "none");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String customJoinMessage()
|
||||
public String getCustomJoinMessage()
|
||||
{
|
||||
return config.getString("custom-join-message");
|
||||
return customJoinMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String customQuitMessage()
|
||||
public boolean isCustomJoinMessage()
|
||||
{
|
||||
return config.getString("custom-quit-message");
|
||||
return isCustomJoinMessage;
|
||||
}
|
||||
private String customQuitMessage;
|
||||
private boolean isCustomQuitMessage;
|
||||
|
||||
public String _getCustomQuitMessage()
|
||||
{
|
||||
return config.getString("custom-quit-message", "none");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomQuitMessage()
|
||||
{
|
||||
return customQuitMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomQuitMessage()
|
||||
{
|
||||
return isCustomQuitMessage;
|
||||
}
|
||||
|
||||
// #easteregg
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.earth2me.essentials.User;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
|
@ -27,7 +26,6 @@ public class Commandremove extends EssentialsCommand
|
|||
{
|
||||
World world = user.getWorld();
|
||||
int radius = 0;
|
||||
Bukkit.broadcastMessage("len: " + args.length);
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -353,14 +353,15 @@ cancel-afk-on-move: true
|
|||
# You can disable the death messages of Minecraft here.
|
||||
death-messages: true
|
||||
|
||||
# You can disable join and quit messages here.
|
||||
# Should operators be able to join and part silently.
|
||||
# You can control this with permissions if it is enabled.
|
||||
allow-silent-join-quit: false
|
||||
|
||||
# You can set a custom join message here, set to "none" to disable.
|
||||
custom-join-message: none
|
||||
custom-join-message: "none"
|
||||
|
||||
# You can set a custom quit message here, set to "none" to disable.
|
||||
custom-quit-message: none
|
||||
custom-quit-message: "none"
|
||||
|
||||
# Add worlds to this list, if you want to automatically disable god mode there.
|
||||
no-god-in-worlds:
|
||||
|
|
Loading…
Reference in a new issue