Changes to fit new API for database transition.

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-07 21:48:49 -07:00
parent c8088f275d
commit cd2a1826d9
3 changed files with 572 additions and 591 deletions

View File

@ -36,7 +36,7 @@
<powermock.version>1.7.4</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.4.0</bentobox.version>
<bentobox.version>1.5.0-SNAPSHOT</bentobox.version>
<level.version>1.3.0</level.version>
<vault.version>68f14ec</vault.version>
<!-- Revision variable removes warning about dynamic version -->

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);
}