001package net.tnemc.plugincore.core.compatibility;
002
003/*
004 * The New Plugin Core
005 * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar
006 *
007 * This program is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU Affero General Public License as published by
009 * the Free Software Foundation, either version 3 of the License, or
010 * (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015 * GNU Affero General Public License for more details.
016 *
017 * You should have received a copy of the GNU Affero General Public License
018 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
019 */
020
021import net.tnemc.menu.core.compatibility.MenuPlayer;
022import net.tnemc.plugincore.core.io.message.MessageData;
023
024import java.util.List;
025import java.util.Optional;
026
027/**
028 * A class that acts as a bridge between various player objects on different server software
029 * providers.
030 *
031 * @author creatorfromhell
032 * @since 0.1.2.0
033 */
034public interface PlayerProvider extends MenuPlayer {
035
036  /**
037   * Used to get the name of this player.
038   *
039   * @return The name of this player.
040   */
041  String getName();
042
043  /**
044   * Used to get the location of this player.
045   *
046   * @return The location of this player.
047   */
048  Optional<Location> getLocation();
049
050  /**
051   * Used to get the name of the world this player is currently in.
052   *
053   * @return The name of the world.
054   */
055  String world();
056
057  /**
058   * Used to get the name of the biome this player is currently in.
059   *
060   * @return The name of the biome.
061   */
062  String biome();
063
064  /**
065   * Used to get the amount of experience this player has.
066   *
067   * @return The amount of levels this player has.
068   */
069  int getExp();
070
071  /**
072   * Used to set the amount of experience this player has.
073   *
074   * @param exp The amount of experience to set for this player.
075   */
076  void setExp(int exp);
077
078  /**
079   * Used to get the amount of experience levels this player has.
080   *
081   * @return The amount of experience levels this player has.
082   */
083  int getExpLevel();
084
085  /**
086   * Used to set the amount of experience levels this player has.
087   *
088   * @param level The amount of experience levels to set for this player.
089   */
090  void setExpLevel(int level);
091
092  InventoryProvider<?> inventory();
093
094  /**
095   * Method for retrieving player permissions.
096   *
097   * @return A list of permission strings.
098   */
099  List<String> getEffectivePermissions();
100
101  /**
102   * Used to determine if this player has the specified permission node.
103   *
104   * @param permission The node to check for.
105   *
106   * @return True if the player has the permission, otherwise false.
107   */
108  boolean hasPermission(String permission);
109
110  /**
111   * Used to send a message to this command source.
112   *
113   * @param messageData The message data to utilize for this translation.
114   */
115  void message(final MessageData messageData);
116}