Spigot ProtectionStones [Updated for 1.13 - 1.17 + WG7] 2.8.5

The easiest grief prevention method that players will enjoy!

  1. Could you explain what you mean by conflict? Higher priorities override settings of lower priorities. However, the setting needs to actually be set, or else it will inherit whatever the lower priority setting is.
     
  2. Once I have time to investigate and if I'm unable to duplicate this bug I may message you
     
  3. Hmm, you're unable to uncancel the event? Weird...

    Use createPSRegion at your own risk though, as it will run a lot of checks and also send messages directly to the player. The method will not actually place the block literally so if that is not happening, you need to do it manually (setType)

    Also, I realized that there is a WorldGuard check in the code (createPSRegion(BlockPlaceEvent)), so that may be causing issues for you if the player is not permitted to place a block there by WorldGuard. If it is, then you'll probably want to call the second createPSRegion method directly, which skips the check.
     
  4. Could you provide an example of how to use createPSRegion in the code?

    This is my actual code:
    Code (Text):
        @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
        public void onPlaceBlock(BlockPlaceEvent e) {
            LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(e.getPlayer());
            RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
            RegionQuery query = container.createQuery();
            ProtectedRegion pr = main.getRegion(null, e.getBlock().getLocation(), "", false);
            {
                if (pr == null
                        && query.queryState(BukkitAdapter.adapt(e.getBlock().getLocation()), localPlayer,
                                Main.ProtFlag) == State.ALLOW
                        && ProtectionStones.isProtectBlockItem(e.getItemInHand(), true)) {
                    e.getPlayer().sendMessage("Block is inside region");
                    e.setBuild(true);
                    e.setCancelled(false);
                }
            }
        }
     
  5. I haven't tested this but this is an idea. I just realized createPSRegion is not public so it is not accessible from the API.

    Code (Text):


    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
    public void onPlaceBlock(BlockPlaceEvent e) {
        Block b = e.getBlock();
        if (ProtectionStones.isProtectBlockType(b) && ProtectionStones.isProtectBlockItem(e.getItemInHand(), true)) {
            e.setCancelled(false);
            Method m = BlockHandler.class.getDeclaredMethod("createPSRegion");
            m.setAccessible(true);
            m.invoke(new BlockHandler(), e.getPlayer(), e.getPlayer().getLocation(), ProtectionStones.getBlockOptions(b));
        }
    }

     
    Something like that, it uses reflection to call a private method. I should probably make it public in 2.6.6, and then you won't need reflection.
     
  6. It doesn't work.
    upload_2020-1-26_17-53-1.png
     
  7. Ah right BlockHandler is also not public. You'll have to use reflection to also set the BlockHandler class to be public.

    What I'm probably going to do is just add a method to call BlockHandler in ProtectionStones in 2.6.6 when my exams are done (in 4-5 days). if you have time, you can search how to use reflection to make the class public but I don't have time right now, sorry.
     
  8. I have a city with a worldguard region callen dontmine in the Y= -30 - bedrock.
    I am trying to put a ps up that i like that works in the Y=20 - sky
    But it do conflicts with the region of dontmine.
     
  9. Again, what do you mean by conflict? Is there a message?
     
  10. Yes a message that i cant place the ps in that zone because override with other protection, the other protection is the region of worldguard.
     
  11. ahh
    Is the player that is placing an owner of the other region?
     
  12. no, because the other region only have access the staff.
    I like disable mine in the layer < 30.
    And i like use a region and the ps over the >30
     
  13. Hey man how is the coding proceeding? :)
    I am opening a side project server, and it will probably be based on 1.12. Could PS support that version? Or it would require a major recode (aka not possible)?
     
  14. Okay, so this would require something custom because to overlap, you have to have permission in that region.

    You can try using allow_overlap_unowned_regions though that isn't exactly what you want, so I'll have to look into that.
     
  15. I had to rewrite the entire plugin in order to support to 1.13, so it'll be a lot of work. I don't really have that much time to do that, but if you wanted to try forking you can.

    I am trying to get to 2.7.0 to get taxes on, but I've been struggling to keep up with all of the bug fixes and smaller issue requests
     
    #655 EspiDev, Feb 1, 2020
    Last edited: Feb 2, 2020
  16. o, i will w8 :)
     
    • Like Like x 1
  17. I have other problem, the limit permission dont works...

    I have this in all the player:


    - protectionstones.limit.home1.3
    - protectionstones.limit.home2.1
    - protectionstones.limit.homep1.1
    - protectionstones.limit.homep2.1
    - protectionstones.limit.hometime.0
    - protectionstones.info
    - protectionstones.create
    - protectionstones.destroy
    - protectionstones.view
    - protectionstones.count
    - protectionstones.hide
    - protectionstones.unhide
    - protectionstones.count
    - protectionstones.home
    - protectionstones.sethome
    - protectionstones.members
    - protectionstones.flags
    - protectionstones.toggle
    - protectionstones.limit.3

    it limits to 3 the total, 3 of home1 or 1 of home2

    But if i add this to a vip group:
    - PROTECTION STONES
    - protectionstones.limit.4
    - protectionstones.limit.home1.4

    Stay the limit in 3.

    And if add
    - PROTECTION STONES
    - -protectionstones.limit.3
    - protectionstones.limit.4
    - -protectionstones.limit.home1.3
    - protectionstones.limit.home1.4

    They can put infinite ps...

    IDK where is the error :(
     
  18. Okay I'll look into it, I'm gathering bug fixes for 2.6.6

    Do you know if the issue is with protectionstones.limit.x, or protectionstones.limit.alias.x? Try using only of one them and let me know which one is giving issues
     
  19. ok, now in a minutes i test it :)