ItemMail
ItemMail 为玩家提供了一种更简便的交易方式。其 MySQL 集成非常适合云服务器。
功能
- 玩家可以向其他玩家发送物品,也可以请求物品
- 友好的显示名称!不确定你有哪些颜色的羊毛?ItemMail 确保你 确切地 知道自己将获得什么。
- 全新的序列化系统!从 ItemMail 4 版本开始,玩家不会再丢失任何数据(如书籍中的文字)。
- MySQL 集成,非常适合云服务器。
新数据系统
ItemMail 4 版本引入了新的数据存储系统,物品的保存方式不同,但效率更高!这需要一个新的 MySQL 表。所有操作均为自动完成,您只需输入一条命令:
该命令会将旧表中任何未读邮件/请求转换为新格式,并放入新表中!如果您在 4 版本之前使用过 ItemMail,在安装时请务必运行此命令。
关于物品如何序列化的完整文档可在 找到
命令
- /im accept [id] - 接受一个物品请求 (ItemRequest)
- /im convert - 将旧数据转换为新格式
- /im decline [id/*] - 拒绝物品请求
- /im delete [id/*] - 删除物品邮件 (ItemMail)
- /im mb - 查看您的物品邮箱 (ItemMailBox)
- /im mail-info [id] - 查看邮件的详细信息
- /im open [id] - 打开物品邮件
- /im rb - 查看您的物品请求箱 (ItemRequestBox)
- /im request <player> <item[:damage]> [amount] - 向玩家请求物品
- /im request-info [id] - 查看请求的详细信息
- /im send <player> [item[:damage]] [amount] - 发送物品邮件
[id] 指的是玩家物品邮箱或物品请求箱中每个物品旁边的数字
星号 (*) 是“全部”的另一种说法。
权限
- ItemMail.admin.convert - 允许玩家运行 '/im convert' 命令
- ItemMail.general.mail.delete - 允许玩家删除物品邮件
- ItemMail.general.mail.open - 允许玩家打开物品邮件
- ItemMail.general.mail.send - 允许玩家发送物品邮件
- ItemMail.general.mail.view-info - 允许玩家查看物品邮件的详细信息
- ItemMail.general.mailbox.view - 允许玩家查看其物品邮箱
- ItemMail.general.request.accept - 允许玩家接受物品请求
- ItemMail.general.request.decline - 允许玩家拒绝物品请求
- ItemMail.general.request.send - 允许玩家发送物品请求
- ItemMail.general.request.view-info - 允许玩家查看物品请求的信息
- ItemMail.general.requestbox.view - 允许玩家查看其物品请求箱
依赖项
ItemMail 需要 TacoAPI v2.4 或更高版本 才能运行。
提示
权限
可以使用星号 (*) 授予玩家以星号前所有内容开头的所有权限
示例
- ItemMail.general.* - 给予玩家所有 'general' 权限
- ItemMail.general.mail.* - 给予玩家所有与邮件相关的权限
- ItemMail.general.request.* - 给予玩家所有与请求相关的权限
- ItemMail.* - 给予玩家所有权限
发送邮件
当您有一个想要发送的物品,且它符合以下任一描述时:
- 它有自定义名称
- 它有附魔
- 它是书,且里面有文字
- 它是已填写的书
- 它是附魔书
- 它是皮革护甲,且已被染色
那么您需要将其放在快捷栏中,手持该物品,并使用 /im send <player> 来发送它。如果不这样做,可能会丢失部分数据,因此最好使用此方法。这类物品无论如何都无法堆叠,所以您有什么可损失的呢?
Unicode 字符
大多数 MySQL 服务器会使用 latin2 字符集创建数据库(具体取决于位置)。如果您的服务器有使用不同语言打字/说话的玩家,您可能希望使用 Unicode 字符集。以下是将字符集更改为 Unicode 的方法,具体取决于您使用的是 SQL Buddy 还是 phpMyAdmin
SQL Buddy
- 找出表所在的数据库。这可以通过引用 TacoAPI 的 config.yml 找到
- 登录 SQL Buddy 时,左侧 'Databases' 下应该有一个数据库列表。选择正确的数据库。
- 导航到 'itemmail' 表
- 您现在应该在页面顶部看到 'Browse'、'Structure'、'Insert'、'Query' 等选项。点击 'Structure'
- 您现在应该看到一个列名列表,旁边带有复选框。选中 'item' 旁边的复选框,然后点击表格上方的 'edit'
- 在下一页上,您将看到一个下拉框旁边的 'Charset:'。在下拉框中选择 'utf8'。
- 点击提交。
phpMyAdmin
- 找出表所在的数据库。这可以通过引用 TacoAPI 的 config.yml 找到
- 登录 phpMyAdmin 时,左侧应该有一个数据库列表。
- 导航到 'itemmail' 表
- 您现在应该在页面顶部看到 'Browse'、'Structure'、'Insert'、'Query' 等选项。点击 'Structure'
- 您现在应该看到一个列名列表,旁边带有复选框。找到 'item' 并点击 'Change'(铅笔旁边)
- 在 'Collation' 下,将其更改为 'utf8generalci'。
- 点击保存。
对于开发者
ItemMail 拥有自定义事件。这些事件包括:
- ItemMailSentEvent - 当玩家发送邮件时触发
- ItemMailOpenedEvent - 当玩家打开邮件时触发
- ItemRequestSentEvent - 当玩家发送请求时触发
- ItemRequestAcceptedEvent - 当玩家接受请求时触发
- ItemRequestDeclinedEvent - 当玩家拒绝请求时触发
如果您计划调用以下任一方法 -
- ItemMail.send()
- ItemMail.open()
- ItemRequest.send()
- ItemRequest.accept()
- ItemRequest.decline()
那么您需要根据需要移除或给予物品(TacoAPI 中提供,或者您可以使用自己的方法)。物品的移除/添加操作是在相应的 TacoCommand 类中完成的,而不是在 ItemMail/ItemRequest 类中。这样做是为了让开发者/我自己能够从一个不存在的玩家处发送 ItemMail。例如,如果插件将 ItemMail 用作一种奖励系统。
如果您打算在自己的插件中使用 ItemMail 作为奖励系统,最好使用 ItemMail.sendUnsafely()(静态方法)。使用此方法时不会触发 ItemMailSentEvent。
有用链接
ItemMail 是一个开源插件。源代码可以在 GitHub 找到
ItemMail
ItemMail provides an easier way for players to trade. The MySQL integration is great for cloud servers.
Features
- Players can send items to other players, as well as request them
- Friendly display names! Not sure what color of wool you have? ItemMail makes sure you know exactly what you are getting.
- New serialization system! As of version ItemMail 4, players don't lose any data like words in books.
- MySQL integration, great for cloud servers.
New Data System
There is a new data saving system in version ItemMail 4, items are saved differently, but way more efficiently! This requires a new MySQL table. Everything is done automatically for you, you just need to type one command:
This takes any unread mail/requests from the old table, converts it into the new format, and puts it in the new table! If you've used ItemMail prior to version 4, be sure to run this command when you install.
Full documentation on how the items are serialized can be found at
Commands
- /im accept [id] - Accept an ItemRequest
- /im convert - Converts old data to the new format
- /im decline [id/*] - Decline ItemRequests
- /im delete [id/*] - Delete ItemMail
- /im mb - View your ItemMailBox
- /im mail-info [id] - View detailed information on mail
- /im open [id] - Open ItemMail
- /im rb - View your ItemRequestBox
- /im request <player> <item[:damage]> [amount] - Request items from a player
- /im request-info [id] - View detailed information on requests
- /im send <player> [item[:damage]] [amount] - Send ItemMail
[id] refers to the number next to each item in a players ItemMailBox or ItemRequestBox
The asterisk is another way of saying all.
Permissions
- ItemMail.admin.convert - Allows a player to run the '/im convert' command
- ItemMail.general.mail.delete - Allows a player to delete a ItemMail
- ItemMail.general.mail.open - Allows a player to open ItemMail
- ItemMail.general.mail.send - Allows a player to send ItemMail
- ItemMail.general.mail.view-info - Allows a player to view detailed information on ItemMail
- ItemMail.general.mailbox.view - Allows a player to view their ItemMailbox
- ItemMail.general.request.accept - Allows a player to accept an ItemRequest
- ItemMail.general.request.decline - Allows a player to decline an ItemRequest
- ItemMail.general.request.send - Allows a player to send an ItemRequest
- ItemMail.general.request.view-info - Allows a player to view information on ItemRequests
- ItemMail.general.requestbox.view - Allows a player to view their ItemRequestBox
Dependencies
ItemMail requires TacoAPI v2.4 or higher to run.
Tips
Permissions
An asterisk (*) can be used to give a player an permission that starts with everything before the asterisk
Examples
- ItemMail.general.* - Gives a player all 'general' permissions
- ItemMail.general.mail.* - Gives a player all permissions related to mail
- ItemMail.general.request.* - Gives a player all permissions related to requests
- ItemMail.* - Gives a player all permissions
Sending Mail
When you have an item you want to send and it fits any of these descriptions:
- It has a custom name
- It has enchantments
- It is a book, and it has words in it
- It is a written book
- It is an enchanted book
- It is leather armor, and it has been dyed
Then you will need to put it in you hotbar, hold it in your hand, and use /im send <player> to send it. If this is not done, some data may be lost, so it is best to use this method. These kind of items can't be stacked anyway, so what do you have to lose?
Unicode Characters
Most MySQL servers will create databases using the latin2 character set (depending on the location). If your server has players that may type/speak a different language, you may want to use the Unicode charset. Below are methods to change the character set to Unicode, depending if you use SQL Buddy or phpMyAdmin
SQL Buddy
- Find out what database the table is in. This can found be referencing the config.yml for TacoAPI
- When logging into SQL Buddy, there should be a list of databases on the left under 'Databases'. Select the correct one.
- Navigate to the table 'itemmail'
- You should now see 'Browse', 'Structure', 'Insert', 'Query' etc. on the top of the page. Click on 'Structure'
- You should now see a list of column names with checkboxes next to them. Select the checkbox next to 'item' and click 'edit' above the table.
- On the next page, you will see 'Charset:' next to a drop down box. In the drop down box, select 'utf8'.
- Click submit.
phpMyAdmin
- Find out what database the table is in. This can found be referencing the config.yml for TacoAPI
- When logging into phpMyAdmin, there should be a list of databases on the left.
- Navigate to the table 'itemmail'
- You should now see 'Browse', 'Structure', 'Insert', 'Query' etc. on the top of the page. Click on 'Structure'
- You should now see a list of column names with checkboxes next to them. Find 'item' and click on 'Change' (next to a pencil)
- Under 'Collation', change it to 'utf8generalci'.
- Click save.
For Developers
ItemMail has custom events. These events are:
- ItemMailSentEvent - Called when a player sends mail
- ItemMailOpenedEvent - Called when a player opens mail
- ItemRequestSentEvent - Called when a player sends a request
- ItemRequestAcceptedEvent - Called when a player accepts a request
- ItemRequestDeclinedEvent - Called when a player declines a request
If you plan to call any of the following methods -
- ItemMail.send()
- ItemMail.open()
- ItemRequest.send()
- ItemRequest.accept()
- ItemRequest.decline()
Then you will need to take away/give the items as needed (available in TacoAPI, or you can use your own method). The item removal/addition is done inside the appropriate TacoCommand class, not the ItemMail/ItemRequest class. This is done so developers/myself can send ItemMail from a non-existant person. For example, if the plugin uses ItemMail as a type of reward system.
If you plan to use ItemMail in one of your plugins as a type of reward system, it is best to use ItemMail.sendUnsafely() (static method). When this method is used an ItemMailSentEvent is not fired.
Useful Links
ItemMail is an open-source plugin. The source can be found at GitHub
评论 0
登录后参与评分
还没有评论,来抢沙发吧