Renamed to bentobox.

Fixed error if level is not enough.
This commit is contained in:
tastybento 2018-08-03 23:54:36 -07:00
parent 303d9a95dc
commit c7b4a1ac06
34 changed files with 98 additions and 89 deletions

View File

@ -1,5 +1,5 @@
name: BSkyBlock-Challenges
main: bskyblock.addon.challenges.ChallengesAddon
name: BentoBox-Challenges
main: bentobox.addon.challenges.ChallengesAddon
version: 0.1
authors: tastybento

View File

@ -36,7 +36,7 @@ challenges:
challange-completed: "Challenge: [challengename] has been completed for [name]"
error:
could-not-save: "&cCould not save the challenge!"
island-level: "&cYour island must be level [level] to complete this challenge!"
island-level: "&cYour island must be level [number] to complete this challenge!"
items-not-there: "&cAll required items must be close to you on your island!"
no-items-clicked: "&cYou did not click on anything. Cancelling."
not-close-enough: "&cYou must be standing within [number] blocks of all required items."

View File

@ -1,9 +1,9 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import org.bukkit.Bukkit;
import bskyblock.addon.challenges.commands.ChallengesCommand;
import bskyblock.addon.challenges.commands.admin.ChallengesAdminImportCommand;
import bentobox.addon.challenges.commands.ChallengesCommand;
import bentobox.addon.challenges.commands.admin.ChallengesAdminImportCommand;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
@ -22,7 +22,7 @@ public class ChallengesAddon extends Addon {
public void onEnable() {
// Check if it is enabled - it might be loaded, but not enabled.
if (getPlugin() == null || !getPlugin().isEnabled()) {
Bukkit.getLogger().severe("BSkyBlock is not available or disabled!");
Bukkit.getLogger().severe("BentoBox is not available or disabled!");
this.setEnabled(false);
return;
}

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import java.util.ArrayList;
import java.util.Arrays;
@ -20,12 +20,12 @@ import org.bukkit.World;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.commands.admin.SurroundChallengeBuilder;
import bskyblock.addon.challenges.database.object.ChallengeLevels;
import bskyblock.addon.challenges.database.object.Challenges;
import bskyblock.addon.challenges.database.object.Challenges.ChallengeType;
import bskyblock.addon.challenges.database.object.PlayerData;
import bskyblock.addon.challenges.panel.ChallengesPanels;
import bentobox.addon.challenges.commands.admin.SurroundChallengeBuilder;
import bentobox.addon.challenges.database.object.ChallengeLevels;
import bentobox.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.database.object.PlayerData;
import bentobox.addon.challenges.database.object.Challenges.ChallengeType;
import bentobox.addon.challenges.panel.ChallengesPanels;
import world.bentobox.bentobox.api.configuration.BSBConfig;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.BSBDatabase;

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import java.io.File;
import java.io.IOException;
@ -16,8 +16,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.database.object.ChallengeLevels;
import bskyblock.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.database.object.ChallengeLevels;
import bentobox.addon.challenges.database.object.Challenges;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;

View File

@ -1,6 +1,6 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import bskyblock.addon.challenges.database.object.ChallengeLevels;
import bentobox.addon.challenges.database.object.ChallengeLevels;
/**
* Level status class

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

View File

@ -1,9 +1,9 @@
package bskyblock.addon.challenges.commands;
package bentobox.addon.challenges.commands;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bskyblock.addon.challenges.panel.ChallengesPanels;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.panel.ChallengesPanels;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,10 +1,10 @@
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;

View File

@ -1,9 +1,9 @@
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bskyblock.addon.challenges.panel.CreateChallengeListener;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.panel.CreateChallengeListener;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.HashMap;
import java.util.List;
@ -16,7 +16,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,14 +1,14 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.ChallengesAddon;
import bskyblock.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.database.object.Challenges;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.EnumMap;
import java.util.Map;
@ -6,7 +6,7 @@ import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.user.User;
/**

View File

@ -1,11 +1,11 @@
/**
*
*/
package bskyblock.addon.challenges.commands.admin;
package bentobox.addon.challenges.commands.admin;
import java.util.List;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,11 +1,11 @@
package bskyblock.addon.challenges.database.object;
package bentobox.addon.challenges.database.object;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.ChallengesManager;
import bentobox.addon.challenges.ChallengesManager;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.database.objects.DataObject;

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges.database.object;
package bentobox.addon.challenges.database.object;
import java.util.ArrayList;
import java.util.EnumMap;
@ -12,7 +12,7 @@ import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.ChallengesManager;
import bentobox.addon.challenges.ChallengesManager;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.database.objects.DataObject;

View File

@ -1,7 +1,7 @@
/**
*
*/
package bskyblock.addon.challenges.database.object;
package bentobox.addon.challenges.database.object;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges.panel;
package bentobox.addon.challenges.panel;
import java.util.ArrayList;
import java.util.Collection;
@ -9,12 +9,12 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
import bskyblock.addon.challenges.ChallengesAddon;
import bskyblock.addon.challenges.ChallengesManager;
import bskyblock.addon.challenges.LevelStatus;
import bskyblock.addon.challenges.commands.ChallengesCommand;
import bskyblock.addon.challenges.database.object.Challenges;
import bskyblock.addon.challenges.database.object.Challenges.ChallengeType;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesManager;
import bentobox.addon.challenges.LevelStatus;
import bentobox.addon.challenges.commands.ChallengesCommand;
import bentobox.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.database.object.Challenges.ChallengeType;
import world.bentobox.bentobox.api.panels.Panel;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;

View File

@ -1,9 +1,9 @@
package bskyblock.addon.challenges.panel;
package bentobox.addon.challenges.panel;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.panels.PanelListener;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,6 +1,6 @@
package bskyblock.addon.challenges.panel;
package bentobox.addon.challenges.panel;
import bskyblock.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesAddon;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.user.User;

View File

@ -1,7 +1,7 @@
/**
*
*/
package bskyblock.addon.challenges.panel;
package bentobox.addon.challenges.panel;
import java.util.ArrayList;
import java.util.EnumMap;
@ -14,12 +14,13 @@ import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import bskyblock.addon.challenges.ChallengesAddon;
import bskyblock.addon.challenges.ChallengesManager;
import bskyblock.addon.challenges.commands.ChallengesCommand;
import bskyblock.addon.challenges.database.object.Challenges;
import bskyblock.addon.challenges.database.object.Challenges.ChallengeType;
import bskyblock.addon.level.Level;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ChallengesManager;
import bentobox.addon.challenges.commands.ChallengesCommand;
import bentobox.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.database.object.Challenges.ChallengeType;
import bentobox.addon.level.Level;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
@ -143,9 +144,14 @@ public class TryToComplete {
private ChallengeResult checkLevel() {
// Check if the level addon is installed or not
return addon.getAddonByName("BSkyBlock-Level")
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId()) >= challenge.getReqIslandlevel() ? new ChallengeResult().setMeetsRequirements() : new ChallengeResult()
).orElse(new ChallengeResult());
long level = addon.getAddonByName("BentoBox-Level")
.map(l -> ((Level)l).getIslandLevel(world, user.getUniqueId())).orElse(0L);
if (level >= challenge.getReqIslandlevel()) {
return new ChallengeResult().setMeetsRequirements();
} else {
user.sendMessage("challenges.error.island-level", TextVariables.NUMBER, String.valueOf(level));
return new ChallengeResult();
}
}
private ChallengeResult checkSurrounding() {

View File

@ -1,7 +1,7 @@
/**
*
*/
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
@ -35,8 +35,8 @@ import org.powermock.modules.junit4.PowerMockRunner;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import bskyblock.addon.challenges.database.object.Challenges;
import bskyblock.addon.challenges.database.object.Challenges.ChallengeType;
import bentobox.addon.challenges.database.object.Challenges;
import bentobox.addon.challenges.database.object.Challenges.ChallengeType;
/**
* @author tastybento

View File

@ -1,4 +1,4 @@
package bskyblock.addon.challenges;
package bentobox.addon.challenges;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ -23,6 +23,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
import bentobox.addon.challenges.ChallengesAddon;
import bentobox.addon.challenges.ParseItem;
@RunWith(PowerMockRunner.class)
public class ParseItemTest {