This commit is contained in:
Jesse Boyd 2015-01-16 22:25:54 -08:00
parent 101cd6b114
commit d958f57375
3 changed files with 10 additions and 6 deletions

View File

@ -575,10 +575,11 @@ import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
* @return true if successful * @return true if successful
*/ */
public static boolean teleportPlayer(final Player player, final Location from, final Plot plot) { public static boolean teleportPlayer(final Player player, final Location from, final Plot plot) {
final PlayerTeleportToPlotEvent event = new PlayerTeleportToPlotEvent(player, from, plot); Plot bot = PlayerFunctions.getBottomPlot(player.getWorld(), plot);
final PlayerTeleportToPlotEvent event = new PlayerTeleportToPlotEvent(player, from, bot);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
final Location location = PlotHelper.getPlotHome(Bukkit.getWorld(plot.world), plot); final Location location = PlotHelper.getPlotHome(Bukkit.getWorld(bot.world), bot);
if ((location.getBlockX() >= 29999999) || (location.getBlockX() <= -29999999) || (location.getBlockZ() >= 299999999) || (location.getBlockZ() <= -29999999)) { if ((location.getBlockX() >= 29999999) || (location.getBlockX() <= -29999999) || (location.getBlockZ() >= 299999999) || (location.getBlockZ() <= -29999999)) {
event.setCancelled(true); event.setCancelled(true);
return false; return false;

View File

@ -65,7 +65,7 @@ public class Home extends SubCommand {
if ((temp = isAlias(args[0])) != null) { if ((temp = isAlias(args[0])) != null) {
if (temp.hasOwner()) { if (temp.hasOwner()) {
if (temp.getOwner().equals(UUIDHandler.getUUID(plr))) { if (temp.getOwner().equals(UUIDHandler.getUUID(plr))) {
PlotMain.teleportPlayer(plr, plr.getLocation(), temp); teleportPlayer(plr, temp);
return true; return true;
} }
} }
@ -79,11 +79,16 @@ public class Home extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER); PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
return false; return false;
} }
PlotMain.teleportPlayer(plr, plr.getLocation(), plots[id - 1]); teleportPlayer(plr, plots[id - 1]);
return true; return true;
} else { } else {
PlayerFunctions.sendMessage(plr, C.NO_PLOTS); PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
return true; return true;
} }
} }
public void teleportPlayer(Player player, Plot plot) {
PlotMain.teleportPlayer(player, player.getLocation(), plot);
}
} }

View File

@ -61,7 +61,6 @@ public abstract class PlotWorld {
public final static boolean WORLD_BORDER_DEFAULT = false; public final static boolean WORLD_BORDER_DEFAULT = false;
// TODO make this configurable // TODO make this configurable
// make non static and static_default_valu + add config option // make non static and static_default_valu + add config option
@SuppressWarnings("deprecation")
public static List<Material> BLOCKS; /* public static List<Material> BLOCKS; /*
* = * =
* new * new
@ -258,7 +257,6 @@ public abstract class PlotWorld {
*/ */
static { static {
// TODO: Let jesse decide if this is stupid or not
BLOCKS = new ArrayList<>(); BLOCKS = new ArrayList<>();
for (final Material material : Material.values()) { for (final Material material : Material.values()) {
if (material.isBlock() && material.isSolid() && !material.hasGravity() && !material.isTransparent() && material.isOccluding() && (material != Material.DROPPER)) { if (material.isBlock() && material.isSolid() && !material.hasGravity() && !material.isTransparent() && material.isOccluding() && (material != Material.DROPPER)) {