Skript

Skript

743k Downloads

Player event-value doesn't error ScriptEvent events

sovdeeth opened this issue ยท 7 comments

commented

Skript/Server Version

[23:17:22 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[23:17:22 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[23:17:22 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[23:17:22 INFO]: [Skript] Server Version: git-Paper-390 (MC: 1.20.4)
[23:17:22 INFO]: [Skript] Skript Version: 2.6.4 (and 2.7.3, and 2.8.3)
[23:17:22 INFO]: [Skript] Installed Skript Addons: None
[23:17:22 INFO]: [Skript] Installed dependencies:
[23:17:22 INFO]: [Skript]  - WorldGuard v7.0.9+5934e49

Bug Description

Using player in on load doesn't cause an error, because there's a command sender event-value for the event.

Expected Behavior

player should error. console should not.

Steps to Reproduce

on load:
    broadcast event-player
    broadcast event-commandsender

Errors or Screenshots

[23:18:32 INFO]: load (script load):
[23:18:32 INFO]:     broadcast event-player
[23:18:32 INFO]:     broadcast event-player/console
[23:18:32 INFO]: loaded 1 trigger and 1 command from 'test.sk'
[23:18:32 INFO]: load (script load)
[23:18:32 INFO]:   broadcast <none>
[23:18:32 INFO]: CONSOLE
[23:18:32 INFO]:   broadcast [commandsender:CONSOLE]
[23:18:32 INFO]: Commands unchanged, not syncing them to clients

Other

No response

Agreement

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

What happens if you use /sk reload in-game to trigger the event?

commented

What happens if you use /sk reload in-game to trigger the event?

That's what the Errors or Screenshots section shows. (the event-value just returns Bukkit.getConsoleSender())

commented

What happens if you use /sk reload in-game to trigger the event?

That's what the Errors or Screenshots section shows. (the event-value just returns Bukkit.getConsoleSender())

No, I meant as a player, not as console

commented

What happens if you use /sk reload in-game to trigger the event?

That's what the Errors or Screenshots section shows. (the event-value just returns Bukkit.getConsoleSender())

No, I meant as a player, not as console

same thing, as I said it just returns Bukkit.getConsoleSender():

EventValues.registerEventValue(ScriptEvent.class, CommandSender.class, new Getter<CommandSender, ScriptEvent>() {
			@Nullable
			@Override
			public CommandSender get(ScriptEvent e) {
				return Bukkit.getConsoleSender();
			}
		}, 0);
commented

Oh, right โ€” do you think it'd be better to add support for getting the real sender (for commands) or just have event-player raise an error?

commented

I think it'd be best to remove this entirely. I think users should explicitly state they're sending something to console, rather than just sending something. Plus, the server could be loading the script, another script could be loading the script, an effect command could be loading the script, so having a command sender at all seems a little bit of an odd choice to me.

of course the best option for compatibility would be to just error for event-player, but to my knowledge that could prove quite difficult.

commented

I think it'd be best to remove this entirely. I think users should explicitly state they're sending something to console, rather than just sending something. Plus, the server could be loading the script, another script could be loading the script, an effect command could be loading the script, so having a command sender at all seems a little bit of an odd choice to me.

of course the best option for compatibility would be to just error for event-player, but to my knowledge that could prove quite difficult.

Sounds good to me :)