• Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server

Bug Report On Block Place Activates Bending

dNiym

Verified Member
Im not sure how long this has existed or if its considered a feature..
BUT, whenever players place blocks it activates bending now, airblast, fireblast, etc.
It would be super nice if this were fixed or made an option that can be turned off!

Version - PK Beta 6
 

Varni1

Verified Member
Im not sure how long this has existed or if its considered a feature..
BUT, whenever players place blocks it activates bending now, airblast, fireblast, etc.
It would be super nice if this were fixed or made an option that can be turned off!

Version - PK Beta 6
Hmm I've seen this happen a lot. I believe it's just a bug that needs attending, but the best way to prevent this on-block-place thing is to toggle your bending.
 

dNiym

Verified Member
Hmm I've seen this happen a lot. I believe it's just a bug that needs attending, but the best way to prevent this on-block-place thing is to toggle your bending.

A lot if not all of our players use bending while building, airspout/waterspout etc so having them toggle isn't a super good option. They aren't real happy when they firejet off a cliff when placing a block on the ground either..
 

Varni1

Verified Member
A lot if not all of our players use bending while building, airspout/waterspout etc so having them toggle isn't a super good option. They aren't real happy when they firejet off a cliff when placing a block on the ground either..
True, that has happened to me several times. I usually don't bother to toggle my bending because I often fall off my buildings (I build tall) so I need something to get back up. But the annoying part is I need to sort my blocks into spots where the move isn't going to be activated.
 

StrangeOne101

Staff member
Plugin Developer
Moderator
Verified Member
In the meantime, I suggest you tell your players to just clear a slot and put the blocks on that slot.

Just use /bending clear [slot] to clear it.
 

Varni1

Verified Member
I submitted a quick fix for this problem that will prevent bending from activating on block place..

4 lines in PKListener.java will fix the issue until the root cause can be discovered.
https://github.com/ProjectKorra/ProjectKorra/pull/307
That is a good way to stop the bug from happening... but in my opinion, it's not clean in a sense. You could use this method that cancels the move when you place a block:

Code:
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if(player.getItemInHand() != null && GeneralMethods.getBoundAbility(player).equals("FireBlast") {
cancelMoveExecution();
else {
...
}
}
Although, this solution shouldn't be used without thorough testing. I'm still unfamiliar with Project Korra, so this solution might not work.

NOTE: The "FireBlast" part was just an example, as many other moves activate upon a block place event.
 

StrangeOne101

Staff member
Plugin Developer
Moderator
Verified Member
That is a good solution, but it's not really "clean" to be honest. You could use:

Code:
public void onInteract(PlayerInteractEvent event) {
if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
return;
}
else {
...
}
A PlayerInteractEvent should be used whenever a player right click a block, the event will be cancelled. Although, this could cause some trouble for upcoming moves.
This approach isn't do-able as bukkit sometimes has trouble registering clicking air. If we did it this way, you'd only be able to fire moves when hitting a block and no one wants that...

@dNiym: We saw your PR but it failed for some reason. It could possibly work although depending on the server, 40ms might not be enough.
 

dNiym

Verified Member
That is a good way to stop the bug from happening... but in my opinion, it's not clean in a sense. You could use this method that cancels the move when you place a block:

Code:
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if(player.getItemInHand() != null && GeneralMethods.getBoundAbility(player).equals("FireBlast") {
cancelMoveExecution();
else {
...
}
}
Although, this solution shouldn't be used without thorough testing. I'm still unfamiliar with Project Korra, so this solution might not work.

NOTE: The "FireBlast" part was just an example, as many other moves activate upon a block place event.
The problem is that OnBlockPlace also fires OnPlayerSwing event.

to date there are no moves that require you to place a block to activate. But since placing a block also causes OnPlayerSwing to fire; all routines which activate left click abilities get Called as if the player punched with the left click.

OnPlayerSwing has no built in methods to distinguish between left and right in its constructor thus why I used a cool down because you can not detect a right click from OnPlayerSwing.

I suppose You could create a variable that was set when right clicking but this just uses one already in place to accomplish the same goal. Just intended to be a temporary four line fix for a super annoying bug.
 

Varni1

Verified Member
The problem is that OnBlockPlace also fires OnPlayerSwing event.

to date there are no moves that require you to place a block to activate. But since placing a block also causes OnPlayerSwing to fire; all routines which activate left click abilities get Called as if the player punched with the left click.

OnPlayerSwing has no built in methods to distinguish between left and right in its constructor thus why I used a cool down because you can not detect a right click from OnPlayerSwing.

I suppose You could create a variable that was set when right clicking but this just uses one already in place to accomplish the same goal. Just intended to be a temporary four line fix for a super annoying bug.
I see. I guess your cooldown solution will have to work for now.
 

dNiym

Verified Member
@dNiym: We saw your PR but it failed for some reason. It could possibly work although depending on the server, 40ms might not be enough.
40 ms was just a random value I grabbed and tested with and it seems to be working fine on our production server. If there were to be some variation of this it could be left configurable I suppose.
 

Simplicitee

Staff member
Plugin Developer
Verified Member
I'ma probably find the best way to fix this tomorrow. Because your pr failed our checks with the BendingPlayer variable used.
 

dNiym

Verified Member
I'ma probably find the best way to fix this tomorrow. Because your pr failed our checks with the BendingPlayer variable used.
Good luck, and hope you can find a proper fix. Fwiw it was noted as a hackish fix.. I posted it only as a bandaid for a super annoying problem that has affected a lot of people. It's already compiled into our production server and no issues as of yet. We will keep the bandaid on until the issue is resolved properly.


*edit*
Lol... I just read through some of the other big reports and kudos to you guys.. If our players posted bug reports to us the way some of these are or were as snotty and rude as some of these guys here are to you they would lose all posting rights on our forums..

And to the guys being asshats to the devs, remember you are getting a complex plugin that is getting constantly improved for FREE, which is developed by people who don't get paid.. So be patient with your bug reports and polite. If you can't live with bugs and a wait time you should hire your very own private developers to create your dream plugin, or stop using a BETA plugin expecting it to be perfect!
 
Last edited:

Varni1

Verified Member
This approach isn't do-able as bukkit sometimes has trouble registering clicking air. If we did it this way, you'd only be able to fire moves when hitting a block and no one wants that...

@dNiym: We saw your PR but it failed for some reason. It could possibly work although depending on the server, 40ms might not be enough.
Technically, the FireBlast thing was just an example, as I put in NOTE. But, I suppose this approach won't work since Bukkit has troubles registering right-clicks in air.
 

dNiym

Verified Member
Technically, the FireBlast thing was just an example, as I put in NOTE. But, I suppose this approach won't work since Bukkit has troubles registering right-clicks in air.

I think you may be confused as to what the actual problem / issue is here...
You Said:
NOTE: The "FireBlast" part was just an example, as many other moves activate upon a block place event.
Key word here being BlockPlaceEvent.. Exactly ZERO abilities in PK trigger OnBlockPlace.

Code:
    public void onBlockPlace(BlockPlaceEvent event) {
        if (event.isCancelled())
            return;
        Player player = event.getPlayer();
        if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
            event.setCancelled(true);
        }
    }
This is the entire onBlockPlace event code... As I mentioned earlier, the problem is that whenever onBlockPlace fires, onPlayerSwing ALSO fires.. All PK abilities that are activated with left clicks are contained in onPlayerSwing. Thus placing a block causes onPlayerSwing to fire, in turn causing bending to happen when you place a block.

Bending does NOT happen if you right click a block or right click air, only onBlockPlace. or on LeftClick aka onPlayerSwing, In addition onPlayerSwing has no built in way of identifying which click was used to activate it. Hence why it's wasn't an easy clean fix.


Bukkit registering right clicks on air is completely irrelevant as no bending moves are activated by right clicking air, or blocks (except for combos) but again the problem is when onBlockPlace fires NOT in PlayerInteractEvent (where right clicks are detected for combos)
 

Varni1

Verified Member
I think you may be confused as to what the actual problem / issue is here...
You Said:


Key word here being BlockPlaceEvent.. Exactly ZERO abilities in PK trigger OnBlockPlace.

Code:
    public void onBlockPlace(BlockPlaceEvent event) {
        if (event.isCancelled())
            return;
        Player player = event.getPlayer();
        if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
            event.setCancelled(true);
        }
    }
This is the entire onBlockPlace event code... As I mentioned earlier, the problem is that whenever onBlockPlace fires, onPlayerSwing ALSO fires.. All PK abilities that are activated with left clicks are contained in onPlayerSwing. Thus placing a block causes onPlayerSwing to fire, in turn causing bending to happen when you place a block.

Bending does NOT happen if you right click a block or right click air, only onBlockPlace. or on LeftClick aka onPlayerSwing, In addition onPlayerSwing has no built in way of identifying which click was used to activate it. Hence why it's wasn't an easy clean fix.


Bukkit registering right clicks on air is completely irrelevant as no bending moves are activated by right clicking air, or blocks (except for combos) but again the problem is when onBlockPlace fires NOT in PlayerInteractEvent (where right clicks are detected for combos)
I'd like to point out, I'm still new to Bukkit. I've transitioned from Forge recently, so pardon me for my low knowledge on Bukkit.
 

dNiym

Verified Member
I'd like to point out, I'm still new to Bukkit. I've transitioned from Forge recently, so pardon me for my low knowledge on Bukkit.
I gotcha, was just trying to clear up the confusion. A lot of posts were going up that were way off track. No offense intended
 
Top