Changes to fit new API for database transition. (#114)

Config files must implement the ConfigObject interface now instead of
DataObject. They no longer need to specify uniqueId.
This commit is contained in:
tastybento 2019-05-09 06:24:01 -07:00 committed by BONNe
parent ff6e28b27e
commit a25796613f
2 changed files with 571 additions and 590 deletions

View File

@ -1,15 +1,16 @@
package world.bentobox.challenges;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
import world.bentobox.bentobox.api.configuration.ConfigObject;
import world.bentobox.bentobox.api.configuration.StoreAt;
import world.bentobox.bentobox.database.objects.DataObject;
@StoreAt(filename="config.yml", path="addons/Challenges")
@ -18,7 +19,7 @@ import world.bentobox.bentobox.database.objects.DataObject;
@ConfigComment("You cannot edit it while the server is running because changes will")
@ConfigComment("be lost! Use in-game settings GUI or edit when server is offline.")
@ConfigComment("")
public class Settings implements DataObject
public class Settings implements ConfigObject
{
@ConfigComment("")
@ConfigComment("Allows to define common challenges command that will open User GUI")
@ -162,12 +163,6 @@ public class Settings implements DataObject
@ConfigEntry(path = "disabled-gamemodes")
private Set<String> disabledGameModes = new HashSet<>();
/**
* Default variable.
*/
@ConfigComment("")
private String uniqueId = "config";
/**
* Configuration version
*/
@ -200,13 +195,6 @@ public class Settings implements DataObject
}
@Override
public String getUniqueId()
{
return this.uniqueId;
}
/**
* @return resetChallenges value.
*/
@ -434,13 +422,6 @@ public class Settings implements DataObject
}
@Override
public void setUniqueId(String uniqueId)
{
this.uniqueId = uniqueId;
}
/**
* This method sets the challengeLoreMessage object value.
* @param challengeLoreMessage the challengeLoreMessage object new value.

View File

@ -311,7 +311,7 @@ public class Challenge implements DataObject
*/
public ItemStack getIcon()
{
return icon.clone();
return icon !=null ? icon.clone() : new ItemStack(Material.PAPER);
}