Right click .schematic

Discussion in 'Plugin Development' started by Banjer_HD, May 6, 2016.

Thread Status:
Not open for further replies.
  1. Hello,
    I need help to check if a player right clicks a .schematic...
    Thank you in advance
     
  2. Online

    timtower Administrator Administrator Moderator

    @Banjer_HD Get the block, loop through the schematics, check if the block is in one of them.
    My suggestion would be saving the schematic instances in the world with their locations, then it will be very easy to check, also for break protection if needed.
     
  3. @timtower What is the best way of checking if it is the same as in the world?
     
  4. Online

    timtower Administrator Administrator Moderator

    @Banjer_HD You go through the instances that you have saved, check the locations.
     
  5. @timtower
    I am new to java.. (I an a nub now xD)
    How to do that?
     
  6. Online

    timtower Administrator Administrator Moderator

    @Banjer_HD You know where you place the schematic.
    You get every block of the just placed thing.
    You store the locations of those blocks.

    When somebody clicks you check the locations, if they match: do whatever you need it to do.
     
  7. @timtower
    I cant get all the block locations... how do you do that?
    (Sorry i am a java NUB)
    (Thank you for all you reply's ;))
    Code:java
    1.  
    2. try {
    3. Location location = b.getLocation();
    4. if(new File("plugins/CraftOfClans/schematics/ElixirP1.schematic").exists()) {
    5. File dir = new File("plugins/CraftOfClans/schematics/ElixirP1.schematic");
    6.  
    7. EditSession es = new EditSession(new BukkitWorld(e.getPlayer().getWorld()), 999999999);
    8. es.enableQueue();
    9.  
    10. SchematicFormat sc = SchematicFormat.getFormat(dir);
    11. CuboidClipboard clip = sc.load(dir);
    12.  
    13. clip.paste(es, BukkitUtil.toVector(location), true);
    14. es.flushQueue();
    15.  
     
  8. Online

    timtower Administrator Administrator Moderator

    @Banjer_HD You know what you place and where you place it.
    Try to get the last changes in that area.
     
Thread Status:
Not open for further replies.

Share This Page