Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,49 +29,60 @@

import java.util.UUID;

public interface Player {
public abstract class Player {

UUID getUuid();
public abstract UUID getUuid();

Text getName();
public abstract Text getName();

ServerWorld getWorld();
public abstract ServerWorld getWorld();

Vector3d getPosition();
public abstract Vector3d getPosition();

/**
* x -> pitch, y -> yaw, z -> roll
*/
Vector3d getRotation();
public abstract Vector3d getRotation();

int getSkyLight();
public abstract int getSkyLight();

int getBlockLight();
public abstract int getBlockLight();

/**
* Return <code>true</code> if the player is sneaking.
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
*/
boolean isSneaking();
public abstract boolean isSneaking();

/**
* Returns <code>true</code> if the player has an invisibillity effect
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
*/
boolean isInvisible();
public abstract boolean isInvisible();

/**
* Returns <code>true</code> if the player is vanished
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
*/
default boolean isVanished() {
public boolean isVanished() {
return false;
}

/**
* Returns the {@link Gamemode} this player is in
* <p><i>If the player is offline the value of this method is undetermined.</i></p>
*/
Gamemode getGamemode();
public abstract Gamemode getGamemode();

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
Player other = (Player) o;
return getUuid().equals(other.getUuid());
}

@Override
public int hashCode() {
return getUuid().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.Map;
import java.util.UUID;

public class FabricPlayer implements Player {
public class FabricPlayer extends Player {

private static final Map<GameMode, Gamemode> GAMEMODE_MAP = new EnumMap<>(GameMode.class);
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.Map;
import java.util.UUID;

public class ForgePlayer implements Player {
public class ForgePlayer extends Player {

private static final Map<GameType, Gamemode> GAMEMODE_MAP = new EnumMap<>(GameType.class);
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.Map;
import java.util.UUID;

public class ForgePlayer implements Player {
public class ForgePlayer extends Player {

private static final Map<GameType, Gamemode> GAMEMODE_MAP = new EnumMap<>(GameType.class);
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

import java.util.*;

public class BukkitPlayer implements Player {
public class BukkitPlayer extends Player {

private static final Map<GameMode, Gamemode> GAMEMODE_MAP = new EnumMap<>(GameMode.class);
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.Map;
import java.util.UUID;

public class BukkitPlayer implements Player {
public class BukkitPlayer extends Player {

private static final Map<GameMode, Gamemode> GAMEMODE_MAP = new EnumMap<>(GameMode.class);
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

import java.util.*;

public class SpongePlayer implements Player {
public class SpongePlayer extends Player {

private static final Map<GameMode, Gamemode> GAMEMODE_MAP = new HashMap<>(5);
static {
Expand Down
Loading