mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-08 00:11:34 +01:00
Added permission level + option for a reduced debug screen
This commit is contained in:
parent
be0311a874
commit
498384d2f4
@ -171,6 +171,8 @@ public class PlayerInit {
|
||||
player.addEventCallback(PlayerLoginEvent.class, event -> {
|
||||
event.setSpawningInstance(instanceContainer);
|
||||
|
||||
player.setPermissionLevel(4);
|
||||
|
||||
player.getInventory().addInventoryCondition((p, slot, clickType, inventoryConditionResult) -> {
|
||||
player.sendMessage("CLICK PLAYER INVENTORY");
|
||||
System.out.println("slot player: " + slot);
|
||||
|
@ -94,6 +94,10 @@ public class Player extends LivingEntity {
|
||||
*/
|
||||
private DamageType lastDamageSource;
|
||||
|
||||
private int permissionLevel;
|
||||
|
||||
private boolean reducedDebugScreenInformation;
|
||||
|
||||
// Abilities
|
||||
private boolean invulnerable;
|
||||
private boolean flying;
|
||||
@ -947,6 +951,33 @@ public class Player extends LivingEntity {
|
||||
playerConnection.sendPacket(positionAndLookPacket);
|
||||
}
|
||||
|
||||
public int getPermissionLevel() {
|
||||
return permissionLevel;
|
||||
}
|
||||
|
||||
public void setPermissionLevel(int permissionLevel) {
|
||||
if (permissionLevel < 0 || permissionLevel > 4)
|
||||
throw new IllegalArgumentException("permissionLevel has to be between 0 and 4");
|
||||
|
||||
this.permissionLevel = permissionLevel;
|
||||
|
||||
// Magic values: https://wiki.vg/Entity_statuses#Player
|
||||
byte permissionLevelStatus = (byte) (24 + permissionLevel);
|
||||
triggerStatus(permissionLevelStatus);
|
||||
}
|
||||
|
||||
public void setReducedDebugScreenInformation(boolean reduced) {
|
||||
this.reducedDebugScreenInformation = reduced;
|
||||
|
||||
// Magic values: https://wiki.vg/Entity_statuses#Player
|
||||
byte debugScreenStatus = (byte) (reduced ? 22 : 23);
|
||||
triggerStatus(debugScreenStatus);
|
||||
}
|
||||
|
||||
public boolean hasReducedDebugScreenInformation() {
|
||||
return reducedDebugScreenInformation;
|
||||
}
|
||||
|
||||
public boolean isInvulnerable() {
|
||||
return invulnerable;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user