Code Monkey home page Code Monkey logo

faceitdiscord's Introduction

Hi there, I'm Phil

  • ๐ŸŒฑ Currently searching something to work on

Visit my Website


Stats

pvhil GitHub Stats

faceitdiscord's People

Contributors

pvhil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

faceitdiscord's Issues

Optimization

Can be done without checks

if (faceitAPI.faceitLevel == 1) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/1.png";
}
if (faceitAPI.faceitLevel == 2) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/2.png";
}
if (faceitAPI.faceitLevel == 3) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/3.png";
}
if (faceitAPI.faceitLevel == 4) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/4.png";
}
if (faceitAPI.faceitLevel == 5) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/5.png";
}
if (faceitAPI.faceitLevel == 6) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/6.png";
}
if (faceitAPI.faceitLevel == 7) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/7.png";
}
if (faceitAPI.faceitLevel == 8) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/8.png";
}
if (faceitAPI.faceitLevel == 9) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/9.png";
}
if (faceitAPI.faceitLevel == 10) {
faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/10.png";
}

Wouldn't it be easier to do it this way:

faceitLevelPNG = "https://raw.githubusercontent.com/pvhil/FaceItDiscord/master/src/main/resources/images/" + String.valueOf(faceitAPI.faceitLevel) + ".png";

P. S.
You also have a different case of the file extension in the folder where the pictures are located src/main/resources/images. In Windows, there is a conflict because of this, I did not make a pull request.

Optimization v2

Lots of code for maps checks:

if (args[1].equalsIgnoreCase("last") || args[1].equalsIgnoreCase("latest") || savedMap.equalsIgnoreCase("dust2") || savedMap.equalsIgnoreCase("mirage") || savedMap.equalsIgnoreCase("train") || savedMap.equalsIgnoreCase("cache") || savedMap.equalsIgnoreCase("overpass") || savedMap.equalsIgnoreCase("vertigo") || savedMap.equalsIgnoreCase("inferno") || savedMap.equalsIgnoreCase("nuke")) {

//class fields
private static final String[] MAPS = {"dust2", "mirage", "train", "cache", "overpass", "vertigo", "inferno", "nuke"};

//over if checks
boolean containsMap = Arrays.asList(MAPS).contains(savedMap.toLowerCase(Locale.ROOT));

if (args[1].equalsIgnoreCase("last") || args[1].equalsIgnoreCase("latest") || containsMap) { 
//some code
}

P. S.
I can't cover the entire hierarchy/architecture of your code in a couple of minutes, but I think it will give you food for thought.
Probably my option is not very reliable, but in my case it works pretty well.

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.