-
-
Notifications
You must be signed in to change notification settings - Fork 20
GH-971 Jail system refactor #1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
4a1734c
ad0b8c2
656b7be
5bf5d52
526e344
67c0735
ef0a5cb
c3bb59a
d640f4c
e09ca18
6c38f6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.eternalcode.core.feature.jail; | ||
|
||
import org.bukkit.Location; | ||
|
||
import java.time.Duration; | ||
import java.time.Instant; | ||
import java.util.UUID; | ||
|
@@ -10,12 +12,14 @@ public class JailedPlayer { | |
private final Instant detainedAt; | ||
private final Duration prisonTime; | ||
private final String detainedBy; | ||
private final Location lastLocation; | ||
|
||
|
||
public JailedPlayer(UUID player, Instant detainedAt, Duration prisonTime, String lockedUpBy) { | ||
public JailedPlayer(UUID player, Instant detainedAt, Duration prisonTime, String detainedBy, Location lastLocation) { | ||
this.player = player; | ||
this.detainedAt = detainedAt; | ||
this.prisonTime = prisonTime; | ||
this.detainedBy = lockedUpBy; | ||
this.detainedBy = detainedBy; | ||
this.lastLocation = lastLocation; | ||
} | ||
|
||
public UUID getPlayerUniqueId() { | ||
|
@@ -34,6 +38,10 @@ public Duration getPrisonTime() { | |
return this.prisonTime; | ||
} | ||
|
||
public Location getLastLocation() { | ||
return this.lastLocation; | ||
} | ||
|
||
public boolean isPrisonExpired() { | ||
return this.detainedAt.plus(this.prisonTime).isBefore(Instant.now()); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.eternalcode.core.configuration.migrations; | ||
|
||
import static eu.okaeri.configs.migrate.ConfigMigrationDsl.move; | ||
import eu.okaeri.configs.migrate.builtin.NamedMigration; | ||
|
||
class Migration_0009_Rename_allowed_to_restricted_jail_commands extends NamedMigration { | ||
|
||
Migration_0009_Rename_allowed_to_restricted_jail_commands() { | ||
super("Rename allowed to restricted jail commands", | ||
move("jail.allowedCommands", "jail.restrictedCommands") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a jak to działa skoro mamy |
||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.eternalcode.core.configuration.migrations; | ||
|
||
import static eu.okaeri.configs.migrate.ConfigMigrationDsl.move; | ||
|
||
import eu.okaeri.configs.migrate.builtin.NamedMigration; | ||
|
||
public class Migration_0010_Move_jail_to_dedicated_section extends NamedMigration { | ||
igoyek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Migration_0010_Move_jail_to_dedicated_section() { | ||
super( | ||
"Move jail to dedicated section", | ||
|
||
move("jailSection.jailLocationSet", "jail.locationSet"), | ||
move("jailSection.jailLocationRemove", "jail.locationRemove"), | ||
move("jailSection.jailLocationNotSet", "jail.locationNotSet"), | ||
move("jailSection.jailLocationOverride", "jail.locationOverride"), | ||
|
||
move("jailSection.jailDetainBroadcast", "jail.detainBroadcast"), | ||
move("jailSection.jailDetainPrivate", "jail.detained"), | ||
move("jailSection.jailDetainCountdown", "jail.detainCountdown"), | ||
move("jailSection.jailDetainOverride", "jail.detainOverride"), | ||
move("jailSection.jailDetainAdmin", "jail.detainAdmin"), | ||
|
||
move("jailSection.jailReleaseBroadcast", "jail.releaseBroadcast"), | ||
move("jailSection.jailReleasePrivate", "jail.released"), | ||
move("jailSection.jailReleaseAll", "jail.releaseAll"), | ||
move("jailSection.jailReleaseNoPlayers", "jail.releaseNoPlayers"), | ||
move("jailSection.jailIsNotPrisoner", "jail.isNotPrisoner"), | ||
|
||
move("jailSection.jailListHeader", "jail.listHeader"), | ||
move("jailSection.jailListEmpty", "jail.listEmpty"), | ||
move("jailSection.jailListPlayerEntry", "jail.listPlayerEntry"), | ||
|
||
move("jailSection.jailCannotUseCommand", "jail.cannotUseCommand") | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.eternalcode.core.feature.jail; | ||
|
||
public enum JailCommandRestrictionType { | ||
WHITELIST, | ||
BLACKLIST | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Position usage in API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trochę słabo będzie wystawiać API które jest relokowane