Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.6 #6

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,17 @@ public void onEnable() {
Settings.FAWE = false;
}

final Map data;
String schemDirName;
try {
File weConfig = new File(getWorldEditPlugin().getDataFolder(), (Settings.FAWE ? "worldedit-" : "") + "config" + ".yml");
Yaml yaml = new Yaml();
data = yaml.load(new FileInputStream(weConfig));
} catch (IOException e){
getLogger().severe(I18nSupport.getInternationalisedString("Startup - Error reading WE config"));
// Try loading from API
schemDirName = worldEditPlugin.getLocalConfiguration().saveDir;
} catch (Exception e) {
e.printStackTrace();
getLogger().severe(I18nSupport.getInternationalisedString("Startup - Error reading WE config"));
getServer().getPluginManager().disablePlugin(this);
return;
}

File schemDir = new File(worldEditPlugin.getDataFolder(), (String) ((Map) data.get("saving")).get("dir"));
File schemDir = new File(worldEditPlugin.getDataFolder(), schemDirName);
worldEditHandler = new WorldEditHandler(schemDir, this);

boolean foundRegionProvider = false;
Expand Down Expand Up @@ -135,7 +133,7 @@ public void onEnable() {
getLogger().info(I18nSupport.getInternationalisedString("Startup - Restrict to regions set to false"));
}

getCommand("structurebox").setExecutor(new StructureBoxCommand());
getCommand("structurebox").setExecutor(new StructureBoxCommand(schemDirName));

getServer().getPluginManager().registerEvents(new BlockListener(), this);
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

public class StructureBoxCommand implements TabExecutor {
private final String schematicDir;
public StructureBoxCommand(){
schematicDir = StructureBoxes.getInstance().getWorldEditPlugin().getConfig().getConfigurationSection("saving").getString("dir");
public StructureBoxCommand(String schematicDirName) {
schematicDir = schematicDirName;
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
Expand Down