mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-06-26 14:45:10 +02:00
* Fix issue when users could not select non-block items as icons for challenges and levels. (#190) * English update (#193) * Organized imports * Minor code cleanup * Updated English locale file. * Translate zh-CN.yml via GitLocalize (#188) * Make default translation looking a bit nicer (#192) * Make default translation looking a bit nicer * Updating a few friendly names and rewording some phrases * Add generic .gitignore * Fix novice level Update `chiseledmaker` name in `novice` level. * Adapt literal style (#197) Improve translations and process as a YAML string. * Test coverage (#199) * Test coverage for Challenges Command * Added CompleteChallengeCommand test class * Added Utils test class * Added ChallengesGUI test class * Fix code smells from sonarcloud analysis * Added .gitignore * Added Travis CI config file * WIP ChallengesManager Test class * Added ChallengesManager test class * Removed debug * Removed code smells. * Added ChallengesAddon test class. * Added onDisbale test * Added new TryToComplete test class - WIP Covers inventory challenges. * Added Island Challenge entity tests to TryToComplete test class * Fix a bug with challenge deletion. If challenge has been left in a level, then system did not remove challenge from it and was kept as ghost challenge, preventing from completing level. * Fixes tests * Updated travis.yml * All strings to spanish (#200) * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Translate es.yml via GitLocalize * Fix LevelListRequestHandler. This handler did not return list of strings but list of challenge levels, that is incorrect. Not it should work correctly. * Create ro.yml * Create id.yml * Remove blanks files now that GitLocalize is fixed. * Initial Russian translation (#207) * Translate ru.yml via GitLocalize Co-authored-by: @mt-gitlocalize @IPeredero @LoveBiscuit * Changed build character from # to b * Add German translation (#210) * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize * Translate de.yml via GitLocalize Co-authored-by: xXjojojXx <36734820+xXjojojXx@users.noreply.github.com> Co-authored-by: FunnysBanana <51290016+FunnysBanana@users.noreply.github.com> Co-authored-by: mt-gitlocalize <mt@gitlocalize.com> * Czech translation. Credit @Polda18 * Added a uniqueId sanitization when creating challenges/levels This will help fixing issues with spaces, hyphens and accents in non-English languages. * Fixes bug with checking entities in nether and end (#219) https://github.com/BentoBoxWorld/Challenges/issues/218 Adds test case to check for compliance. * Add 7 new placeholders for Challenges Addon. - `[gamemode]_challenge_total_completion_count` returns number of sum of challenge completions for user. - `[gamemode]_challenge_completed_count` returns number of completed challenges (at least once) for user. - `[gamemode]_challenge_uncompleted_count` returns number of uncompleted challenges for user. - `[gamemode]_challenge_completed_level_count` returns number of completed levels for user. - `[gamemode]_challenge_uncompleted_level_count` returns number of uncompleted levels for user. - `[gamemode]_challenge_unlocked_level_count` returns number of unlocked levels for user. - `[gamemode]_challenge_locked_level_count` returns number of locked levels for user. Fixes #224 * Add 2 new placeholders: - `[gamemode]_challenge_latest_level_name` returns latest unlocked challenge level name - `[gamemode]_challenge_latest_level_id` returns latest unlocked challenge level id Fixes #226 * Fix broken tests due to placeholder additions.b5ecffb725
2958ca8b6c
* Added default perms for aoneblock * Downgrade to 0.8.1 version * Add option to quit from conversation by writing "cancel" in chat. Move sanitizeInput to a GuiUtil class. * Change latest version to 0.8.1
210 lines
5.1 KiB
Java
210 lines
5.1 KiB
Java
//
|
|
// Created by BONNe
|
|
// Copyright - 2019
|
|
//
|
|
|
|
|
|
package world.bentobox.challenges.database.object.requirements;
|
|
|
|
|
|
import java.util.EnumMap;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Map;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import com.google.gson.annotations.Expose;
|
|
|
|
|
|
/**
|
|
* This class contains all necessary requirements to complete island type challenge.
|
|
*/
|
|
public class IslandRequirements extends Requirements
|
|
{
|
|
/**
|
|
* Constructor Requirements creates a new Requirements instance.
|
|
*/
|
|
public IslandRequirements()
|
|
{
|
|
// Empty constructor for data loader
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
// Section: Getters and Setters
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#getRequiredBlocks returns the requiredBlocks of this object.
|
|
*
|
|
* @return the requiredBlocks (type Map<Material, Integer>) of this object.
|
|
*/
|
|
public Map<Material, Integer> getRequiredBlocks()
|
|
{
|
|
return requiredBlocks;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#setRequiredBlocks sets new value for the requiredBlocks of this object.
|
|
* @param requiredBlocks new value for this object.
|
|
*
|
|
*/
|
|
public void setRequiredBlocks(Map<Material, Integer> requiredBlocks)
|
|
{
|
|
this.requiredBlocks = requiredBlocks;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#isRemoveBlocks returns the removeBlocks of this object.
|
|
*
|
|
* @return the removeBlocks (type boolean) of this object.
|
|
*/
|
|
public boolean isRemoveBlocks()
|
|
{
|
|
return removeBlocks;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#setRemoveBlocks sets new value for the removeBlocks of this object.
|
|
* @param removeBlocks new value for this object.
|
|
*
|
|
*/
|
|
public void setRemoveBlocks(boolean removeBlocks)
|
|
{
|
|
this.removeBlocks = removeBlocks;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#getRequiredEntities returns the requiredEntities of this object.
|
|
*
|
|
* @return the requiredEntities (type Map<EntityType, Integer>) of this object.
|
|
*/
|
|
public Map<EntityType, Integer> getRequiredEntities()
|
|
{
|
|
return requiredEntities;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#setRequiredEntities sets new value for the requiredEntities of this object.
|
|
* @param requiredEntities new value for this object.
|
|
*
|
|
*/
|
|
public void setRequiredEntities(Map<EntityType, Integer> requiredEntities)
|
|
{
|
|
this.requiredEntities = requiredEntities;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#isRemoveEntities returns the removeEntities of this object.
|
|
*
|
|
* @return the removeEntities (type boolean) of this object.
|
|
*/
|
|
public boolean isRemoveEntities()
|
|
{
|
|
return removeEntities;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#setRemoveEntities sets new value for the removeEntities of this object.
|
|
* @param removeEntities new value for this object.
|
|
*
|
|
*/
|
|
public void setRemoveEntities(boolean removeEntities)
|
|
{
|
|
this.removeEntities = removeEntities;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#getSearchRadius returns the searchRadius of this object.
|
|
*
|
|
* @return the searchRadius (type int) of this object.
|
|
*/
|
|
public int getSearchRadius()
|
|
{
|
|
return searchRadius;
|
|
}
|
|
|
|
|
|
/**
|
|
* Method IslandRequirements#setSearchRadius sets new value for the searchRadius of this object.
|
|
* @param searchRadius new value for this object.
|
|
*
|
|
*/
|
|
public void setSearchRadius(int searchRadius)
|
|
{
|
|
this.searchRadius = searchRadius;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
// Section: Other methods
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
/**
|
|
* Method Requirements#clone allows to clone Requirements object, to avoid changing content when it is necessary
|
|
* to use it.
|
|
* @return IslandRequirements clone
|
|
*/
|
|
@Override
|
|
public Requirements clone()
|
|
{
|
|
IslandRequirements clone = new IslandRequirements();
|
|
clone.setRequiredPermissions(new HashSet<>(this.getRequiredPermissions()));
|
|
|
|
clone.setRequiredBlocks(new HashMap<>(this.requiredBlocks));
|
|
clone.setRemoveBlocks(this.removeBlocks);
|
|
clone.setRequiredEntities(new HashMap<>(this.requiredEntities));
|
|
clone.setRemoveEntities(this.removeEntities);
|
|
|
|
clone.setSearchRadius(this.searchRadius);
|
|
|
|
return clone;
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
// Section: Variables
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
/**
|
|
* Map that contains which materials and how many is necessary around player to complete challenge.
|
|
*/
|
|
@Expose
|
|
private Map<Material, Integer> requiredBlocks = new EnumMap<>(Material.class);
|
|
|
|
/**
|
|
* Boolean that indicate if blocks should be removed from world after completion.
|
|
*/
|
|
@Expose
|
|
private boolean removeBlocks;
|
|
|
|
/**
|
|
* Map that contains which entities and how many is necessary around player to complete challenge.
|
|
*/
|
|
@Expose
|
|
private Map<EntityType, Integer> requiredEntities = new EnumMap<>(EntityType.class);
|
|
|
|
/**
|
|
* Boolean that indicate if entities should be removed from world after completion.
|
|
*/
|
|
@Expose
|
|
private boolean removeEntities;
|
|
|
|
/**
|
|
* Radius for searching distance for blocks and entities.
|
|
*/
|
|
@Expose
|
|
private int searchRadius = 10;
|
|
}
|