-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create some challenges related events:
- 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
Showing
4 changed files
with
578 additions
and
0 deletions.
There are no files selected for viewing
154 changes: 154 additions & 0 deletions
154
src/main/java/world/bentobox/challenges/events/ChallengeCompletedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
152 changes: 152 additions & 0 deletions
152
src/main/java/world/bentobox/challenges/events/ChallengeResetAllEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.