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
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
Thanks for your helpfulness, but what do you need the plugin.yml for? It has nothing to do with the location
Just in case you have something wrong
It's been years since I coded plugins. But foam after p.getLocation (). GetY or something.
[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 ();