yoffset removed for nether world types

This commit is contained in:
SuperRonanCraft
2020-11-23 22:32:15 -05:00
parent c03682b06d
commit d8bd216294
9 changed files with 49 additions and 33 deletions

View File

@@ -30,9 +30,13 @@ public class CmdPlayer implements RTPCommand, RTPCommandHelpable {
else
usage(sendi, label);
else if (args.length >= 3)
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline())
getCmd().tp(Bukkit.getPlayer(args[1]), sendi, Bukkit.getWorld(args[2]).getName(), getCmd().getBiomes(args, 3, sendi), RTP_TYPE.FORCED);
else if (Bukkit.getPlayer(args[1]) != null)
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline()) {
World world = Bukkit.getWorld(args[2]);
if (world != null) {
getCmd().tp(Bukkit.getPlayer(args[1]), sendi, world.getName(), getCmd().getBiomes(args, 3, sendi), RTP_TYPE.FORCED);
} else
BetterRTP.getInstance().getText().getNotExist(sendi, args[2]);
} else if (Bukkit.getPlayer(args[1]) != null)
getCmd().playerNotOnline(sendi, args[1]);
else
usage(sendi, label);

View File

@@ -52,7 +52,7 @@ public class RTPPlayer {
//Valid location?
if (tpLoc != null && checkDepends(tpLoc)) {
if (getPl().getEco().charge(p, pWorld)) {
settings.teleport.sendPlayer(sendi, p, tpLoc, pWorld.getPrice(), pWorld.getAttempts(), type);
settings.teleport.sendPlayer(sendi, p, tpLoc, pWorld.getPrice(), pWorld.getAttempts(), type, pWorld.getWorldtype());
}
} else
randomlyTeleport(sendi);

View File

@@ -13,9 +13,10 @@ import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.angeschossen.lands.api.integration.LandsIntegration;
import me.angeschossen.lands.api.land.Land;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Location;
import org.kingdoms.constants.land.Land;
//import org.kingdoms.constants.land.Land;
public class RTPPluginValidation { //Safe locations depending on enabled dependencies
@@ -147,8 +148,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean result = true;
if (getPl().getSettings().getsDepends().isKingdomsX())
try {
Land land = Land.getLand(loc);
result = land == null || !land.isClaimed();
//Land land = Land.getLand(loc);
//result = land == null || !land.isClaimed();
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -3,6 +3,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
import io.papermc.lib.PaperLib;
import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.SuperRonanCraft.BetterRTP.references.customEvents.*;
import me.SuperRonanCraft.BetterRTP.references.worlds.WORLD_TYPE;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
@@ -42,7 +43,7 @@ public class RTPTeleport {
// }
void sendPlayer(final CommandSender sendi, final Player p, final Location location, final int price,
final int attempts, RTP_TYPE type) throws NullPointerException {
final int attempts, RTP_TYPE type, WORLD_TYPE worldType) throws NullPointerException {
Location oldLoc = p.getLocation();
loadingTeleport(p, sendi); //Send loading message to player who requested
List<CompletableFuture<Chunk>> asyncChunks = getChunks(location); //Get a list of chunks
@@ -52,7 +53,7 @@ public class RTPTeleport {
@Override
public void run() {
try {
RTP_TeleportEvent event = new RTP_TeleportEvent(p, location);
RTP_TeleportEvent event = new RTP_TeleportEvent(p, location, worldType);
getPl().getServer().getPluginManager().callEvent(event);
Location loc = event.getLocation();
PaperLib.teleportAsync(p, loc).thenRun(new BukkitRunnable() { //Async teleport

View File

@@ -1,5 +1,6 @@
package me.SuperRonanCraft.BetterRTP.references.customEvents;
import me.SuperRonanCraft.BetterRTP.references.worlds.WORLD_TYPE;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@@ -9,11 +10,13 @@ public class RTP_TeleportEvent extends Event {
Player p;
Location loc;
WORLD_TYPE worldType;
private static final HandlerList handler = new HandlerList();
public RTP_TeleportEvent(Player p, Location loc) {
public RTP_TeleportEvent(Player p, Location loc, WORLD_TYPE worldType) {
this.p = p;
this.loc = loc;
this.worldType = worldType;
}
public Player getPlayer() {
@@ -36,4 +39,8 @@ public class RTP_TeleportEvent extends Event {
public void changeLocation(Location loc) {
this.loc = loc;
}
public WORLD_TYPE getWorldType() {
return worldType;
}
}