Launcher/libLauncher/src/main/java/ru/gravit/launcher/ClientPermissions.java

42 lines
1.1 KiB
Java
Raw Normal View History

package ru.gravit.launcher;
import ru.gravit.launcher.serialize.HInput;
import ru.gravit.launcher.serialize.HOutput;
import java.io.IOException;
2018-10-01 13:08:16 +03:00
public class ClientPermissions {
public static final ClientPermissions DEFAULT = new ClientPermissions();
@LauncherAPI
2018-10-01 13:08:16 +03:00
public boolean canAdmin;
@LauncherAPI
2018-10-01 13:08:16 +03:00
public boolean canServer;
2019-01-15 06:35:39 +03:00
public ClientPermissions(HInput input) throws IOException {
canAdmin = input.readBoolean();
canServer = input.readBoolean();
}
2019-01-15 06:35:39 +03:00
2018-10-01 13:08:16 +03:00
public ClientPermissions() {
canAdmin = false;
canServer = false;
}
2018-11-08 15:30:16 +03:00
public ClientPermissions(long data) {
2018-11-08 15:30:16 +03:00
canAdmin = (data & (1)) != 0;
canServer = (data & (1 << 1)) != 0;
}
2018-11-08 15:30:16 +03:00
public static ClientPermissions getSuperuserAccount() {
ClientPermissions perm = new ClientPermissions();
perm.canServer = true;
perm.canAdmin = true;
return perm;
}
2019-01-15 06:35:39 +03:00
public void write(HOutput output) throws IOException {
output.writeBoolean(canAdmin);
output.writeBoolean(canServer);
}
2018-10-01 13:08:16 +03:00
}