Fix permission requirement and API

This commit is contained in:
Daniel Saukel 2020-04-11 13:51:46 +02:00
parent 42cd5a1bf2
commit 2dbceef81a
2 changed files with 9 additions and 11 deletions

View File

@ -229,11 +229,8 @@ public class GameRule<V> {
try { try {
Constructor constructor = clss.getConstructor(DungeonsAPI.class); Constructor constructor = clss.getConstructor(DungeonsAPI.class);
if (constructor == null) { if (constructor == null) {
constructor = clss.getConstructor(); MessageUtil.log(api, "&4Requirement \"" + key + "\" is not implemented properly with a (DungeonsAPI) constructor.");
if (constructor == null) { continue;
MessageUtil.log(api, "&4Requirement \"" + key + "\" is not implemented properly with a (DungeonsAPI) constructor.");
continue;
}
} }
Requirement requirement = (Requirement) constructor.newInstance(api); Requirement requirement = (Requirement) constructor.newInstance(api);
requirement.setup(section); requirement.setup(section);
@ -271,11 +268,8 @@ public class GameRule<V> {
try { try {
Constructor constructor = clss.getConstructor(DungeonsAPI.class); Constructor constructor = clss.getConstructor(DungeonsAPI.class);
if (constructor == null) { if (constructor == null) {
constructor = clss.getConstructor(); MessageUtil.log(api, "&4Reward \"" + key + "\" is not implemented properly with a (DungeonsAPI) constructor.");
if (constructor == null) { continue;
MessageUtil.log(api, "&4Reward \"" + key + "\" is not implemented properly with a (DungeonsAPI) constructor.");
continue;
}
} }
Reward reward = (Reward) constructor.newInstance(api); Reward reward = (Reward) constructor.newInstance(api);
// reward.setup(); // reward.setup();

View File

@ -16,6 +16,7 @@
*/ */
package de.erethon.dungeonsxl.requirement; package de.erethon.dungeonsxl.requirement;
import de.erethon.dungeonsxl.api.DungeonsAPI;
import de.erethon.dungeonsxl.api.Requirement; import de.erethon.dungeonsxl.api.Requirement;
import de.erethon.dungeonsxl.config.DMessage; import de.erethon.dungeonsxl.config.DMessage;
import de.erethon.dungeonsxl.player.DPermission; import de.erethon.dungeonsxl.player.DPermission;
@ -34,6 +35,9 @@ public class PermissionRequirement implements Requirement {
private List<String> permissions = new ArrayList<>(); private List<String> permissions = new ArrayList<>();
public PermissionRequirement(DungeonsAPI api) {
}
/* Getters and setters */ /* Getters and setters */
/** /**
* @return the permission the player must have to play the dungeon * @return the permission the player must have to play the dungeon
@ -52,7 +56,7 @@ public class PermissionRequirement implements Requirement {
/* Actions */ /* Actions */
@Override @Override
public void setup(ConfigurationSection config) { public void setup(ConfigurationSection config) {
permissions = config.getStringList("permissions"); permissions = config.getStringList("permission");
} }
@Override @Override