Solved Double chest gives the same coordinates for both sides!?

Discussion in 'Spigot Plugin Development' started by JustBrainless, Apr 1, 2020.

  1. Hey Guys,
    i have the problem that I try to get coordinates from a double chest from the right and left side and both sides give me the same coordinates. Do you have any suggestions what could be the reason?

    Code (Java):
    if(target.getType().equals(Material.CHEST)) {
                            Chest targetChest = (Chest) target.getState();
                            InventoryHolder holder = targetChest.getInventory().getHolder();
                            if(holder instanceof DoubleChest) {
                                //TODO [FIX] Double chest safe
                                //TDC = targetDoubleChest
                                DoubleChest TDC = ((DoubleChest) holder);
                                Chest leftChest = (Chest) TDC.getLeftSide();
                                Chest rightChest = (Chest) TDC.getRightSide();
                                int rightX = rightChest.getLocation().getBlockX();
                                int rightY = rightChest.getLocation().getBlockY();
                                int rightZ = rightChest.getLocation().getBlockZ();
                                int leftX = leftChest.getLocation().getBlockX();
                                int leftY = leftChest.getLocation().getBlockY();
                                int leftZ = leftChest.getLocation().getBlockZ();
                                //right and left side have the same coordinates
                                System.out.println(rightX + " " + rightY + " " + rightZ);
                                System.out.println(leftX + " " + leftY + " " + leftZ);
  2. Try printing out the leftChest and rightChest objects to see if their hash codes are different, also please post the actual output you get with maybe a picture so we can make sure things are correct.