mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-05 09:01:47 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d8cbf2825d | |||
| f4292e761a | |||
| 47018fbf7d | |||
| dd277e99e8 | |||
| b3078553e7 | |||
| e67e23a24c | |||
| 30e57e3945 | |||
| acea995996 | |||
| 511d8d77c4 | |||
| 96ff3398c8 | |||
| 42860c332f | |||
| 5ea196b6df |
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+13
-8
@@ -1,6 +1,7 @@
|
||||
package cc.carm.lib.easyplugin.configuration.language;
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.file.FileConfig;
|
||||
import cc.carm.lib.easyplugin.configuration.language.builder.EasyMessageBuilder;
|
||||
import cc.carm.lib.easyplugin.configuration.values.ConfigValue;
|
||||
import cc.carm.lib.easyplugin.utils.ColorParser;
|
||||
import cc.carm.lib.easyplugin.utils.MessageUtils;
|
||||
@@ -19,6 +20,10 @@ public class EasyMessage {
|
||||
@Nullable String defaultValue;
|
||||
@Nullable String[] messageParams;
|
||||
|
||||
public static EasyMessageBuilder builder() {
|
||||
return new EasyMessageBuilder();
|
||||
}
|
||||
|
||||
public EasyMessage() {
|
||||
this(null);
|
||||
}
|
||||
@@ -58,10 +63,10 @@ public class EasyMessage {
|
||||
}
|
||||
|
||||
public @NotNull String get(@Nullable CommandSender sender) {
|
||||
return get(sender, null);
|
||||
return get(sender, (Object[]) null);
|
||||
}
|
||||
|
||||
public @NotNull String get(@Nullable CommandSender sender, @Nullable Object[] values) {
|
||||
public @NotNull String get(@Nullable CommandSender sender, @Nullable Object... values) {
|
||||
return get(sender, getMessageParams(), values);
|
||||
}
|
||||
|
||||
@@ -74,10 +79,10 @@ public class EasyMessage {
|
||||
}
|
||||
|
||||
public void send(@Nullable CommandSender sender) {
|
||||
send(sender, null);
|
||||
send(sender, (Object[]) null);
|
||||
}
|
||||
|
||||
public void send(@Nullable CommandSender sender, @Nullable Object[] values) {
|
||||
public void send(@Nullable CommandSender sender, @Nullable Object... values) {
|
||||
send(sender, getMessageParams(), values);
|
||||
}
|
||||
|
||||
@@ -88,10 +93,10 @@ public class EasyMessage {
|
||||
}
|
||||
|
||||
public void sendBar(@Nullable Player player) {
|
||||
sendBar(player, null);
|
||||
sendBar(player, (Object[]) null);
|
||||
}
|
||||
|
||||
public void sendBar(@Nullable Player player, @Nullable Object[] values) {
|
||||
public void sendBar(@Nullable Player player, @Nullable Object... values) {
|
||||
sendBar(player, getMessageParams(), values);
|
||||
}
|
||||
|
||||
@@ -104,10 +109,10 @@ public class EasyMessage {
|
||||
}
|
||||
|
||||
public void sendToAll() {
|
||||
sendToAll(null);
|
||||
sendToAll((Object[]) null);
|
||||
}
|
||||
|
||||
public void sendToAll(@Nullable Object[] values) {
|
||||
public void sendToAll(@Nullable Object... values) {
|
||||
sendToAll(messageParams, values);
|
||||
}
|
||||
|
||||
|
||||
+11
-6
@@ -1,6 +1,7 @@
|
||||
package cc.carm.lib.easyplugin.configuration.language;
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.file.FileConfig;
|
||||
import cc.carm.lib.easyplugin.configuration.language.builder.EasyMessageListBuilder;
|
||||
import cc.carm.lib.easyplugin.configuration.values.ConfigValueList;
|
||||
import cc.carm.lib.easyplugin.utils.ColorParser;
|
||||
import cc.carm.lib.easyplugin.utils.MessageUtils;
|
||||
@@ -21,6 +22,10 @@ public class EasyMessageList {
|
||||
@Nullable String[] defaultValue;
|
||||
@Nullable String[] messageParams;
|
||||
|
||||
public static EasyMessageListBuilder builder() {
|
||||
return new EasyMessageListBuilder();
|
||||
}
|
||||
|
||||
public EasyMessageList() {
|
||||
this((String[]) null);
|
||||
}
|
||||
@@ -62,10 +67,10 @@ public class EasyMessageList {
|
||||
}
|
||||
|
||||
public @NotNull List<String> get(@Nullable CommandSender sender) {
|
||||
return get(sender, null);
|
||||
return get(sender, (Object[]) null);
|
||||
}
|
||||
|
||||
public @NotNull List<String> get(@Nullable CommandSender sender, @Nullable Object[] values) {
|
||||
public @NotNull List<String> get(@Nullable CommandSender sender, @Nullable Object... values) {
|
||||
return get(sender, getMessageParams(), values);
|
||||
}
|
||||
|
||||
@@ -78,10 +83,10 @@ public class EasyMessageList {
|
||||
}
|
||||
|
||||
public void send(@Nullable CommandSender sender) {
|
||||
send(sender, null);
|
||||
send(sender, (Object[]) null);
|
||||
}
|
||||
|
||||
public void send(@Nullable CommandSender sender, @Nullable Object[] values) {
|
||||
public void send(@Nullable CommandSender sender, @Nullable Object... values) {
|
||||
send(sender, getMessageParams(), values);
|
||||
}
|
||||
|
||||
@@ -93,10 +98,10 @@ public class EasyMessageList {
|
||||
}
|
||||
|
||||
public void sendToAll() {
|
||||
sendToAll(null);
|
||||
sendToAll((Object[]) null);
|
||||
}
|
||||
|
||||
public void sendToAll(@Nullable Object[] values) {
|
||||
public void sendToAll(@Nullable Object... values) {
|
||||
sendToAll(messageParams, values);
|
||||
}
|
||||
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cc.carm.lib.easyplugin.configuration.language.builder;
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.language.EasyMessage;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EasyMessageBuilder {
|
||||
|
||||
protected String content;
|
||||
protected String[] params;
|
||||
|
||||
protected @Nullable String paramPrefix = "%(";
|
||||
protected @Nullable String paramSuffix = ")";
|
||||
|
||||
public EasyMessageBuilder() {
|
||||
}
|
||||
|
||||
|
||||
public EasyMessageBuilder contents(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageBuilder params(String... placeholders) {
|
||||
this.params = placeholders;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageBuilder setParamPrefix(@Nullable String paramPrefix) {
|
||||
this.paramPrefix = paramPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageBuilder setParamSuffix(@Nullable String paramSuffix) {
|
||||
this.paramSuffix = paramSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageBuilder setParamFormat(@Nullable String paramPrefix, @Nullable String paramSuffix) {
|
||||
this.paramPrefix = paramPrefix;
|
||||
this.paramSuffix = paramSuffix;
|
||||
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() {
|
||||
return new EasyMessage(this.content, buildParams());
|
||||
}
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package cc.carm.lib.easyplugin.configuration.language.builder;
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.language.EasyMessageList;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EasyMessageListBuilder {
|
||||
|
||||
protected String[] contents;
|
||||
protected String[] params;
|
||||
|
||||
protected @Nullable String paramPrefix = "%(";
|
||||
protected @Nullable String paramSuffix = ")";
|
||||
|
||||
public EasyMessageListBuilder() {
|
||||
}
|
||||
|
||||
|
||||
public EasyMessageListBuilder contents(String... contents) {
|
||||
this.contents = contents;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageListBuilder params(String... placeholders) {
|
||||
this.params = placeholders;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageListBuilder setParamPrefix(@Nullable String paramPrefix) {
|
||||
this.paramPrefix = paramPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageListBuilder setParamSuffix(@Nullable String paramSuffix) {
|
||||
this.paramSuffix = paramSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EasyMessageListBuilder setParamFormat(@Nullable String paramPrefix, @Nullable String paramSuffix) {
|
||||
this.paramPrefix = paramPrefix;
|
||||
this.paramSuffix = paramSuffix;
|
||||
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() {
|
||||
return new EasyMessageList(this.contents, buildParams());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easysql-beecp</artifactId>
|
||||
<version>0.3.0</version>
|
||||
<version>0.3.8</version>
|
||||
<optional>true</optional>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.3.6</version>
|
||||
<version>1.3.9</version>
|
||||
<modules>
|
||||
|
||||
<module>easyplugin-main</module>
|
||||
@@ -75,12 +75,6 @@
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>carm-repo</id>
|
||||
<name>Carm's Repo</name>
|
||||
<url>https://repo.carm.cc/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
@@ -91,6 +85,17 @@
|
||||
<url>https://oss.sonatype.org/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>carm-repo</id>
|
||||
<name>Carm's Repo</name>
|
||||
<url>https://repo.carm.cc/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
@@ -104,13 +109,6 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
@@ -160,9 +158,6 @@
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<classifier>javadoc</classifier>
|
||||
<links>
|
||||
<link>https://javadoc.io/doc/org.jetbrains/annotations/</link>
|
||||
</links>
|
||||
<detectJavaApiLink>false</detectJavaApiLink>
|
||||
<encoding>UTF-8</encoding>
|
||||
<charset>UTF-8</charset>
|
||||
|
||||
Reference in New Issue
Block a user