mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-04 16:48:16 +08:00
独立buildParams方法
This commit is contained in:
+6
-2
@@ -4,7 +4,6 @@ import cc.carm.lib.easyplugin.configuration.language.EasyMessage;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class EasyMessageBuilder {
|
public class EasyMessageBuilder {
|
||||||
|
|
||||||
@@ -44,8 +43,13 @@ public class EasyMessageBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected @Nullable String[] buildParams() {
|
||||||
|
if (this.params == null) return null;
|
||||||
|
else return Arrays.stream(this.params).map(param -> paramPrefix + param + paramSuffix).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
public EasyMessage build() {
|
public EasyMessage build() {
|
||||||
return new EasyMessage(this.content, Optional.ofNullable(this.params).map(params -> Arrays.stream(this.params).map(param -> paramPrefix + param + paramSuffix).toArray(String[]::new)).orElse(null));
|
return new EasyMessage(this.content, buildParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -4,7 +4,6 @@ import cc.carm.lib.easyplugin.configuration.language.EasyMessageList;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class EasyMessageListBuilder {
|
public class EasyMessageListBuilder {
|
||||||
|
|
||||||
@@ -44,8 +43,13 @@ public class EasyMessageListBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected @Nullable String[] buildParams() {
|
||||||
|
if (this.params == null) return null;
|
||||||
|
else return Arrays.stream(this.params).map(param -> paramPrefix + param + paramSuffix).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
public EasyMessageList build() {
|
public EasyMessageList build() {
|
||||||
return new EasyMessageList(this.contents, Optional.ofNullable(this.params).map(params -> Arrays.stream(this.params).map(param -> paramPrefix + param + paramSuffix).toArray(String[]::new)).orElse(null));
|
return new EasyMessageList(this.contents, buildParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,11 @@
|
|||||||
<url>https://oss.sonatype.org/content/groups/public</url>
|
<url>https://oss.sonatype.org/content/groups/public</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>carm-repo</id>
|
<id>carm-repo</id>
|
||||||
<name>Carm's Repo</name>
|
<name>Carm's Repo</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user