Minecraft plugin block coordinates?

Tr
- in Plugins
5

I'm doing a plugin where you are teleported when you are at certain coordinates. The problem: as soon as you are on the block you should be teleported, not only when I'm on the 2nd decimal place on the axis. How can I solve the problem?

LG

How do I check if the player is in this area of one block?

if (p.getLocation (). Equals (PortalHashMap.targetloc. Get (p {

// action

fu

Please send me the whole code of the plugin on https://www.pastebin.com

Then I can tell you how to do it and I need the Plugin.yml too

Tr

Thanks for your helpfulness, but what do you need the plugin.yml for? It has nothing to do with the location

fu

Just in case you have something wrong

ja

It's been years since I coded plugins. But foam after p.getLocation (). GetY or something.

Tr

[SOLVED]

public static Location BlocklocationFromPlayer (Player p) {

World world = p.getWorld ();

double x = p.getLocation (). GetX ();

double y = p.getLocation (). GetY () - 1;

double z = p.getLocation (). GetZ ();

Location loc3 = new location (world, x, y, z);

Block block = loc3.getBlock ();

return block.getLocation ();