Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrekt committed Aug 24, 2021
1 parent 989ad40 commit 0e3d224
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/me/vrekt/arc/Arc.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class Arc extends PluginBase {
/**
* IPL version
*/
public static final String VERSION_STRING = "1.7-824a-nukkit";
public static final String VERSION_STRING = "1.7-824b-nukkit";

/**
* The instance of this class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.vrekt.arc.check.CheckType;
import me.vrekt.arc.permissions.Permissions;
import me.vrekt.arc.utility.chat.ColoredChat;
import me.vrekt.arc.utility.misc.DeviceType;
import me.vrekt.arc.violation.ViolationHistory;
import org.apache.commons.lang3.ArrayUtils;

Expand Down Expand Up @@ -50,7 +51,7 @@ public void execute(CommandSender sender, String[] arguments) {
final int playerPing = player.getPing();

// TODO: Mapping of devices.
final String playerDeviceId = playerDevice == 7 ? "Windows" : "Unknown Device";
final String playerDeviceId = DeviceType.getByCode(playerDevice).getPrettyName();
final String checksBypassed = bypass.isEmpty() ? " cannot bypass any checks."
: " can bypass " + ArrayUtils.toString(bypass);
final String playerGameMode = player.getGamemode() == 0 ? "Survival"
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/me/vrekt/arc/exemption/ExemptionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ private boolean isFlying(Player player) {
* @return {@code true} if so
*/
private boolean isExemptWhenFlying(CheckType check) {
return check == CheckType.FLIGHT || check == CheckType.SPEED || check == CheckType.PHASE;
return check == CheckType.FLIGHT
|| check == CheckType.SPEED
|| check == CheckType.PHASE
|| check == CheckType.LIQUID_WALK;
}

@Override
Expand Down
57 changes: 57 additions & 0 deletions src/main/java/me/vrekt/arc/utility/misc/DeviceType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package me.vrekt.arc.utility.misc;

/**
* Represents a device type a player is playing on.
*/
public enum DeviceType {

ANDROID("Android", 1),
IOS("iOS", 2),
MAC_OS("MacOS", 3),
FIRE_OS("FireOS", 4),
GEAR_VR("GearVR", 5),
HOLO_LENS("HoloLens", 6),
WINDOWS_10("Windows", 7),
WINDOWS("Windows", 8),
DEDICATED("Dedicated", 9),
PS4("PS4", 10),
SWITCH("Switch", 11),
UNKNOWN("Unknown", 0);

/**
* The name
*/
private final String prettyName;

/**
* The Code
*/
private final int code;

DeviceType(String prettyName, int code) {
this.prettyName = prettyName;
this.code = code;
}

public String getPrettyName() {
return prettyName;
}

public int getCode() {
return code;
}

/**
* Get the device type from the provided code.
*
* @param code the code
* @return the device type or {@code UNKNOWN} if not found.
*/
public static DeviceType getByCode(int code) {
for (DeviceType value : values()) {
if (value.code == code) return value;
}
return UNKNOWN;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ permissions:
description: Allows the player to bypass the Speed check.
arc.bypass.moving.phase:
description: Allows the player to bypass the Phase check.
arc.bypass.moving.waterwalk:
arc.bypass.moving.liquidwalk:
description: Allows the player to bypass the LiquidWalk check.
arc.bypass.block:
description: Allows the player to bypass block related checks
Expand Down

0 comments on commit 0e3d224

Please sign in to comment.