Slimefun

Slimefun

3M Downloads

SlimefunGuideMode.CHEAT_MODE doesn't fire

JustinDevB opened this issue · 7 comments

commented

❗ Checklist

  • I am using the official english version of Slimefun and did not modify the jar.
  • I am using an up to date "DEV" (not "RC") version of Slimefun.
  • I am aware that issues related to Slimefun addons need to be reported on their bug trackers and not here.
  • I searched for similar open issues and could not find an existing bug report on this.

📍 Description

@eventhandler
public void slimefunGuideOpen(SlimefunGuideOpenEvent event) {
mcpe.log("Mode: " + event.getGuideLayout().toString(), true);
if (event.getGuideLayout() != SlimefunGuideMode.CHEAT_MODE)
return;

When doing /sf cheat this never returns CHEAT_MODE, nothing is printed.
Haven't looked through the source, but I'm guessing that the /sf cheat command does not fire the SlimefunGuideOpenEvevnt event and then set the Enum to CHEAT_MODE

📑 Reproduction Steps

@eventhandler
public void slimefunGuideOpen(SlimefunGuideOpenEvent event) {
mcpe.log("Mode: " + event.getGuideLayout().toString(), true);
if (event.getGuideLayout() != SlimefunGuideMode.CHEAT_MODE)
return;

Run /sf cheat
nothing will print. Open a regular guide and it prints SURVIVAL_MODE This should fire and print CHEAT_MODE when opening the cheat menu

💡 Expected Behavior

SlimefunGuideOpeneEvent fires on /sf cheat and Enum is properly set to CHEAT_MODE

📷 Screenshots / Videos

No response

📜 Server Log

No response

📂 /error-reports/ folder

No response

💻 Server Software

Purpur

🎮 Minecraft Version

1.18.x

⭐ Slimefun version

Capture

🧭 Other plugins

No response

commented

is this actually a bug or would we say this is intended? The event requires an itemstack which is @Nonnull and the problem is the command has no itemstack, we would also need a new message to be sent to the player if the event was cancelled otherwise they are going to think the command is just broken.

commented

No idea if this is intended or not. I opened this over a year ago with no response. Completely forgot everything about it.

commented

so the 'issue' here is the /sf open_guide and /sf cheat commands not calling the SlimefunGuideOpenEvent event?

commented

so the 'issue' here is the /sf open_guide and /sf cheat commands not calling the SlimefunGuideOpenEvent event?

Yes but in reality imo it shouldnt, the event has a nonnull itemstack for the guide passed also if the event is cancelled we would need a message or something sent to the player that way they dont just think the command is broken

commented

The nonnull itemstack means we can't really change this. There is no itemstack when using the command, but making it nullable would very likely break a lot of implementations. Only option would be providing a dummy itemstack, but that would be kind of ugly.

commented

The nonnull itemstack means we can't really change this. There is no itemstack when using the command, but making it nullable would very likely break a lot of implementations. Only option would be providing a dummy itemstack, but that would be kind of ugly.

Bingo

commented

Going to go ahead and close this due to the aforementioned issues