mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-09-27 21:12:35 +02:00
Properly set a default value for the Replacements
option
This commit is contained in:
parent
0e8bae4187
commit
0812ff3ade
@ -122,7 +122,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
if (template.getBuildOptions().getBoolean("Update-Files", false)) updateDirectory(template.getDirectory(), dir);
|
||||
else Util.copyDirectory(template.getDirectory(), dir);
|
||||
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements").getValues()) if (!replacement.isNull()) {
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements", new ObjectMap<>()).getValues()) if (!replacement.isNull()) {
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asRawString());
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class PacketExUploadTemplates implements PacketObjectIn<Integer>, PacketO
|
||||
HashMap<String, SubCreator.ServerTemplate> map = Util.getDespiteException(() -> Util.reflect(ExternalSubCreator.class.getDeclaredField("templates"), ((ExternalHost) client.getHandler()).getCreator()), new HashMap<>());
|
||||
UniversalFile templatedir = new UniversalFile(plugin.dir, "SubServers:Cache:Remote:Templates");
|
||||
ObjectMap<String> templates = new ObjectMap<>((Map<String, ?>) data.getObject(0x0000));
|
||||
templatedir.mkdirs();
|
||||
map.clear();
|
||||
for (String name : templates.getKeys()) {
|
||||
try {
|
||||
UniversalFile dir = new UniversalFile(templatedir, name);
|
||||
|
@ -300,7 +300,7 @@ public class SubCreatorImpl {
|
||||
if (template.getBuildOptions().getBoolean("Update-Files", false)) updateDirectory(template.getDirectory(), dir);
|
||||
else Util.copyDirectory(template.getDirectory(), dir);
|
||||
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements").getValues()) if (!replacement.isNull()) {
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements", new ObjectMap<>()).getValues()) if (!replacement.isNull()) {
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asRawString());
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,9 @@ public class PacketExUploadTemplates implements PacketIn, PacketObjectOut<Intege
|
||||
|
||||
@Override
|
||||
public ObjectMap<Integer> send(SubDataSender client) {
|
||||
host.log.info.println(((first)?"S":"Res") + "ending Local Template Metadata...");
|
||||
if (!first) host.creator.load(false);
|
||||
if (!host.templates.isEmpty())
|
||||
host.log.info.println(((first)?"S":"Res") + "ending Local Template Metadata...");
|
||||
|
||||
ObjectMap<Integer> data = new ObjectMap<Integer>();
|
||||
ObjectMap<String> templates = new ObjectMap<String>();
|
||||
|
Loading…
Reference in New Issue
Block a user