From 1e8976c9fcf3166538b6ca0ad58113f0e965273e Mon Sep 17 00:00:00 2001 From: LT_Name <572413378@qq.com> Date: Sat, 7 Oct 2023 20:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=80=82=E9=85=8DNSGB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/FakeNsGameBase.jar | Bin 0 -> 6681 bytes pom.xml | 11 ++++++-- .../lanink/murdermystery/MurderMystery.java | 13 +++++++++- .../room/classic/ClassicModeRoom.java | 21 +++++++++++++++ .../utils/update/ConfigUpdateUtils.java | 24 ++++++++++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 lib/FakeNsGameBase.jar diff --git a/lib/FakeNsGameBase.jar b/lib/FakeNsGameBase.jar new file mode 100644 index 0000000000000000000000000000000000000000..d8272b63f744d0f1346e33e4dd8feee5a81ce689 GIT binary patch literal 6681 zcmb7|bzBt8*2hWd4nZVWx&-NzrG%wnY3T*&SXc=`NF(~7kcLH4q>+%Nltw^W zd6&m~U*AXX_Z zrrv#W84O%;Jb;jztV2;pPmfg)5&nzGZGHo+5QEz7SNnQXlz#s7kT)$%z--s>dnbaQ zhLXLmJblqe6>9yxQ3-&88m`lu#gQJ5F5F76zfL8KCqUUF>jJ2HUN*>tYWNAcRo`L` zOV~0pkL{Q1TTbxd*enA_rf>r0N8iE4ZDfJZ>vu_Q-QO?>2Fb8Xcx?*B%+?oxLzCM^kCcQz8 z5Xeo%yd=&@V`pst7EV{ld7@$}FepwO<=0N1N*AoOTFRNOeXuHxmN{^ zbJ?YcI>TxVPamU0C&It##gm4c8molnSj_N;QM?Ia#d)5UlHVHQM8b8vHh_I5cNT2bQ$8Z5qP>) zZAy|{Pwe#Svhf@Czz5`vY*x%C$sYPFvnpLu2d2yN5~rwsaWmqIj-M<1$aTJ+y!&+1 zACx91(xZ73^&Aa7z!I1=L^(JccsH$3t=YS^AznqLTDX@Y8=Ag8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r z^@irMSHnp)v&j$RbDryim0Ib-72eOO61_040N^~}%w`{%Sr zw?u|Bi|0E5bkvTr{0B6X%KO{l%j zjyT*cG34t>m|0n%E=0#;LLs5D0L#;3*t(+9L7-;qoDnU>CHk-)3YDSjk{EcZK;+y( zA<3Cor5qO$onaEaOL}A%y=&41ki?0O!t*BBU@mi%+SkP*e3LE(C$U;>5D-v{glRkcn.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) { + + } + } + }