在Bukkit 1.20中调用ImmutableList,您需要首先导入com.google.common.collect.ImmutableList类。然后,您可以使用ImmutableList.of()方法创建一个不可变的列表,并将元素作为参数传递给该方法。例如:

import com.google.common.collect.ImmutableList;

public class MyClass {
    public static void main(String[] args) {
        ImmutableList<String> myList = ImmutableList.of("Element 1", "Element 2", "Element 3");
        System.out.println(myList);
    }
}

在上面的示例中,我们首先导入ImmutableList类。然后,我们使用ImmutableList.of()方法创建一个包含三个字符串元素的不可变列表。最后,我们将列表打印到控制台上。

请确保您的项目中包含了Guava库的依赖,以便使用ImmutableList

Bukkit120 里面咋调用ImmutableList

原文地址: https://www.cveoy.top/t/topic/igA5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录