织物声望系统

织物声望系统

这是一个用于管理服务器上玩家声誉的模组。恶劣的玩家(例如破坏者和窃贼)会被踩,而友善的玩家会被赞。你可以配置根据玩家声誉触发的一些操作。

管理

Fabric 声望系统

这是一个用于管理服务器上玩家声望的模组。恶劣的玩家(例如破坏者和窃贼)可以被差评,而友善的玩家可以获得好评。你可以根据玩家的声望配置一些动作来触发。你还可以使用数据包配置更多动作。

命令摘要

  • /rep view [player] — 查看玩家的声望。
  • /rep set <rep>、/rep set <player> <rep>(仅限管理员)— 设置玩家的声望。
  • /rep upvote <player> [reason] — 给玩家点赞。reason 参数可以配置为必填。
  • /rep downvote <player> [reason] — 给玩家点踩。reason 参数可以配置为必填。
  • /rep reload(仅限管理员)— 重新加载配置文件
  • /rep wanted — 查看“通缉”玩家的坐标。

在数据包中获取声望

你可以使用以下命令将玩家的声望保存到记分板目标中:

execute as <entity> store result score @s <objective> run rep view @s[type=player]

配置模组

以下是模组的默认配置文件:

{
	// Cooldown time is in seconds.
	// `/rep set` is not affected by cooldown, but `/rep upvote` and `/rep downvote` are.
	cooldown: 84600,
	// The minimum and maximum reputation.
	// All reputation changes will clamp between these values.
	minRep: null,
	maxRep: null,
	// Minimum required reputation to PvP. Anything lower than this will not be able to hit another player.
	// Can be set to null to always allow PvP.
	minPvPRep: null,
	// Minimum required reputation to modify within the range of spawn protection.
	// Can be set to null to always disallow modification.
	minSpawnBuildingRep: null,
	// Maximum required reputation to be wanted (have co-ords shown).
	// Can be set to null to not allow anyone to be wanted.
	maxWantedRep: null,
	// Require a reason to vote on a player.
	votingReasonRequired: true,
	// Show the upvote/downvote reason in notifications.
	showReason: false,
	// Notify the player when they get upvoted.
	upvoteNotifications: false,
	// Notify the player when they get downvoted.
	downvoteNotifications: false,
	// Webhook to log upvotes and downvotes.
	discordWebhookUrl: null
}

从模组中查询声望

首先,在你的 build.gradle 中依赖此模组:

repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}

dependencies {
    modImplementation "maven.modrinth:fabric-rep-system:1.0.0"
}

然后,你可以使用 RepUtils.getPlayerReputation(playerUuid) 查询声望数据的 API。