mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Prevent default and prefix from being in defaults
This commit is contained in:
1 parent
eaf172b683
commit
ab102be69d
1 file changed
+24
-40
@@ -373,7 +373,11 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isDefault() {
|
public Boolean isDefault() {
|
||||||
return getBoolean("default", false);
|
if (config != null && config.contains("default")) {
|
||||||
|
return config.getBoolean("default");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -416,7 +420,11 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getMessagePrefix() {
|
public String getMessagePrefix() {
|
||||||
return getString("message-prefix", false);
|
if (config != null && config.contains("message-prefix")) {
|
||||||
|
return config.getString("message-prefix");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -508,86 +516,62 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
return section.get(key);
|
return section.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(String key, boolean includeDefault) {
|
private String getString(String key) {
|
||||||
if (config != null && config.contains(key)) {
|
if (config != null && config.contains(key)) {
|
||||||
return config.getString(key);
|
return config.getString(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeDefault) {
|
|
||||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||||
|
|
||||||
if (defaultSection != null && defaultSection.contains(key)) {
|
if (defaultSection != null && defaultSection.contains(key)) {
|
||||||
return defaultSection.getString(key);
|
return defaultSection.getString(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getString(String key) {
|
|
||||||
return this.getString(key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getStringList(String key, boolean includeDefault) {
|
|
||||||
if (config != null && config.contains(key)) {
|
|
||||||
return config.getStringList(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (includeDefault) {
|
|
||||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
|
||||||
|
|
||||||
if (defaultSection != null && defaultSection.contains(key)) {
|
|
||||||
return defaultSection.getStringList(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getStringList(String key) {
|
private List<String> getStringList(String key) {
|
||||||
return this.getStringList(key, true);
|
if (config != null && config.contains(key)) {
|
||||||
|
return config.getStringList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getBoolean(String key, boolean includeDefault) {
|
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||||
|
|
||||||
|
if (defaultSection != null && defaultSection.contains(key)) {
|
||||||
|
return defaultSection.getStringList(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getBoolean(String key) {
|
||||||
if (config != null && config.contains(key)) {
|
if (config != null && config.contains(key)) {
|
||||||
return config.getBoolean(key);
|
return config.getBoolean(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeDefault) {
|
|
||||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||||
|
|
||||||
if (defaultSection != null && defaultSection.contains(key)) {
|
if (defaultSection != null && defaultSection.contains(key)) {
|
||||||
return defaultSection.getBoolean(key);
|
return defaultSection.getBoolean(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getBoolean(String key) {
|
private double getDouble(String key) {
|
||||||
return this.getBoolean(key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getDouble(String key, boolean includeDefault) {
|
|
||||||
if (config != null && config.contains(key)) {
|
if (config != null && config.contains(key)) {
|
||||||
return config.getDouble(key);
|
return config.getDouble(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeDefault) {
|
|
||||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||||
|
|
||||||
if (defaultSection != null && defaultSection.contains(key)) {
|
if (defaultSection != null && defaultSection.contains(key)) {
|
||||||
return defaultSection.getDouble(key);
|
return defaultSection.getDouble(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getDouble(String key) {
|
|
||||||
return this.getDouble(key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
|
|||||||
Reference in new issue
Block a user