Skript

Skript

743k Downloads

CondContains is ... crazy.

Alyanos22 opened this issue · 13 comments

commented

Skript/Server Version

.

Bug Description

// if "test" contain "hihi" | true | true
// if "test" contains "hihi" | true | true
// if "test", "test1" contain "hihi" | false | true
// if "test", "test1" contains "hihi" | false | false

Expected Behavior

Why is the variable "explicitSingle" true for ("if "test", "test1" contain "hihi"") - is that really wanted?

Steps to Reproduce

reproduce in IntelliJ :)

Errors or Screenshots

No response

Other

No response

Agreement

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

What's the issue here?

commented

Code: explicitSingle = matchedPattern == 2 && parseResult.mark != 1 || containers.isSingle();
Pattern: %inventories/strings/objects% contain[(1¦s)] %itemtypes/strings/objects%

commented

I just noticed that and wondered if its really explained when to use contain and when containS.
Because it seems to change something.

commented

I just wonder for what the variable "explicitSingle" is, when it can be changed by adding an "s"...

commented

"abc", "bcd", "cde" contain "c" -> true: checks if each of the strings contain another string
"abc", "bcd", "cde" contains "c" -> false: checks if the list of string contains a specific string

Closing as not a bug report or suggestion

commented

Oh, thanks for clarifiing.... Maybe that should be added to the docs

commented

Sorry, but how can I just use java's "contains"?
E.g.

List<String> list
list.contains("test")
commented

image

commented

"cde" contains "c".

commented

How can I check if ONE or more of the list contains "c"? not all

commented

But list.contains("c") would be false if given a list with "cde" in it

commented

How can I check if ONE or more of the list contains "c"? not all

This should really be done on the skunity discord, not here.
But you'd use if "x", "y" or "z" contain "a"

commented

oh f i noticed, thanks