Wrap Bukkit API in commands

Discussion in 'Bukkit Discussion' started by Matthew Broomfield, Sep 29, 2013.

Thread Status:
Not open for further replies.
  1. wouldn't it be cool it wrap the bukkit api + java in commands so command blocks could do everything?
     
  2. Offline

    evilmidget38

    No. That'd be a huge amount of work, and would make the API harder to use and less flexible. To get a true 1 to 1 with Bukkit you'd have to either have a command for literally anything you want, or add in support for a scripting language, so that you'd be writing code anyway.
     
    lukegb and Jade like this.
  3. eh, a lot of work in the beginning maybe, but you really think it wouldn't be useful? sometimes you might want to use a couple of calls right on the spot.

    As for the implementation, function names and object names are easy.

    Return values are a little more complicated. You would either have to send them along the circuit or give blocks tags so other blocks know the return values of each other.

    You could also define the scope which each command is in, and their execution order would be the order of activation by redstone.

    Objects would be passed through the scope.

    And why would you change the API? just have a plugin wrap the API. sure that's a lot of calls, but you could generate your code.
     
  4. Offline

    Lolmewn

    Meh, isn't this exactly why plugins are created?
     
  5. Offline

    desht

    Yes, is definitely is. Bit of self-promotion here, but ScrollingMenuSign's been able to do this (although not with command blocks) for a while now: http://dev.bukkit.org/bukkit-plugins/scrollingmenusign/pages/scripting/

    Command blocks are really for vanilla servers; Bukkit plugins (and I know SMS isn't the only one, it's just the one I know best :) ) can do way more than the command block could ever hope to do.
     
  6. You mean to say none of you have had a moment where 5 lines of bukkit code was all you needed, and you had to pack it into a plugin?

    And what if I want to allow more than myself to mess with the bukkit API on my server?

    Of course I could use a scripting language, but what if redstone circuits controlled the flow of the program? Am I alone here?
     
  7. Offline

    kezz101

    Yeah I get what you are saying, sometimes I really can't be bothered to compile a few lines of code... But just grab a plugin with a mock-scripting language like Skript. Skript is awesome :)
     
  8. Offline

    Necrodoom

    5 lines of bukkit code can easily translate to a 5x5x3 block of redstone depending on what these lines contain.

    You are suggesting to compress a complex programming language into redstone which all it contains is pulse delay, reverser, a very crude form of a pulse compare block, and a simple command execution block. Recoding the API or coding a plugin to do this will be extremely complex and it will probably only support simple functions.

    As other people suggest, it would be much easier to create and understand functions using plugins such as skript/commandhelper/variabletriggers, or even your own java plugins.
     
  9. Offline

    jeffro1001

    Variabletriggers is pretty awesome
    You can pretty much turn any block ( or area ) into a command block that will run console commands.
     

  10. Never said it wouldn't be complex. Using a redstone circuit to control the order of operations would allow for very dynamic results. Essentially the code would change every time the machine ran differently.

    Think of throwing all your lines of code into a bucket and pulling them out when you need them.

    Now this probably wouldn't expand the amount of stuff you could do with a plugin, but there might be different (and maybe simpler) methods to solve more complicated tasks.

    I'll try to think of some examples.
     
  11. Offline

    lycano

    @Matthew-Broomfield so basically you want to controll the API ingame with items and such? Try to do the following.

    Build logic components like NOT, AND, OR, NOR, NAND, XOR.
    Grab simple commands like getPlayer("playerName") which can be linked to a plate or another interactable material.
    Grab some actions: sendMessage, teleport.

    Create an UML Diagram that uses a plate to start actions (use it as IF condition) and try to build

    If player triggers plate (stands on) then teleport target player to his bed.

    All this should be build by using redstone and blocks.

    When you have the UML ready try to implement code into your plugin.

    You will encounter numerous problems like redstone energy cant be followed easy from one point to another. You will have to track "is a logic gate created" ... this has to be bound to classes "Actors". Also you would have to listen to Redstone event if this block is powered and if its connected to a logic gate and so on.

    Creating the UML diagram shouldn't be that problematic but the implementation ... maybe you are done next year March solving this simple task.

    After that the BukkitAPI might have changed due to 1.7 or 1.8 release. Then you might have to start over due to possible changes.

    Would it be cool to control the API ingame? Indeed! But maintaining this plugin will be a full time job. One single method has to change and you might end up losing many features you have offered so far.

    Also it might be the only plugin you can have on your server as it will most likely consume resources.
     
Thread Status:
Not open for further replies.

Share This Page