mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-18 22:24:35 +00:00
Add 2 different getBendingPlayer() to GeneralMethods
This commit is contained in:
parent
ca84318f5a
commit
bf8c4fa3a8
1 changed files with 21 additions and 3 deletions
|
@ -38,6 +38,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -654,12 +655,29 @@ public class GeneralMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a {@link BendingPlayer} from specified player name.
|
* Attempts to get a {@link BendingPlayer} from specified player name.
|
||||||
|
* this method tries to get a {@link Player} object and gets the uuid
|
||||||
|
* and then calls {@link #getBendingPlayer(UUID)}
|
||||||
|
*
|
||||||
* @param player The name of the Player
|
* @param player The name of the Player
|
||||||
* @return The BendingPlayer object if {@link BendingPlayer#players} contains the player name
|
* @return The BendingPlayer object if {@link BendingPlayer#players} contains the player name
|
||||||
|
*
|
||||||
|
* @see #getBendingPlayer(UUID)
|
||||||
*/
|
*/
|
||||||
public static BendingPlayer getBendingPlayer(String player) {
|
public static BendingPlayer getBendingPlayer(String playerName) {
|
||||||
return BendingPlayer.getPlayers().get(player);
|
OfflinePlayer player = Bukkit.getPlayer(playerName);
|
||||||
|
if (player == null) {
|
||||||
|
player = Bukkit.getOfflinePlayer(playerName);
|
||||||
|
}
|
||||||
|
return getBendingPlayer(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BendingPlayer getBendingPlayer(UUID uuid) {
|
||||||
|
return BendingPlayer.getPlayers().get(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BendingPlayer getBendingPlayer(Player player) {
|
||||||
|
return getBendingPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) {
|
public static List<Block> getBlocksAlongLine(Location ploc, Location tloc, World w) {
|
||||||
|
|
Loading…
Reference in a new issue