API [1.9] CoreAPI | Languages / Nametags / Skins / Glow &more

Discussion in 'Resources' started by Letscrime, Mar 29, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Letscrime

    [​IMG]

    Hey guys and surely the one or another girl!
    Today i want to introduce CoreAPI!
    What can you do with CoreAPI?
    • Set the players language (MySQL, 31 languages)
    • Send TellRaw messages (with hover, click and colours)
    • Send holograms with multiple lines
    • Create achievements (MySQL)
    • MySQL database to save language and achievements
    • SkinChange without loosing name
    • Send ActionBars
    • Send WorldBorders
    • Create scoreboards
    • Modify the tablist
    • Get the ping from a player
    • Let players glow
    • Let players glow in case of their ping
    • Change the player nametag
    Download: Here
    Source code:
    //Note: Source code is currently not reachable (too much files for github ö.ö? [>100])


    Plugins using CoreAPI:

    AdminToGo - Portable AdminGUI
    NickUltimate - Nickplugin

    Your plugin is using CoreAPI and you want to see it here?
    PM me!


    Tutorials

    Holograms:

    Hologram usage (open)

    1. Creating a hologram
    Code:
    Hologram holo = new Hologram(location);
    2. Adding lines to the hologram
    Code:
    holo.addLine("§eWelcome");
    
    holo.addLine("§6"+ p.getName());    
    3. Show the hologram to the player
    For a single player:
    Code:
    holo.sendToPlayer(p);
    3.1. Show the hologram to all players
    Code:
    for(Player all : Bukkit.getOnlinePlayers()){
    holo.sendToPlayer(all);  }
    4. Register the hologram
    Code:
    HologramResetter.register(p, holo);
    5. Remove the hologram
    Code:
    holo.remove();
    5.1. Remove the hologram from one player:
    Code:
    holo.removeFromPlayer(p)
    6. Remove a single line
    Code:
    holo.removeLine(1)


    TellRaw Messages:

    TellRaw usage (open)

    1. Creating unclickable section of the message
    Code:
    JSONChatMessage message= new JSONChatMessage("Message: ", JSONChatColor.GRAY, null);
    2. Creating clickable/hoverable section of the message
    Code:
    JSONChatExtra extra= new JSONChatExtra("Clickable", JSONChatColor.GREEN, Arrays.asList(JSONChatFormat.BOLD));
    3. Set hover event
    Code:
     extra.setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "This is a hovering message");
    4. Set command when clicking the message
    Code:
     extra.setClickEvent(JSONChatClickEventType.RUN_COMMAND, "/command");
    5. Bind the events to the message
    Code:
    message.addExtra(extra);
    6. Send the message
    Code:
    message.sendToPlayer(p);


    Languages:

    Language usage (open)

    1. Getting the language of a player
    Code:
    LanguageAPI.getLanguage(player);
    2. Set the language of a player
    Code:
    LanguageAPI.setLanguage(player, Language.POLISH);


    Achievements:

    Achievements usage (open)

    1. Creating a new achievement
    Code:
    Achievements achievement = new Achievements("FirstDeath");
    2. Check if player has achievement
    Code:
    if(achievement.hasPlayer(player)){
    3. Give player the achievement
    Code:
    achievement.addToPlayer(player);
    4. Remove the achievement from player
    Code:
    achievement.removeFromPlayer(player);


    Titles:

    Title usage (open)
    1. Set the title
    Code:
    Titles.sendTitle(player, "§6Title with color!", "Subtitle", Fade-In, Stay, Fade-Out);


    Tab Header/Footer:

    Tab usage (open)
    1. Send the Tab Header/Footer
    Code:
    TabTitle.sendTabTitle(p, "&aIm a Header!", "&eIm a Footer");
    //NOTE: %player% will be replaced with the players name


    Actionbar:

    Actionbar usage (open)
    1. Send the Actionbar
    Code:
    Actionbar.sendBar(player, "Im a Actionbar for &a%player%");
    
    //NOTE: %player% will be replaced with the players name


    WorldBorder:

    WorldBorder usage (open)
    1. Set the border
    Code:
    WorldBorderAPI.setBorder(world, size, center);


    Player ping:

    Ping usage (open)
    1. Get the ping
    Code:
    PlayerPing.getPing(player);
    
    Note: The ping will be shown in matching colors (green, orange, red)


    Skins:

    Skin usage (open)
    1. Set the skin
    Code:
    SkinAPI.setSkinPlayer(player, skinname, true);


    Scoreboards:

    Scoreboard usage (open)
    1. Set the scoreboard
    Code:
        ScoreboardAPI.FlyScoreboard(player, title, new String[]{"§aL§da§anguage:",
                                            "§eLine1",
                                            "§9Line2" + 30,
                                            "§cLine3" + player.getHealth()
                            
                                    });


    Glow:

    Glow usage (open)
    1. Set the glow
    Code:
    GlowAPI.set(player, color, true/false);
    
    Note: the true/false is for the tablist color
    2. Set the glow in case of ping
    Code:
    GlowAPI.PingGlow(player, true/false);
    
    Note: the true/false is for the tablist color
    3. Stop glowing:
    Code:
    GlowAPI.stopGlow(player);
    4. Check if player is glowing:
    Code:
    GlowAPI.isGlowing(player);
    5. Get the color of the glow:

    Code:
    GlowAPI.getColorName(player)
    
    Will receive: §cRed or §eYellow & so on..




    Nametags:

    Nametags usage (open)
    1. Set the nametag
    Code:
    NametagAPI.setNametag(player, name, true/false, true/false);
    
    
    First true/false: For tablist change
    Second true/false: For aboveHead change
    2. Set the nametag of OfflinePlayers:
    Code:
    NametagAPI.setNametagOther(player, name, true/false, true/false);
    
    
    First true/false: For tablist change
    Second true/false: For aboveHead change
    3. Remove the Nametag from a player
    Code:
    NametagAPI.removeNametag(player);
    



    Currently provided Events:

    Called when player receives a achievement:
    Code:
    AchievementReceiveEvent
    Called when player receives a language:
    Code:
    LanguageReceiveEvent
    Called when player receives a skin change:
    Code:
    SkinReceiveEvent
    Called when player receives a nametag:
    Code:
    NametagReceiveEvent
    Called when player receives a glow:
    Code:
    GlowReceiveEvent




    FAQ:

    Is this API only for 1.9?
    - Yes this API is only for 1.9 in case of the GlowAPI but you can find the 1.8 version in the version history

    Can i use the API in my plugins?
    - OF COURSE!

    Am i permitted to decompile the API?
    - Yes for personal use

    Am i permitted to reupload the API?
    - No.

    Am i permitted to sell the API?
    - No. No. No.
     
    ChipDev likes this.
  2. Offline

    Zombie_Striker

    All of the above can be done using other APIs. What makes this API different than any other?

    1. Does it also save achievenets/languages to text files? Do we have to use MYSQL (A memory hog that does the exact same thing as a text file) to use these features?
    2. Why choose MYSQL support?
    What do these mean? What do you mean by "in case of their ping"?
     
  3. Offline

    Letscrime

    "All of the above can be done using other APIs. What makes this API different than any other?"
    Some of the features can be done with other API's yes but i dont know a languageAPI with 31 languages and i dont know any achievements API and the nametag feature is also different to NickNamers API but everyone has to do the decision for himself which API he wants to use :)



    1. "Does it also save achievenets/languages to text files? Do we have to use MYSQL (A memory hog that does the exact same thing as a text file) to use these features?
    2. Why choose MYSQL support?"
    1: MariaDB should work too but there is no textfile currently. This isnt "productive" in case of that can be done in ArrayLists too on single severs so its more for Bungee networks
    2: Why dont? BungeePluginChannels would be much more stressful :)


    What do these mean? What do you mean by "in case of their ping"?
    GlowAPI supports the PingGlow feature which means:

    A ping above 100: red glow
    A ping above 50: orange glow
    A ping under 50: green glow

    Example plugin with random ping int's: Here

    I hope everything is a little bit more clear now :p
     
    ChipDev likes this.
  4. Offline

    MisterErwin

    So I have a few questions: Did you ask @bobacadodl for the permission to use his JSON chat lib

    What is the reason for the WorldBorderAPI?

    And you might want to add JavaDocs.

    (Oh - and I can't count more than 100 files)
     
  5. Offline

    Letscrime

    As you see bobacadodl is set as Contributor on spigot, i dont know how to do it here. Hwups.

    The reason for the WorldBorderAPI:
    I dont get it either, a user has asked for the WorldBorderAPI so i implemented one, 3 lines of codes but he wanted it. :3

    And yes JavaDocs is also a thing i have to set up in near future but i have to understand how i dot it first :D

    To the 100 files thing: Github does, problem found ._.
    Everytime i want to upload the files it says "Try with less than 100 files"
    I think github counts everything, folders, ymls, classes
     
  6. Offline

    mcdorli

    It's not enough to mark him as contributor, you need to ask him if you can use it or not. Did you do that?
     
  7. Offline

    ChipDev

    Though, he DID mark it as Open Source, you have to give him credits.
    ALTHOUGH- You did pretty much copy & paste @bobacadodl's work into your project. SO- TO BE SAFE, ask him ;)
     
Thread Status:
Not open for further replies.

Share This Page