Skript

Skript

743k Downloads

Multiple executions of an event from my job script (with custom-enchanted tools).

LutrexMC opened this issue · 3 comments

commented

Skript/Server Version

[16:12:30 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[16:12:30 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[16:12:30 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[16:12:30 INFO]: [Skript] Server Version: 1.21.1-2329-803bf62 (MC: 1.21.1)
[16:12:30 INFO]: [Skript] Skript Version: 2.9.1 (skriptlang-github)
[16:12:30 INFO]: [Skript] Installed Skript Addons:
[16:12:30 INFO]: [Skript]  - skript-placeholders v1.6.0 (https://github.com/APickledWalrus/skript-placeholders)
[16:12:30 INFO]: [Skript]  - Skellett v2.0.9 (https://forums.skunity.com/resources/skellett.24/)
[16:12:30 INFO]: [Skript]  - skript-reflect v2.5.1 (https://github.com/SkriptLang/skript-reflect)
[16:12:30 INFO]: [Skript]  - skRayFall v1.9.28 (https://sk.rayfall.net/)
[16:12:30 INFO]: [Skript]  - SkBee v3.6.0 (https://github.com/ShaneBeee/SkBee)
[16:12:30 INFO]: [Skript] Installed dependencies:
[16:12:30 INFO]: [Skript]  - Vault v1.7.3-b131
[16:12:30 INFO]: [Skript]  - WorldGuard v7.0.11-beta1+a801a9d

Bug Description

I created a job script where players mine blocks and receive rewards for it. When using the 'ExcellentEnchants' plugin, it’s possible to break multiple blocks at once.

However, when I use this enchantment and execute the job by mining blocks, I receive more rewards than expected. (The script seems to count more blocks than are actually mined.)

Example 'tunnel' enchantment without job script:
https://github.com/user-attachments/assets/f68e295f-f18c-4b48-9aa5-46dec809c1dd

Example 'tunnel' enchantment with job script:
https://github.com/user-attachments/assets/59229080-4ac7-4121-b80f-e486937c1ac4

Expected Behavior

Not so many blocks should be counted. What I mean is that when you break a block with the enchanted tool, for example, only 4 blocks should be added to the variable (see script), and the reward should not be paid out multiple times.

Steps to Reproduce

We are using the following plugin: https://www.spigotmc.org/resources/excellentenchants-%E2%AD%90-75-vanilla-like-enchantments.61693/

With the enchantment "Tunnel", blocks in a radius of 3 blocks around the broken block are removed by the player. However, the actual number of blocks removed by this enchantment is apparently not recognized by the script.

Script snippet:

on break:
	if player's world = "Farmwelt" or "world_nether":
		if event-block contains dark oak log or acacia log or jungle log or birch log or spruce log or oak log:
			if {Level::%uuid of player%} < 100:
				if {Job.%uuid of player%} is "Holzfäller":
					if {JobLimit.%uuid of player%} <= {@Stundenlimit}:
						if {placed::*} does not contain location of event-block:
							if event-block is oak log or birch log or spruce log:
								add 1 to {Holzfäller::%uuid of player%::Fortschritt.Eichenholz}
								add 1 to {StatsBlöcke.%uuid of player%}
								chance of 5%:
									doppeltesItem(player)
									drop drops of block using player's tool at event-block
									show 10 (firework spark) at event-block
								if {Holzfäller::%uuid of player%::Fortschritt.Eichenholz} >= {@EichenholzAmount}:
									wait 1 ticks
									set {Holzfäller::%uuid of player%::Fortschritt.Eichenholz} to 0
									add {@EichenholzGeld} to player's balance
									add {@EichenholzGeld} to {JobLimit.%uuid of player%}
									add {@EichenholzGeld} to {StatsGeld.%uuid of player%}
									add {@EichenholzXP} to {StatsXP.%uuid of player%}
									add {@EichenholzXP} to {EXP.%uuid of player%}
									add round({@EichenholzXP} * 0.3) to {EXP.%uuid of player%} if ({Job-EXP-Booster} is true)
									if {togglenotify.%uuid of player%} is true:
										if {Job-EXP-Booster} is true:
											send "{@Prefix} &7Du hast &e{@EichenholzGeld}$ &7und &e{@EichenholzXP} EXP &8(<##38bdf8>+ %round({@EichenholzXP} * 0.3)% Boost&8) &7erhalten" to player
										else:
											send "{@Prefix} &7Du hast &e{@EichenholzGeld}$ &7und &e{@EichenholzXP} EXP &7erhalten" to player
										play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 2 to player
									if {EXP.%uuid of player%} >= {EXP.%uuid of player%.needed}:
										levelup(player)

Errors or Screenshots

^ Video about this error under “Error description”

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

are you referring to the event being called multiple times when using the tunnel enchantment?

Yes, something like that.

You mine the wood (in this case, you need 16 pieces to receive the reward). With the enchantment, for example, you break 4 pieces at once, but my script registers a higher amount. This means you receive more rewards than you should. Sometimes it also spams the chat, as you can see in the video.

commented

are you referring to the event being called multiple times when using the tunnel enchantment?

commented

Well, given I have no access to your code and cannot replicate the same conditions, I'm willing to bet that it's an issue with your code.
The enchant fires one break event per block broken, exactly as expected, so there's no issue with Skript here.
image
image