Skip to content

Commit

Permalink
4.91 bug solve: marks in non-vanilla worlds used to cause exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyinqiu committed Jul 23, 2021
1 parent b8e11e2 commit 2081593
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion NWorldPermissions/res/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: NWorldPermissions
description: A strange power stopping players being teleported to a world.
website: https://github.com/yueyinqiu/NWorldPermissions/wiki

version: '4.90'
version: '4.91'
author: yueyinqiu5990
main: top.nololiyt.worldpermissions.RootPlugin
softdepend: [PlaceholderAPI,MarksAPI]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,31 @@ protected RootPlugin getRootPlugin()
ConfigurationManager(RootPlugin rootPlugin)
{
this.rootPlugin = rootPlugin;
reload();
createIfNotExist();
}

public void reload()
private File createIfNotExist()
{
File file = new File(rootPlugin.getDataFolder().getAbsolutePath(), getFileName());
if (!file.exists())
rootPlugin.saveResource(getFileName(), false);
configuration = YamlConfiguration.loadConfiguration(file);
return file;
}


private YamlConfiguration configuration;
public void reload()
{
File file = createIfNotExist();
configuration = YamlConfiguration.loadConfiguration(file);
}

protected YamlConfiguration getConfiguration()
{
if(configuration == null)
reload();
return configuration;
}

protected void saveConfiguration() throws IOException
{
configuration.save(new File(
Expand Down

0 comments on commit 2081593

Please sign in to comment.