Saber-Factions/src/main/java/com/massivecraft/factions/FPlayer.java

451 lines
9.6 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions;
2011-02-06 13:36:11 +01:00
2011-10-12 17:25:01 +02:00
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator;
2011-09-24 12:04:49 +02:00
import com.massivecraft.factions.struct.ChatMode;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
2015-05-25 06:42:31 +02:00
import com.massivecraft.factions.util.WarmUpUtil;
2018-02-11 00:59:21 +01:00
import mkremins.fanciful.FancyMessage;
import net.dv8tion.jda.core.entities.User;
2014-04-04 20:55:21 +02:00
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
2014-04-04 20:55:21 +02:00
import org.bukkit.entity.Player;
2014-11-06 01:36:47 +01:00
import java.util.List;
2011-02-06 13:36:11 +01:00
/**
2014-04-04 20:55:21 +02:00
* Logged in players always have exactly one FPlayer instance. Logged out players may or may not have an FPlayer
* instance. They will always have one if they are part of a faction. This is because only players with a faction are
* saved to disk (in order to not waste disk space).
2011-03-23 12:00:38 +01:00
* The FPlayer is linked to a minecraft player using the player name.
2014-04-04 20:55:21 +02:00
* The same instance is always returned for the same player. This means you can use the == operator. No .equals method
* necessary.
*/
2014-11-06 01:36:47 +01:00
public interface FPlayer extends EconomyParticipator {
void setNotificationsEnabled(boolean notifications);
boolean hasNotificationsEnabled();
2019-07-04 04:30:58 +02:00
/**
* Get if a player has setup their Discord before
* @return if the player setup Discord as a boolean
*/
boolean discordSetup();
/**
* Get the players Discord user ID
* @return players Discord user ID as a String
*/
String discordUserID();
/**
* Set the players Boolean defining if the player has setup their Discord
* @param b Boolean for discordSetup to be defined to
*/
void setDiscordSetup(Boolean b);
/**
* Set the players Discord user ID
* @param s String for their user ID to be set to
*/
void setDiscordUserID(String s);
/**
* Get the players Discord user (If the player has not setup Discord it will return null!)
* @return User from players set Discord User ID
*/
User discordUser();
/**
* Used to check if this player should be served titles
* @return if this FPlayer has titles enabled as a boolean
*/
boolean hasTitlesEnabled();
/**
* Used to set if player should be served titles
* @param b Boolean to titlesEnabled to
*/
void setTitlesEnabled(Boolean b);
/**
* Used to determine if a player is in their faction's chest
* @return if player is in their faction's as a boolean
*/
boolean isInFactionsChest();
/**
* Set if the player is inside of their faction's chest
*/
void setInFactionsChest(boolean b);
boolean isAlt();
2019-07-04 04:30:58 +02:00
void setAlt(boolean alt);
/**
* Used to know if stealth is toggled on or off
*
* @return if stealth mode is on or not.
*/
boolean isStealthEnabled();
/**
* Toggles the stealth of the FPlayer depending on the parameter
*
* @param stealthToggle - toggles stealth
*/
void setStealth(boolean stealthToggle);
/**
* Sets the kills and deaths of a player.
*/
void login();
/**
* Caches the kills and deaths of a player.
*/
void logout();
/**
* gets the faction of a FPlayer.
*
* @return Faction of the FPlayer.
*/
Faction getFaction();
/**
* Sets the faction of the FPlayer
*
* @param faction faction to set.
*/
void setFaction(Faction faction, boolean alt);
/**
* Gets the faction ID of the player.
*
* @return FactionsID string
*/
String getFactionId();
/**
* Check if a player has a faction
*
* @return boolean
*/
boolean hasFaction();
/**
* Gets autoleave status
*
* @return boolean of the autoleave
*/
boolean willAutoLeave();
void setAutoLeave(boolean autoLeave);
long getLastFrostwalkerMessage();
void setLastFrostwalkerMessage();
void setMonitorJoins(boolean monitor);
boolean isMonitoringJoins();
Role getRole();
void setRole(Role role);
boolean shouldTakeFallDamage();
2018-03-05 02:27:48 +01:00
void setTakeFallDamage(boolean fallDamage);
2018-03-05 02:27:48 +01:00
double getPowerBoost();
void setPowerBoost(double powerBoost);
Faction getAutoClaimFor();
void setAutoClaimFor(Faction faction);
boolean isAutoSafeClaimEnabled();
2014-04-04 20:55:21 +02:00
void setIsAutoSafeClaimEnabled(boolean enabled);
2014-04-04 20:55:21 +02:00
boolean isAutoWarClaimEnabled();
2014-04-04 20:55:21 +02:00
void setIsAutoWarClaimEnabled(boolean enabled);
2014-04-04 20:55:21 +02:00
boolean isAdminBypassing();
2014-04-04 20:55:21 +02:00
boolean isVanished();
void setIsAdminBypassing(boolean val);
2014-04-04 20:55:21 +02:00
ChatMode getChatMode();
2014-04-04 20:55:21 +02:00
void setChatMode(ChatMode chatMode);
2014-04-04 20:55:21 +02:00
boolean isIgnoreAllianceChat();
2015-02-25 15:38:03 +01:00
void setIgnoreAllianceChat(boolean ignore);
2015-02-25 15:38:03 +01:00
boolean isSpyingChat();
2014-04-04 20:55:21 +02:00
void setSpyingChat(boolean chatSpying);
2014-04-04 20:55:21 +02:00
boolean showScoreboard();
void setShowScoreboard(boolean show);
// FIELD: account
String getAccountId();
2014-04-04 20:55:21 +02:00
void resetFactionData(boolean doSpoutUpdate);
void resetFactionData();
long getLastLoginTime();
void setLastLoginTime(long lastLoginTime);
boolean isMapAutoUpdating();
2014-04-04 20:55:21 +02:00
void setMapAutoUpdating(boolean mapAutoUpdating);
2014-04-04 20:55:21 +02:00
boolean hasLoginPvpDisabled();
2014-04-04 20:55:21 +02:00
FLocation getLastStoodAt();
2014-04-04 20:55:21 +02:00
void setLastStoodAt(FLocation flocation);
2014-04-04 20:55:21 +02:00
String getTitle();
void setTitle(CommandSender sender, String title);
String getName();
String getTag();
2014-04-04 20:55:21 +02:00
// Base concatenations:
2014-04-04 20:55:21 +02:00
String getNameAndSomething(String something);
2014-04-04 20:55:21 +02:00
String getNameAndTitle();
2014-04-04 20:55:21 +02:00
String getNameAndTag();
2014-04-04 20:55:21 +02:00
// Colored concatenations:
// These are used in information messages
2014-04-04 20:55:21 +02:00
String getNameAndTitle(Faction faction);
String getNameAndTitle(FPlayer fplayer);
// Chat Tag:
// These are injected into the format of global chat messages.
2014-04-04 20:55:21 +02:00
String getChatTag();
2014-04-04 20:55:21 +02:00
// Colored Chat Tag
String getChatTag(Faction faction);
2014-04-04 20:55:21 +02:00
String getChatTag(FPlayer fplayer);
2014-04-04 20:55:21 +02:00
int getKills();
int getDeaths();
boolean takeMoney(int amt);
boolean hasMoney(int amt);
//inspect Stuff
boolean isInspectMode();
void setInspectMode(boolean status);
// Fly Checks
Boolean canflyinWilderness();
Boolean canflyinWarzone();
Boolean canflyinSafezone();
Boolean canflyinEnemy();
Boolean canflyinAlly();
Boolean canflyinTruce();
Boolean canflyinNeutral();
// -------------------------------
// Relation and relation colors
// -------------------------------
2014-04-04 20:55:21 +02:00
@Override
String describeTo(RelationParticipator that, boolean ucfirst);
2014-04-04 20:55:21 +02:00
@Override
String describeTo(RelationParticipator that);
2014-04-04 20:55:21 +02:00
@Override
Relation getRelationTo(RelationParticipator rp);
2014-04-04 20:55:21 +02:00
@Override
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
2014-04-04 20:55:21 +02:00
Relation getRelationToLocation();
2014-04-04 20:55:21 +02:00
@Override
ChatColor getColorTo(RelationParticipator rp);
2014-04-04 20:55:21 +02:00
String getRolePrefix();
//----------------------------------------------//
// Health
//----------------------------------------------//
void heal(int amnt);
2014-04-04 20:55:21 +02:00
//----------------------------------------------//
// Power
//----------------------------------------------//
double getPower();
void alterPower(double delta);
double getPowerMax();
double getPowerMin();
int getPowerRounded();
int getPowerMaxRounded();
int getPowerMinRounded();
long getMillisPassed();
long getLastPowerUpdateTime();
void updatePower();
void losePowerFromBeingOffline();
void onDeath();
2014-04-04 20:55:21 +02:00
//----------------------------------------------//
// Territory
//----------------------------------------------//
boolean isInOwnTerritory();
boolean isInOthersTerritory();
boolean isInAllyTerritory();
boolean isInNeutralTerritory();
boolean isInEnemyTerritory();
void sendFactionHereMessage(Faction from);
2014-04-04 20:55:21 +02:00
// -------------------------------
// Actions
// -------------------------------
2014-04-04 20:55:21 +02:00
void leave(boolean makePay);
2014-04-04 20:55:21 +02:00
boolean canClaimForFaction(Faction forFaction);
boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
boolean isInVault();
2018-03-26 23:43:15 +02:00
void setInVault(boolean status);
2018-03-26 23:43:15 +02:00
void msg(String str, Object... args);
String getId();
void setId(String id);
Player getPlayer();
boolean isOnline();
void sendMessage(String message);
void sendMessage(List<String> messages);
2018-02-11 00:59:21 +01:00
void sendFancyMessage(FancyMessage message);
2018-02-11 00:59:21 +01:00
void sendFancyMessage(List<FancyMessage> message);
int getMapHeight();
2018-02-11 00:59:21 +01:00
void setMapHeight(int height);
boolean isOnlineAndVisibleTo(Player me);
void remove();
boolean isOffline();
2015-05-25 06:42:31 +02:00
boolean isFlying();
2018-03-04 23:13:32 +01:00
void setFlying(boolean fly);
2018-03-04 23:13:32 +01:00
void setFFlying(boolean fly, boolean damage);
2018-03-04 23:13:32 +01:00
boolean canFlyAtLocation();
2018-03-04 23:13:32 +01:00
boolean canFlyAtLocation(FLocation location);
2018-03-04 23:13:32 +01:00
boolean isEnteringPassword();
2018-03-26 23:43:15 +02:00
void setEnteringPassword(boolean toggle, String warp);
2018-03-26 23:43:15 +02:00
String getEnteringWarp();
2018-03-26 23:43:15 +02:00
boolean checkIfNearbyEnemies();
2018-03-26 23:43:15 +02:00
int getCooldown(String cmd);
2019-06-02 20:28:42 +02:00
void setCooldown(String cmd, long cooldown);
2019-06-02 20:28:42 +02:00
boolean isCooldownEnded(String cmd);
2019-06-02 20:28:42 +02:00
2018-03-26 23:43:15 +02:00
// -------------------------------
// Warmups
// -------------------------------
2015-05-25 06:42:31 +02:00
boolean isWarmingUp();
WarmUpUtil.Warmup getWarmupType();
void addWarmup(WarmUpUtil.Warmup warmup, int taskId);
void stopWarmup();
void clearWarmup();
2015-05-25 06:42:31 +02:00
2018-03-26 23:43:15 +02:00
}