diff --git a/README.md b/README.md index 8c5020d..0a47e63 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,17 @@

在游戏中添加统计信息来统计玩家挖掘数据, 可以借助计分板显示出数据

- -
GitHub GitHub Workflow Status -Kotlin Version -# 依赖 - -* 由于使用了`Kotlin`语言所以你需要放置`fabric-language-kotlin`在你的mods文件夹内. 点击[这里](https://github.com/FabricMC/fabric-language-kotlin/releases/latest)快速下载最新版本的`fabric-language-kotlin` - # 使用 -* 默认是不会记录玩家挖掘数据的, 你需要添加一个计分板, 准则为`minecraft.custom:minecraft.rmc`的一个计分板, 以下为实例命令, 如有需要可以自行修改 +* 默认是不会记录玩家挖掘数据的, 你需要添加一个计分板, 准则为`minecraft.custom:minecraft.rmc.dig`的一个计分板, 以下为实例命令, 如有需要可以自行修改 -* `/scoreboard objectives add rmc minecraft.custom:minecraft.rmc {"text":"挖掘榜", "color":"yellow"}` +* `/scoreboard objectives add rmc minecraft.custom:minecraft.rmc.dig {"text":"挖掘榜", "color":"yellow"}` * 上面的命令执行完成后所有玩家破坏任何方块都会使其加1(常规情况下破坏方块), 使用以下命令来显示出计分板 diff --git a/src/main/java/cn/rtast/rmc/RMC.kt b/src/main/java/cn/rtast/rmc/RMC.kt deleted file mode 100644 index 524b5a1..0000000 --- a/src/main/java/cn/rtast/rmc/RMC.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2023 RTAkland - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cn.rtast.rmc - -import cn.rtast.rmc.mixin.StatsAccessor -import com.google.common.collect.Sets -import net.fabricmc.api.DedicatedServerModInitializer -import net.minecraft.stat.Stat -import net.minecraft.stat.StatFormatter -import net.minecraft.util.Identifier - -class RMC : DedicatedServerModInitializer { - - companion object { - private val stats: MutableSet = Sets.newHashSet() - - var RMC_STAT_ID: Identifier? = null - - private fun addStat(stat: Identifier) { - stats.add(stat.toString()) - } - - fun registerStats() { - addStat(StatsAccessor.callRegister("rmc", StatFormatter.TIME).also { RMC_STAT_ID = it }) - } - - operator fun contains(stat: Stat<*>): Boolean { - return stats.contains(stat.value.toString()) - } - } - - override fun onInitializeServer() { - println("RMC 已加载!") - } -} \ No newline at end of file diff --git a/src/main/java/cn/rtast/rmc/mixin/ServerStatHandlerMixin.java b/src/main/java/cn/rtast/rmc/mixin/ServerStatHandlerMixin.java deleted file mode 100644 index 3ec1420..0000000 --- a/src/main/java/cn/rtast/rmc/mixin/ServerStatHandlerMixin.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 RTAkland - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cn.rtast.rmc.mixin; - -import cn.rtast.rmc.RMC; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.stat.ServerStatHandler; -import net.minecraft.stat.Stat; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(ServerStatHandler.class) -public abstract class ServerStatHandlerMixin { - @Redirect(method = "sendStats", at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/objects/Object2IntMap;put(Ljava/lang/Object;I)I"), remap = false) - private int excludeCustomStats(Object2IntMap> map, Object object, int value, ServerPlayerEntity player) { - if (!RMC.Companion.contains((Stat) object)) { - return map.put((Stat) object, value); - } else { - return map.defaultReturnValue(); - } - } -} \ No newline at end of file diff --git a/src/main/java/cn/rtast/rmc/mixin/StatsAccessor.java b/src/main/java/cn/rtast/rmc/mixin/StatsAccessor.java deleted file mode 100644 index 582aada..0000000 --- a/src/main/java/cn/rtast/rmc/mixin/StatsAccessor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 RTAkland - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cn.rtast.rmc.mixin; - -import net.minecraft.registry.Registry; -import net.minecraft.stat.StatFormatter; -import net.minecraft.stat.StatType; -import net.minecraft.stat.Stats; -import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(Stats.class) -public interface StatsAccessor { - @Invoker - static Identifier callRegister(String string, StatFormatter statFormatter) { - return null; - } - - @Invoker - static StatType callRegisterType(String string, Registry registry) { - return null; - } -} diff --git a/src/main/java/cn/rtast/rmc/mixin/StatsMixin.java b/src/main/java/cn/rtast/rmc/mixin/StatsMixin.java deleted file mode 100644 index bb9dfb3..0000000 --- a/src/main/java/cn/rtast/rmc/mixin/StatsMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2023 RTAkland - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package cn.rtast.rmc.mixin; - -import cn.rtast.rmc.RMC; -import net.minecraft.stat.Stats; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(Stats.class) -public class StatsMixin { - - static { - RMC.Companion.registerStats(); - } -} \ No newline at end of file diff --git a/src/main/resources/assets/rmc/lang/en_us.json b/src/main/resources/assets/rmc/lang/en_us.json deleted file mode 100644 index fcad059..0000000 --- a/src/main/resources/assets/rmc/lang/en_us.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "stat.rmc.rmc_stat": "挖掘数" -} \ No newline at end of file diff --git a/src/main/resources/assets/rmc/lang/zh_cn.json b/src/main/resources/assets/rmc/lang/zh_cn.json deleted file mode 100644 index 6dc0d22..0000000 --- a/src/main/resources/assets/rmc/lang/zh_cn.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "stat.rmc.rmc_stat": "Total number of blocks destroyed." -} \ No newline at end of file