mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add config for default shout state and for persisting shout state
This commit is contained in:
parent
94edbcfeb1
commit
88c8ccd29b
@ -46,6 +46,10 @@ public interface ISettings extends IConf {
|
||||
|
||||
char getChatQuestion();
|
||||
|
||||
boolean isShoutDefault();
|
||||
|
||||
boolean isPersistShout();
|
||||
|
||||
boolean isChatQuestionEnabled();
|
||||
|
||||
BigDecimal getCommandCost(IEssentialsCommand cmd);
|
||||
|
@ -226,6 +226,16 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
return chatQuestion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShoutDefault() {
|
||||
return config.getBoolean("chat.shout-default", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPersistShout() {
|
||||
return config.getBoolean("chat.persist-shout", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChatQuestionEnabled() {
|
||||
return config.getBoolean("chat.question-enabled", true);
|
||||
|
@ -90,7 +90,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
private long lastNotifiedAboutMailsMs;
|
||||
private String lastHomeConfirmation;
|
||||
private long lastHomeConfirmationTimestamp;
|
||||
private boolean toggleShout = false;
|
||||
private Boolean toggleShout;
|
||||
private transient final List<String> signCopy = Lists.newArrayList("", "", "", "");
|
||||
|
||||
public User(final Player base, final IEssentials ess) {
|
||||
@ -1202,10 +1202,16 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
@Override
|
||||
public void setToggleShout(boolean toggleShout) {
|
||||
this.toggleShout = toggleShout;
|
||||
if (ess.getSettings().isPersistShout()) {
|
||||
setShouting(toggleShout);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToggleShout() {
|
||||
return toggleShout;
|
||||
if (ess.getSettings().isPersistShout()) {
|
||||
return toggleShout = isShouting();
|
||||
}
|
||||
return toggleShout == null ? toggleShout = ess.getSettings().isShoutDefault() : toggleShout;
|
||||
}
|
||||
}
|
||||
|
@ -722,6 +722,18 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
config.save();
|
||||
}
|
||||
|
||||
public boolean isShouting() {
|
||||
if (holder.shouting() == null) {
|
||||
holder.shouting(ess.getSettings().isShoutDefault());
|
||||
}
|
||||
return holder.shouting();
|
||||
}
|
||||
|
||||
public void setShouting(boolean shouting) {
|
||||
holder.shouting(shouting);
|
||||
config.save();
|
||||
}
|
||||
|
||||
public UUID getConfigUUID() {
|
||||
return config.getUuid();
|
||||
}
|
||||
|
@ -322,6 +322,16 @@ public class UserConfigHolder {
|
||||
this.baltopExempt = value;
|
||||
}
|
||||
|
||||
private @MonotonicNonNull Boolean shouting;
|
||||
|
||||
public Boolean shouting() {
|
||||
return shouting;
|
||||
}
|
||||
|
||||
public void shouting(final Boolean value) {
|
||||
this.shouting = value;
|
||||
}
|
||||
|
||||
private @NonNull Timestamps timestamps = new Timestamps();
|
||||
|
||||
public Timestamps timestamps() {
|
||||
|
@ -921,6 +921,12 @@ chat:
|
||||
# plots: "&dP&r"
|
||||
# creative: "&eC&r"
|
||||
|
||||
# Whether players should be placed into shout mode by default.
|
||||
shout-default: false
|
||||
|
||||
# Whether a player's shout mode should persist restarts.
|
||||
persist-shout: false
|
||||
|
||||
# Whether chat questions should be enabled or not.
|
||||
question-enabled: true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user