Private Books

Discussion in 'CommandHelper Scripts' started by sebdomsan54, Apr 17, 2016.

  1. sebdomsan54

    sebdomsan54 Member

    Private Books
    this scrips is in basic a way for player to ether add passwords to a book or only allow certain people to read the books.
    *note i cant do passwords yet because exodus is broken on 1.9.2


    bind('player_interact', null, null, @c,null
            if(@c[action] == 'right_click_air' || @c[action] == 'right_click_block'){
                if(@c[item] == '387:0'){
                 @bookinfo = (get_mob_equipment(entity_id(puuid(player())))[weapon])
                    if(((string_position(@bookinfo[meta][pages], password)) != -1) || ((string_position(@bookinfo[meta][pages], Password)) != '-1')){
                     @password = ((split('\n', (split(':', @bookinfo[meta][pages])[1]))[0]))
                        @input = user_input(@c[player], if((@input == @password)){
                    } else if(((string_position(@bookinfo[meta][pages], readers)) != -1) || ((string_position(@bookinfo[meta][pages], Readers)) != '-1')){
                     @readerlist = ((split('\n', (split(':', @bookinfo[meta][pages])[1]))[0]))
                        if((string_position(@readerlist, @c[player])) != -1){
                        } else{
                         msg('A magic force holds the book closed')
  2. MCmacjuul

    MCmacjuul Member

    Your using user_input() in a wrong way, you want it like this:


    @pass = '12345'; // Terrible password hehe

    user_input(@c['player'], closure(@inp) {
        if(@pass == @inp) {
            // Password successful
        } else {
            // Password incorrect
    Do note that cancel() won't work when you put it in closures, so you might want to think of a different way of approaching this. You could instead make the book "locked" and "unlock" it when a password has been entered correctly. It would then lock once again when the book would be dropped or put in a container
    Last edited: Apr 18, 2016
  3. sebdomsan54

    sebdomsan54 Member

    with only this code i get
    "An unexpected exeption occured during the execution of your script. please cheak the consol for more information."

    ps: Sorry for breaking it

    [22:44:26] [Server thread/INFO]: cats_doom issued server command: /recompile
    [22:44:26] [Server thread/INFO]: CHExodius 2.2.3 has sucessfully been disabled!
    [22:44:26] [Server thread/INFO]: CHVC 1.0.3 unloaded.
    [22:44:26] [Server thread/INFO]: CHExodius 2.2.3 has sucessfully been enabled!
    [22:44:26] [Server thread/INFO]: CHVC 1.0.3 loaded.
    [22:44:26] [Server thread/INFO]: [CommandHelper]: MethodScript files processed
    [22:44:26] [Server thread/INFO]: [CommandHelper]: 11 alias(es) defined.
    [22:44:27] [Server thread/INFO]: cats_doom issued server command: /input
    [22:44:27] [Server thread/INFO]: CH: Running original command on player cats_doom ----> /input
    [22:44:27] [Server thread/INFO]: An unexpected exception occured during the execution of a script.
    [22:44:27] [Server thread/WARN]: java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_8_R3/entity/CraftPlayer
    [22:44:27] [Server thread/WARN]: at me.macjuul.chexodius.CHExodiusFunctions$user_input.exec(
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.core.Script.eval(
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.core.MethodScriptCompiler.execute(
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.core.MethodScriptCompiler.execute(
    [22:44:27] [Server thread/WARN]: at
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.core.AliasCore.alias(
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.commandhelper.CommandHelperListener.runAlias(
    [22:44:27] [Server thread/WARN]: at com.laytonsmith.commandhelper.CommandHelperListener.onPlayerCommandPreprocess(
    [22:44:27] [Server thread/WARN]: at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
    [22:44:27] [Server thread/WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    [22:44:27] [Server thread/WARN]: at java.lang.reflect.Method.invoke(
    [22:44:27] [Server thread/WARN]: at$1.execute(
    [22:44:27] [Server thread/WARN]: at org.bukkit.plugin.RegisteredListener.callEvent(
    [22:44:27] [Server thread/WARN]: at
    [22:44:27] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(
    [22:44:27] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PlayerConnection.handleCommand(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PlayerConnection.a(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$
    [22:44:27] [Server thread/WARN]: at java.util.concurrent.Executors$
    [22:44:27] [Server thread/WARN]: at
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45)
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.MinecraftServer.D(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.DedicatedServer.D(
    [22:44:27] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.MinecraftServer.C(
    [22:44:27] [Server thread/WARN]: at
    [22:44:27] [Server thread/WARN]: at

    /input = >>>
    user_input(player(), closure());
  4. MCmacjuul

    MCmacjuul Member

    Oh I see, the latest version isn't compatible with 1.8 I'm afraid
  5. sebdomsan54

    sebdomsan54 Member

    im on 1.9 still not compatible right?
  6. MCmacjuul

    MCmacjuul Member

    It should be compatible for 1.9, at least, it is working for me on 1.9