• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Spirit55555/PHP-Minecraft: Useful PHP classes for Minecraft

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Spirit55555/PHP-Minecraft

开源软件地址(OpenSource Url):

https://github.com/Spirit55555/PHP-Minecraft

开源编程语言(OpenSource Language):

PHP 100.0%

开源软件介绍(OpenSource Introduction):

Latest Stable Version Total Downloads License PHP Version Require

PHP-Minecraft

Useful PHP classes for Minecraft

Using Composer?

First require it like this:

composer require spirit55555/php-minecraft

and then use it like this:

<?php
require 'vendor/autoload.php';
use \Spirit55555\Minecraft\MinecraftColors;

MinecraftColors::clean("test");
?>

Not using Composer?

Just download the files and include them.

MinecraftColors.php

Convert Minecraft color codes to HTML/CSS. Can also remove the color codes.

Usage

<?php
require 'vendor/autoload.php';
use \Spirit55555\Minecraft\MinecraftColors;

//Support for § and & signs
$text = '§4Lorem §3§lipsum §rdolor &nsit &c&mamet';

//Convert to HTML with CSS colors
echo MinecraftColors::convertToHTML($text);

//Same as above, but will replace \n with <br />
echo MinecraftColors::convertToHTML($text, true);

//Same as above, but will use CSS classes instead of inline styles
echo MinecraftColors::convertToHTML($text, true, true, 'mc-motd--');

//Will be compatible with the server.properties file
echo MinecraftColors::convertToMOTD($text);

//Will be compatible with BungeeCord's config.yml file
echo MinecraftColors::convertToMOTD($text, '&');

//Will also output RGB/HEX colors, if they exist (&#000000)
//NOTE: Not supported in Vanilla Minecraft
echo MinecraftColors::convertToMOTD($text, '&', true);

//Same as above, but RGB/HEX in a long format (&x&0&0&0&0&0&0)
//NOTE: Not supported in Vanilla Minecraft
echo MinecraftColors::convertToMOTD($text, '&', true, true);

//Remove all color codes
echo MinecraftColors::clean($text);
?>

More information about Minecraft colors: http://minecraft.gamepedia.com/index.php?title=Color_codes

MinecraftJSONColors.php

Converts Minecraft JSON (http://wiki.vg/Chat) text to legacy format ('§aHello')

Usage

<?php
require 'vendor/autoload.php';
use \Spirit55555\Minecraft\MinecraftJSONColors;

$first_component = ['text' => 'first '];
$second_component = ['text' => 'second ', 'color' => 'red'];
$third_component = ['text' => 'third ', 'strikethrough' => true];
$json = ['extra' => [$first_component, $second_component, $third_component]];

echo MinecraftJSONColors::convertToLegacy($json);
?>

MinecraftVotifier.php

Send Votifier votes to a Minecraft server.

Usage

<?php
require 'vendor/autoload.php';
use \Spirit55555\Minecraft\MinecraftVotifier;

$votifier = new MinecraftVotifier('YOUR_PUBLIC_KEY', 'YOUR_SERVER_IP', 'YOUR_VOTIFIER_PORT', 'YOUR_SERVICE_NAME');
$votifier->sendVote('MINECRAFT_USERNAME');
?>

More information about Votifier: http://dev.bukkit.org/bukkit-plugins/votifier/




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap