有没有办法让玩家在协调时提供特定项目?

is there any way to make player give specific items when in the coords?

我正在制作我的自定义插件,我想做一件事:

当玩家处于指定的 region/coords 时,例如从 0、60、0 到 50、80、50 设置玩家库存清除

在全球范围内,您必须检查它是否在移动之前不在,以及它是否会在移动之后。

你可以这样做:

@EventHandler
public void onMove(PlayerMoveEvent e) { // when move
    if(e.isCancelled())
        return;
    
    if(!isLocIn(e.getFrom()) && isLocIn(e.getTo())) { // if was not in but will be in
        e.getPlayer().getInventory().clear(); // clear inventory
    }
}

private boolean isLocIn(Location loc) {
    // enter min & max values
    int minX = 0, minY = 60, minZ = 0;
    int maxX = 50, maxY = 80, maxZ = 50;
    
    // get content from given loc
    double x = loc.getX();
    double y = loc.getY();
    double z = loc.getZ();
    
    return x > minX && x < maxX && y > minY && y < maxY && z > minZ && z < maxZ; // check in x/y/z are more than min and lower than max
}