JimiIT92 / UniverseGuard2

An easy to use world protection plugin for Sponge
https://ore.spongepowered.org/Francesco_Jimi/Universe-Guard
GNU General Public License v3.0
19 stars 3 forks source link

Water Pickup issue #148

Closed DingDongDIngles closed 3 years ago

DingDongDIngles commented 3 years ago

Whenever I try to pickup water in a bucket it doesn't let people who aren't op. Not sure what flag its under for some reason.

Vulant commented 3 years ago

Make sure spawn protection isn't the case. I feel like that may be the reason why as you mention OP.

Try to pickup water in a bucket somewhere far far away from spawn or set spawn protection to 0 in your server.properties

JimiIT92 commented 3 years ago

Sounds similar to this bug https://github.com/JimiIT92/UniverseGuard2/issues/145 As I said there it might be the destroy flag interfering with this. If so I might change the behavior just for buckets so they are handled by the flowing flags as well

hypersmc commented 3 years ago

@JimiIT92 I'm using 2.32 and my users can't pick up any fluids /rg flag flag destry true still doesn't make it work

JimiIT92 commented 3 years ago

@JimiIT92 I'm using 2.32 and my users can't pick up any fluids /rg flag flag destry true still doesn't make it work

Understand. Will try different combinations with destroy/flag/waterflow flags to see when this occurs 👍🏼

MatessCZ commented 3 years ago

Hi, experiencing same bug, I even tried to add bucket to list of allowed items, tried to exclude water from region but still non-OP-players cant pick it up. At least bucket gets filled up.

SimonMage commented 3 years ago

Ciao, scusa il disturbo. Potrei sapere quando sarà possibile il download di una versione che ripara anche solo questo problema? Non permettendo ai player di prendere l'acqua mi obbliga a rimuovere il plugin ma non voglio perché questo plugin mi piace molto.

PS: So che non è la sezione giusta, ma potresti aggiungere la flag "blocked-cmds" per bloccare i comandi? Sarebbe molto utile. Saluti :)

hypersmc commented 3 years ago

Ciao, scusa il disturbo. Potrei sapere quando sarà possibile il download di una versione che ripara anche solo questo problema? Non permettendo ai player di prendere l'acqua mi obbliga a rimuovere il plugin ma non voglio perché questo plugin mi piace molto.

PS: So che non è la sezione giusta, ma potresti aggiungere la flag "blocked-cmds" per bloccare i comandi? Sarebbe molto utile.

Saluti :)

@SimonMage uh? English?

SimonMage commented 3 years ago

Hi, sorry for bothering you. May I know when it will be possible to download a version that fixes this problem alone? Not allowing the players to take the water forces me to remove the plugin but I don't want to because I really like this plugin.

PS: So that's not the right section, but could you add the "block-cmds" flag to block commands? It would be very useful. Greetings :)

--;English Version;--

hypersmc commented 3 years ago

Hi, sorry for bothering you. May I know when it will be possible to download a version that fixes this problem alone? Not allowing the players to take the water forces me to remove the plugin but I don't want to because I really like this plugin.

PS: So that's not the right section, but could you add the "block-cmds" flag to block commands? It would be very useful.

Greetings :)

--;English Version;--

@SimonMage there is no current fix for it. For now you will have to uninstall it or wait for an update to happen.

Vulant commented 3 years ago

Hey Jim,

I can pick up water but it will tell me that I don't have permission to do that, and it gives me the bucket of water HOWEVER the water is still there. No this is not an infinite water source, I made a 1x1x1 hole to test this. Oddly enough, the same message appears with placing down lilypads, except with lilypads I actually can't place them down. It will appear on client-side but upon relog it will be gone. I didn't see a message for boats though.

This happens anywhere in the world, whether in a region or not.

benllben commented 3 years ago

Hey @JimiIT92, I have managed to locate the issue that is preventing water from being picked up.

By commenting out some code in the FlagDestoryListener, I was now able to pick up water as intended.

public void onBlockDestroyedByPlayer(ChangeBlockEvent.Break event) {
    if (!event.getTransactions().isEmpty()) {
        BlockSnapshot block = event.getTransactions().get(0).getOriginal();
        BlockType type = block.getState().getType();
        if(event.getContext().containsKey(EventContextKeys.PISTON_EXTEND) ||
                event.getContext().containsKey(EventContextKeys.PISTON_RETRACT) ||
                type == BlockTypes.PISTON_EXTENSION ||
                type == BlockTypes.PISTON_HEAD) {
            return;
        }
        if (block.getLocation().isPresent() &&
                event.getContext().containsKey(EventContextKeys.SPAWN_TYPE) &&
                event.getContext().get(EventContextKeys.SPAWN_TYPE).get() != SpawnTypes.CUSTOM &&
                (event.getContext().containsKey(EventContextKeys.OWNER) || event.getContext().containsKey(EventContextKeys.PLAYER_BREAK))) {
            Player player = event.getCause().first(Player.class).orElse(null);
            Region region = RegionUtils.getRegion(block.getLocation().get());
            /*if(region != null && FlagUtils.isExcludedFromDestroy(region, type)
                    && (player == null || !PermissionUtils.hasPermission(player, RegionPermission.REGION))) {
                if(region.getFlag(EnumRegionFlag.DESTROY)) {
                    event.setCancelled(true);
                    MessageUtils.sendHotbarErrorMessage(player, RegionText.NO_PERMISSION_REGION.getValue());
                }
            } else {*/
                this.handleEvent(event, block.getLocation().get(), player);
            //}
        }
    }
}

I hope this helps you out with diagnosing the underlying issue.

JimiIT92 commented 3 years ago

Ciao, scusa il disturbo. Potrei sapere quando sarà possibile il download di una versione che ripara anche solo questo problema? Non permettendo ai player di prendere l'acqua mi obbliga a rimuovere il plugin ma non voglio perché questo plugin mi piace molto.

PS: So che non è la sezione giusta, ma potresti aggiungere la flag "blocked-cmds" per bloccare i comandi? Sarebbe molto utile. Saluti :)

Ciao, per la prima domanda ti direi a breve, sto già analizzando il problema. Per la seconda c'è già la possibilità di bloccare comandi all'interno di una regione, trovi la documentazione qui: https://github.com/JimiIT92/UniverseGuard2/wiki/rg-command

JimiIT92 commented 3 years ago

Hey @JimiIT92, I have managed to locate the issue that is preventing water from being picked up.

By commenting out some code in the FlagDestoryListener, I was now able to pick up water as intended.

public void onBlockDestroyedByPlayer(ChangeBlockEvent.Break event) {
  if (!event.getTransactions().isEmpty()) {
      BlockSnapshot block = event.getTransactions().get(0).getOriginal();
      BlockType type = block.getState().getType();
      if(event.getContext().containsKey(EventContextKeys.PISTON_EXTEND) ||
              event.getContext().containsKey(EventContextKeys.PISTON_RETRACT) ||
              type == BlockTypes.PISTON_EXTENSION ||
              type == BlockTypes.PISTON_HEAD) {
          return;
      }
      if (block.getLocation().isPresent() &&
              event.getContext().containsKey(EventContextKeys.SPAWN_TYPE) &&
              event.getContext().get(EventContextKeys.SPAWN_TYPE).get() != SpawnTypes.CUSTOM &&
              (event.getContext().containsKey(EventContextKeys.OWNER) || event.getContext().containsKey(EventContextKeys.PLAYER_BREAK))) {
          Player player = event.getCause().first(Player.class).orElse(null);
            Region region = RegionUtils.getRegion(block.getLocation().get());
            /*if(region != null && FlagUtils.isExcludedFromDestroy(region, type)
                  && (player == null || !PermissionUtils.hasPermission(player, RegionPermission.REGION))) {
                if(region.getFlag(EnumRegionFlag.DESTROY)) {
                    event.setCancelled(true);
                    MessageUtils.sendHotbarErrorMessage(player, RegionText.NO_PERMISSION_REGION.getValue());
                }
            } else {*/
                this.handleEvent(event, block.getLocation().get(), player);
            //}
      }
  }
}

I hope this helps you out with diagnosing the underlying issue.

Thank you for the hint ;)

JimiIT92 commented 3 years ago

Version 2.33 should now fix the fluid pickup issue. The pickup logic is now handled by the corresponding flow flag https://ore.spongepowered.org/Francesco_Jimi/Universe-Guard/versions/2.33