Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.sean.game.model.player;
- import java.io.Serializable;
- import com.sean.game.net.packet.codec.context.VarBitContext;
- import com.sean.game.net.packet.codec.encoders.VarBitEncoder;
- /**
- *
- * @author Dennis
- *
- */
- public final class Preferences implements Serializable {
- /**
- * The serial version UID.
- */
- private static final long serialVersionUID = -1014769258411933653L;
- /**
- * The player.
- */
- private transient Player player;
- /**
- * Whether the player accepts aid.
- */
- private boolean acceptAid;
- /**
- * Whether the players profanity filter is enabled.
- */
- private boolean profanityFilter;
- /**
- * Whether the chat effects are enabled.
- */
- private boolean chatEffects;
- /**
- * Whether the player is using 2 mouse buttons.
- */
- private boolean mouseButtons;
- /**
- * Whether the player has a right click report option.
- */
- private boolean rightClickReport;
- public Preferences(Player player) {
- this.player = player;
- acceptAid = true;
- profanityFilter = true;
- chatEffects = true;
- mouseButtons = true;
- }
- /**
- * Refreshes the preferences.
- */
- public void refresh() {
- refreshAcceptAid();
- refreshProfanityFilter();
- refreshChatEffects();
- refreshMouseButtons();
- refreshRightClickReport();
- }
- /**
- * @return the acceptAid
- */
- public boolean isAcceptAid() {
- return acceptAid;
- }
- /**
- * @param acceptAid
- * the acceptAid to set
- */
- public void setAcceptAid(boolean acceptAid) {
- this.acceptAid = acceptAid;
- }
- /**
- * Toggles the accept aid.
- */
- public void toggleAcceptAid() {
- this.acceptAid = !acceptAid;
- refreshAcceptAid();
- }
- /**
- * Refreshes the accept aid option.
- */
- public void refreshAcceptAid() {
- player.getVarsManager().sendVar(427, acceptAid ? 1 : 0);
- }
- /**
- * @return the profanityFilter
- */
- public boolean isProfanityFilter() {
- return profanityFilter;
- }
- /**
- * @param profanityFilter the profanityFilter to set
- */
- public void setProfanityFilter(boolean profanityFilter) {
- this.profanityFilter = profanityFilter;
- }
- /**
- * Toggles the profanity filter.
- */
- public void toggleProfanityFilter() {
- this.profanityFilter = !profanityFilter;
- refreshProfanityFilter();
- }
- /**
- * Refreshes the profanity filter option.
- */
- public void refreshProfanityFilter() {
- player.encode(VarBitEncoder.class, new VarBitContext(8780, profanityFilter ? 0 : 1));
- }
- /**
- * @return the chatEffects
- */
- public boolean isChatEffects() {
- return chatEffects;
- }
- /**
- * @param chatEffects the chatEffects to set
- */
- public void setChatEffects(boolean chatEffects) {
- this.chatEffects = chatEffects;
- }
- /**
- * Toggles the chat effects.
- */
- public void toggleChatEffects() {
- this.chatEffects = !chatEffects;
- refreshChatEffects();
- }
- /**
- * Refreshes the chat effects option.
- */
- public void refreshChatEffects() {
- player.getVarsManager().sendVar(171, chatEffects ? 0 : 1);
- }
- /**
- * @return the mouseButtons
- */
- public boolean isMouseButtons() {
- return mouseButtons;
- }
- /**
- * @param mouseButtons the mouseButtons to set
- */
- public void setMouseButtons(boolean mouseButtons) {
- this.mouseButtons = mouseButtons;
- }
- /**
- * Toggles the mouse buttons.
- */
- public void toggleMouseButtons() {
- this.mouseButtons = !mouseButtons;
- refreshMouseButtons();
- }
- /**
- * Refreshes the mouse buttons option.
- */
- public void refreshMouseButtons() {
- player.getVarsManager().sendVar(170, mouseButtons ? 0 : 1);
- }
- /**
- * @return the rightClickReport
- */
- public boolean isRightClickReport() {
- return rightClickReport;
- }
- /**
- * @param rightClickReport the rightClickReport to set
- */
- public void setRightClickReport(boolean rightClickReport) {
- this.rightClickReport = rightClickReport;
- }
- /**
- * Toggles the right click report.
- */
- public void toggleRightClickReport() {
- this.rightClickReport = !rightClickReport;
- refreshRightClickReport();
- }
- /**
- * Refreshes the right click report.
- */
- public void refreshRightClickReport() {
- player.sendPlayerOption(rightClickReport ? "Report" : "null", 6, false);
- // TODO config
- }
- /**
- * @return the player
- */
- public Player getPlayer() {
- return player;
- }
- /**
- * @param player
- * the player to set
- */
- public void setPlayer(Player player) {
- this.player = player;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement