137 lines
3.4 KiB
Java
137 lines
3.4 KiB
Java
package eu.univento.commons.player.settings;
|
|
|
|
import eu.univento.commons.player.DatabasePlayer;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 0.1
|
|
*/
|
|
public class PlayerSettings {
|
|
|
|
private DatabasePlayer player;
|
|
|
|
public PlayerSettings(DatabasePlayer player) {
|
|
this.player = player;
|
|
}
|
|
|
|
public String getPlayerVisibility() {
|
|
return (String) getSettings().get("playerVisibility");
|
|
}
|
|
|
|
public boolean hasInventoryAnimationEnabled() {
|
|
return (boolean) getSettings().get("inventoryAnimation");
|
|
}
|
|
|
|
public boolean hasTeleportAnimationEnabled() {
|
|
return (boolean) getSettings().get("teleportAnimation");
|
|
}
|
|
|
|
public boolean hasPartyRequestsEnabled() {
|
|
return (boolean) getSettings().get("partyRequests");
|
|
}
|
|
|
|
public boolean hasFriendRequestsEnabled() {
|
|
return (boolean) getSettings().get("friendRequests");
|
|
}
|
|
|
|
public boolean hasFriendJumpEnabled() {
|
|
return (boolean) getSettings().get("friendJump");
|
|
}
|
|
|
|
public boolean hasChatSoundsEnabled() {
|
|
return (boolean) getSettings().get("chatSounds");
|
|
}
|
|
|
|
public boolean hasEffectsEnabled() {
|
|
return (boolean) getSettings().get("effects");
|
|
}
|
|
|
|
public boolean hasStoryModeEnabled() {
|
|
return (boolean) getSettings().get("storyMode");
|
|
}
|
|
|
|
public String getLanguage() {
|
|
return (String) getSettings().get("language");
|
|
}
|
|
|
|
public boolean hasTsMoveEnabled() {
|
|
return (boolean) getSettings().get("tsMove");
|
|
}
|
|
|
|
public boolean hasScoreboardEnabled() {
|
|
return (boolean) getSettings().get("scoreboard");
|
|
}
|
|
|
|
public void setPlayerVisibility(String visibility) {
|
|
setSetting("playerVisibility", visibility);
|
|
}
|
|
|
|
public void setInventoryAnimation(boolean animation) {
|
|
setSetting("inventoryAnimation", animation);
|
|
}
|
|
|
|
public void setTeleportAnimation(boolean animation) {
|
|
setSetting("teleportAnimation", animation);
|
|
}
|
|
|
|
public void setPartyRequests(boolean requests) {
|
|
setSetting("partyRequests", requests);
|
|
}
|
|
|
|
public void setFriendRequests(boolean requests) {
|
|
setSetting("friendRequests", requests);
|
|
}
|
|
|
|
public void setFriendJump(boolean jump) {
|
|
setSetting("friendJump", jump);
|
|
}
|
|
|
|
public void setChatSounds(boolean sounds) {
|
|
setSetting("chatSounds", sounds);
|
|
}
|
|
|
|
public void setEffects(boolean effects) {
|
|
setSetting("effects", effects);
|
|
}
|
|
|
|
public void setStoryMode(boolean storyMode) {
|
|
setSetting("storyMode", storyMode);
|
|
}
|
|
|
|
public void setLanguage(String language) {
|
|
setSetting("language", language);
|
|
}
|
|
|
|
public void setTsMove(boolean tsMove) {
|
|
setSetting("tsMove", tsMove);
|
|
}
|
|
|
|
public void setScoreboard(boolean scoreboard) {
|
|
setSetting("scoreboard", scoreboard);
|
|
}
|
|
|
|
public boolean isNicked() {
|
|
return (boolean) getSettings().get("nicked");
|
|
}
|
|
|
|
public void setNickStatus(boolean nicked) {
|
|
setSetting("nicked", nicked);
|
|
}
|
|
|
|
private Map<String, Object> getSettings() {
|
|
return player.getMapFromDatabase("Settings");
|
|
}
|
|
|
|
private void setSettings(Map<String, Object> settings) {
|
|
player.setInDatabase("Settings", settings);
|
|
}
|
|
|
|
private void setSetting(String name, Serializable setting) {
|
|
Map<String, Object> list = getSettings();
|
|
list.put(name, setting);
|
|
setSettings(list);
|
|
}
|
|
} |