Skip to content

Commit

Permalink
Create some challenges related events:
Browse files Browse the repository at this point in the history
- CompletedEvent: fires when challenge/level is competed
- ResetEvent: fires when challenge is reset
- ResetAllEvent: fires when all challenges data in world is reset
  • Loading branch information
BONNe committed Feb 22, 2019
1 parent 7bb2ad0 commit 60965eb
Show file tree
Hide file tree
Showing 4 changed files with 578 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
package world.bentobox.challenges.events;



import java.util.UUID;

import world.bentobox.bentobox.api.events.PremadeEvent;


/**
* This Event is fired when challenge is completed.
*/
public class ChallengeCompletedEvent extends PremadeEvent
{

/**
* Constructor creates a new ChallengeCompletedEvent instance.
*
* @param challengeID of type String
* @param playerUUID of type UUID
* @param admin of type boolean
* @param completionCount of type int
*/
public ChallengeCompletedEvent(
String challengeID,
UUID playerUUID,
boolean admin,
int completionCount)
{
this.challengeID = challengeID;
this.playerUUID = playerUUID;
this.admin = admin;
this.completionCount = completionCount;
}


// ---------------------------------------------------------------------
// Section: Getters and setters
// ---------------------------------------------------------------------


/**
* This method returns the challengeID value.
*
* @return the value of challengeID.
*/
public String getChallengeID()
{
return challengeID;
}


/**
* This method sets the challengeID value.
*
* @param challengeID the challengeID new value.
*/
public void setChallengeID(String challengeID)
{
this.challengeID = challengeID;
}


/**
* This method returns the playerUUID value.
*
* @return the value of playerUUID.
*/
public UUID getPlayerUUID()
{
return playerUUID;
}


/**
* This method sets the playerUUID value.
*
* @param playerUUID the playerUUID new value.
*/
public void setPlayerUUID(UUID playerUUID)
{
this.playerUUID = playerUUID;
}


/**
* This method returns the admin value.
*
* @return the value of admin.
*/
public boolean isAdmin()
{
return admin;
}


/**
* This method sets the admin value.
*
* @param admin the admin new value.
*/
public void setAdmin(boolean admin)
{
this.admin = admin;
}


/**
* This method returns the completionCount value.
*
* @return the value of completionCount.
*/
public int getCompletionCount()
{
return completionCount;
}


/**
* This method sets the completionCount value.
*
* @param completionCount the completionCount new value.
*/
public void setCompletionCount(int completionCount)
{
this.completionCount = completionCount;
}


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


/**
* Completed challenge ID
*/
private String challengeID;

/**
* User who completes challenge
*/
private UUID playerUUID;

/**
* Indicates if admin completes challenge
*/
private boolean admin;

/**
* Count of completions
*/
private int completionCount;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package world.bentobox.challenges.events;


import java.util.UUID;

import world.bentobox.bentobox.api.events.PremadeEvent;


/**
* This event is fired when all challenges in given world is reset.
*/
public class ChallengeResetAllEvent extends PremadeEvent
{
/**
* Constructor creates a new ChallengeResetAllEvent instance.
*
* @param worldName of type String
* @param playerUUID of type UUID
* @param admin of type boolean
* @param reason of type String
*/
public ChallengeResetAllEvent(
String worldName,
UUID playerUUID,
boolean admin,
String reason)
{
this.worldName = worldName;
this.playerUUID = playerUUID;
this.admin = admin;
this.reason = reason;
}


// ---------------------------------------------------------------------
// Section: Getters and setters
// ---------------------------------------------------------------------


/**
* This method returns the worldName value.
*
* @return the value of worldName.
*/
public String getWorldName()
{
return worldName;
}


/**
* This method sets the worldName value.
*
* @param worldName the worldName new value.
*/
public void setWorldName(String worldName)
{
this.worldName = worldName;
}


/**
* This method returns the playerUUID value.
*
* @return the value of playerUUID.
*/
public UUID getPlayerUUID()
{
return playerUUID;
}


/**
* This method sets the playerUUID value.
*
* @param playerUUID the playerUUID new value.
*/
public void setPlayerUUID(UUID playerUUID)
{
this.playerUUID = playerUUID;
}


/**
* This method returns the admin value.
*
* @return the value of admin.
*/
public boolean isAdmin()
{
return admin;
}


/**
* This method sets the admin value.
*
* @param admin the admin new value.
*/
public void setAdmin(boolean admin)
{
this.admin = admin;
}


/**
* This method returns the reason value.
*
* @return the value of reason.
*/
public String getReason()
{
return reason;
}


/**
* This method sets the reason value.
*
* @param reason the reason new value.
*/
public void setReason(String reason)
{
this.reason = reason;
}


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


/**
* World where challenges are reset
*/
private String worldName;

/**
* User who resets challenges
*/
private UUID playerUUID;

/**
* Indicates if admin resets challenges
*/
private boolean admin;

/**
* Reset Reason
*/
private String reason;
}

0 comments on commit 60965eb

Please sign in to comment.