MineColonies

MineColonies

57M Downloads

Only owner can build warehouse

wyattzastrow opened this issue ยท 3 comments

commented

Minecolonies version

version 1.10.2-0.8.1917 or curse 0.7.4.2.1

Expected behavior

  • I'm not sure what permission lets someone place a warehouse, but on the default officer permissions, an officer should be able to place the warehouse if there isn't one placed.

Actual behavior

  • I'm not the owner of the colony but an officer with default permissions and when I use the building tool to place the warehouse, it says that there can only be one warehouse in a colony when I click the green checkmark. There were no warehouses in the colony at the time. The owner was able to place the warehouse right after I tried.

Steps to reproduce the problem

  1. Be an officer at a colony with no warehouse.
  2. Try and place a warehouse with the building tool.
  3. Get error message.
  4. Profit
commented

Can confirm this issue by code logic:

private static boolean onWareHousePlaced(final World world, final EntityPlayer player, final BlockPos pos)
    {
        if(onBlockHutPlaced(world, player, pos))
        {
            final IColony colony = ColonyManager.getIColonyByOwner(world, player);
            if(colony != null && (!Configurations.limitToOneWareHousePerColony || !colony.hasWarehouse()))
            {
                return true;
            }
            LanguageHandler.sendPlayerMessage(player, "tile.blockHut.warehouse.limit");
        }
        return false;
    }

Looks like we check if the colony that the placer owns has a warehouse, and not actually the colony they are placing it in has a warehouse. I'm guessing @wyattzastrow doesn't have a colony, so its null in this case (EDIT: I suppose he could have a colony, but it already has a warehouse).

This could lead to a colony potentially having multiple warehouses, if people made their own colony, then placed a warehouse in other peoples colonies.

commented

Yes I didn't have a colony of my own when this occurred.

commented

Same Issue with me.
Owner can place but not officer