我正在尝试为 hypixel skyblock 制作 1.8.9 forge mod,但我不知道该怎么办了。我不断收到以下错误:
error: diamond operator is not supported in -source 1.6
error: lambda expressions are not supported in -source 1.6
我尝试删除并重新编码该项目,重新启动intellij和我的计算机,更改项目设置中的每个设置,使其在Java 1.8上,但我找不到问题,没有任何效果。
导致问题的代码来自 danker 的 skyblock mod:
package com.salad.ssm.utils.handlers;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.StringUtils;
import scala.collection.mutable.StringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.stream.Collectors;
public class ScoreboardHandler {
public static String cleanSB(String scoreboard) {
char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray();
StringBuilder cleaned = new StringBuilder();
for (char c : nvString) {
if ((int) c > 20 && (int) c < 127) {
cleaned.append(c);
}
}
return cleaned.toString();
}
public static List<String> getSidebarLines() {
List<String> lines = new ArrayList<>();
if (Minecraft.getMinecraft().theWorld == null) return lines;
Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard();
if (scoreboard == null) return lines;
ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);
if (objective == null) return lines;
Collection<Score> scores;
try {
scores = scoreboard.getSortedScores(objective);
} catch (ConcurrentModificationException ex) {
ex.printStackTrace();
return new ArrayList<>();
}
List<Score> list = scores.stream()
.filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName()
.startsWith("#"))
.collect(Collectors.toList());
if (list.size() > 15) {
scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15));
} else {
scores = list;
}
for (Score score : scores) {
ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName());
lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName()));
}
return lines;
}
}
请帮忙,已经3个小时了...
是两行...我很不安
他们在这里:
sourceCompatibility = 1.8
targetCompatibility = 1.8
将它们放入 build.gradle 文件中,即可编译