diff --git a/.github/release.yml b/.github/release.yml
new file mode 100644
index 0000000..8f9f897
--- /dev/null
+++ b/.github/release.yml
@@ -0,0 +1,26 @@
+changelog:
+ exclude:
+ labels:
+ - ignore-for-release
+ categories:
+ - title: '🔥 Breaking Changes'
+ labels:
+ - 'refactor'
+ - 'breaking'
+ - title: 🏕 Features
+ labels:
+ - 'feat'
+ - 'enhancement'
+ - title: '🐛 Bug Fixes'
+ labels:
+ - 'fix'
+ - 'bug'
+ - title: '👋 Deprecated'
+ labels:
+ - 'deprecation'
+ - title: 📦 Dependencies
+ labels:
+ - dependencies
+ - title: Other Changes
+ labels:
+ - "*"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3a9b9af..0ed5a37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
RcRPG.RcRPGMain
RcRPG
- 1.1.1-MOT
+ 1.1.2-MOT
UTF-8
diff --git a/src/main/java/RcRPG/RPG/Armour.java b/src/main/java/RcRPG/RPG/Armour.java
index b62c9c2..3ba764e 100644
--- a/src/main/java/RcRPG/RPG/Armour.java
+++ b/src/main/java/RcRPG/RPG/Armour.java
@@ -104,12 +104,11 @@ public static Armour loadArmour(String name,Config config){
armour.setDismantle(config.getString("分解", ""));
if (config.exists("套装")) {
- String suitStr = config.getString("套装", "");
List suitList;
- if (suitStr.isEmpty()) {
+ if (config.isList("套装")) {
suitList = config.getStringList("套装");
} else {
- suitList = new ArrayList<>(Arrays.asList(suitStr.split(",")));
+ suitList = new ArrayList<>(Arrays.asList(config.getString("套装", "").split(",")));
}
armour.setSuit(suitList);
}
diff --git a/src/main/java/RcRPG/RPG/Level.java b/src/main/java/RcRPG/RPG/Level.java
index 4481702..8f8185c 100644
--- a/src/main/java/RcRPG/RPG/Level.java
+++ b/src/main/java/RcRPG/RPG/Level.java
@@ -16,34 +16,34 @@ public Level(){
public static boolean addExp(Player player,int exp){
String name = player.getName();
- if(Handle.getPlayerConfig(name) != null){
- Config config = Handle.getPlayerConfig(name);
- int newExp = config.getInt("经验") + exp;
- int level = config.getInt("等级");
- int oldLevel = level;
- while(newExp >= level * MainConfig.getExpIncrement()){
- newExp -= level * MainConfig.getExpIncrement();
- level++;
- }
- config.set("经验",newExp);
- String text = MainConfig.getExpGainMessage();
- if(!text.isEmpty()){
- if(text.contains("@player")) text = text.replace("@player",name);
- if(text.contains("@exp")) text = text.replace("@exp",String.valueOf(exp));
- player.sendMessage(text);
- }
- config.save();
- addLevel(player,level - oldLevel);
- return true;
+ if(Handle.getPlayerConfig(name) == null) {
+ return false;
+ }
+ Config config = Handle.getPlayerConfig(name);
+ int newExp = config.getInt("经验", 0) + exp;
+ int level = config.getInt("等级", 0);
+ int oldLevel = level;
+ while(newExp >= level * MainConfig.getExpIncrement()){
+ newExp -= level * MainConfig.getExpIncrement();
+ level++;
}
- return false;
+ config.set("经验",newExp);
+ String text = MainConfig.getExpGainMessage();
+ if(!text.isEmpty()){
+ if(text.contains("@player")) text = text.replace("@player",name);
+ if(text.contains("@exp")) text = text.replace("@exp",String.valueOf(exp));
+ player.sendMessage(text);
+ }
+ config.save();
+ addLevel(player,level - oldLevel);
+ return true;
}
public static void addLevel(Player player, int level){
if(level == 0) return;
String name = player.getName();
Config config = Handle.getPlayerConfig(name);
- int newLevel = config.getInt("等级") + level;
+ int newLevel = config.getInt("等级", 0) + level;
if(!MainConfig.getExpGainMessage().isEmpty()){
String text = MainConfig.getExpGainMessage();
if(text.contains("@player")) text = text.replace("@player",name);
@@ -59,19 +59,19 @@ public static void addLevel(Player player, int level){
public static int getLevel(Player player){
Config config = Handle.getPlayerConfig(player.getName());
if (config == null) return 0;
- return config.getInt("等级");
+ return config.getInt("等级", 0);
}
public static int getExp(Player player){
Config config = Handle.getPlayerConfig(player.getName());
if (config == null) return 0;
- return config.getInt("经验");
+ return config.getInt("经验", 0);
}
public static int getMaxExp(Player player){
Config config = Handle.getPlayerConfig(player.getName());
if (config == null) return 0;
- int level = config.getInt("等级");
+ int level = config.getInt("等级", 0);
return level * MainConfig.getExpIncrement();
}
diff --git a/src/main/java/RcRPG/RPG/Ornament.java b/src/main/java/RcRPG/RPG/Ornament.java
index 8649041..58353da 100644
--- a/src/main/java/RcRPG/RPG/Ornament.java
+++ b/src/main/java/RcRPG/RPG/Ornament.java
@@ -88,12 +88,11 @@ public static Ornament loadOrnament(String name, Config config) {
ornament.setLoreList(new ArrayList<>(config.getStringList("显示")));
if (config.exists("套装")) {
- String suitStr = config.getString("套装", "");
List suitList;
- if (suitStr.isEmpty()) {
+ if (config.isList("套装")) {
suitList = config.getStringList("套装");
} else {
- suitList = new ArrayList<>(Arrays.asList(suitStr.split(",")));
+ suitList = new ArrayList<>(Arrays.asList(config.getString("套装", "").split(",")));
}
ornament.setSuit(suitList);
}
diff --git a/src/main/java/RcRPG/RPG/Weapon.java b/src/main/java/RcRPG/RPG/Weapon.java
index eae9f11..309f31d 100644
--- a/src/main/java/RcRPG/RPG/Weapon.java
+++ b/src/main/java/RcRPG/RPG/Weapon.java
@@ -133,12 +133,11 @@ public static Weapon loadWeapon(String name, Config config) {
weapon.setDismantle(config.getString("分解", ""));
if (config.exists("套装")) {
- String suitStr = config.getString("套装", "");
List suitList;
- if (suitStr.isEmpty()) {
+ if (config.isList("套装")) {
suitList = config.getStringList("套装");
} else {
- suitList = new ArrayList<>(Arrays.asList(suitStr.split(",")));
+ suitList = new ArrayList<>(Arrays.asList(config.getString("套装", "").split(",")));
}
weapon.setSuit(suitList);
}
diff --git a/src/main/java/RcRPG/RcRPGMain.java b/src/main/java/RcRPG/RcRPGMain.java
index aaedc5f..cd7cf81 100644
--- a/src/main/java/RcRPG/RcRPGMain.java
+++ b/src/main/java/RcRPG/RcRPGMain.java
@@ -75,7 +75,7 @@ public void onEnable() {
this.createConfigDir();
init();
- if (MainConfig.isPrefixSystemDisabled()) {
+ if (MainConfig.isExpSystemDisabled()) {
Level.enable = false;
}
diff --git a/src/main/java/RcRPG/command/Commands.java b/src/main/java/RcRPG/command/Commands.java
index cdf44de..71c7607 100644
--- a/src/main/java/RcRPG/command/Commands.java
+++ b/src/main/java/RcRPG/command/Commands.java
@@ -370,10 +370,13 @@ public boolean execute(CommandSender sender, String label, String[] args) {
Player player = Server.getInstance().getPlayer(args[2]);
if (player == null) return false;
int expValue = Integer.parseInt(args[3]);
- if (Level.addExp(player, expValue)) {
- if (sender.isPlayer()) sender.sendMessage("给予成功");
- } else {
- if (sender.isPlayer()) sender.sendMessage("给予失败");
+ if (sender.isPlayer()) {
+ if (Level.addExp(player, expValue)) {
+ sender.sendMessage("给予成功");
+ } else {
+ sender.sendMessage("给予失败");
+ }
+ return true;
}
}
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 8867371..9810b6d 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: RcRPG
main: RcRPG.RcRPGMain
-version: 1.1.1
+version: 1.1.2
author: 若尘
authors: ["若尘", "Mcayear"]
api: 1.0.8