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.

Addon MiSK

Discussion in 'Addon Releases' started by Moderocky, May 19, 2019.

  1. Moderocky

    Moderocky Master Magician
    Moderator Resource Staff Supporter Addon Developer Dev Programme

    Mar 12, 2017
    Likes Received:
    Misk - A Miscellaneous Addon

    For Skript 1.14.1+

    The purpose of this addon is to add a few bits and pieces of syntax that aren't present in vanilla Skript or in other addons. It also contains things from very outdated add-ons, as well as syntax that I use on my own projects.
    It will be updated regularly with new things, as well as simplified utilities for Skript-Mirror users.

    WARNING: This is currently in an alpha state. There will almost certainly be bugs.

    Expect regular updates as I improve stuff, fix bugs and add new features.

    Requirements (Things you must have!)

      • PaperSpigot 1.14.1
      • ProtocolLib (latest dev build)
    Images and Examples (from my server)
    A Wandering Trader with custom recipes. Wait! That's illegal.
    Code used:
    Code (Text):
    1. add trade (a new trade of air and air for slimeball) to target entity

    A Custom Merchant Object using 1.14's new model data. Check out my custom item registry resource for more info.

    An example of controllable Ravagers, using the on vehicle steer: event with ProtocolLib.

    An example of vehicles using on vehicle steer:
    Careful, this was quite an old test, and it also required some other addons and a lot of skript-mirror. But it's still possible!

    Current features (Currently in the plugin, available for use)

      • Villager effects
      • Custom trades
      • Custom merchant objects
      • Wandering Trader syntax
      • ID-based merchants (Unfinished, but theoretically available)
      • Vehicle steer event (ProtocolLib required)
      • Advancements menu toggle (ProtocolLib required)
    In-progress features (Partially finished, accessible for skript-mirror users)

      • Client-side equipment (ProtocolLib required)
      • Working jump event
      • Resource pack accept/reject/send/cancel events
    Planned features (Not started)

      • Loot restock (PaperSpigot?)
      • Loot-table utilities
      • More packet listeners (unless a stable MundoSK is released.)
      • More villager events
      • Utilities for lists, arraylists, treemaps, etc. in skript.
      • Basic file utilities
    Most things that take %merchant% have an alternative for a villager/wandering trader entity.

    Recipes in a merchant are numbered 0, 1, 2, etc...
    Starting from zero like inventory slots.
    Be careful with this!

    Code (Text):
    2. [a] new merchant named %string%
    3. # returns new custom merchant object, store this in a variable
    5. [the] (recipe|trade) count of [merchant] %merchant%
    6. [the] (recipe|trade) count of villager %entity%
    7. # gets the numerical count
    9. (dis|en)able (trade|recipe) %integer% of [merchant] %merchant%
    10. (dis|en)able (trade|recipe) %integer% of villager %entity%
    11. # disables a trade
    13. add (trade|recipe)[s] %merchantrecipes% to [merchant] %merchant%
    14. add (trade|recipe)[s] %merchantrecipes% to villager %entity%
    15. # add a custom merchant recipe to a merchant/villager
    17. open merchant %merchant% to %players%
    18. open villager %entity% to %players%
    19. # opens a custom merchant object/villager to a player for trading
    21. set trade %integer% of merchant %merchant% to %merchantrecipe%
    22. # replace an EXISTING trade with a new one
    24. [a] new (merchant recipe|trade) of %itemtypes% and %itemtypes% for %itemtypes%
    25. # create a new merchant recipe, that can be added to a villager/CMO
    Code (Text):
    2. on vehicle steer[ing]:
    3. #vehicle steer, event-string is the key pressed, W A S D SPACEBAR and SHIFT
    4. on open [of] advancements [menu]:
    5. # called when you press 'L' to open/close advancements menu
    Yes, there are a few other bits of syntax in the plugin. These are not currently supported and are untested. Use them at your own risk!

    Code (Text):
    2. command /blob:
    3.   trigger:
    4.     set {_m} to a new merchant named "Trader"
    5.     add (a new trade of (2 of gold ingot) and (stone) for (iron ingot named "bob")) to {_r::*}
    6.     add (a new trade of (1 of gold ingot) and (air) for (gold ingot named "fred")) to {_r::*}
    7.     add trades {_r::*} to merchant {_m}
    8.     open merchant {_m} to player
    Code (Text):
    2. set {_e} to target entity
    3. set {_r} to a new trade of stone and stick for slimeball
    4. add trade {_r} to villager {_e}
    Code (Text):
    1. (ProtocolLib)
    2. on vehicle steer:
    3.   event-string is "SPACEBAR"
    4.   push player's vehicle up at speed 10
    5. # maybe don't try this, else you'll end up in space...
    6. # this can be used to make controllable vehicles
    7. # if you need help/examples, you can ask me :)

    The plugin contains a MerchantUtils class.
    You can use this to easily mess with CMOs and villagers, as well as using syntax that isn't publically available yet!

    These are designed to simplify Bukkit methods. They will not change between versions (as Bukkit methods sometimes do).

    Add this to the top of your skript:
    Code (Text):
    1. import:
    2.     com.moderocky.misk.utils.loot.LootTableUtils
    3.     com.moderocky.misk.utils.skript.SkriptUtils
    4.     com.moderocky.misk.utils.merchant.MerchantUtils
    You can then use the following methods in your code:
    Code (Text):
    2. set {variable} to LootTableUtils.newSeed()
    3. # returns a Java Random
    Code (Text):
    2. set {variable} to SkriptUtils.getItemStack({item-here})
    3. # returns a real Bukkit itemstack
    Code (Text):
    2. set {list} to MerchantUtils.tradeList()
    3. set {list} to MerchantUtils.tradeList({recipes})
    4. # returns a mutable Java List for MerchantRecipes
    5. # the second allows you to add a pre-existing collection
    Code (Text):
    2. set {recipe} to MerchantUtils.disableRecipe({recipe})
    3. set {recipe} to MerchantUtils.enableRecipe({recipe})
    4. MerchantUtils.disableRecipe(merchant, integer)
    5. MerchantUtils.enableRecipe(merchant, integer)
    6. # allows you to disable individual recipes from a merchant or from a villager/wandering trader
    Code (Text):
    2. set {recipe} to MerchantUtils.getRecipe(merchant, integer)
    3. # returns a recipe at an index. Indices go from 0+, like inventory slots
    Code (Text):
    2. MerchantUtils.merchant()
    3. MerchantUtils.merchant(name)
    4. MerchantUtils.merchant(tradelist)
    5. MerchantUtils.merchant(name, tradelist)
    6. MerchantUtils.merchant(recipes[ ])
    7. MerchantUtils.merchant(name, recipes[ ])
    8. # Simple CMO creators for every situation
    9. # The last two accept a collection. It's just to cover every possibility
    11. MerchantUtils.openMerchant(player, merchant)
    12. # Simple CMO creators for every situation
    And our two favourites...
    Code (Text):
    2. MerchantUtils.setResult(merchant, integer, itemstack)
    3. MerchantUtils.recipeWithResult(merchantrecipe, itemstack)
    4. # Bukkit doesn't allow this by default, it took me a while to work around!
    5. # Remember that these take ITEMSTACKS. Use the getItemStack() method.
    Code (Text):
    2. MerchantUtils.tradeCreator(itemstack, itemstack, itemstack)
    3. # A LOT simpler than Bukkit's constructor. Also handles all the hard work for you.
    4. # Bukkit doesn't allow this by default, it took me a while to work around!
    5. # Remember that these take ITEMSTACKS. Use the getItemStack() method.

    Found a Bug?!?

      • Are you on a supported 1.14.1 PaperSpigot?
      • Are you on a supported 2.4.x Skript?
      • Are you on a supported ProtocolLib version?
      • Are you sure it isn't a Spigot bug?
      • Are you sure it isn't a Skript bug?
      • Are you sure it's a MiSK bug?
    If the answer to these is yes, then you should contact me!
    Discord: Moderocky#0001

    REMINDER: There will be bugs. This is an ALPHA release, to be used with an ALPHA Skript version.

    If you find a bug, contact me here or on discord: Moderocky#0001 and you can get support.

    Got a suggestion/feature request?
    Contact me on Discord!
  2. Diclo

    Diclo Member

    Mar 13, 2019
    Likes Received:
  3. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Jan 20, 2018
    Likes Received:
    You need PaperSpigot

Share This Page