Jump to content




[Idea] Bukkit peripheral


  • You cannot reply to this topic
4 replies to this topic

#1 AliasXNeo

  • Members
  • 23 posts

Posted 16 May 2012 - 02:14 AM

Hey,

http://www.computerc...-bukkit-tekkit/

Figured I would make a new topic in here in case anyone was interested in developing this. Something as simple as a peripheral with an API to run console commands would be amazing!

#2 AliasXNeo

  • Members
  • 23 posts

Posted 16 May 2012 - 02:30 AM

Alternatively if someone is willing to point me in the direction of a down-to-earth tutorial or possibly chat with me on Skype and answer a few questions then I would be more than willing to do it myself :P/>

#3 AliasXNeo

  • Members
  • 23 posts

Posted 28 May 2012 - 01:58 AM

Bump. Willing to pay money if necessary to get this built :)/>

#4 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 28 May 2012 - 04:46 AM

I doubt it. Not many people know how to code Java and/or even make a plugin for bukkit.

#5 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 28 May 2012 - 08:52 AM

I know how to do it, but I don't really have the time for it and I'm working on two mods already...
I could provide the important part of the code (the peripheral tile entity) if someone else makes the graphics and the framework around it.
public class TileCommandPeripheral extends TileEntity implements IPeripheral {

static class CommandCallback implements ICommandListener {
  private IComputerAccess computer;
 
  private String uname;
 
  CommandCallback(IComputerAccess computer) {
   this.computer = computer;
   uname = "Computer-#"+computer.getID();
  }
 
  public void log(String message)
  {
   computer.postEvent("command_reply", message);
  }
 
  public String getUsername()
  {
   return uname;
  }
}

public String[] getMethods() {
  return new String[]{"issueCommand"};
}

public Object[] call(IComputerAccess computer, int method, Object[] args) throws Exception {
  // only one method, no big choice
 
  if(args.length < 1 || !(args[0] instanceof String)) {
   throw new IllegalArgumentException("arg 1: string expected");
  }
 
  String message = (String) args[0];
 
  ModLoader.getMinecraftServerInstance().addCommand(message, new CommandCallback(computer));
 
  return null;
}
}






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users