mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
SPIGOT-7370: Remove float value conversion in plugin.yml
By: Doc <nachito94@msn.com>
This commit is contained in:
parent
c110fcda22
commit
f16f465a47
@ -23,12 +23,14 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
import org.yaml.snakeyaml.LoaderOptions;
|
import org.yaml.snakeyaml.LoaderOptions;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.constructor.AbstractConstruct;
|
import org.yaml.snakeyaml.constructor.AbstractConstruct;
|
||||||
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||||
import org.yaml.snakeyaml.nodes.Node;
|
import org.yaml.snakeyaml.nodes.Node;
|
||||||
import org.yaml.snakeyaml.nodes.Tag;
|
import org.yaml.snakeyaml.nodes.Tag;
|
||||||
|
import org.yaml.snakeyaml.representer.Representer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This type is the runtime-container for the information in the plugin.yml.
|
* This type is the runtime-container for the information in the plugin.yml.
|
||||||
@ -201,6 +203,7 @@ public final class PluginDescriptionFile {
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
protected Yaml initialValue() {
|
protected Yaml initialValue() {
|
||||||
|
DumperOptions dumperOptions = new DumperOptions();
|
||||||
return new Yaml(new SafeConstructor(new LoaderOptions()) {
|
return new Yaml(new SafeConstructor(new LoaderOptions()) {
|
||||||
{
|
{
|
||||||
yamlConstructors.put(null, new AbstractConstruct() {
|
yamlConstructors.put(null, new AbstractConstruct() {
|
||||||
@ -230,7 +233,7 @@ public final class PluginDescriptionFile {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, new Representer(dumperOptions), dumperOptions, new PluginDescriptionResolver());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
String rawName = null;
|
String rawName = null;
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package org.bukkit.plugin;
|
||||||
|
|
||||||
|
import org.yaml.snakeyaml.nodes.Tag;
|
||||||
|
import org.yaml.snakeyaml.resolver.Resolver;
|
||||||
|
|
||||||
|
final class PluginDescriptionResolver extends Resolver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addImplicitResolvers() {
|
||||||
|
addImplicitResolver(Tag.BOOL, BOOL, "yYnNtTfFoO");
|
||||||
|
// addImplicitResolver(Tag.FLOAT, FLOAT, "-+0123456789."); // Don't resolve floats. Preserve strings - SPIGOT-7370
|
||||||
|
addImplicitResolver(Tag.INT, INT, "-+0123456789");
|
||||||
|
addImplicitResolver(Tag.MERGE, MERGE, "<");
|
||||||
|
addImplicitResolver(Tag.NULL, NULL, "~nN\0");
|
||||||
|
addImplicitResolver(Tag.NULL, EMPTY, null);
|
||||||
|
addImplicitResolver(Tag.TIMESTAMP, TIMESTAMP, "0123456789");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user