1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can somebody make a tutorial called HOW TO WRITE A SKRIPT ADDON

Discussion in 'Java' started by pascal25565, Jan 30, 2017.

Tags:
  1. pascal25565

    pascal25565 Member

    Joined:
    Jan 26, 2017
    Messages:
    4
    Likes Received:
    0
    Can somebody make this?


    Greets
     
    • Useful Useful x 1
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    I'll be on this soon :emoji_wink:
     
    • Useful Useful x 1
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    • Useful Useful x 1
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    You can look at the cached version of the link @Gamebuster posted here: [X]
     
    • Useful Useful x 1
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    @Blade that doesn't work.
     
    • Like Like x 1
    • Useful Useful x 1
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Sorry, wrong link, try this one: [X]
     
    • Useful Useful x 1
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    upload_2017-2-2_13-11-52.png
     
    • Winner Winner x 1
    • Useful Useful x 1
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Rip, worked earlyer
     
    • Useful Useful x 1
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    I think it's basically a thing in which you put files in, and the addon 'scans' for patterns in the script. If there is a pattern, it enable (for example) messaging when someone does the command (for example) /message

    Here's what you need for any help hooking your addon into skript: http://njol.ch/projects/skript/API/
     
    • Useful Useful x 1
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    I'm a skript noob, i only know how to register basic events

    Some code (from my old project)

    1: make a spigot event
    Code (Java):
    1.  
    2. package me.mindgamesnl.openaudiomc.publicApi;
    3.  
    4. import org.bukkit.event.Event;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.event.HandlerList;
    7.  
    8. public class SoundEndEvent extends Event {
    9.  
    10.     Player p;
    11.     String id;
    12.    
    13.     public SoundEndEvent(Player player, String id) {
    14.         this.p = player;
    15.         this.id = id;
    16.     }
    17.    
    18.     public Player getPlayer() {
    19.         return p;
    20.     }
    21.    
    22.     public String getId() {
    23.         return id;
    24.     }
    25.    
    26.     private static final HandlerList handlers = new HandlerList();
    27.  
    28.     public HandlerList getHandlers() {
    29.        return handlers;
    30.     }
    31.  
    32.     public static HandlerList getHandlerList() {
    33.        return handlers;
    34.     }
    35.    
    36. }
    37.  
    2: register it in skript
    Code (Java):
    1.  
    2. @Override
    3. public void onEnable() {
    4.     Skript.registerAddon(this);
    5.     Skript.registerEvent("OpenAudio sound end", SimpleEvent.class, me.mindgamesnl.openaudiomc.publicApi.SoundEndEvent.class, "audio sound end", "audio sound end");
    6.     EventValues.registerEventValue(me.mindgamesnl.openaudiomc.publicApi.SoundEndEvent.class, String.class, new Getter < String, SoundEndEvent > () {
    7.         @Override
    8.         public String get(SoundEndEvent e) {
    9.             return e.getId();
    10.         }
    11.     }, 0);
    12.     EventValues.registerEventValue(me.mindgamesnl.openaudiomc.publicApi.SoundEndEvent.class, Player.class, new Getter < Player, SoundEndEvent > () {
    13.         @Override
    14.         public Player get(SoundEndEvent e) {
    15.             return e.getPlayer();
    16.         }
    17.     }, 0);
    18. }
    19.  
    this registers the event and getters

    the skript event:
    Code (Text):
    1.  
    2. on audio sound end:
    3.    broadcast "the sound %event-string% ended for %event-player%"
    4.  
    gets triggerd everytime the java events gets triggerd

    (This is probs not the best solution so pls correct me where i'm wrong)
     
    • Useful Useful x 1
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    • Winner Winner x 1
    • Useful Useful x 1
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    You are just doing it wrong. Shouldn't you learn Java and Bukkit development first and take a look at Njol's JavaDocs?
     
    • Useful Useful x 1

Share This Page

Loading...