SkinLoader
by Sebi_Zocer
重要消息
此插件在 1.13.x 和 1.14.x 版本中无法正常工作!
如果您了解如何使用 NMS(Net Minecraft Server,即服务端底层代码)进行编程并希望修复此问题,请与我联系。
大家好,今天我正式发布我的项目 SkinLoader。这是一个自 2018 年 12 月 3 日起就已存在的插件。它最初是为一个服务器开发的,用于更改玩家的外观皮肤。玩家可以花费 5000 金币购买皮肤,并在所有小游戏模式中使用这些已购买的皮肤。SkinLoader 最初是大厅系统的一部分,因此我需要开发一个能在各个小游戏服务器上运行的 SkinLoader,这便是第一个版本。在服务器上线后,插件中出现了一些 bug,所以我决定从头重写 SkinLoader,也就是今天发布的这个版本。在过去的一段时间里,我发现插件存在一些潜在问题,例如需要处理 Mojang API 的调用限制,这也是我目前正在开发 SkinLoaderV3 的原因。V3 将为开发者提供更便捷的方法来使用其中实现的所有功能。如果你想知道为什么我要发布当前这个版本,答案是:在我开发 V3 的过程中,我希望你们能够亲自尝试使用该 API,这样未来你们就能拥有一个优秀的 API 并熟练掌握其用法。
什么是 SkinLoader?
SkinLoader 是一个面向开发者的 API,用于管理玩家外观皮肤的切换。例如,你可以编写一个游戏内的 GUI 系统,让玩家购买、选择并使用不同的皮肤进行游戏。
由于在服务端使用昵称系统时处理皮肤切换可能比较困难,SkinLoader 内置了一个昵称系统,运行效果良好。它还支持 MySQL 数据库,用于保存自动昵称(autonick)的相关设置。
还有另一件需要注意的事情:标签页列表/计分板(tablist/scoreboard)。由于使用了昵称系统,当玩家切换昵称时,必须更改其所属的队伍。因此,这里引入了 "CallScoreboardEvent",当需要更新计分板时,该事件会被触发。
方法说明
开发者需要了解如何操作 API,因此在 V3 版本中,所有核心方法都附带了详细的解释,说明它们的功能及工作原理。
如果你想启用 SkinLoader 的调试模式,请进入 plugins/SkinLoader/config.yml 并将 "info: true" 设置为开启状态。
以下是你可以在自己的插件中使用的类:
- Info | SkinLoader 的调试管理器。在配置文件中启用后可供你自己使用。
- User | 包含昵称和皮肤切换的方法。通过 User.getUser(Player/Name) 获取用户对象。
- Database | 包含所有已加载的皮肤和资料信息。
- Manager | 在 onEnable 阶段从 MySQL 加载信息,并可获取 UUID 和名称。
- ProfileManager | 包含所有与资料(profile)相关的方法。
- SkinManager | 包含所有与皮肤(skin)相关的方法。
别忘了查看 源代码。
版本 3
版本 3 已在几天前发布,相较于 V2 有一些变化。方法被移到了新的类中,并且提供了调试模式。我不打算发布适用于 1.9.x 及以上版本的更新,但如果我有时间,我会着手处理。如果发现任何 bug 或其他问题,请予以报告。
技术演示
这里有一些针对 SkinLoader 的技术演示示例。你可以看到 SkinLoader 是如何在其中被使用的,并学习如何将其应用于你自己的插件:
Prefix
致谢
昵称和外观皮肤的切换功能得以实现,完全归功于 BlvckBytes 的 AutoNick 所做的工作。
SkinLoader
by Sebi_Zocer
IMPORTANT NEWS
This plugin is not working on 1.13.x and 1.14.x!
If you know how to program with NMS and want to let this work, please contact me.
Hey Guys, today im releasing my project SkinLoader public. Its an plugin which exists since 3.12.2018. It was made for a server to change the skin for players. Players were able to buy a skin for 5000 coins and to play with their bought skins in every minigame. The SkinLoader was at first a part of the lobbysystem, so i had to made a SkinLoader that works on every minigame-server, thats the first version. After the release on the server there were a lot of bugs in the plugin, so i decidet to program the SkinLoader again from ground-up and thats the version im releasing today. In the past time i saw some problems in the plugin, as example it has to handle with the mojang-api-limitations, so thats why im currently programming SkinLoaderV3. It will be more easier for developers to use all the methods which are implemented. If you want to know why im releasing this version, the answer is: While im programming the V3 i want you to be able to try yourself on the api and later you have an great api and know how to work with it.
What is SkinLoader?
SkinLoader is an API for developers to manage skin-switching for players. As example you can program a gui-system ingame to let players buy, select and play with other skins.
Because skin-switching could be difficult to handle with nick-systems on you server, SkinLoader has an implemented nick-system, which works pretty good. It also has an MySQL database to save autonick-decisions.
There is another thing to have in mind: The tablist/scoreboard. Because of the nick-system you have to change the team of the player when he nicks. So thats why it has the "CallScoreboardEvent", which gets called when a scoreboard-update is needed.
Method-Explanation
Developers need to know how to work with an api, so in V3 all essential methods have explanations what they do and how they do that.
If you want to enable the debug-mode of SkinLoader, go in plugins/SkinLoader/config.yml and set "info: true".
Here are classes which you can use for your plugin:
- Info | Debug-manager for SkinLoader. Enable it in config to use it for yourself.
- User | Contains nick- and skinchanging methods. Get a user with User.getUser(Player/Name).
- Database | Contains all loaded Skins and Profiles.
- Manager | Loads informations at onEnable from MySQL and can get UUIDs and names.
- ProfileManager | All methods for profiles are in it.
- SkinManager | All methods for skins are in it.
Dont forget to take a look in the Source.
Version 3
Version 3 is out since a few days and has some changes from V2. Methods are in new classes and debug-mode is available. Im not planning to release a version for 1.9.x and above, but i will work on it when i have time for that. If you find bugs or anything like that, please report these.
Tech-Demos
Here are some tech-demos for SkinLoader. You can see how SkinLoader got use in it and learn how to use SkinLoader for your own plugins:
Prefix
Credits
Nick and Skin-Switching is only possible because of the work of BlvckBytes' AutoNick
评论 0
登录后参与评分
还没有评论,来抢沙发吧