[FEATURE] 4 новых permissions

This commit is contained in:
Gravit 2019-01-21 20:38:51 +07:00
parent c865a8fec8
commit f761460122
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -8,23 +8,43 @@
public class ClientPermissions { public class ClientPermissions {
public static final ClientPermissions DEFAULT = new ClientPermissions(); public static final ClientPermissions DEFAULT = new ClientPermissions();
@LauncherAPI @LauncherAPI
public boolean canAdmin; public boolean canAdmin = false;
@LauncherAPI @LauncherAPI
public boolean canServer; public boolean canServer = false;
@LauncherAPI
public boolean canUSR1 = false;
@LauncherAPI
public boolean canUSR2 = false;
@LauncherAPI
public boolean canUSR3 = false;
@LauncherAPI
public boolean canBot = false;
public ClientPermissions(HInput input) throws IOException { public ClientPermissions(HInput input) throws IOException {
canAdmin = input.readBoolean(); canAdmin = input.readBoolean();
canServer = input.readBoolean(); canServer = input.readBoolean();
canUSR1 = input.readBoolean();
canUSR2 = input.readBoolean();
canUSR3 = input.readBoolean();
canBot = input.readBoolean();
} }
public ClientPermissions() { public ClientPermissions() {
canAdmin = false; canAdmin = false;
canServer = false; canServer = false;
canUSR1 = false;
canUSR2 = false;
canUSR3 = false;
canBot = false;
} }
public ClientPermissions(long data) { public ClientPermissions(long data) {
canAdmin = (data & (1)) != 0; canAdmin = (data & (1)) != 0;
canServer = (data & (1 << 1)) != 0; canServer = (data & (1 << 1)) != 0;
canUSR1 = (data & (1 << 2)) != 0;
canUSR2 = (data & (1 << 3)) != 0;
canUSR3 = (data & (1 << 4)) != 0;
canBot = (data & (1 << 5)) != 0;
} }
public static ClientPermissions getSuperuserAccount() { public static ClientPermissions getSuperuserAccount() {
@ -37,5 +57,9 @@ public static ClientPermissions getSuperuserAccount() {
public void write(HOutput output) throws IOException { public void write(HOutput output) throws IOException {
output.writeBoolean(canAdmin); output.writeBoolean(canAdmin);
output.writeBoolean(canServer); output.writeBoolean(canServer);
output.writeBoolean(canUSR1);
output.writeBoolean(canUSR2);
output.writeBoolean(canUSR3);
output.writeBoolean(canBot);
} }
} }