mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 06:57:39 +01:00
Add option to ignore vanished players from sleeping (#4200)
This commit is contained in:
parent
a4fbfbef02
commit
fed26071ac
@ -209,6 +209,8 @@ public interface ISettings extends IConf {
|
|||||||
|
|
||||||
boolean sleepIgnoresAfkPlayers();
|
boolean sleepIgnoresAfkPlayers();
|
||||||
|
|
||||||
|
boolean sleepIgnoresVanishedPlayers();
|
||||||
|
|
||||||
boolean isAfkListName();
|
boolean isAfkListName();
|
||||||
|
|
||||||
String getAfkListName();
|
String getAfkListName();
|
||||||
|
@ -1101,6 +1101,11 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
return config.getBoolean("sleep-ignores-afk-players", true);
|
return config.getBoolean("sleep-ignores-afk-players", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sleepIgnoresVanishedPlayers() {
|
||||||
|
return config.getBoolean("sleep-ignores-vanished-player", true);
|
||||||
|
}
|
||||||
|
|
||||||
public String _getAfkListName() {
|
public String _getAfkListName() {
|
||||||
return FormatUtil.replaceFormat(config.getString("afk-list-name", "none"));
|
return FormatUtil.replaceFormat(config.getString("afk-list-name", "none"));
|
||||||
}
|
}
|
||||||
|
@ -889,6 +889,9 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||||||
if (isAuthorized("essentials.vanish.effect")) {
|
if (isAuthorized("essentials.vanish.effect")) {
|
||||||
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
||||||
}
|
}
|
||||||
|
if (ess.getSettings().sleepIgnoresVanishedPlayers()) {
|
||||||
|
getBase().setSleepingIgnored(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (final Player p : ess.getOnlinePlayers()) {
|
for (final Player p : ess.getOnlinePlayers()) {
|
||||||
p.showPlayer(getBase());
|
p.showPlayer(getBase());
|
||||||
@ -898,6 +901,9 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||||||
if (isAuthorized("essentials.vanish.effect")) {
|
if (isAuthorized("essentials.vanish.effect")) {
|
||||||
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
|
this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||||
}
|
}
|
||||||
|
if (ess.getSettings().sleepIgnoresVanishedPlayers()) {
|
||||||
|
getBase().setSleepingIgnored(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,6 +471,11 @@ cancel-afk-on-chat: true
|
|||||||
# Users with the permission node essentials.sleepingignored will always be ignored.
|
# Users with the permission node essentials.sleepingignored will always be ignored.
|
||||||
sleep-ignores-afk-players: true
|
sleep-ignores-afk-players: true
|
||||||
|
|
||||||
|
# Should vanished players be ignored when other players are trying to sleep?
|
||||||
|
# When this setting is false, player's won't be able to skip the night if vanished players are not sleeping.
|
||||||
|
# Users with the permission node essentials.sleepingignored will always be ignored.
|
||||||
|
sleep-ignores-vanished-player: true
|
||||||
|
|
||||||
# Set the player's list name when they are AFK. This is none by default which specifies that Essentials
|
# Set the player's list name when they are AFK. This is none by default which specifies that Essentials
|
||||||
# should not interfere with the AFK player's list name.
|
# should not interfere with the AFK player's list name.
|
||||||
# You may use color codes, use {USERNAME} the player's name or {PLAYER} for the player's displayname.
|
# You may use color codes, use {USERNAME} the player's name or {PLAYER} for the player's displayname.
|
||||||
|
Loading…
Reference in New Issue
Block a user