Store Who Placed A Block ?

Discussion in 'Plugin Development' started by Notorious-Riddler, Jul 24, 2013.

Thread Status:
Not open for further replies.
  1. What would i use to store who placed a specific block

    and then send a player a message who placed it.
  2. Offline


    Notorious-Riddler If there are many Blocks beeing placed at your Server you should use an MySQL Database and save the location of the block with the information of the Player that placed the block. You can get all this Information at BlockPlaceEvent.
  3. @etaxi cant i store the player who placed the block in life a String or hashmap or a file rather than using MySQL
  4. Offline


    Notorious-Riddler You can save this in a hashmap but then the data would be lost on restart. And if you store it in a file your Server may lag.
  5. etaxi341 The problem is that i dont know how to use MySQL
  6. Offline


    You can store data in a List<T> or Hashmap, but you need to perform serialization to keep the data across restarts.

    If you wish to go this route, look here:
  7. Offline


  8. Offline


    Can't you use Metadata for this? I don't think it's persistent though.
  9. That's what I always use to store things like this. I can post the code here later, if anyone's interested.
  10. i'd like to know how you can store data in externel files (textfiles)
  11. Assist please do !!!!!!!!


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 3, 2016
  12. Offline


    Bumping within 24 hours is not allowed.

    Everyone has given useful information on this thread, you have no reason to bump anyway

  13. Are you a mod ?
  14. Offline


    Notorious-Riddler No he is not but the rules say you are only allowed to bump every 24 hours.
  15. Offline


    Moderators have a little bar under their username that says Moderator. I think anyone that is staff, part of the bukkit team, did the bukkit docs (Sagacious_Zed) or administrator can make a final decision on a rule. I am not one, however I can inform you of the rules, or maybe a report for somethig more serious.

    I think anyone can agree that after all these people have posted good answers you can at least try one of them instead of bumping.
  16. Offline


    I would love if someone posted a tutorial over MetaData in the Resources section.
  17. save it in a hashmap, and on server shutdown, save it to a file. i do this with a lot of my plugins.

  18. then you can help me:

  19. Here is all the info you need. Create a new class and call it IO, paste this and use the stuff on the bottom inside on enable and disable.

    1. import;
    2. import;
    3. import;
    4. import;
    6. public class IO
    7. {
    8. public static void save(Object obj,String path) throws Exception
    9. {
    10. oos.writeObject(obj);
    11. oos.flush();
    12. oos.close();
    13. }
    14. public static Object load(String path) throws Exception
    15. {
    16. Object result = ois.readObject();
    17. ois.close();
    18. return result;
    19. }
    20. }
    21. //saving:, "path.bin");
    22. //loading: Object = (ObjectMap<object stuff>)IO.load("path.bin");
  20. EDIT: Re-writing code.
Thread Status:
Not open for further replies.

Share This Page