Creating CommandBlock commands?

Discussion in 'Plugin Development' started by Smerfa, Oct 5, 2014.

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

    Smerfa

    How to create commands like /testforblock one?
    If it find that block from command then comparator connected to block will start giving power, if there is no block then it stops giving power.
    Any ideas?



    EDIT:
    return false -> don't work, comparator is still powered.
    throw new CommandException(); -> work, but... that exception, so I have big errors in console <3
    Any ideas how to fix that? :D


    EDIT2:
    Creating own exception (with always return empty StackTrace) giving better results, but that still don't look good
    Code:
    [12:46:14 WARN]: CommandBlock at (-866,127,-739) failed to handle command
    org.bukkit.command.CommandException: Unhandled exception executing command 'cbaisn' in plugin AutoIn_BukkitSmerf v1.9-beta
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.CommandBlockListenerAbstract.a(CommandBlockListenerAbstract.java:172) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.BlockCommand.a(BlockCommand.java:47) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.WorldServer.a(WorldServer.java:569) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.WorldServer.doTick(WorldServer.java:211) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:690) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
            at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
    Caused by: com.gmail.bukkitsmerf.autoin.EmtpyException: This error is fine, just ignore it <3
    
     
  2. Offline

    CaptainUniverse

    So Smerfa you're trying to recreate command block commands in your plugin?
     
  3. Offline

    Smerfa

    I just want create command like
    /testplayer <nickname>
    and if you run it from CommandBlock then comparator will turn on if my code return true, and turn off if my code return false. like tihs /testforblock one

    ;/
     
  4. Offline

    CaptainUniverse

    why do you want to do that with a comparator Smerfa?
     
  5. Offline

    Smerfa

    eeem, because that how vanilla minecraft works :)
     
  6. Offline

    CaptainUniverse

    So lemme get this strait. You want to use bukkit but for vanilla?
    Code:java
    1. boolean b = new Boolean(config.getInt("boolean"));
    2. //cause im to swaggy to get null pointer exceptions
     
  7. Offline

    Smerfa

    meh, I just want that command :D
    Bukkit API is sooooooo small ;/
     
Thread Status:
Not open for further replies.

Share This Page