mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
Adjust schema, fix commands and user data refactoring
This commit is contained in:
1 parent
ec1c0b744f
commit
ff2465ac85
12 files changed
+120
-105
No files matched your search
@@ -5,40 +5,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Extension of a {@link User} that contains persistently-stored additional user data
|
||||
* (home slots, teleport ignoring status & rtp cooldown)
|
||||
* Represents data about a player on the server
|
||||
*/
|
||||
public class UserData extends User {
|
||||
public record UserData(@NotNull User user, int homeSlots, boolean ignoringTeleports, long rtpCooldown) {
|
||||
|
||||
/**
|
||||
* The number of slots this user has consumed (bought) in total, used for economy checks
|
||||
*/
|
||||
public int homeSlots;
|
||||
|
||||
/**
|
||||
* Whether this user is ignoring incoming /tpa and /tpahere requests
|
||||
*/
|
||||
public boolean isIgnoringTeleports;
|
||||
|
||||
/**
|
||||
* A timestamp indicating when the user can use the /rtp command next
|
||||
*/
|
||||
public long rtpCooldown;
|
||||
|
||||
public UserData(@NotNull UUID uuid, @NotNull String username,
|
||||
int homeSlots, boolean isIgnoringTeleports, long rtpCooldown) {
|
||||
super(uuid, username);
|
||||
this.homeSlots = homeSlots;
|
||||
this.isIgnoringTeleports = isIgnoringTeleports;
|
||||
this.rtpCooldown = rtpCooldown;
|
||||
@NotNull
|
||||
public UUID getUserUuid() {
|
||||
return user.uuid;
|
||||
}
|
||||
|
||||
public UserData(@NotNull User user,
|
||||
int homeSlots, boolean isIgnoringTeleports, long rtpCooldown) {
|
||||
super(user.uuid, user.username);
|
||||
this.homeSlots = homeSlots;
|
||||
this.isIgnoringTeleports = isIgnoringTeleports;
|
||||
this.rtpCooldown = rtpCooldown;
|
||||
public String getUsername() {
|
||||
return user.username;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user