147 lines
3.4 KiB
Java
147 lines
3.4 KiB
Java
/*
|
|
* Copyright (c) 2017 univento.eu - All rights reserved
|
|
* You are not allowed to use, distribute or modify this code
|
|
*/
|
|
|
|
package eu.univento.commons.player.settings;
|
|
|
|
import eu.univento.commons.player.DatabasePlayer;
|
|
import io.vertx.core.json.JsonObject;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.1
|
|
*/
|
|
public class PlayerSettings {
|
|
|
|
private DatabasePlayer player;
|
|
private JsonObject json;
|
|
|
|
public PlayerSettings(DatabasePlayer player, JsonObject json) {
|
|
this.player = player;
|
|
this.json = json;
|
|
}
|
|
|
|
public String getPlayerVisibility() {
|
|
return json.getString("playerVisibility");
|
|
}
|
|
|
|
public boolean hasInventoryAnimationEnabled() {
|
|
return json.getBoolean("inventoryAnimation");
|
|
}
|
|
|
|
public boolean hasTeleportAnimationEnabled() {
|
|
return json.getBoolean("teleportAnimation");
|
|
}
|
|
|
|
public boolean hasPartyRequestsEnabled() {
|
|
return json.getBoolean("partyRequests");
|
|
}
|
|
|
|
public boolean hasFriendRequestsEnabled() {
|
|
return json.getBoolean("friendRequests");
|
|
}
|
|
|
|
public boolean hasFriendJumpEnabled() {
|
|
return json.getBoolean("friendJump");
|
|
}
|
|
|
|
public boolean hasChatSoundsEnabled() {
|
|
return json.getBoolean("chatSounds");
|
|
}
|
|
|
|
public boolean hasEffectsEnabled() {
|
|
return json.getBoolean("effects");
|
|
}
|
|
|
|
public boolean hasStoryModeEnabled() {
|
|
return json.getBoolean("storyMode");
|
|
}
|
|
|
|
public String getLanguage() {
|
|
return json.getString("language");
|
|
}
|
|
|
|
public boolean hasTsMoveEnabled() {
|
|
return json.getBoolean("tsMove");
|
|
}
|
|
|
|
public boolean hasScoreboardEnabled() {
|
|
return json.getBoolean("scoreboard");
|
|
}
|
|
|
|
public boolean isNicked() {
|
|
return json.getBoolean("nicked");
|
|
}
|
|
|
|
public void setPlayerVisibility(String visibility) {
|
|
json.put("playerVisibility", visibility);
|
|
update();
|
|
}
|
|
|
|
public void setInventoryAnimation(boolean animation) {
|
|
json.put("inventoryAnimation", animation);
|
|
update();
|
|
}
|
|
|
|
public void setTeleportAnimation(boolean animation) {
|
|
json.put("teleportAnimation", animation);
|
|
update();
|
|
}
|
|
|
|
public void setPartyRequests(boolean requests) {
|
|
json.put("partyRequests", requests);
|
|
update();
|
|
}
|
|
|
|
public void setFriendRequests(boolean requests) {
|
|
json.put("friendRequests", requests);
|
|
update();
|
|
}
|
|
|
|
public void setFriendJump(boolean jump) {
|
|
json.put("friendJump", jump);
|
|
update();
|
|
}
|
|
|
|
public void setChatSounds(boolean sounds) {
|
|
json.put("chatSounds", sounds);
|
|
update();
|
|
}
|
|
|
|
public void setEffects(boolean effects) {
|
|
json.put("effects", effects);
|
|
update();
|
|
}
|
|
|
|
public void setStoryMode(boolean storyMode) {
|
|
json.put("storyMode", storyMode);
|
|
update();
|
|
}
|
|
|
|
public void setLanguage(String language) {
|
|
json.put("language", language);
|
|
update();
|
|
}
|
|
|
|
public void setTsMove(boolean tsMove) {
|
|
json.put("tsMove", tsMove);
|
|
update();
|
|
}
|
|
|
|
public void setScoreboard(boolean scoreboard) {
|
|
json.put("scoreboard", scoreboard);
|
|
update();
|
|
}
|
|
|
|
public void setNickStatus(boolean nicked) {
|
|
json.put("nicked", nicked);update();
|
|
update();
|
|
|
|
}
|
|
|
|
private void update() {
|
|
player.setInDatabase("Settings", json);
|
|
}
|
|
|
|
} |