I had a question so i programmed a navigator (for minecraft) and i have a problem it works fine only when i do teleport i have a bug.
Here is a section where the teleport takes place:
if (name.equalsIgnoreCase ("§6Spawn")) {
p.setVelocity (p.getVelocity (). SetY (1.0D));
p.closeInventory ();
try {
Thread.sleep (1000);
} catch (InterruptedException e1) {
e1.printStackTrace ();
}
p.sendMessage ("§cTeleportation successfully carried out, you are now at" + name);
p.teleport (LocationManager.getLocation ("spawn"));
p.playSound (p.getLocation (), Sound.ENDERMAN_TELEPORT, 3, 2);
p.addPotionEffect (new PotionEffect (PotionEffectType.BLINDNESS, 30, 2));
p.sendTitle ("§cTeleportation", "§c§l§nSpawn");
So you can see in the code "p.setVelocity (p.getVelocity (). SetY (1.0D));" the teleport upwards but here is the mistake the inventory is closed first then we wait a second and then the jump is carried out but the jump should close before the inventory and before the teleportation.
My guess is that I did something wrong with the sleeper and I just don't find mistakes.
Is there an error message?
No there's no error message
And what exactly is the error now?
So the player should first close the inventory then the player should jump and then wait a second and then the sound should be played then the effect then the teleport then the text and then the title.
But first we close the inventory and then wait a second and then the jump and then the rest.
Under no circumstances may you use Thread.Sleep there. If you want to wait a second you should use a scheduler
Write that
p.setVelocity (p.getVelocity (). SetY (1.0D));
in the line before the p.teleport ();
Sorry that I did not get in touch but it still does not work. You should be shot first and then tpt if you were shot