mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2024-12-20 01:06:31 +08:00
禁止使用空字符串作为领地名称
This commit is contained in:
parent
23a9523ae2
commit
52887016db
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>Dominion</artifactId>
|
||||
<version>1.28.1-beta</version>
|
||||
<version>1.28.2-beta</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Dominion</name>
|
||||
|
@ -57,6 +57,10 @@ public class DominionController {
|
||||
public static DominionDTO create(Player owner, String name,
|
||||
Location loc1, Location loc2,
|
||||
String parent_dominion_name) {
|
||||
if (name.isEmpty()) {
|
||||
Dominion.notification.error(owner, "领地名称不能为空");
|
||||
return null;
|
||||
}
|
||||
if (name.contains(" ")) {
|
||||
Dominion.notification.error(owner, "领地名称不能包含空格");
|
||||
return null;
|
||||
@ -523,6 +527,10 @@ public class DominionController {
|
||||
* @param new_name 新名称
|
||||
*/
|
||||
public static void rename(Player operator, String old_name, String new_name) {
|
||||
if (new_name.isEmpty()) {
|
||||
Dominion.notification.error(operator, "新名称不能为空");
|
||||
return;
|
||||
}
|
||||
if (new_name.contains(" ")) {
|
||||
Dominion.notification.error(operator, "领地名称不能包含空格");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user