船新两个 Sendable Json 和 ActionBar

This commit is contained in:
Izzel_Aliz 2018-04-30 11:13:12 +08:00
parent 19b4bd9a6b
commit 919ded650b
4 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,16 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="false" level="BLOCKER" enabled_by_default="false" />
<inspection_tool class="AliDeprecation" enabled="false" level="CRITICAL" enabled_by_default="false" />
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="false" level="CRITICAL" enabled_by_default="false" />
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaAvoidComplexCondition" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaClassMustHaveAuthor" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="AlibabaConstantFieldShouldBeUpperCase" enabled="false" level="CRITICAL" enabled_by_default="false" />
<inspection_tool class="AlibabaEnumConstantsMustHaveComment" enabled="false" level="CRITICAL" enabled_by_default="false" />
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="false" level="MAJOR" enabled_by_default="false" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS"> <option name="TOP_LEVEL_CLASS_OPTIONS">
<value> <value>
@ -30,7 +40,7 @@
<option name="IGNORE_JAVADOC_PERIOD" value="true" /> <option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" /> <option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" /> <option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="author,author" /> <option name="myAdditionalJavadocTags" value="author,author,date" />
</inspection_tool> </inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="true" level="233" enabled_by_default="true"> <inspection_tool class="SpellCheckingInspection" enabled="true" level="233" enabled_by_default="true">
<option name="processCode" value="true" /> <option name="processCode" value="true" />

View File

@ -22,7 +22,7 @@ public class TLocaleActionBar implements TLocaleSendable, ConfigurationSerializa
private final boolean papi; private final boolean papi;
public TLocaleActionBar(String text, boolean papi) { private TLocaleActionBar(String text, boolean papi) {
this.text = text; this.text = text;
this.papi = papi; this.papi = papi;
} }

View File

@ -63,6 +63,7 @@ public class TLocaleJson implements TLocaleSendable, ConfigurationSerializable {
String text = split.length > 1 ? split[0] : ""; String text = split.length > 1 ? split[0] : "";
String node = split.length > 1 ? split[1] : split[0]; String node = split.length > 1 ? split[1] : split[0];
if (section.containsKey(node)) { if (section.containsKey(node)) {
@SuppressWarnings("unchecked")
Map<String, Object> arg = (Map<String, Object>) section.get(node); Map<String, Object> arg = (Map<String, Object>) section.get(node);
text = (String) arg.getOrDefault("text", text); text = (String) arg.getOrDefault("text", text);
BaseComponent[] component = TextComponent.fromLegacyText(text); BaseComponent[] component = TextComponent.fromLegacyText(text);
@ -83,6 +84,7 @@ public class TLocaleJson implements TLocaleSendable, ConfigurationSerializable {
baseComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(String.valueOf(value)).create())); baseComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(String.valueOf(value)).create()));
} }
break; break;
default:
} }
}); });
builder.addAll(Arrays.asList(component)); builder.addAll(Arrays.asList(component));

View File

@ -44,7 +44,7 @@ public class TLocaleText implements TLocaleSendable, ConfigurationSerializable {
if (map.containsKey("text")) { if (map.containsKey("text")) {
Object object = map.get("text"); Object object = map.get("text");
Object objPapi = map.getOrDefault("papi", Main.getInst().getConfig().getBoolean("LOCALE.USE_PAPI", false)); Object objPapi = map.getOrDefault("papi", Main.getInst().getConfig().getBoolean("LOCALE.USE_PAPI", false));
boolean papi = objPapi instanceof Boolean ? (boolean) objPapi : objPapi instanceof String && objPapi.equals("true"); boolean papi = objPapi instanceof Boolean ? (boolean) objPapi : objPapi instanceof String && "true".equals(objPapi);
if (object instanceof List) { if (object instanceof List) {
return new TLocaleText(((List<String>) object).stream() return new TLocaleText(((List<String>) object).stream()
.map(s -> ChatColor.translateAlternateColorCodes('&', s)) .map(s -> ChatColor.translateAlternateColorCodes('&', s))