-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/staff-pin' into dev
- Loading branch information
Showing
31 changed files
with
1,241 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
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
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
24 changes: 24 additions & 0 deletions
24
...rc/main/java/com/nookure/staff/api/config/bukkit/partials/messages/PinMessagePartial.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,24 @@ | ||
package com.nookure.staff.api.config.bukkit.partials.messages; | ||
|
||
import org.spongepowered.configurate.objectmapping.ConfigSerializable; | ||
import org.spongepowered.configurate.objectmapping.meta.Setting; | ||
|
||
@ConfigSerializable | ||
public class PinMessagePartial { | ||
@Setting | ||
public final String thePinIsIncorrect = "<red>The PIN is incorrect."; | ||
@Setting | ||
public final String correctPin = "<green>The PIN is correct."; | ||
@Setting | ||
public final String pinSet = "<green>Your PIN has been set to {pin}."; | ||
@Setting | ||
public final String youMustHaveToSetAPin = """ | ||
{center}<bold>◆ <red>Nookure <white>Network</white> ◆</bold> | ||
{center}<gray>You <red>must</red> have to set a <red>PIN</red> before you can play on this server. | ||
{center}<gray>Use <red><u><click:run_command:'/setpin'>/setpin</click></u></red> to set a PIN. | ||
{center}<gray>You have {time} to set a PIN. | ||
"""; | ||
@Setting | ||
public final String pinTimeExpired = "<red>Your time to set a PIN has expired."; | ||
} |
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
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
65 changes: 65 additions & 0 deletions
65
NookureStaff-API/src/main/java/com/nookure/staff/api/model/PinModel.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,65 @@ | ||
package com.nookure.staff.api.model; | ||
|
||
import io.ebean.Model; | ||
import jakarta.persistence.*; | ||
|
||
import java.time.Instant; | ||
|
||
@Entity | ||
@Table(name = "nookure_staff_pin") | ||
public class PinModel extends Model { | ||
@Id | ||
Long id; | ||
@OneToOne | ||
PlayerModel player; | ||
@Column(nullable = false, length = 64) | ||
String pin; | ||
@Column(nullable = false) | ||
Instant lastLogin; | ||
@Column(nullable = false, length = 15) | ||
String ip; | ||
|
||
public PinModel() { | ||
super("nkstaff"); | ||
} | ||
|
||
public String ip() { | ||
return ip; | ||
} | ||
|
||
public PinModel setIp(String ip) { | ||
this.ip = ip; | ||
return this; | ||
} | ||
|
||
public String pin() { | ||
return pin; | ||
} | ||
|
||
public PinModel setPin(String pin) { | ||
this.pin = pin; | ||
return this; | ||
} | ||
|
||
public PlayerModel player() { | ||
return player; | ||
} | ||
|
||
public PinModel setPlayer(PlayerModel player) { | ||
this.player = player; | ||
return this; | ||
} | ||
|
||
public Long id() { | ||
return id; | ||
} | ||
|
||
public Instant lastLogin() { | ||
return lastLogin; | ||
} | ||
|
||
public PinModel setLastLogin(Instant lastLogin) { | ||
this.lastLogin = lastLogin; | ||
return this; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
NookureStaff-API/src/main/java/com/nookure/staff/api/service/PinUserService.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,47 @@ | ||
package com.nookure.staff.api.service; | ||
|
||
import com.nookure.staff.api.model.PlayerModel; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* This service is responsible for handling the pin user server. | ||
*/ | ||
public interface PinUserService { | ||
/** | ||
* Check if the pin is valid for the player. | ||
* | ||
* @param uuid the player to check | ||
* @param pin the pin to check | ||
* @return true if the pin is valid, false otherwise | ||
*/ | ||
boolean isValid(@NotNull UUID uuid, @NotNull String pin); | ||
|
||
/** | ||
* Check if the pin is valid for the player. | ||
* | ||
* @param player the player to check | ||
* @param pin the pin to check | ||
* @return true if the pin is valid, false otherwise | ||
*/ | ||
boolean isValid(@NotNull PlayerModel player, @NotNull String pin); | ||
|
||
/** | ||
* Set the pin for the player. | ||
* | ||
* @param player the player to set the pin | ||
* @param pin the pin to set | ||
*/ | ||
void setPin(@NotNull PlayerModel player, @NotNull String pin); | ||
|
||
/** | ||
* Check if the player has a pin set. | ||
* | ||
* @param player the player to check | ||
* @return true if the player has a pin set, false otherwise | ||
*/ | ||
boolean isPinSet(@NotNull PlayerModel player); | ||
|
||
void updateIp(@NotNull PlayerModel player); | ||
} |
Oops, something went wrong.