Skip to content

Conversation

@TheLimeGlass
Copy link
Contributor

@TheLimeGlass TheLimeGlass commented Jan 22, 2025

Continuation #5531

See split commit Modify EffOpenInventory for easy reviewing to allow for easier reviewing of what was changed in EffOpenInventory before rename to EffSecOpenInventory.

TheLimeGlass and others added 26 commits March 17, 2023 00:10
Co-authored-by: Ayham Al Ali <20037329+AyhamAl-Ali@users.noreply.github.com>
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
@Moderocky
Copy link
Member

It looks mostly fine I think.

Co-authored-by: Moderocky <admin@moderocky.com>
EventValues.registerEventValue(InventorySectionEvent.class, Player[].class, InventorySectionEvent::getPlayers);
Skript.registerSection(EffSecOpenInventory.class,
"(show|create|open) %inventory/inventorytype% (to|for) %players%",
"open [a[n]] " + OpenableInventorySyntax.construct() + " [view|window|inventory] (to|for) %players%",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows open target block's inventory inventory to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing syntax, let me know if you want it to break existing syntax.

Copy link
Member

@sovdeeth sovdeeth Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not existing. The prior pattern was (open|show) (...|%-inventory/inventorytype%) (to|for) %players%. That doesn't allow open target block's inventory inventory to me. Sorry for the delayed response, I lost track of this notification in github.

}

private @Nullable OpenableInventorySyntax syntax;
private @Nullable Expression<?> object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private @Nullable Expression<?> object;
private @Nullable Expression<?> inventoryObject;

needs a more descriptive name

Comment on lines +191 to +194
if (open && hasSection())
trigger = loadCode(sectionNode, "open inventory", InventorySectionEvent.class);

return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no check to disallow

close player's inventory: do something 
Comment on lines +191 to +192
if (open && hasSection())
trigger = loadCode(sectionNode, "open inventory", InventorySectionEvent.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't load code if using open %inventory/inventorytype%

EventValues.registerEventValue(InventorySectionEvent.class, Inventory.class, InventorySectionEvent::getInventory);
EventValues.registerEventValue(InventorySectionEvent.class, Player[].class, InventorySectionEvent::getPlayers);
Skript.registerSection(EffSecOpenInventory.class,
"(show|create|open) %inventory/inventorytype% (to|for) %players%",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open an anvil inventory uses pattern 0
open an anvil uses pattern 1
These should both follow the same code path.

for (Player player : players)
player.openInventory(inventory);

} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section trigger is never run in this path. This is the only path where the section trigger even exists.

return super.walk(event, false);

Player[] players = this.players.getArray(event);
if (players.length > 0 && trigger != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to earlier errors, the trigger will always be null since loadCode was never called.

@Override
public String toString(@Nullable Event event, boolean debug) {
if (object != null)
return "show " + object.toString(event, debug) + " to " + players.toString(event, debug);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show isn't always accurate

@sovdeeth sovdeeth added feature Pull request adding a new feature. bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. labels Jan 24, 2025
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label May 15, 2025
@sovdeeth
Copy link
Member

sovdeeth commented Jul 2, 2025

Inactivity

@sovdeeth sovdeeth closed this Jul 2, 2025
@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. feature Pull request adding a new feature.

3 participants