mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
async chunk finding
This commit is contained in:
parent
d48e258907
commit
b66a188592
@ -12,6 +12,7 @@ import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -173,20 +174,25 @@ public class RTP {
|
||||
|
||||
private void sendPlayer(final CommandSender sendi, final Player p, final Location loc, final int price,
|
||||
final int attempts) throws NullPointerException {
|
||||
if (sendi != p)
|
||||
checkPH(sendi, p.getDisplayName(), loc, price, false, attempts);
|
||||
if (pl.getText().getTitleSuccessChat())
|
||||
checkPH(p, p.getDisplayName(), loc, price, true, attempts);
|
||||
if (pl.getText().getTitleEnabled())
|
||||
titles(p, loc, attempts);
|
||||
try {
|
||||
//loc.getWorld().loadChunk(loc.getChunk());
|
||||
p.teleport(loc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pl.getText().getSoundsEnabled())
|
||||
sounds(p);
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
if (sendi != p)
|
||||
checkPH(sendi, p.getDisplayName(), loc, price, false, attempts);
|
||||
if (pl.getText().getTitleSuccessChat())
|
||||
checkPH(p, p.getDisplayName(), loc, price, true, attempts);
|
||||
if (pl.getText().getTitleEnabled())
|
||||
titles(p, loc, attempts);
|
||||
try {
|
||||
//loc.getWorld().loadChunk(loc.getChunk());
|
||||
p.teleport(loc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pl.getText().getSoundsEnabled())
|
||||
sounds(p);
|
||||
}
|
||||
}.runTask(pl);
|
||||
}
|
||||
|
||||
private void checkPH(CommandSender sendi, String player, Location loc, int price, boolean sameAsPlayer,
|
||||
|
@ -5,6 +5,7 @@ import me.SuperRonanCraft.BetterRTP.Main;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -124,10 +125,20 @@ public class Commands {
|
||||
if (timer != 0)
|
||||
if (sendi == player)
|
||||
delay = true;
|
||||
pl.getRTP().start(player, sendi, world, biomes, delay);
|
||||
//pl.getRTP().start(player, sendi, world, biomes, delay);
|
||||
tpSync(player, sendi, world, biomes, delay);
|
||||
}
|
||||
}
|
||||
|
||||
private void tpSync(Player player, CommandSender sendi, String world, List<String> biomes, boolean delay) {
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
pl.getRTP().start(player, sendi, world, biomes, delay);
|
||||
}
|
||||
}.runTaskAsynchronously(pl);
|
||||
}
|
||||
|
||||
private boolean checkDelay(CommandSender sendi, Player player) {
|
||||
//Bypassing/Forced?
|
||||
if (sendi != player || pl.getPerms().getBypassCooldown(player))
|
||||
|
Loading…
x
Reference in New Issue
Block a user