mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
"Lets remove features in a minor build! -some guy at SpigotMC"
This commit is contained in:
1 parent
9bbb02a3a6
commit
7842153e60
2 files changed
+28
-15
No files matched your search
@@ -101,7 +101,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.18-R0.1-SNAPSHOT</version>
|
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+27
-14
@@ -16,20 +16,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.config.yaml;
|
package com.rammelkast.anticheatreloaded.config.yaml;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConstructor;
|
|
||||||
import org.bukkit.configuration.file.YamlRepresenter;
|
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
|
||||||
import org.yaml.snakeyaml.representer.Representer;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -40,6 +28,18 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConstructor;
|
||||||
|
import org.bukkit.configuration.file.YamlRepresenter;
|
||||||
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
|
import org.yaml.snakeyaml.representer.Representer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of {@link org.bukkit.configuration.file.YamlConfiguration} which preserves comments.
|
* An extension of {@link org.bukkit.configuration.file.YamlConfiguration} which preserves comments.
|
||||||
* Note that this implementation is not synchronized.
|
* Note that this implementation is not synchronized.
|
||||||
@@ -87,7 +87,7 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
blank++;
|
blank++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (lines[i].contains(COMMENT_PREFIX)) {
|
if (lines[i].contains("# ")) {
|
||||||
comments.put(i - blank, lines[i]);
|
comments.put(i - blank, lines[i]);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@@ -104,7 +104,7 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
// String header = buildHeader(); - CommentedConfiguration
|
// String header = buildHeader(); - CommentedConfiguration
|
||||||
String dump = yaml.dump(getValues(false));
|
String dump = yaml.dump(getValues(false));
|
||||||
|
|
||||||
if (dump.equals(BLANK_CONFIG)) {
|
if (dump.equals("{}\\n")) {
|
||||||
dump = "";
|
dump = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,4 +201,17 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void convertMapsToSections(Map<?, ?> input, ConfigurationSection section) {
|
||||||
|
for (Map.Entry<?, ?> entry : input.entrySet()) {
|
||||||
|
String key = entry.getKey().toString();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
|
||||||
|
if (value instanceof Map) {
|
||||||
|
convertMapsToSections((Map<?, ?>) value, section.createSection(key));
|
||||||
|
} else {
|
||||||
|
section.set(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user