games647 / minecraft-banner-generator
为服务器和玩家定制的横幅生成器
0.4.1
2016-05-25 19:44 UTC
Requires
- php: >=5.6
Requires (Dev)
Suggests
- funnyitselmo/minecraftserverstatus: An alternative to xpaw's project
- games647/minecraft-skin-renderer: Allows you to render minecraft skin heads and complete skins for player banners
- xpaw/php-minecraft-query: Allows you to query data from minecraft servers like: motd, online players, max players, favicon, ping
This package is not auto-updated.
Last update: 2024-09-26 01:23:02 UTC
README
描述
Minecraft横幅生成器库。
功能
- 服务器横幅显示
- Ping(显示ping的好坏程度)
- 在线玩家
- 最大玩家数
- 如有,显示favicon
- 彩色motd(每日消息)
- 自定义背景
- 玩家横幅显示
- 玩家头像图片
- 显示玩家名字
- 无品牌
- 无魔法值
- 免费
待办事项
- 文本样式效果(加粗、斜体、下划线)
- 自动换行
- 玩家活动图
安装
使用composer只需
composer require games647/minecraft-banner-generator
对于非composer项目,您可以将/src文件夹中的文件放入库文件夹,并在PHP文件的顶部使用require语句使用它。您可以在example.php文件中看到一个示例。
使用方法
//this is only used if you don't use composer require __DIR__ . '/PATH_TO_LIB_FOLDER/MinecraftBanner.php'; require __DIR__ . '/PATH_TO_LIB_FOLDER/ServerBanner.php'; use \MinecraftBanner\ServerBanner; use \MinecraftBanner\MinecraftBanner; [...] //tell the browser that we will send the raw image without HTML header('Content-type: image/png'); $banner = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt"); imagepng($banner);
背景
您可以使用11种内置背景或图片作为文件或URL
$favicon = imagecreatefrompng("server_favicon.png"); $image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon, "MinecraftBanner::[DEFAULT_BACKGROUND, CLOUDS_BACKGROUND, LILLY_PADS_BACKGROUND, HILLS_BACKGROUND, WATERFALL_BACKGROUND, CANYON_BACKGROUND, GRASSLAND_BACKGROUND, GRASSLAND_CANYON_BACKGROUND, SWAMP_BACKGROUND, LAKE_BACKGROUND, SWAMP2_BACKGROUND, LILLY_PADS_SWAMP_BACKGROUND]");
CLOUDS_BACKGROUND
LILLY_PADS_BACKGROUND
HILLS_BACKGROUND
WATERFALL_BACKGROUND
CANYON_BACKGROUND
GRASSLAND_BACKGROUND
GRASSLAND_CANYON_BACKGROUND
SWAMP_BACKGROUND
LAKE_BACKGROUND
SWAMP2_BACKGROUND
LILLY_PADS_SWAMP_BACKGROUND
缩放
示例
$favicon = imagecreatefrompng("server_favicon.png"); $image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon);
$favicon = imagecreatefrompng("notch_head.png"); $image = PlayerBanner::player("Notch", $favicon);
$favicon = imagecreatefrompng("server_favicon.png"); $image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);
$favicon = imagecreatefrompng("notch_head.png"); $image = PlayerBanner::player("Notch", $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);