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

Java tutorial

Introduction

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

    @JsonProperty("server")
    private UUID server;

    @JsonProperty("player")
    private UUID player;

    @JsonProperty("left")
    private Date left;

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

    public ServerPlayerLeaveRequest(UUID server, UUID player, Date left) {
        this.server = server;
        this.player = player;
        this.left = left;
    }

    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 Date getLeft() {
        return left;
    }

    public void setLeft(Date left) {
        this.left = left;
    }

    public ServerPlayerLeaveRequest copy() {
        return new ServerPlayerLeaveRequest(getServer(), getPlayer(), getLeft());
    }

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

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