]> git.basschouten.com Git - openhab-addons.git/blob
bf632f5d1a97336a74ce6cc47709d9a22730a9c2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.minecraft.internal.message.data;
14
15 /**
16  * Object representing Minecraft player.
17  *
18  * @author Mattias Markehed - Initial contribution
19  */
20 public class PlayerData {
21
22     protected String displayName;
23     protected String name;
24     protected int level;
25     protected int totalExperience;
26     protected float experience;
27     protected double health;
28     protected float walkSpeed;
29     protected LocationData location;
30     protected String gameMode;
31
32     /**
33      * Get the display name of player.
34      *
35      * @return display name
36      */
37     public String getDisplayName() {
38         return displayName;
39     }
40
41     /**
42      * Get the name of player
43      *
44      * @return name of player.
45      */
46     public String getName() {
47         return name;
48     }
49
50     /**
51      * Get the player level.
52      *
53      * @return level of player
54      */
55     public int getLevel() {
56         return level;
57     }
58
59     /**
60      * Get the total experience of player.
61      *
62      * @return total experience
63      */
64     public int getTotalExperience() {
65         return totalExperience;
66     }
67
68     /**
69      * Get player experiance.
70      *
71      * @return experiance of player
72      */
73     public float getExperience() {
74         return experience;
75     }
76
77     /**
78      * Get health of player.
79      *
80      * @return player health
81      */
82     public double getHealth() {
83         return health;
84     }
85
86     /**
87      * Get the walk speed of player.
88      *
89      * @return walk speed of player
90      */
91     public float getWalkSpeed() {
92         return walkSpeed;
93     }
94
95     /**
96      * Get location of player.
97      *
98      * @return location of player
99      */
100     public LocationData getLocation() {
101         return location;
102     }
103
104     /**
105      * Get the players game mode.
106      *
107      * @return game mode
108      */
109     public String getGameMode() {
110         return gameMode;
111     }
112
113     @Override
114     public int hashCode() {
115         final int prime = 31;
116         int result = 1;
117         result = prime * result + ((name == null) ? 0 : name.hashCode());
118         return result;
119     }
120
121     @Override
122     public boolean equals(Object obj) {
123         if (this == obj) {
124             return true;
125         }
126         if (obj == null) {
127             return false;
128         }
129         if (getClass() != obj.getClass()) {
130             return false;
131         }
132         PlayerData other = (PlayerData) obj;
133         if (name == null) {
134             if (other.name != null) {
135                 return false;
136             }
137         } else if (!name.equals(other.name)) {
138             return false;
139         }
140         return true;
141     }
142 }