SA-MP Forums Archive
[Plugin] Shoebill 1.1 - SA-MP Java Development Kit - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] Shoebill 1.1 - SA-MP Java Development Kit (/showthread.php?tid=397735)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - mk124 - 28.01.2015

Yes, because there is an old version of shoebill-api included.
I think if you disable offlineMode in resources.yml it should download the newest api.


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - stokdam - 28.01.2015

OfflineMode is disabled by default. But I found out that there is no .jar file in ..\shoebill\repository\net\gtaun\shoebill-api\1.1-SNAPSHOT.


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - mk124 - 28.01.2015

I updated both server packages, you can redownload them at the start-post. I tried everything and it should launch without any configuration now (except JAVA_HOME variable).


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - mk124 - 29.01.2015

[Image: 15LWaBE]

We just patched an important bug. You should update immediately if you don't want to put your server at risk.
You can use the provided update-shoebill.bat/sh file to update all the old files, or you can redownload the package from the first post, and replace files.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - The King's Bastard - 01.02.2015

Are all the native function provided by 0.3z fully supported? Or are there any native functions missing? I still see a lot of interfaces in the source code like the Textdraw interface. I just want to make sure that all the 0.3z functionality can be accessed.

//EDiT: Nevermind, found that there are lots of implementations in a different project.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 01.02.2015

Yes, every SAMP Function is implemented, also every callback. You can take a look at shoebill-common for extra functions, like paged dialogs


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - The King's Bastard - 01.02.2015

If I see that correctly, callbacks are implemented as event handlers, right? No general functions like Gamemode.onPlayerConnect etc.?


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - stokdam - 02.02.2015

You should add an event so that we can use plugin callbacks.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 02.02.2015

@The King's Bastard: Yes, you can register as many events as you want. You can create EventManagerNodes and destroy them etc.

You register a event like this: eventManager.registerHandler(PlayerConnectEvent.cl ass, (e) -> { ... });

@stokdam: Yes, we are currently working on it. You can already call natives.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - stokdam - 02.02.2015

Another question. Can I call shoebill functions from a child thread?


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 02.02.2015

Yes, you can call SAMP Functions from a child thread, but you need to use
Код:
Shoebill.get().runOnSampThread(() -> {
            
});
in your running thread.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - Anarkien - 02.02.2015

Mk124, one question.
Can one plug a Java MongoDB driver into this, and use it as a replacement for MySQL? Or does it require a custom-made DB connector?


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 02.02.2015

@Anarkien: You just need to add a mysql / mongodb connector to your maven dependencies, and shoebill will download the needed connector automatically if you use maven. You can use every already existing java librarie with shoebill.

For example, you can see my project, it used Mongo DB: https://github.com/GTAUN/wl-vehicle-manager


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - stokdam - 03.02.2015

I have a problem with my login dialog;

PHP код:
DscGamemode.get().getShoebill().runOnSampThread(()->
            {
                
                
InputDialog.create(playerDscGamemode.get().getEventManager())
                .
caption("Login for Player " player.getName())
                .
message("Please enter the password for account " player.getName())
                .
buttonCancel("Disconnect")
                .
buttonOk("Login")
                .
onClickOk(new DialogLogin())
                .
onClickCancel(abstractDialog -> player.kick())
                .
build()
                .
show();
                
            });
public class 
DialogLogin implements ClickOkHandler{
    public 
DialogLogin()
    {
        
    }
    
    @
Override
    
public void onClickOk(InputDialog dialogString testo) {
        
Player player dialog.getPlayer();
        
Utente utente Utente.getUtente(player);
        
String hashPassCmp Metodi.criptaPass(testoutente.getSalt()); //Get the hash from inputtext and salt
        
if (hashPassCmp.equals(utente.getHashPass()))
        {
            
utente.setLoggato(true); //set the user logged in
            
player.sendMessage(Color.LIGHTGREEN"You succesful logged in");    
        }
        else
        {
            
utente.aggiungiTentativo(); //user login attempts count
            
dialog.setCaption("Login failed");
            
dialog.setMessage("You entered the wrong password.\nTry again.");
            
dialog.show();
        }
    }

I have managed to show the dialog again if the player insterted the wrong password. The dialog appears but the caption and the message are not changed.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 03.02.2015

@stokdam: I tried to reproduce this, but it didn't work. Everything is working correctly, I tried it with this code:

Код:
        InputDialog.create(player, Gamemode.get().getEventManager())
                .caption("This is the old cap.")
                .message("This is old text")
                .onClickOk((dialog, text) -> {
                    dialog.setCaption("This is the new cap");
                    dialog.setMessage("This is the new text");
                    dialog.show();
                })
                .build()
                .show();



Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - stokdam - 03.02.2015

Quote:
Originally Posted by mk124
Посмотреть сообщение
@stokdam: I tried to reproduce this, but it didn't work. Everything is working correctly, I tried it with this code:

Код:
        InputDialog.create(player, Gamemode.get().getEventManager())
                .caption("This is the old cap.")
                .message("This is old text")
                .onClickOk((dialog, text) -> {
                    dialog.setCaption("This is the new cap");
                    dialog.setMessage("This is the new text");
                    dialog.show();
                })
                .build()
                .show();
The difference is that I called dialog.setCaption(" ") after the method build(), using the InputDialog object.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 03.02.2015

I am doing the exact same as you do, just in a lambda expression. The dialog variable is the input dialog, and then onClickOk Event will be called after the .build() of course, so both do the exact same thing.


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - stokdam - 03.02.2015

Recompiled the project from my Linux pc and now it's working. I don't know what was happening. Thank you anyway for your help


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - PaulDinam - 03.02.2015

I like it, is there a list of all available functions and such and how to utilize them such as handling events?


Re: [UPDATE][SNAPSHOT][Java 8] Shoebill 1.1 - SA-MP Java Development Kit - mk124 - 03.02.2015

You can take a look at the example gamemode: https://github.com/Shoebill/example-lvdm
Eventhandeling is pretty easy:
Код:
eventManager.registerHandler(EventName.class, (e) -> {
    //Handle event, get player or vehicle etc. like: e.getPlayer()
});
The event names are like in pawn, for example: PlayerConnectEvent.class, PlayerUpdateEvent.class, PlayerTextEvent.class.

Also, you can take a look at shoebill-common. In this package are many functions to make developing a gamemode much easier.