Solved Check if a block was placed by a player

Discussion in 'Plugin Development' started by YoFuzzy3, Jan 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    YoFuzzy3

    What is the most efficient and/or easiest way of checking this? Also accounting for all blocks that existed before the plugin was even installed on the server.
     
  2. Offline

    MinecraftSped I steal plugins as my own

    I don't know how to check BUT it is impossible to check the blocks before the plugin was installed.
     
  3. You can monitor block placements by listening the the BlockPlaceEvent.

    However short of using your plugin to log block placements there is no way to select a block and naturally determine if it was placed by a player or not.
     
  4. Offline

    YoFuzzy3

    There must be another way. :/
     
  5. Unfortunately there isn't. What are you trying to achieve with your plugin?
     
  6. Offline

    YoFuzzy3

    Basically you get exp towards certain things by breaking certain blocks, but currently you can just break/place a block over and over to exploit that. Doesn't mcMMO manage to do what I'm after, or is that also only after the plugin is installed? The only reason why I don't want to make a list of the player-placed blocks is because it would end up being huge and probably affect performance.
     
  7. Offline

    Cjreek

    I've got an idea how you somehow could check if the block was placed by a player even before the plugin was installed...
    You could create a copy of the world with the same seed. And if a player breaks a block you lookup the block type of the block in your copy of the world. If they are the same the block probably is not placed by a player.
    You should also log the blocks broken by players since your plugin was installed.

    This idea is kinda ugly but it's the closest solution I can think of.
     
  8. Offline

    YoFuzzy3

    That doesn't really work, for example you can just place/break diamond ore in the space of where natural diamond ore was and exploit the system. Although I guess if you combined that system with the block place list it would be fail-safe (maybe).
     
  9. Offline

    Terradominik

    i know this isn't the answer of your startquestion, but related to your latest posts you could rethink the way you do it in you plugin, if you want to give xp like in vanilla for ores you could listen to the blockbreak event and if it's a certain block, and the drop isn't a block/the sam block you give the xp (because than the player can't abuse it by replacing the block)
     
    YoFuzzy3 likes this.
  10. Offline

    YoFuzzy3

    That's a brilliant idea, thank you!
     
    Terradominik likes this.
Thread Status:
Not open for further replies.

Share This Page