xyz.cloudbans.entities.request.ServerPlayerJoinRequest.java Source code

Java tutorial

Introduction

Here is the source code for xyz.cloudbans.entities.request.ServerPlayerJoinRequest.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.request;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class ServerPlayerJoinRequest {

    @JsonProperty("server")
    private UUID server;

    @JsonProperty("player")
    private UUID player;

    @JsonProperty("player_name")
    private String playerName;

    @JsonProperty("joined")
    private Date joined;

    public ServerPlayerJoinRequest() {
        this(null, null, null, null);
    }

    public ServerPlayerJoinRequest(UUID server, UUID player, String playerName, Date joined) {
        this.server = server;
        this.player = player;
        this.playerName = playerName;
        this.joined = joined;
    }

    public UUID getServer() {
        return server;
    }

    public void setServer(UUID server) {
        this.server = server;
    }

    public UUID getPlayer() {
        return player;
    }

    public void setPlayer(UUID player) {
        this.player = player;
    }

    public String getPlayerName() {
        return playerName;
    }

    public void setPlayerName(String playerName) {
        this.playerName = playerName;
    }

    public Date getJoined() {
        return joined;
    }

    public void setJoined(Date joined) {
        this.joined = joined;
    }

    public ServerPlayerJoinRequest copy() {
        return new ServerPlayerJoinRequest(getServer(), getPlayer(), getPlayerName(), getJoined());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof ServerPlayerJoinRequest))
            return false;
        ServerPlayerJoinRequest that = (ServerPlayerJoinRequest) o;
        return Objects.equals(getServer(), that.getServer()) && Objects.equals(getPlayer(), that.getPlayer())
                && Objects.equals(getPlayerName(), that.getPlayerName())
                && Objects.equals(getJoined(), that.getJoined());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getServer(), getPlayer(), getPlayerName(), getJoined());
    }
}