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.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.
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.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..
That works too, xDIn 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.
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: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
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if(player.getItemInHand() != null && GeneralMethods.getBoundAbility(player).equals("FireBlast") {
cancelMoveExecution();
else {
...
}
}
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...That is a good solution, but it's not really "clean" to be honest. You could use:
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.Code:public void onInteract(PlayerInteractEvent event) { if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { return; } else { ... }
The problem is that OnBlockPlace also fires OnPlayerSwing event.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:
Although, this solution shouldn't be used without thorough testing. I'm still unfamiliar with Project Korra, so this solution might not work.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 { ... } }
NOTE: The "FireBlast" part was just an example, as many other moves activate upon a block place event.
I see. I guess your cooldown solution will have to work for now.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.
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.@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.
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.I'ma probably find the best way to fix this tomorrow. Because your pr failed our checks with the BendingPlayer variable used.
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.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.
Key word here being BlockPlaceEvent.. Exactly ZERO abilities in PK trigger OnBlockPlace.NOTE: The "FireBlast" part was just an example, as many other moves activate upon a block place event.
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);
}
}
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 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.
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.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); } }
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)
Lol. Skrub. Bukkit4Life. ForgeBadI'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 intendedI'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.
Spigot or PR. Skrub.Lol. Skrub. Bukkit4Life. ForgeBad