GithubHelp home page GithubHelp logo

gameapis's People

Contributors

yive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gameapis's Issues

Possibly move to Rust.

Rust is fast af & hopefully won't require me to have multiple VPS's anymore at least for GameAPIs

Code duplication in MCPEPing.php

switch ($actualcode) {
case "1":
$returnstring = $returnstring . '<span style="color:#0000aa">';
$ending = $ending . "</span>";
break;
case "2":
$returnstring = $returnstring . '<span style="color:#00aa00">';
$ending = $ending . "</span>";
break;
case "3":
$returnstring = $returnstring . '<span style="color:#00aaaa">';
$ending = $ending . "</span>";
break;
case "4":
$returnstring = $returnstring . '<span style="color:#aa0000">';
$ending = $ending . "</span>";
break;
case "5":
$returnstring = $returnstring . '<span style="color:#aa00aa">';
$ending = $ending . "</span>";
break;
case "6":
$returnstring = $returnstring . '<span style="color:#ffaa00">';
$ending = $ending . "</span>";
break;
case "7":
$returnstring = $returnstring . '<span style="color:#aaaaaa">';
$ending = $ending . "</span>";
break;
case "8":
$returnstring = $returnstring . '<span style="color:#555555">';
$ending = $ending . "</span>";
break;
case "9":
$returnstring = $returnstring . '<span style="color:#5555ff">';
$ending = $ending . "</span>";
break;
case "a":
$returnstring = $returnstring . '<span style="color:#55ff55">';
$ending = $ending . "</span>";
break;
case "b":
$returnstring = $returnstring . '<span style="color:#55ffff">';
$ending = $ending . "</span>";
break;
case "c":
$returnstring = $returnstring . '<span style="color:#ff5555">';
$ending = $ending . "</span>";
break;
case "d":
$returnstring = $returnstring . '<span style="color:#ff55ff">';
$ending = $ending . "</span>";
break;
case "e":
$returnstring = $returnstring . '<span style="color:#ddc300">';
$ending = $ending . "</span>";
break;
case "f":
$returnstring = $returnstring . '<span style="color:#ffffff">';
$ending = $ending . "</span>";
break;
case "l":
if (strlen($individual) > 2) {
$returnstring = $returnstring . '<span style="font-weight:bold;">';
$ending = "</span>" . $ending;
break;
}
case "m":
if (strlen($individual) > 2) {
$returnstring = $returnstring . '<strike>';
$ending = "</strike>" . $ending;
break;
}
case "n":
if (strlen($individual) > 2) {
$returnstring = $returnstring . '<span style="text-decoration: underline;">';
$ending = "</span>" . $ending;
break;
}
case "o":
if (strlen($individual) > 2) {
$returnstring = $returnstring . '<i>';
$ending = "</i>" . $ending;
break;
}
case "r":
$returnstring = $returnstring . $ending;
$ending = '';
break;
}

Switch statement contains a lot of duplicated code, a solution for this could be the use of a key-value array, where the keys are the color codes and the values are the colors/html tags.

EDIT: same goes for MCPing.php

API uncleanly errors out during ip/domain check.

Something doesn't like valid domains with unicode/untranslated punycode. See: https://use.gameapis.net/arma3/query/players/iā¤.ws

Same with invalid domains using disallowed ASCII characters. See: https://use.gameapis.net/arma3/query/players/1337_H@k$.example.com

It also throws the same error when attempting to fetch from (sub)domains that are registered, but have no dns record(s) assigned. See: https://use.gameapis.net/arma3/query/players/no-dns-record.example.com

Code duplication in MCPEPing.php head.phtml

switch (true) {
case strpos($this->tag->getTitle(), "7 Days to Die") !== false: {
$subtitle = "7 Days to Die Documentation";
$button = "7 Days to Die";
break;
}
case strpos($this->tag->getTitle(), "Alien Swarm") !== false: {
$subtitle = "Alien Swarm Documentation";
$button = "Alien Swarm";
break;
}
case strpos($this->tag->getTitle(), "ARK: Survival Evolved") !== false: {
$subtitle = "ARK: Survival Evolved Documentation";
$button = "ARK: Survival Evolved";
break;
}
case strpos($this->tag->getTitle(), "Battlefield 2") !== false: {
$subtitle = "Battlefield 2 Documentation";
$button = "Battlefield 2";
break;
}
case strpos($this->tag->getTitle(), "Battlefield 3") !== false: {
$subtitle = "Battlefield 3 Documentation";
$button = "Battlefield 3";
break;
}
case strpos($this->tag->getTitle(), "Battlefield 4") !== false: {
$subtitle = "Battlefield 4 Documentation";
$button = "Battlefield 4";
break;
}
case strpos($this->tag->getTitle(), "Battlefield: Bad Company 2") !== false: {
$subtitle = "Battlefield: Bad Company 2 Documentation";
$button = "Battlefield: Bad Company 2";
break;
}
case strpos($this->tag->getTitle(), "Battlefield 1942") !== false: {
$subtitle = "Battlefield 1942 Documentation";
$button = "Battlefield 1942";
break;
}
case strpos($this->tag->getTitle(), "Battlefield: Hardline") !== false: {
$subtitle = "Battlefield: Hardline Documentation";
$button = "Battlefield: Hardline";
break;
}
case strpos($this->tag->getTitle(), "Counter-Strike 1.6") !== false: {
$subtitle = "Counter-Strike 1.6 Documentation";
$button = "Counter-Strike 1.6";
break;
}
case strpos($this->tag->getTitle(), "Counter-Strike: Global Offensive") !== false: {
$subtitle = "Counter-Strike: Global Offensive Documentation";
$button = "Counter-Strike: Global Offensive";
break;
}
case strpos($this->tag->getTitle(), "Counter-Strike: Source") !== false: {
$subtitle = "Counter-Strike: Source Documentation";
$button = "Counter-Strike: Source";
break;
}
case strpos($this->tag->getTitle(), "Garry") !== false: {
$subtitle = "Garry's Mod Documentation";
$button = "Garry's Mod";
break;
}
case strpos($this->tag->getTitle(), "Minecraft: Pocket Edition") !== false: {
$subtitle = "Minecraft: Pocket Edition Documentation";
$button = "Minecraft: Pocket Edition";
break;
}
case strpos($this->tag->getTitle(), "Minecraft") !== false: {
$subtitle = "Minecraft Documentation";
$button = "Minecraft";
break;
}
default: {
$subtitle = "Documentation";
break;
}

Switch contains more duplicate code than it should. A much cleaner way would be to do something along the lines of this:

case strpos($this->tag->getTitle(), "Documentation") !== false: {
    $subtitle = $this->tag->getTitle() . " Documentation";
    $button = $this->tag->getTitle();
}

that shortens the code from about 80 lines to 4.

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.