Skip to content

Conditions possibly not working #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Hezkore opened this issue Apr 28, 2025 · 8 comments · May be fixed by #560
Open

Conditions possibly not working #556

Hezkore opened this issue Apr 28, 2025 · 8 comments · May be fixed by #560

Comments

@Hezkore
Copy link

Hezkore commented Apr 28, 2025

I have this condition:

  conditions:
  - "%checkitem_amount_nameequals:Test\ Thing%>=1"

And despite having that item on me, I am being rejected from the portal.

I've tested so that the commend is correct via a scoreboard plugin which also uses the placeholderAPI, using this line:

      text:
      - "%checkitem_amount_nameequals:Test\ Thing%"

And I can see that it returns the correct amount.

Am I missing something here?

@TreemanKing
Copy link
Contributor

TreemanKing commented May 1, 2025

It should work fine. Is there a reason you are using a \ as that may contribute to it?

@sekwah41
Copy link
Owner

sekwah41 commented May 3, 2025

usualy "\ " is used to indicate a space in a variable, I assume this would be the same here? Though I don't believe that's needed given how you coded the split for the condition.

@Hezkore
Copy link
Author

Hezkore commented May 3, 2025

Yes, it's there for the space, and is required for the scoreboard plugin to correctly detect the item.
However, I tried without the \ for Advanced Portals, and the portal still does not work.

Here's the Portal file:

args:
  name:
  - other_portal
  triggerblock:
  - END_PORTAL
  proxy:
  - server3
  destination:
  - start
  conditions:
  - "%checkitem_amount_nameequals:Test Thing%>=1"
maxLoc:
  posX: -7
  posY: 82
  posZ: 8
  worldName: world
minLoc:
  posX: -8
  posY: 82
  posZ: 9
  worldName: world

The server has been fully restarted since the portal file was created.

And in-game (on 1.21.4) I give myself the item like this:
/minecraft:give @s minecraft:paper[custom_name='"Test Thing"']

The scoreboard plugin sees the item and displays 1 correctly.
But when going through the portal, I get:
[AdvancedPortals]The conditions to activate this portal have not been met

And there are no errors in the server console output.

For debugging, I have tried other conditions.
The documentation states:

Example: conditions:%player_food_level%>=5

However, that is a syntax error according to the console.
But doing this instead works:

  conditions:
  - "%player_food_level%>=5"

The condition works correctly, and only lets the player teleport if their hunger is above 5.

@Hezkore
Copy link
Author

Hezkore commented May 3, 2025

After further testing, I can confirm that the issue is the space, and how Advanced Portals handles it.
Simplifying the item name to simply "Test" makes the condition execute correctly.

/minecraft:give @s minecraft:paper[custom_name='"Test"']

  conditions:
  - "%checkitem_amount_nameequals:Test%>=1"

The above works.

So either I am handing the space incorrectly, or Advanced Portals isn't parsing the code correctly.

@sekwah41
Copy link
Owner

sekwah41 commented May 4, 2025

I haven't touched this part of the plugin so ill leave this to you @TreemanKing if that's ok :D We may need to update the documentation or see why its not being handled correctly.

@TreemanKing TreemanKing linked a pull request May 4, 2025 that will close this issue
@TreemanKing
Copy link
Contributor

Let me know if this works @Hezkore

Advanced-Portals-Spigot-2.5.0-SNAPSHOT.jar.zip

@sekwah41
Copy link
Owner

sekwah41 commented May 5, 2025

If that works then ill merge the pr that @TreemanKing has made and we can release it in the main build :)

@Hezkore
Copy link
Author

Hezkore commented May 28, 2025

Sorry.
Unfortunately, I needed to solve my issue quickly, so I am no longer relying on conditions.
I thank you for the effort creating the fork, and I hope someone can test this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants