Skip to content

Commit

Permalink
1.20.6 (#6)
Browse files Browse the repository at this point in the history
* Try a lot

* Fix 1.20.6 loading
  • Loading branch information
TylerS1066 authored Sep 7, 2024
1 parent 837df0e commit e16da67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
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

0 comments on commit e16da67

Please sign in to comment.