-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
241 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package aplini.usetranslatednames.Enum; | ||
|
||
import java.util.Map; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import static aplini.usetranslatednames.Util.SEL; | ||
|
||
public class Cli { | ||
// 必选变量 | ||
public int inspectLength; | ||
public String get; | ||
public String set; | ||
// 可选变量 | ||
public String permission; | ||
public String displayPlace; | ||
|
||
|
||
// 这个配置启用了哪些功能 | ||
public boolean enTransVar = false; // 翻译功能 | ||
public Matcher dataTransVar; | ||
|
||
public boolean enWordReplace = false; // 词替换 | ||
public Matcher dataWordReplace; | ||
|
||
public boolean enRegExpReplace = false; // 正则表达式替换 | ||
|
||
|
||
// 从 getConfig 中转换数据 | ||
public Cli setConfig(Map<?, ?> li){ | ||
// 必选变量 | ||
this.inspectLength = (int) li.get("inspectLength"); | ||
this.get = (String) li.get("get"); | ||
this.set = (String) li.get("set"); | ||
// 可选变量 | ||
this.permission = (String) SEL(li.get("permission"), ""); | ||
this.displayPlace = (String) SEL(li.get("displayPlace"), ""); | ||
|
||
|
||
// 这个配置启用了哪些功能 | ||
|
||
// 翻译功能 | ||
this.dataTransVar = Pattern.compile("_\\$(\\d+):(TranslatedName|ItemType)_").matcher(this.set); | ||
this.enTransVar = this.dataTransVar.find(); | ||
|
||
// 词替换 | ||
this.dataWordReplace = Pattern.compile("_\\$(\\d+):Words:([^_]+)_").matcher(this.set); | ||
this.enWordReplace = this.dataWordReplace.find(); | ||
|
||
// 正则表达式替换 | ||
this.enRegExpReplace = Pattern.compile("_\\$\\d+_").matcher(this.set).find(); | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package aplini.usetranslatednames.Enum; | ||
|
||
public class TransVar { | ||
public String transName; | ||
public String itemType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package aplini.usetranslatednames.Enum; | ||
|
||
import java.util.Map; | ||
|
||
import static aplini.usetranslatednames.Util.SEL; | ||
|
||
public class Word { | ||
// 必选变量 | ||
public String get; | ||
public String set; | ||
// 可选变量 | ||
public String lang; | ||
|
||
|
||
// 从 Map 中转换数据 | ||
public Word setConfig(Map<?, ?> li){ | ||
// 必选变量 | ||
this.get = (String) li.get("get"); | ||
this.set = (String) li.get("set"); | ||
// 可选变量 | ||
this.lang = (String) SEL(li.get("lang"), ""); | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.