mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Remove commands.yml
This commit is contained in:
parent
5004005c5a
commit
265c10ec1c
@ -154,12 +154,10 @@ public class PlotSquared {
|
||||
public File styleFile;
|
||||
public File configFile;
|
||||
public File worldsFile;
|
||||
public File commandsFile;
|
||||
public File translationFile;
|
||||
public YamlConfiguration style;
|
||||
public YamlConfiguration worlds;
|
||||
public YamlConfiguration storage;
|
||||
public YamlConfiguration commands;
|
||||
// Temporary hold the plots/clusters before the worlds load
|
||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
@ -1796,23 +1794,6 @@ public class PlotSquared {
|
||||
} catch (IOException ignored) {
|
||||
PlotSquared.log("Failed to save storage.yml");
|
||||
}
|
||||
try {
|
||||
this.commandsFile = new File(folder, "commands.yml");
|
||||
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
|
||||
PlotSquared.log(
|
||||
"Could not the storage settings file, please create \"commands.yml\" manually.");
|
||||
}
|
||||
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
||||
} catch (IOException ignored) {
|
||||
PlotSquared.log("Failed to save commands.yml");
|
||||
}
|
||||
try {
|
||||
this.style.save(this.styleFile);
|
||||
this.commands.save(this.commandsFile);
|
||||
} catch (IOException e) {
|
||||
PlotSquared.log("Configuration file saving failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.message.PlotMessage;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
@ -40,7 +38,6 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@ -190,36 +187,16 @@ public abstract class Command {
|
||||
this.permission = declaration.permission();
|
||||
this.required = declaration.requiredType();
|
||||
this.category = declaration.category();
|
||||
|
||||
List<String> aliasOptions = new ArrayList<>();
|
||||
aliasOptions.add(this.id);
|
||||
aliasOptions.addAll(Arrays.asList(declaration.aliases()));
|
||||
HashMap<String, Object> options = new HashMap<>();
|
||||
options.put("aliases", aliasOptions);
|
||||
options.put("description", declaration.description());
|
||||
options.put("usage", declaration.usage());
|
||||
options.put("confirmation", declaration.confirmation());
|
||||
boolean set = false;
|
||||
YamlConfiguration commands =
|
||||
PlotSquared.get() == null ? new YamlConfiguration() : PlotSquared.get().commands;
|
||||
for (Map.Entry<String, Object> entry : options.entrySet()) {
|
||||
String key = this.getFullId() + "." + entry.getKey();
|
||||
if (!commands.contains(key)) {
|
||||
commands.set(key, entry.getValue());
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
if (set && PlotSquared.get() != null) {
|
||||
try {
|
||||
commands.save(PlotSquared.get().commandsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
this.aliases = commands.getStringList(this.getFullId() + ".aliases");
|
||||
this.description = commands.getString(this.getFullId() + ".description");
|
||||
this.usage = commands.getString(this.getFullId() + ".usage");
|
||||
this.confirmation = commands.getBoolean(this.getFullId() + ".confirmation");
|
||||
this.aliases = aliasOptions;
|
||||
this.description = declaration.description();
|
||||
this.usage = declaration.usage();
|
||||
this.confirmation = declaration.confirmation();
|
||||
|
||||
if (this.parent != null) {
|
||||
this.parent.register(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user