1. Welcome to the Brawl website! Feel free to look around our forums. Join our growing community by typing /register in-game!

Technology Java and Python Coding

Discussion in 'Off Topic' started by profbonkars, Feb 18, 2015.

Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...
  1. profbonkars

    profbonkars Well-Known Member

    Joined:
    Jun 1, 2014
    Messages:
    376
    Ratings:
    +171
    Hello! My name is bonkars and forever now I have been working on servers with custom plugins, but never actually understood how plugins worked. I am currently taking online courses of Python (which I might skip) and Java. I was wondering if anyone here was experienced with Java and could give me a little help and a few points.

    Meoow! < o ~ o >
     
  2. StrikerSly

    StrikerSly Well-Known Member

    Joined:
    Dec 8, 2014
    Messages:
    2,192
    Ratings:
    +745
    Just don't screw up the script. My friend messed up 2000 lines of code and had to do it all over again because he couldn't find the mistake
     
  3. profbonkars

    profbonkars Well-Known Member

    Joined:
    Jun 1, 2014
    Messages:
    376
    Ratings:
    +171
    Good call, haha c: But I meant advice on how to do certain things, how to practice, etc..
     
  4. GreenPeas

    GreenPeas The man, the myth, the meme

    Joined:
    Aug 19, 2013
    Messages:
    3,120
    Ratings:
    +1,054
    ---===[ JAVA CODING ]===---

    ===========================================================


    FUNCTIONS :


    Creating

    var list = function (friends) {

    // Do something here

    }





    VARIABLES :

    byte

    short

    int - integer - 3, 47, 362

    long

    double - decimal place 2.3, 587.92

    float

    char

    boolean - true or false

    String



    Declaring a variable:

    <type> <name> = <value>;

    E.G :

    int 1 = health;

    double 1.5 = money;

    String name = Tom;



    ===========================================================


    STRINGS :


    Strings can also work similar to arrays:

    var myName = ‘Tom’

    myName[0] //Equals ’T'


    ===========================================================


    LOOPS :


    FOR LOOP :

    for loop - 3 parts :

    for (int i = 0; i < 4; i++) { }

    General Syntax :

    for (var i = 1; i < 11; i = i + 1) {

    /* your code here */;

    }

    My example :http://i.imgur.com/E23nU4d.png


    WHILE LOOP :

    while loop - 1 part :

    while (!(while == 0)) { }

    General Syntax :

    var condition = true;

    while(condition) {

    console.log("Hello!");

    // Avoid infinite loops!

    condition = false;

    }

    When the condition equals true, the loop continues to run until it evaluates to false. JavaScript : 1 = true 0 = false


    DO WHILE LOOP :

    do while loop - all code within :

    do {

    [code code code]

    while (!(input == 0)) }

    General Syntax :

    // Can be false from the start, since

    // do/while runs at least one time

    var condition = false;

    do {

    console.log("I'm printed once!");

    } while(condition);


    My example (for, while do while loops) :

    http://i.imgur.com/qtHVq63.png


    ===========================================================


    METHODS :

    public : visibility modifier

    static : calling it from the main method (must be static)

    void : doesn’t need to be returned

    int : returns an integer



    ===========================================================


    CLASS DESIGN :

    private : Only visible by that class

    public : Visible to all classes



    ===========================================================


    BASIC ARRAYS :

    String[] = String Array

    String[] msgs = new String[5];



    Example of declaring an Array :

    var myArray = ['hello', 'world’];

    myArray[0] //equals “hello"



    Remember in Arrays :

    First element in array = junkData[0]

    Second element in array = junkData[1]



    ===========================================================


    ADVANCED ARRAYS :


    TWO DIMENSIONAL ARRAYS :


    This basically puts an array inside an array (creates columns, and can be used to create 2D objects)

    var twoDimensional = [[1, 1], [1, 1]];

    JAGGED ARRAYS :


    This allows the creation of different amount of elements within the arrays, such as 3 elements in the first array, 1 element in the next and 2 elements in the third.



    Example : var jagged = [[3, 4, 5, 6, 7], [true, false, true]];



    HETEROGENEOUS ARRAYS :



    These types of arrays manage different types of data. E.G :

    var mix = [42, true, "towel"];

    ===========================================================


    SWITCH STATEMENT :


    Switch allows you to set a number of options (case(s)) then check an expression to see if it matched any of them. If there's a match, the program will perform the action for the matching case; if there's no match, it can execute a default option



    Example :

    http://i.imgur.com/M1F6FLc.png



    General syntax :

    switch (/*Some expression*/) {

    case'option1':

    // Do something

    break;

    case'option2':

    // Do something else

    break;

    case'option3':

    // Do a third thing

    break;

    default:

    // Do yet another thing

    }

    ===========================================================


    LOGICAL OPERATORS :


    AND : && :

    true && true; // => true

    true && false; // => false

    false && true; // => false

    false && false; // => false

    OR : || :

    true || true; // => true

    true || false; // => true

    false || true; // => true

    false || false; // => false

    NOT : ! :

    !true; // => false

    !false; // => true


    ===========================================================


    OBJECT :


    Put information and functions which use that information in the same place

    var myObject = {

    key: value,

    key: value,

    key: value

    };

    An object is similar to an array, however, it's keys can be variables and strings, not just numbers.



    Two ways to create an object :



    Object literal notation :

    var myObj = {

    type: 'fancy',

    disposition: 'sunny'

    };



    var emptyObj = {};

    Object Constructor :

    var myObj = new Object();

    Adding keys to an Object constructor is done by :

    myObj["name"] = "Charlie";

    myObj.name = "Charlie";
     
  5. profbonkars

    profbonkars Well-Known Member

    Joined:
    Jun 1, 2014
    Messages:
    376
    Ratings:
    +171
  6. MrWaffleman

    MrWaffleman The negligence of time's end is man's downfall

    Joined:
    Jun 12, 2014
    Messages:
    3,007
    Ratings:
    +650
    That's actually pretty nice! I remember learning that in javascript :V.

    Right when I saw Python I didn't really like, I never took any lessons on it. I'm intermediate in Java having learned from thenewboston. However, I CANNOT tell you how horrible I am at bukkit. I'm good at Javadon't understand how I can't handle bukkit which is way easier .-. . If I made a server all I would probably do is copy codes and change the output of it so it looks 'official' :stuck_out_tongue:.
     
  7. MemeGodKevin

    MemeGodKevin Well-Known Member

    Joined:
    Jul 3, 2014
    Messages:
    445
    Ratings:
    +105
    All I can say is check your script every 5 lines or so, I am not that good at coding, but I know that putting a " when it should be a ' can be fatal
     
  8. profbonkars

    profbonkars Well-Known Member

    Joined:
    Jun 1, 2014
    Messages:
    376
    Ratings:
    +171
    Haha. I definitely agree about Python but I have not even checked bukkit yea. Now I am scared c:

    Yea. Definitely something I need to work at seeing that I do that exact mistake even in the tutorials. Thanks! meeow
     
  9. MrWaffleman

    MrWaffleman The negligence of time's end is man's downfall

    Joined:
    Jun 12, 2014
    Messages:
    3,007
    Ratings:
    +650
    Everyone gets it right away, I guess I'm lacking that sense... well in all, I'm a waffle am I not?
     
  10. Phanta

    Phanta Well-Known Member

    Joined:
    Jan 1, 2014
    Messages:
    2,555
    Ratings:
    +997
    A few pointers:
    0x00029FAB
    0x0091BC6D
    0x00C6DD49
     
  11. Javed

    Javed Well-Known Member

    Joined:
    Aug 6, 2013
    Messages:
    1,867
    Ratings:
    +370
    and whats why you use a good api so stupid **** like that doesnt happen :V
     
Loading...
Similar Threads Forum Date
Clan: Java Clans Oct 11, 2017
Minecraft java's future BTU update Discussion Jun 24, 2017
java.lang.NullPointerException: group Off Topic May 29, 2017
Java.net.SocketException: Network is Unreachable Discussion May 10, 2016
Technology Someone who knows Java VERY Well. Off Topic Jan 12, 2016
Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...