Closed 42Willow closed 1 year ago
Sounds like a perfect addon if someone wants to make it.
Here's my initial untested thoughts on how one could possibly implement it:
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (!getConfig().getBoolean("hide-if-under-blocks")) {
return; // feature disabled
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getWorld().equals(to.getWorld()) &&
from.getBlockX() == to.getBlockX() &&
from.getBlockY() == to.getBlockY() &&
from.getBlockZ() == to.getBlockZ()) {
return; // did not move
}
boolean underBlocks = to.getWorld().getHighestBlockYAt(to) > to.getBlockY() + 1;
Pl3xMap.api().getPlayerRegistry().optional(event.getPlayer().getUniqueId())
.ifPresent(player -> player.setHidden(underBlocks, false));
}
@EventHandler
public void onPlayerSneak(PlayerToggleSneakEvent event) {
if (!getConfig().getBoolean("hide-if-sneaking")) {
return; // feature disabled
}
Pl3xMap.api().getPlayerRegistry().optional(event.getPlayer().getUniqueId())
.ifPresent(player -> player.setHidden(event.isSneaking(), false));
}
Thanks time to learn java use github copilot
I'll work on this.
Thanks time to ~learn java~ use github copilot
I'll work on this.
That's a lazy method of doing itπ But hey, instead of relying solely on GitHub Copilot, why not dive into learning Java yourself? Trust me, AI can be a little mischievous at times and might lead you down a confusing path. Let's come together and conquer Java by truly understanding it, making mistakes, and learning from them. United we stand, united we learn Java like true champions! ππ
(I'm not only kidding here, you should seriously learn java.)
Thanks time to ~learn java~ use github copilot I'll work on this.
That's a lazy method of doing itπ But hey, instead of relying solely on GitHub Copilot, why not dive into learning Java yourself? Trust me, AI can be a little mischievous at times and might lead you down a confusing path. Let's come together and conquer Java by truly understanding it, making mistakes, and learning from them. United we stand, united we learn Java like true champions! ππ
(I'm not only kidding here, you should seriously learn java.)
I'll try it :)
maybe if someone doesn't do it for me :/