Skip to content

Commit

Permalink
Fixes JavaDoc warnings. (#164)
Browse files Browse the repository at this point in the history
@inheritdoc cannot be used on Constructors.

Fixed some other warnings.
  • Loading branch information
tastybento authored and BONNe committed Aug 5, 2019
1 parent 76fb30b commit a50d00b
Show file tree
Hide file tree
Showing 14 changed files with 4,933 additions and 4,873 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
public class ChallengeDataRequestHandler extends AddonRequestHandler
{

/**
* Constructor creates a new ChallengesDataRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public ChallengeDataRequestHandler(ChallengesAddon addon)
{
super("challenge-data");
this.addon = addon;
}


/**
* @param metaData Required meta data.
* @return Map that returns information about challenges
* @see AddonRequestHandler#handle(Map<String, Object>)
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
/**
* Constructor creates a new ChallengesDataRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public ChallengeDataRequestHandler(ChallengesAddon addon)
{
super("challenge-data");
this.addon = addon;
}


/* (non-Javadoc)
* @param metaData Required meta data.
* @return Map that returns information about challenges
* @see world.bentobox.bentobox.api.addons.request.AddonRequestHandler#handle(java.util.Map)
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
What we need in the metaData:
0. "challenge-name" -> String
What we will return:
Expand All @@ -56,51 +56,51 @@ public Object handle(Map<String, Object> metaData)
- maxTimes: Integer object that represents how many times challenge can be completed.
*/

if (metaData == null ||
metaData.isEmpty() ||
metaData.get("challenge-name") == null ||
!(metaData.get("challenge-name") instanceof String))
{
return Collections.emptyMap();
}
if (metaData == null ||
metaData.isEmpty() ||
metaData.get("challenge-name") == null ||
!(metaData.get("challenge-name") instanceof String))
{
return Collections.emptyMap();
}

Challenge challenge = this.addon.getChallengesManager().getChallenge((String) metaData.get("challenge-name"));
Challenge challenge = this.addon.getChallengesManager().getChallenge((String) metaData.get("challenge-name"));

Map<String, Object> challengeDataMap;
Map<String, Object> challengeDataMap;

if (challenge == null)
{
challengeDataMap = Collections.emptyMap();
}
else
{
challengeDataMap = new HashMap<>();
if (challenge == null)
{
challengeDataMap = Collections.emptyMap();
}
else
{
challengeDataMap = new HashMap<>();

challengeDataMap.put("uniqueId", challenge.getUniqueId());
challengeDataMap.put("name", challenge.getFriendlyName());
challengeDataMap.put("icon", challenge.getIcon());
challengeDataMap.put("levelId", challenge.getLevel());
challengeDataMap.put("order", challenge.getOrder());
challengeDataMap.put("deployed", challenge.isDeployed());
challengeDataMap.put("description", challenge.getDescription());
challengeDataMap.put("type", challenge.getChallengeType().toString());
challengeDataMap.put("uniqueId", challenge.getUniqueId());
challengeDataMap.put("name", challenge.getFriendlyName());
challengeDataMap.put("icon", challenge.getIcon());
challengeDataMap.put("levelId", challenge.getLevel());
challengeDataMap.put("order", challenge.getOrder());
challengeDataMap.put("deployed", challenge.isDeployed());
challengeDataMap.put("description", challenge.getDescription());
challengeDataMap.put("type", challenge.getChallengeType().toString());

challengeDataMap.put("repeatable", challenge.isRepeatable());
challengeDataMap.put("maxTimes", challenge.isRepeatable() ? challenge.getMaxTimes() : 1);
challengeDataMap.put("repeatable", challenge.isRepeatable());
challengeDataMap.put("maxTimes", challenge.isRepeatable() ? challenge.getMaxTimes() : 1);

}
}

return challengeDataMap;
}
return challengeDataMap;
}


// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------


/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,53 @@
*/
public class ChallengeListRequestHandler extends AddonRequestHandler
{
/**
* Constructor creates a new CompletedChallengesRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public ChallengeListRequestHandler(ChallengesAddon addon)
{
super("challenge-list");
this.addon = addon;
}
/**
* Constructor creates a new CompletedChallengesRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public ChallengeListRequestHandler(ChallengesAddon addon)
{
super("challenge-list");
this.addon = addon;
}


/**
* @param metaData Required meta data.
* @return Set of strings that contains completed challenges.
* @see AddonRequestHandler#handle(Map <String, Object>)
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
/* (non-Javadoc)
* @see world.bentobox.bentobox.api.addons.request.AddonRequestHandler#handle(java.util.Map)
* @param metaData Required meta data.
* @return Set of strings that contains completed challenges.
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
What we need in the metaData:
0. "world-name" -> String
What we will return:
- List of challenges in given world.
*/

if (metaData == null ||
metaData.isEmpty() ||
metaData.get("world-name") == null ||
!(metaData.get("world-name") instanceof String) ||
Bukkit.getWorld((String) metaData.get("world-name")) == null)
{
return Collections.emptyList();
}
if (metaData == null ||
metaData.isEmpty() ||
metaData.get("world-name") == null ||
!(metaData.get("world-name") instanceof String) ||
Bukkit.getWorld((String) metaData.get("world-name")) == null)
{
return Collections.emptyList();
}

return this.addon.getChallengesManager().getAllChallengesNames(Bukkit.getWorld((String) metaData.get("world-name")));
}
return this.addon.getChallengesManager().getAllChallengesNames(Bukkit.getWorld((String) metaData.get("world-name")));
}


// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------


/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
public class CompletedChallengesRequestHandler extends AddonRequestHandler
{

/**
* Constructor creates a new CompletedChallengesRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public CompletedChallengesRequestHandler(ChallengesAddon addon)
{
super("completed-challenges");
this.addon = addon;
}


/**
* @param metaData Required meta data.
* @return Set of strings that contains completed challenges.
* @see AddonRequestHandler#handle(Map<String, Object>)
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
/**
* Constructor creates a new CompletedChallengesRequestHandler instance.
*
* @param addon of type ChallengesAddon
*/
public CompletedChallengesRequestHandler(ChallengesAddon addon)
{
super("completed-challenges");
this.addon = addon;
}


/* (non-Javadoc)
* @see world.bentobox.bentobox.api.addons.request.AddonRequestHandler#handle(java.util.Map)
* @param metaData Required meta data.
* @return Set of strings that contains completed challenges.
*/
@Override
public Object handle(Map<String, Object> metaData)
{
/*
What we need in the metaData:
0. "player" -> UUID
1. "world-name" -> String
Expand All @@ -46,35 +46,35 @@ public Object handle(Map<String, Object> metaData)
- Set of completed challenges in given world (or empty list if user haven't completed any challenge)
*/

if (metaData == null ||
metaData.isEmpty() ||
metaData.get("world-name") == null ||
!(metaData.get("world-name") instanceof String) ||
metaData.get("player") == null ||
!(metaData.get("player") instanceof UUID) ||
Bukkit.getWorld((String) metaData.get("world-name")) == null)
{
return Collections.emptySet();
}
if (metaData == null ||
metaData.isEmpty() ||
metaData.get("world-name") == null ||
!(metaData.get("world-name") instanceof String) ||
metaData.get("player") == null ||
!(metaData.get("player") instanceof UUID) ||
Bukkit.getWorld((String) metaData.get("world-name")) == null)
{
return Collections.emptySet();
}

World world = Bukkit.getWorld((String) metaData.get("world-name"));
UUID player = (UUID) metaData.get("player");
World world = Bukkit.getWorld((String) metaData.get("world-name"));
UUID player = (UUID) metaData.get("player");

ChallengesManager manager = this.addon.getChallengesManager();
ChallengesManager manager = this.addon.getChallengesManager();

return manager.getAllChallengesNames(world).stream().
filter(challenge -> manager.isChallengeComplete(player, world, challenge)).
collect(Collectors.toSet());
}
return manager.getAllChallengesNames(world).stream().
filter(challenge -> manager.isChallengeComplete(player, world, challenge)).
collect(Collectors.toSet());
}


// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------


/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
/**
* Variable stores challenges addon.
*/
private ChallengesAddon addon;
}

0 comments on commit a50d00b

Please sign in to comment.