Only owner can build warehouse
wyattzastrow opened this issue ยท 3 comments
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
- Be an officer at a colony with no warehouse.
- Try and place a warehouse with the building tool.
- Get error message.
- Profit
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.