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 providers.
029 *
030 * @since 0.1.2.0
031 * @author creatorfromhell
032 */
033public interface PlayerProvider extends MenuPlayer {
034
035  /**
036   * Used to get the name of this player.
037   * @return The name of this player.
038   */
039  String getName();
040
041  /**
042   * Used to get the location of this player.
043   * @return The location of this player.
044   */
045  Optional<Location> getLocation();
046
047  /**
048   * Used to get the name of the world this player is currently in.
049   *
050   * @return The name of the world.
051   */
052  String world();
053
054  /**
055   * Used to get the name of the biome this player is currently in.
056   *
057   * @return The name of the biome.
058   */
059  String biome();
060
061  /**
062   * Used to get the amount of experience this player has.
063   *
064   * @return The amount of levels this player has.
065   */
066  int getExp();
067
068  /**
069   * Used to set the amount of experience this player has.
070   *
071   * @param exp The amount of experience to set for this player.
072   */
073  void setExp(int exp);
074
075  /**
076   * Used to get the amount of experience levels this player has.
077   *
078   * @return The amount of experience levels this player has.
079   */
080  int getExpLevel();
081
082  /**
083   * Used to set the amount of experience levels this player has.
084   *
085   * @param level The amount of experience levels to set for this player.
086   */
087  void setExpLevel(int level);
088
089  InventoryProvider<?> inventory();
090
091  /**
092   * Method for retrieving player permissions.
093   *
094   * @return A list of permission strings.
095   */
096  List<String> getEffectivePermissions();
097
098  /**
099   * Used to determine if this player has the specified permission node.
100   *
101   * @param permission The node to check for.
102   * @return True if the player has the permission, otherwise false.
103   */
104  boolean hasPermission(String permission);
105
106  /**
107   * Used to send a message to this command source.
108   * @param messageData The message data to utilize for this translation.
109   */
110  void message(final MessageData messageData);
111}