xyz.cloudbans.entities.data.Player.java Source code

Java tutorial

Introduction

Here is the source code for xyz.cloudbans.entities.data.Player.java

Source

/*
 * Copyright 2016 CloudBans (https://cloudbans.xyz)
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package xyz.cloudbans.entities.data;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

public class Player {

    @JsonProperty("uuid")
    private UUID uuid;

    @JsonIgnore
    private Realm realm;

    @JsonProperty("last_name_update")
    private Date lastNameUpdate;

    @JsonProperty("player_names")
    private List<PlayerName> playerNames;

    public UUID getUuid() {
        return uuid;
    }

    public void setUuid(UUID uuid) {
        this.uuid = uuid;
    }

    public Realm getRealm() {
        return realm;
    }

    public void setRealm(Realm realm) {
        this.realm = realm;
    }

    public Date getLastNameUpdate() {
        return lastNameUpdate;
    }

    public void setLastNameUpdate(Date lastNameUpdate) {
        this.lastNameUpdate = lastNameUpdate;
    }

    public List<PlayerName> getPlayerNames() {
        return playerNames;
    }

    public void setPlayerNames(List<PlayerName> playerNames) {
        this.playerNames = playerNames;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof Player))
            return false;
        Player that = (Player) o;
        return Objects.equals(getUuid(), that.getUuid()) && Objects.equals(getRealm(), that.getRealm())
                && Objects.equals(getLastNameUpdate(), that.getLastNameUpdate())
                && Objects.equals(getPlayerNames(), that.getPlayerNames());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getUuid(), getRealm(), getLastNameUpdate(), getPlayerNames());
    }
}