mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Moved a method to use User instead of Player.
This commit is contained in:
parent
1f92c2b60e
commit
06dec42029
@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@ -194,11 +195,27 @@ public class User {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's game mode
|
||||
* @param mode
|
||||
*/
|
||||
public void setGameMode(GameMode mode) {
|
||||
player.setGameMode(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleports user to this location. If the user is in a vehicle, they will exit first.
|
||||
* @param location
|
||||
*/
|
||||
public void teleport(Location location) {
|
||||
player.teleport(location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current world this entity resides in
|
||||
* @return World
|
||||
*/
|
||||
public World getWorld() {
|
||||
return player.getWorld();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class IslandSethomeCommand extends CompositeCommand {
|
||||
user.sendMessage("general.errors.no-island");
|
||||
return true;
|
||||
}
|
||||
if (!getPlugin().getIslands().playerIsOnIsland(user.getPlayer())) {
|
||||
if (!getPlugin().getIslands().playerIsOnIsland(user)) {
|
||||
user.sendMessage("commands.island.sethome.must-be-on-your-island");
|
||||
return true;
|
||||
}
|
||||
|
@ -685,19 +685,19 @@ public class IslandsManager {
|
||||
|
||||
/**
|
||||
* Checks if a location is within the home boundaries of a player. If coop is true, this check includes coop players.
|
||||
* @param player
|
||||
* @param uuid
|
||||
* @param coop
|
||||
* @param loc
|
||||
* @return true if the location is within home boundaries
|
||||
* @return
|
||||
*/
|
||||
public boolean locationIsAtHome(final Player player, boolean coop, Location loc) {
|
||||
public boolean locationIsAtHome(UUID uuid, boolean coop, Location loc) {
|
||||
// Make a list of test locations and test them
|
||||
Set<Location> islandTestLocations = new HashSet<Location>();
|
||||
if (plugin.getPlayers().hasIsland(player.getUniqueId()) || plugin.getPlayers().inTeam(player.getUniqueId())) {
|
||||
islandTestLocations.add(plugin.getIslands().getIslandLocation(player.getUniqueId()));
|
||||
if (plugin.getPlayers().hasIsland(uuid) || plugin.getPlayers().inTeam(uuid)) {
|
||||
islandTestLocations.add(plugin.getIslands().getIslandLocation(uuid));
|
||||
// If new Nether
|
||||
if (Settings.netherGenerate && Settings.netherIslands && IslandWorld.getNetherWorld() != null) {
|
||||
islandTestLocations.add(netherIsland(plugin.getIslands().getIslandLocation(player.getUniqueId())));
|
||||
islandTestLocations.add(netherIsland(plugin.getIslands().getIslandLocation(uuid)));
|
||||
}
|
||||
}
|
||||
// TODO: Check coop locations
|
||||
@ -817,21 +817,21 @@ public class IslandsManager {
|
||||
* @param player
|
||||
* @return true if on valid island, false if not
|
||||
*/
|
||||
public boolean playerIsOnIsland(final Player player) {
|
||||
return playerIsOnIsland(player, true);
|
||||
public boolean playerIsOnIsland(User user) {
|
||||
return playerIsOnIsland(user, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an online player is in the protected area of their island, a team island or a
|
||||
* coop island
|
||||
* @param player
|
||||
* @param user
|
||||
* @param coop - if true, coop islands are included
|
||||
* @return true if on valid island, false if not
|
||||
*/
|
||||
public boolean playerIsOnIsland(final Player player, boolean coop) {
|
||||
return locationIsAtHome(player, coop, player.getLocation());
|
||||
public boolean playerIsOnIsland(User user, boolean coop) {
|
||||
return locationIsAtHome(user.getUniqueId(), coop, user.getLocation());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param location
|
||||
*/
|
||||
@ -969,5 +969,4 @@ public class IslandsManager {
|
||||
islandCache.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user