Skip to content

Commit

Permalink
rework fractions
Browse files Browse the repository at this point in the history
  • Loading branch information
Snabeldier committed Dec 15, 2024
1 parent f18f568 commit 241da76
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 36 deletions.
6 changes: 3 additions & 3 deletions src/main/java/minevalley/core/api/users/OnlineUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import minevalley.core.api.enums.sounds.AmbientSound;
import minevalley.core.api.enums.sounds.Sound;
import minevalley.core.api.regions.utils.PlayerLocation;
import minevalley.core.api.users.enums.FractionService;
import minevalley.core.api.users.enums.Fraction;
import minevalley.core.api.users.enums.McVersion;
import minevalley.core.api.users.enums.TabListView;
import minevalley.core.api.users.enums.TeamRank;
Expand Down Expand Up @@ -328,9 +328,9 @@ public interface OnlineUser extends User {
*
* @return users fraction
*/
FractionService getFractionService();
Fraction getFractionService();

void enterFractionService(FractionService service);
void enterFractionService(Fraction service);

void leaveFractionService();

Expand Down
21 changes: 21 additions & 0 deletions src/main/java/minevalley/core/api/users/enums/Fraction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package minevalley.core.api.users.enums;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum Fraction {

POLICE("Polizei"),
MEDIC("Rettungsdienst"),
MAIL("Post"),
DISPOSAL("Müllabfuhr");

private final String name;

public static Fraction getFraction(int value) {
return value >= values().length ? null : values()[value];
}
}
26 changes: 0 additions & 26 deletions src/main/java/minevalley/core/api/users/enums/FractionService.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import lombok.Getter;
import minevalley.core.api.users.OnlineUser;
import minevalley.core.api.users.enums.FractionService;
import minevalley.core.api.users.enums.Fraction;

@Getter
public class UserEnterFractionServiceEvent extends UserUpdateFractionServiceEvent {

public UserEnterFractionServiceEvent(OnlineUser user, FractionService fractionService) {
public UserEnterFractionServiceEvent(OnlineUser user, Fraction fractionService) {
super(user, fractionService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import lombok.Getter;
import minevalley.core.api.users.OnlineUser;
import minevalley.core.api.users.enums.FractionService;
import minevalley.core.api.users.enums.Fraction;

@Getter
public class UserLeaveFractionServiceEvent extends UserUpdateFractionServiceEvent {

public UserLeaveFractionServiceEvent(OnlineUser user, FractionService fractionService) {
public UserLeaveFractionServiceEvent(OnlineUser user, Fraction fractionService) {
super(user, fractionService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import lombok.Getter;
import minevalley.core.api.users.OnlineUser;
import minevalley.core.api.users.enums.FractionService;
import minevalley.core.api.users.enums.Fraction;
import minevalley.core.api.users.events.OnlineUserEvent;

@Getter
public abstract class UserUpdateFractionServiceEvent extends OnlineUserEvent {

private final FractionService fractionService;
private final Fraction fractionService;

public UserUpdateFractionServiceEvent(OnlineUser user, FractionService fractionService) {
public UserUpdateFractionServiceEvent(OnlineUser user, Fraction fractionService) {
super(user);
this.fractionService = fractionService;
}
Expand Down

0 comments on commit 241da76

Please sign in to comment.