关于
AbilityTrader 允许玩家使用经济系统或经验值购买和租赁指令与权限。
编写此插件的原因是,我运营的服务器存在一个问题:部分玩家拥有远超其他人的巨额资金。通过安装此插件,他们可以获得更多功能,同时其余额会相应减少。
设置
将 AbilityTrader.jar 复制到你的 plugins 目录中。首次运行时,会在 AbilityTrader/config.yml 生成一个配置文件。你需要编辑该文件以添加你想要出售或出租给玩家的技能。
权限
abilitytrader.use - 允许玩家使用 AbilityTrader (默认: true)
abilitytrader.showhidden - 允许玩家在列表中查看隐藏的技能 (默认: op)
abilitytrader.admin.reload - 重新加载配置 (默认: op)
abilitytrader.admin.players - 查看玩家列表及其拥有的技能 (默认: op)
abilitytrader.admin.add - 向玩家添加技能 (默认: op)
abilitytrader.admin.remove - 从玩家移除技能 (默认: op)
abilitytrader.admin.* - 提供 showhidden、reload、players、add 和 remove 权限 (默认: op)
命令
AbilityTrader 的命令非常少——输入 /ability help 可获取简短列表。除了 info、rent 和 buy 之外,所有命令均可在控制台和游戏内使用。
对于管理员,你可以输入 /ability players 查看拥有技能的玩家列表——这将显示所有拥有技能的玩家及其到期时间(如果适用)。如果你修改了配置文件本身,也可以使用 /ability reload 重新加载配置。
管理员还可以在不手动编辑文件的情况下移除玩家的技能。为此,请输入 /ability remove <player> <ability>。如果出现错误,你将看到相应的错误消息。
管理员还可以通过输入 /ability add <player> <rent/buy> <ability> <true/false> 向玩家授予技能。末尾的 true/false 决定 AbilityTrader 是否应向玩家收取技能费用(不会向管理员收费)。
或者,你可以使用 /ab、/at 或 /abt 作为 /ability 的快捷方式。
配置
默认配置如下:
log: false
page_results: 10
global:
commands:
add: []
remove: []
abilities:
workbench:
description: No need for real workbenches any more!
permissions:
- essentials.workbench
commands:
add: []
remove:
- msg {0} Removing workbench ability
rent_cost: 100
duration: 300
me:
description: Say stuff third-person style
permissions:
- essentials.me
commands:
add: []
remove: []
buy_cost: 5000
rent_cost: 15
duration: 60
hat:
description: Look dapper in your choice of hat
groups:
add: Fashionable
remove: PREVIOUS_GROUP
permissions:
- essentials.hat
buy_cost: 1000
players: []
你应该在 abilities 部分下添加你想要出售或租赁的技能。保持技能名称简短且有意义。你可以使用 description 来扩展描述该技能提供的功能。
每个技能都可以为玩家分配零个或多个 permissions。如果你不想给予任何权限,只需将其设置为 permissions: []。
每个技能还可以在添加和移除技能时执行 commands(当玩家购买/租赁时,以及当技能过期时,如果是租赁的话)。同样,这可以是一个或多个命令,也可以没有。你可以使用占位符 {0} 将玩家名称传递给命令。如果你想在他们移除技能时向他们发送消息等,这会很有用。命令开头不应带有斜杠 (/),并且当玩家购买或租赁技能时将自动运行,如果指定了任何 remove 命令,则当技能过期或管理员从玩家移除技能时也会自动运行。你也可以为命令使用其他占位符——{1} 是技能名称,{2} 是技能的价格(如果他们租赁,则是租赁价格;如果他们购买,则是购买价格),{3} 与 {2} 相同,但包含货币格式(即在金额前添加 $,或者根据你的经济系统设置进行格式化。如果你使用的是经验值,它会将 'exp' 后缀添加到成本中)。全局命令可以与单个技能命令一起运行,或者代替它们运行。特殊的占位符在这里也有效。
你可以指定使用金钱或经验值的租赁价格和购买价格,可以单独指定,也可以一起指定。如果是租赁,只需调用 rent_cost。如果是购买,则为 buy_cost,如果你希望允许购买 和 租赁该技能,只需同时指定这两个选项。如果你更倾向于使用经验值而不是经济系统,请使用 buy_exp 和 rent_exp。
duration 指定(以秒为单位)玩家将拥有该技能的时长。在此时间之后,技能将被移除,并执行任何移除命令。持续时间仅适用于可租赁的技能。
在添加或移除能力时,可以选择将玩家移动到指定组别或从组别中移除。添加/移除时只能指定一个组别(多个组别并无实际意义)。上文中的 hat 能力示例便展示了这一用法。该示例使用了特殊关键字 _PREVIOUSGROUP —— 若在“移除”组别中指定了此关键字,AbilityTrader 会在移除能力时将玩家之前的组别重新分配给他们。如果你拥有复杂的组别层级结构,这将非常有用。
如果你不希望玩家在列表(或已拥有该能力时的信息界面)中看到某个能力,可以在该能力配置中添加 hidden: true。这非常适合用于测试能力,或者防止玩家访问某些特定能力。拥有 abilitytrader.showhidden 权限的玩家(默认 OP)可以看到这些隐藏的能力。管理员如有需要,也可以将这些隐藏能力授予普通玩家。
请避免修改 players 部分——该部分用于记录哪些玩家拥有能力、获得能力的时间以及过期时间(如果是租赁的话)。
其他
AbilityTrader 每分钟运行一次任务以移除过期的能力——你可能会发现,如果能力已过期但任务尚未运行,/ability info 仍可能显示这些能力。
这是我的第一个 Bukkit 插件,也是我第一次使用 Java 编程,因此请注意,它可能并不完美,且可能存在一些 bug。话虽如此,我已在生产服务器上进行了测试,未出现任何问题,并在开发机上进行了大量测试。
如果发现任何 bug,或希望建议功能或改进,请点击上方的 Tickets 链接。
如果你想测试本插件,欢迎在游戏中连接至 PlayPyxis.com 并使用上述命令。
如果你希望允许玩家创建自己的公共传送点,可以查看我的另一个插件 AreaTP。
About
AbilityTrader allows your players to buy and rent commands and permissions using an economy or experience points.
This plugin was created because the server I run has a particular problem with a few players having significantly more money than the rest, so having this plugin allows them to get a few more features and reduces their balance accordingly.
Setup
Copy AbilityTrader.jar into your plugins directory. The first time it runs, a configuration file will be created in AbilityTrader/config.yml. You should edit this to add abilities that you want to sell or rent to players.
Permissions
abilitytrader.use - Allow players to use AbilityTrader (default: true)
abilitytrader.showhidden - Allow players to see hidden abilities in the list (default: op)
abilitytrader.admin.reload - Reload the configuration (default: op)
abilitytrader.admin.players - See a list of players and abilities they have (default: op)
abilitytrader.admin.add - Add abilities to players (default: op)
abilitytrader.admin.remove - Remove abilities from players (default: op)
abilitytrader.admin.* - Provides showhidden, reload, players, add and remove permissions (default: op)
Commands
There are very few commands for AbilityTrader - type /ability help for a short list. All of these work (with the exception of info, rent and buy) on the console as well as in-game.
For administrators, you can view a list of players with abilities by typing /ability players - this will show all players with abilities, along with their expiry times if applicable. You can also reload the configuration file with /ability reload if you make any changes to the file itself.
Administrators are also able to remove player abilities without having to manually edit the file. To do this, type /ability remove <player> <ability>. You will see error messages if something goes wrong.
Administrators can also give abilities to players by typing /ability add <player> <rent/buy> <ability> <true/false>. The true/false at the end determines whether AbilityTrader should charge the player for the ability (it won't charge the administrator).
Alternatively, you can use /ab, /at or /abt as a shortcut to /ability.
Configuration
The default configuration is as follows:
log: false
page_results: 10
global:
commands:
add: []
remove: []
abilities:
workbench:
description: No need for real workbenches any more!
permissions:
- essentials.workbench
commands:
add: []
remove:
- msg {0} Removing workbench ability
rent_cost: 100
duration: 300
me:
description: Say stuff third-person style
permissions:
- essentials.me
commands:
add: []
remove: []
buy_cost: 5000
rent_cost: 15
duration: 60
hat:
description: Look dapper in your choice of hat
groups:
add: Fashionable
remove: PREVIOUS_GROUP
permissions:
- essentials.hat
buy_cost: 1000
players: []
You should add abilities that you want to buy or rent under the abilities section. Keep the ability name short and meaningful. You can expand on what the ability provides with the description.
Each ability can assign zero or more permissions to players. If you don't want to give any permissions, just set this to permissions: [].
Each ability can also execute commands when abilities are added and removed (when players buy/rent, and when they expire, if rented). Again, this can be one or more commands, or none at all. You can use the placeholder {0} to pass the player's name to the command. This is useful if you want to message them when the ability is removed, etc. The commands should not have a slash (/) at the start, and will be run automatically when a player buys or rents an ability, and run automatically when abilities expire or admins remove them from players, if any remove commands have been specified. You can also use additional placeholders for commands - {1} is the ability name, {2} is the price of the ability (if they rented, it'll be the rent price - if they bought, it'll be the buy price), and {3} is the same as {2} except it includes currency formatting (i.e. adding $ to the amount, or however you have your economy setup. If you're using experience, it will suffix the cost with 'exp'). Global commands can be run as well as or instead of individual ability commands. The special placeholders work here too.
You can specify a rent price and buy price with money or experience, either individually or together. If renting, simply call this rent_cost. For buying, it's buy_cost, and if you want to allow buying and renting of the ability, just specify both options. If you prefer to use experience points rather than an economy system, use buy_exp and rent_exp.
The duration specifies (in seconds) how long a player will have the ability for. After this time, the ability will be removed and any remove commands will be executed. The duration only applies to rentable abilities.
Each ability can optionally move players to and from groups when adding or removing the ability. You can only specify one group when adding or removing (multiple groups wouldn't make sense). An example can be seen for the hat ability above. This example uses the special keyword _PREVIOUSGROUP - if that's specified for the 'remove' group, AbilityTrader will assign the player's previous group to them when removing the ability. This is useful if you have a complex hierarchy of groups.
You can add hidden: true to an ability if you don't want players to see it in the list (or on their info screen if they already have it). This is ideal if you're testing abilities or don't want players to have access to certain abilities. Any players with the abilitytrader.showhidden permission will be able to see these (op by default). Administrators can give hidden abilities to regular players if necessary.
You should avoid modifying the players section - this tracks which players have abilities, when they were given and when they will expire (if they were rented).
Other
AbilityTrader runs a task every minute to remove expired abilities - you may notice that /ability info may still show these if they have expired but the task hasn't run yet.
This is my first Bukkit plugin and the first time I've used Java, so please bear in mind that this won't be perfect and may well have bugs. Having said that, I have tested it on one production server without any issues, as well as extensive testing on a development machine.
If you find any bugs or would like to suggest features or improvements, please click the Tickets link above.
If you would like to test this plugin, you're welcome to connect to PlayPyxis.com in-game and use the commands above.
Check out my other plugin, AreaTP if you want to allow your players to create their own public warp points.
评论 0
登录后参与评分
还没有评论,来抢沙发吧