找回密码
 立即注册

QQ登录

只需一步,快速开始

[全版本]BigSpender - 允许玩家在命令中键入数字缩写

像素搬运菌 2024-6-8 02:44:23 经济 阅读 68 | Edg | Windows 10 来自 美国
服务器插件
中文名称:
英文名称: BigSpender
插件来源: 转载
适用服务端: Spigot 
插件类型: 经济
语言支持: 英文 
适用版本: 全版本 
前置插件/mod:
下载地址: https://www.spigotmc.org/resources/bigspender.117170/
原贴地址: https://www.spigotmc.org/resources/bigspender.117170/

马上登录/注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x

BigSpender

BigSpender 是 Paper 和 Spigot 的简单插件,允许玩家在与经济相关的命令中输入数字缩写。这样就无需在命令中键入一堆零,从而节省了时间并减少了拼写错误。这对于经济规模非常大(余额达到数万亿甚至更高)的服务器特别有用。换句话说,如果玩家需要向某人支付 3 万亿美元(通常显示为“3T”),他们只需输入“/pay Steve 3t”,而不必输入九个零。
image.jpg

特征

简单:完全按照它打算做的事情去做;仅此而已。这种简单性使其能够与来自任何插件的任何命令一起使用。
轻:使用 OG Bukkit API,仅注册单个事件。像黄油一样运行,与每个游戏版本兼容。
配置:您可以准确定义哪些命令(和子命令!BigSpender应该处理,以及针对哪些参数。还支持自定义数字后缀和大数字。查看config.yml了解更多详情。

如何使用

将 jar 放入您的插件文件夹并运行您的服务器。BigSpender将从配置中的一些默认设置开始,但您可能应该进入并定义自己的缩写和命令。截至目前,您需要重新加载插件以应用配置更改。

权限

玩家需要权限 bigspender.use 才能处理他们的命令。如果未安装权限插件,则默认情况下为 true。

示例配置

# This is where you define your abbreviations. Should be a suffix followed by a multiplier.
# The suffix MUST be letters only, otherwise the plugin will reject it.
# Example format - "k 1000". Also supports exponential notation. Example - "M 1e6"
# NOTE: BigSpender can support nearly-infinite large numbers.
# However, many economy plugins only allow maximum balances of $10T or so.
abbreviations:
  - "k 1000"
  - "M 1000000"
  - "B 1000000000"
  - "T 1000000000000"
  - "Q 1e15"

# Are the above abbreviations case sensitive?
case-sensitive: false

# Add your commands, along with the argument number(s) that we should substitute, seperated by spaces.
# The arguments start from 1, so if you want to substitute the fifth argument in the "foo" command,
# you would add "foo 5". If you ALSO want the second argument to be substituted, you'd do "foo 2 5".
# These entries are always case insensitive when matching to user input.
# You can also specify subcommands such as the "auc bid" example below. 
# The argument numbers start counting after the subcommand like you'd expect.
# Subcommands are matched longest-first, so "foo bar baz" would match before "foo bar", which matches before "foo"
# IMPORTANT: If a command has multiple aliases, you need to add each one separately. (e.g. "auc" and "auction")
commands:
  - "pay 2" # "/pay Steve 1.337B"
  - "eco 3" # "/eco give Alex 3.5T" (this entry also works for "take"; "reset" has no third argument)
  - "economy 3" # alias of eco
  - "auc bid 1" # "/auc bid 12k"
  - "auction bid 1" # alias of auc
  - "auc start 2" # "/auc start 64 7.2M"
  - "auction start 2" # alias of auc

# Prints extra info to the console when the plugin processes a command.
# Useful for figuring out problems with your config. Required if asking for support.
verbose: false

问:它是如何工作的?

答:它的工作原理是在命令到达处理命令的插件之前读取和修改命令的文本。这是通过一个名为 PlayerCommandPreprocessEvent 的很少使用的事件完成的。这种方法的好处是插件不需要知道有关实际命令的任何细节,只需要知道要扩展数字缩写的部分。

问:如何替换每个命令中的所有缩写?

答:你不能。这会导致很多看起来很像可扩展数字的参数出现很多偷偷摸摸的问题,但实际上并非如此——也许它们是玩家名称或消息的一部分。更糟糕的是,玩家甚至不知道为什么他们的命令会搞砸。通过显式定义BigSpender处理哪些命令的参数,可以防止此类事情发生。

问:这适用于控制台吗?

答:不可以,原因与上述类似。有些插件作为控制台运行命令,您绝对不想像这样惹恼其他插件。这也将是一个潜在的安全风险。

需要改进的地方

如果我有时间,这些可能是一些需要改进的地方:
动态重新加载配置的命令
使用缩写前缀代替后缀的选项
自动解析命令别名和命名空间命令
可配置的事件优先级
更好地处理使用参数自动完成的命令


bigspender-1.0.jar (10.37 KB, 下载次数: 2)
(0)
像素搬运菌板块版主

帖子地址: 

发表回复

使用道具 举报