diff --git a/lib/FakeNsGameBase.jar b/lib/FakeNsGameBase.jar
new file mode 100644
index 0000000..d8272b6
Binary files /dev/null and b/lib/FakeNsGameBase.jar differ
diff --git a/pom.xml b/pom.xml
index 0983c53..1b81aff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
cn.lanink
MurderMystery
- 1.4.2-PM1E
+ 1.4.3-PM1E-SNAPSHOT
@@ -169,6 +169,14 @@
${project.basedir}/lib/SimpleScoreboards-2.6.1.jar
+
+ FakeNsGameBase
+ FakeNsGameBase
+ 1.0.0
+ system
+ ${project.basedir}/lib/FakeNsGameBase.jar
+
+
org.jetbrains
annotations
@@ -182,7 +190,6 @@
1.18.26
provided
-
\ No newline at end of file
diff --git a/src/main/java/cn/lanink/murdermystery/MurderMystery.java b/src/main/java/cn/lanink/murdermystery/MurderMystery.java
index c45b828..82b1849 100644
--- a/src/main/java/cn/lanink/murdermystery/MurderMystery.java
+++ b/src/main/java/cn/lanink/murdermystery/MurderMystery.java
@@ -96,6 +96,8 @@ public class MurderMystery extends PluginBase {
private IScoreboard scoreboard;
private boolean hasTips = false;
+ @Getter
+ private boolean hasNsGB = false;
private String serverWorldPath;
private String worldBackupPath;
@@ -294,8 +296,17 @@ public void onEnable() {
}
this.hasTips = true;
} catch (Exception ignored) {
- //注册RsNPC变量
+
+ }
+ //检查FAP基础插件
+ try {
+ Class.forName("cn.nsgamebase.NsGameBaseMain");
+ ConfigUpdateUtils.checkFapNsGB(this);
+ this.hasNsGB = true;
+ } catch (Exception ignored) {
+
}
+ //注册RsNPC变量
try {
Class.forName("com.smallaswater.npc.variable.BaseVariableV2");
com.smallaswater.npc.variable.VariableManage.addVariableV2("MurderMysteryVariable", RsNpcVariable.class);
diff --git a/src/main/java/cn/lanink/murdermystery/room/classic/ClassicModeRoom.java b/src/main/java/cn/lanink/murdermystery/room/classic/ClassicModeRoom.java
index 3a8c33b..e7d7ff2 100644
--- a/src/main/java/cn/lanink/murdermystery/room/classic/ClassicModeRoom.java
+++ b/src/main/java/cn/lanink/murdermystery/room/classic/ClassicModeRoom.java
@@ -4,6 +4,8 @@
import cn.lanink.murdermystery.room.base.BaseRoom;
import cn.lanink.murdermystery.room.base.PlayerIdentity;
import cn.lanink.murdermystery.utils.Tools;
+import cn.nsgamebase.api.GbGameApi;
+import cn.nsgamebase.entity.pojo.AbstractDataGamePlayerPojo;
import cn.nukkit.Player;
import cn.nukkit.Server;
import cn.nukkit.level.Level;
@@ -51,7 +53,9 @@ protected void victoryReward(int victory) {
Player killerVictory = null;
Set commonPeopleVictory = new HashSet<>();
Set defeatPlayers = new HashSet<>();
+ Set players = new HashSet<>();
for (Map.Entry entry : this.getPlayers().entrySet()) {
+ players.add(entry.getKey());
if (victory == 3) {
if (entry.getValue() == PlayerIdentity.KILLER) {
killerVictory = entry.getKey();
@@ -88,6 +92,23 @@ public void onRun(int i) {
for (Player player : defeatPlayers) {
Tools.executeCommands(player, murderMystery.getConfig().getStringList("defeatCmd"));
}
+
+ if (murderMystery.isHasNsGB()) {
+ for (Player player : players) {
+ AbstractDataGamePlayerPojo pojo = new AbstractDataGamePlayerPojo();
+ pojo.add("played");
+ Config config = murderMystery.getConfig();
+ int money = config.getInt("fapIntegral.money");
+ int point = config.getInt("fapIntegral.point");
+ int exp = config.getInt("fapIntegral.exp");
+ int maxMultiplier = config.getInt("fapIntegral.maxMultiplier");
+ if (maxMultiplier > 1) { //nsgb没有检查,这里检查下防止报错
+ GbGameApi.saveAndReward(player, "MurderMystery", pojo, money, point, exp, maxMultiplier);
+ } else {
+ GbGameApi.saveAndReward(player.getName(), "MurderMystery", pojo, money, point, exp);
+ }
+ }
+ }
}
}, 1);
}
diff --git a/src/main/java/cn/lanink/murdermystery/utils/update/ConfigUpdateUtils.java b/src/main/java/cn/lanink/murdermystery/utils/update/ConfigUpdateUtils.java
index a15292f..f648498 100644
--- a/src/main/java/cn/lanink/murdermystery/utils/update/ConfigUpdateUtils.java
+++ b/src/main/java/cn/lanink/murdermystery/utils/update/ConfigUpdateUtils.java
@@ -7,6 +7,8 @@
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;
+import java.util.LinkedHashMap;
+
/**
* @author LT_Name
*/
@@ -37,4 +39,26 @@ private static void update1_X_X_To_1_4_2() {
config.save();
}
+ // 需要在NsGB加载后检查,放到onEnable里
+ public static void checkFapNsGB(MurderMystery murderMystery) {
+ try {
+ Class.forName("cn.nsgamebase.NsGameBaseMain");
+
+ Config config = murderMystery.getConfig();
+
+ LinkedHashMap fapIntegral = new LinkedHashMap<>();
+ fapIntegral.put("money", 10);
+ fapIntegral.put("point", 0);
+ fapIntegral.put("exp", 10);
+ fapIntegral.put("maxMultiplier", 1);
+
+ if (!config.exists("fapIntegral")) {
+ config.set("fapIntegral", fapIntegral);
+ config.save();
+ }
+ } catch (Exception ignored) {
+
+ }
+ }
+
}