LukeDarling / iProtector

A PocketMine plugin
20 stars 53 forks source link

When "edit":false, can break blocks, cannot place blocks. #27

Open markkrueg opened 8 years ago

markkrueg commented 8 years ago

I have a fresh world. Spawn protection is set to 0. I am not op. I am not "bob". The config.yml file is set to defaults.This is my areas.json:

[{"name":"test","flags":{"edit":false,"god":true,"touch":true},"pos1":[137,1,162],"pos2":[153,127,172],"level":"world","whitelist":["bob"]}]

When standing at 143, 67, 164 I am able to break blocks. I am not able to PvP. I am not able to place blocks.

I should not be able to break blocks when edit is false; right?

# Config file for iProtector by LDX;

# Settings for unprotected areas in worlds without specific settings:
Default:

  # Keep players from getting hurt?
  God: false

  # Keep players from editing the world?
  Edit: false

  # Keep players from touching blocks and activating things like chests?
  Touch: false

# Settings for unprotected areas in individual worlds:
Worlds:

  world:

    # Keep players from getting hurt?
    God: false

    # Keep players from editing the world?
    Edit: false

    # Keep players from touching blocks and activating things like chests?
    Touch: false
LukeDarling commented 8 years ago

...and now I see why people get so confused, and also a flaw in the way events are fired in PocketMine...

LukeDarling commented 8 years ago

The edit flag is short for "Edit protection", although this will be changed soon. If you want to disable breaking and placing blocks, you must set edit to true. As for the placing blocks, there's nothing you can do but disable touch protection. When you place a block, PocketMine fires both a BlockPlaceEvent and a PlayerInteractEvent, so if either touch or edit is enabled, you will be unable to place blocks. I'll brainstorm for a while and see if I can think of a way around this, but if there is one, it won't be simple.

P.S. Thanks for the donation, much appreciated. 😁

markkrueg commented 8 years ago

@LDX-MCPE Thanks for your thoughts on this; and I see the issue. I also will test further and brainstorm.

The difficulty is that I will likely have protected areas where I want people to be able to tap on a sign in a shop (EconomySell) or similar actions.

The donation should have come long ago; your work is incredibly helpful to so many.

LukeDarling commented 8 years ago

That problem doesn't exist in reverse, you don't have to worry about things such as sign shops not working. The PlayerInteractEvent fires first, and the BlockPlaceEvent doesn't even get called unless you're holding a block.

LinuxLogo commented 7 years ago

When will this be fixed? This seems to be a crucial issue

LukeDarling commented 7 years ago

@LinuxLogo It is a PocketMine issue. It either has to be fixed in PocketMine's code, or I will have to find a hacky workaround.

LinuxLogo commented 7 years ago

Find hacky way around it plz. Been waiting since the summer for this plugin to like.... ya kno.. work on my prison server. Meaning An area in the prison they need to be able to break. And the rest... welp put it together lmao

markkrueg commented 7 years ago

Or the other alternative would maybe be to try to fix the PocketMine code directly? PMMP has resurrected PocketMine-MP development. @LDX-MCPE Do you have any ideas about how to fix the PM code? Or maybe just a general description of the bug on the forum would get the attention of one of the main developers?

Just a thought :-)