Skip to content

Commit

Permalink
Add boolean to know if all items have been collected
Browse files Browse the repository at this point in the history
  • Loading branch information
FunixG committed Feb 13, 2025
1 parent 79f8442 commit 79acfcc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE job_player_task ADD COLUMN done_collecting_items BOOLEAN NOT NULL DEFAULT FALSE;

UPDATE job_player_task SET done_collecting_items = TRUE WHERE collected_task_items = 99999;
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public class JobPlayerTaskDTO extends JobPlayerEntityDTO {
@NotNull(message = "Le nombre d'items collectés est requis")
private Integer collectedTaskItems;

/**
* Indique si le joueur a fini de collecter les items
*/
@NotNull(message = "Le joueur a fini de collecter les items ou non")
private Boolean doneCollectingItems;

/**
* Le nom de la ressource à collecter, nom mojang
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public class JobPlayerTask extends JobPlayerEntity {
@Column(name = "collected_task_items", nullable = false)
private Integer collectedTaskItems;

/**
* Indique si le joueur a fini de collecter les items
*/
@Column(name = "done_collecting_items", nullable = false)
private Boolean doneCollectingItems;

/**
* Le nom de la ressource à collecter, nom mojang
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void testCrud() throws Exception {
jobPlayerTaskDTO.setAmountCollected(0);
jobPlayerTaskDTO.setCollectedTaskItems(0);
jobPlayerTaskDTO.setIsTaskCompleted(false);
jobPlayerTaskDTO.setDoneCollectingItems(false);
jobPlayerTaskDTO.setMaterialNameToCollect("materialNameToCollect");
jobPlayerTaskDTO.setPlayerUuid(UUID.randomUUID().toString());
jobPlayerTaskDTO.setGameMode(ServerGameMode.CREATIVE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private JobPlayerTaskDTO generateTask() {
jobPlayerTaskDTO.setPlayerUuid(UUID.randomUUID().toString());
jobPlayerTaskDTO.setGameMode(ServerGameMode.CREATIVE);
jobPlayerTaskDTO.setJobName("jobName");
jobPlayerTaskDTO.setDoneCollectingItems(false);

return jobPlayerTaskService.create(jobPlayerTaskDTO);
}
Expand Down

0 comments on commit 79acfcc

Please sign in to comment.