GithubHelp home page GithubHelp logo

pavog / codex-minecraft Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aternosorg/codex-minecraft

0.0 0.0 0.0 3.82 MB

PHP library to read, parse, print and analyse Minecraft server log files.

Home Page: https://packagist.org/packages/aternos/codex-minecraft

License: MIT License

PHP 100.00%

codex-minecraft's Introduction

Codex for Minecraft

About

Codex (lat. roughly for "log") is a PHP library to read, parse, print and analyse log files to find problems and suggest possible solutions. This is the implementation for Minecraft logs including detectors, parsers and analysers to work with different Minecraft log files.

Installation

composer require aternos/codex-minecraft

Usage

This is only an introduction to the Minecraft implementation of Codex, for more information take a look at the Codex repository: aternosorg/codex

Create a log file

[see codex#logfile]

<?php

$logFile = new \Aternos\Codex\Log\File\StringLogFile("This is the log content");
$logFile = new \Aternos\Codex\Log\File\PathLogFile("/path/to/log");
$logFile = new \Aternos\Codex\Log\File\StreamLogFile(fopen("/path/to/log", "r"));

Create log object

[see codex#log]

If you know the log type, you can directly create a new log object.

<?php

$log = new \Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog();
$log->setLogFile($logFile);

Detect the log type

[see codex#detection]

If you don't know the log type, you can let the Detective decide and create a log object.

<?php

$detective = new \Aternos\Codex\Minecraft\Detective\Detective();
$detective->setLogFile($logFile);
$log = $detective->detect();

Parse the log content

[see codex#parsing]

<?php

$log->parse();

Analyse the log

[see codex#analysing]

<?php

$analysis = $log->analyse();

The $analysis object contains problems and information which you can get with the $analysis->getProblems() and $analysis->getInformation() functions or all insights together with $analysis->getInsights(). The problems contain solutions, a few of them could be solved automatically. They implement the \Aternos\Codex\Analysis\AutomatableSolutionInterface, e.g. FileDeleteSolution.

<?php

foreach ($analysis->getInformation() as $information) {
    echo $information->getLabel() . ": " . $information->getValue();
}

foreach ($analysis->getProblems() as $problem) {
    echo $problem->getMessage();
    foreach($problem->getSolutions() as $solution) {
        echo $solution->getMessage();
    }
}

Translations

The output messages, e.g. for problems and solutions are translated by the Translator. The available translations are in the lang folder. They are not complete (yet) and you can help to translate them here: https://crowdin.com/project/aternos. You can set the translation language with the setLanguage() function before using any getMessage() function.

See the current translation status here: TRANSLATION.md

<?php

\Aternos\Codex\Minecraft\Translator\Translator::getInstance()->setLanguage("de");

codex-minecraft's People

Contributors

dominikdoemsky avatar julianvennen avatar kurtthiemann avatar matthi4s avatar pavog avatar rico132 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.