[Plugin] Shoebill 1.1 - SA-MP Java Development Kit

EDIT: WORKING GREAT Thanks!
Amazing work!
There is a way to use another plugins like Incognito Streamer?
Reply

Nice to hear!
Yes, just add the Streamer to your plugins list in server.cfg and it will be loaded too. You can access native functions via the Amx-Interface. You can take a look at this:

http://shoebill.github.io/apidoc/net...xInstance.html
(getNative(), registerFunction() etc.)

and for a example you can take a look at this wrapper for Incognito's streamer:
https://github.com/Shoebill/streamer-wrapper
Reply

@mk124, about CreateFailureException, I'm not sure if I did everything right, but even after disabling offlineMode there were no updates.

And another question:
Reading last posts in this thread about people having problem with running server with your plugin on linux OS is quite frightening me . Will I have same problems when I rent server on linux OS?
Reply

Everyone who had problems on linux have resolved them. And those problems were missing libraries which could be avoided if someone would build the plugin statically.
Reply

I noticed a bug, when you try to use a skin whit an id greater that 299 you got the following ArrayIndexOutOfBoundsException: 300

Quote:

In new versions of SA-MP since 0.3.7 RC3 you can use more than 299 skins, maximum 311 skins.

Furthermore, how can I use returns? I want to prevent a player from spawning, but I have no idea how can I set a return 0 on
Code:
eventManager.registerHandler(PlayerRequestSpawnEvent.class, (e) ->
        {
Reply

@Su37Erich, about ArrayIndexOutOfBoundsException, are you sure you are using the last version of shoebill plugin? Because I dont have any problems with skins. Show us a code where you are setting a skin for a player.

New issue:
It's about PlayerAttach. After player edits an attached object, the Offset, Rotation and Scale of that object remain the same (the values are equals to which were set by method set(...) of PlayerAttachSlot class).

Code example:
PHP Code:
// attaching
PlayerAttach.PlayerAttachSlot slot player.getAttach().getSlot(0)
slot.set(PlayerAttachBone.SPINE, new Vector3D(), new Vector3D(), new Vector3D(111), ,0);
// Now, slot.getOffset() = { 0,0,0 }, slot.getRotation() = { 0,0,0 }, slot.getScale() = { 1,1,1 }
// Then, make a player to edit the attached object
slot.edit();
// After editing (when the player press save button), values of Offset, Ration and Scale are not changed:
// slot.getOffset() = { 0,0,0 }, slot.getRotation() = { 0,0,0 }, slot.getScale() = { 1,1,1 } 
I tried to get those values in PlayerEditAttachedObjectEvent and just by typing a command - nothing was changed.
If it's not an issue, then I would like to know a way how to get coordinates of a new position.
Reply

Quote:
Originally Posted by Su37Erich
View Post
I noticed a bug, when you try to use a skin whit an id greater that 299 you got the following ArrayIndexOutOfBoundsException: 300


Furthermore, how can I use returns? I want to prevent a player from spawning, but I have no idea how can I set a return 0 on
Code:
eventManager.registerHandler(PlayerRequestSpawnEvent.class, (e) ->
        {
Use the disallow method.

Code:
eventManager.registerHandler(PlayerRequestSpawnEvent.class, (e) -> {
    e.disallow();
});
That is the equivalent of returnin 0 in pawn.

About skins, I tested adding classes(Server.get().addPlayerClass) and it worked for me. How are you using them? Have you updated shoebill files?

Quote:
Originally Posted by valych
View Post
@Su37Erich, about ArrayIndexOutOfBoundsException, are you sure you are using the last version of shoebill plugin? Because I dont have any problems with skins. Show us a code where you are setting a skin for a player.

New issue:
It's about PlayerAttach. After player edits an attached object, the Offset, Rotation and Scale of that object remain the same (the values are equals to which were set by method set(...) of PlayerAttachSlot class).

Code example:
PHP Code:
// attaching
PlayerAttach.PlayerAttachSlot slot player.getAttach().getSlot(0)
slot.set(PlayerAttachBone.SPINE, new Vector3D(), new Vector3D(), new Vector3D(111), ,0);
// Now, slot.getOffset() = { 0,0,0 }, slot.getRotation() = { 0,0,0 }, slot.getScale() = { 1,1,1 }
// Then, make a player to edit the attached object
slot.edit();
// After editing (when the player press save button), values of Offset, Ration and Scale are not changed:
// slot.getOffset() = { 0,0,0 }, slot.getRotation() = { 0,0,0 }, slot.getScale() = { 1,1,1 } 
I tried to get those values in PlayerEditAttachedObjectEvent and just by typing a command - nothing was changed.
If it's not an issue, then I would like to know a way how to get coordinates of a new position.
Confirmed. The reason is that new values are passed to OnPlayerEditAttachedObject and shoebill ignores them. Will create an issue on github.
Reply

Thanks for replying but this didn't work
Quote:

eventManager.registerHandler(PlayerRequestSpawnEve nt.class, (e) ->
{
Callbacks.onPlayerRequestSpawn(e.getPlayer());
e.disallow();
});

I was still able to spawn
I updated the shoebill files using the updater.bat
Here is my code:
Quote:

settings.addPlayerClass(287, 2744.3704F, -2537.4812F, 13.6557F, 50.0F, 0, 0, 0, 0, 0, 0);
for(short i=0; i<312; i++){
if(Server.isValidSkin(i) && i != 287){
settings.addPlayerClass(i, 2744.3704F, -2537.4812F, 13.6557F, 50.0F, 0, 0, 0, 0, 0, 0);
}
}

Reply

Quote:
Originally Posted by Su37Erich
View Post
Thanks for replying but this didn't work

I was still able to spawn
I updated the shoebill files using the updater.bat
Here is my code:
Code:
 getEventManager().registerHandler(PlayerRequestSpawnEvent.class, e -> {
            Random random = new Random();
            Player player = e.getPlayer();
            if(random.nextInt(2) == 0) {
                player.sendMessage(Color.CHOCOLATE, "No spawn");
                e.disallow();
            } else {
                player.sendMessage(Color.CHOCOLATE, "Yes spawn");
            }
        });
I tested with this code. Dissallow worked fine for me. I assume that Callbacks.onPlayerRequestSpawn(e.getPlayer()); in your code calls the Pawn callback, why?

Could you also show me your resources.yml file?


As for classes, I can confirm that it's a bug. I found it and will submit an issue on github.
Reply

I just call my own method called onPlayerRequestSpawn to code in another file, there I have only a show dialog instruction so far:
Quote:

public static void onPlayerRequestSpawn(Player player){
Server.showSpawnMenu(player);
}

Quote:

repositories:
- id: central
url: http://repo1.maven.org/maven2/

- id: gtaun-public-repo
url: http://repo.gtaun.net/content/groups/public

- id: sonatype-oss-snapshots
url: https://oss.sonatype.org/content/rep...ies/snapshots/

# When to update cache?
# Options: always / daily / interval:[minutes]
cacheUpdatePolicy: always

# If Maven checks for Updates or use old artifacts
offlineMode: false

# Your needed runtimes
runtimes:
- net.gtaunhoebill-runtime:1.2-SNAPSHOT
- net.gtaunhoebill-common:1.0-SNAPSHOT

# Additional plugins
plugins:

# Your gamemode
gamemode: dev.acesamp:test:1.0-SNAPSHOT

Reply

@Su37Erich: This is fixed in Shoebill 1.2 with commit https://github.com/Shoebill/shoebill...eb29941ae1b971.

@valych: I added the new values to the PlayerEditAttachedObjectEvent in commit https://github.com/Shoebill/shoebill...8a02cf35d65f57

@Su37Erich: PlayerRequestSpawn is working fine for me. Your Pawn Gamemode / Filterscript might be making problems.
Reply

@mk124, thank you for very quick response and fixes
Reply

Another issue (and now it's about npcs):
Firstly, I tried to check my npcs, created by RNPC plugin in pawn code. None of them were connected to my server (if I run the server without Shoebill, everything works without any problems).
Then, I tried to connect npcs with java code. I created a command /testnpc and call Server.get().connectNPC("test", "test") method in it. And when I type this command, nothing happens - in a server console there should be a message about new connection, but it's absent.
Server slots remain the same value. maxnpc in server.cfg file is set to 10.
Reply

@valych: I'll have a look at it.
You say it is working in Pawn but not in Shoebill, although you changed nothing?
Reply

@mk124, not exactly, those npcs connect only when a server runs WITHOUT shoebill plugin. But with plugin they are dont, functions of pawn code and methods of java code are executed without any error or exception, but in console there are no messages about any connection. Is it more clear now?

Short variant:
Server without shoebill plugin -> npc connects successfully
Server with shoebill plugin -> npc doesnt connect (neither with pawn code nor with java code) and there is no message about his connection.
So, I guess the problem is in shoebill plugin.
Reply

Quote:
Originally Posted by mk124
View Post
@Su37Erich: PlayerRequestSpawn is working fine for me. Your Pawn Gamemode / Filterscript might be making problems.
I don't think so, I tested the following code and it didn't work.
Quote:

package dev.acesamp;
import net.gtaun.shoebill.resource.Gamemode;
import net.gtaun.util.event.EventManager;
import net.gtaun.util.event.EventManagerNode;
public class Militar extends Test {
@Override
protected void onEnable() throws Throwable {
EventManager eventManager = getEventManager();
EventManagerNode ev = eventManager.createChildNode();
ev.registerHandler(PlayerRequestSpawnEvent.class, (e) ->
{
e.disallow();
});
}

@Override
protected void onDisable() throws Throwable {

}
}

And I do not have another filterscripts or gamemodes
Reply

Are you sure that your Event is getting called? Try to register a handler directly to the EventManager, because it is possible that the EventManagerNode is getting collected by the garbage collector. Also try to add a blank game mode into your server.cfg file (only the main() method) and remove any amx that is getting loaded via filter script.
Reply

I removed the base filterscript and created the empty gamemode and it worked great!
Thank you for the support!
One more question, why the following code has errors?
Quote:

public void showMapIcons(){
PlayerMapIcon.createIcon(1213.8862F, 224.4393F, 19.5547F, 52, Color.BLACK, MapIconStyle.GLOBAL, 63);
}

It says: non-static method cannot be referenced from a static conext.
Reply

Quote:
Originally Posted by Su37Erich
View Post
I removed the base filterscript and created the empty gamemode and it worked great!
Thank you for the support!
One more question, why the following code has errors?

It says: non-static method cannot be referenced from a static conext.
Well you're probably calling showMapIcons method from a static one. Basically, you can only call non-static methods on an instance of an object.
Reply

@Su37Erich: You need to have an instance of PlayerMapIcon which you can get by calling player.getMapIcon();
If you want to show an Map Icon for every player, you should iterate through every player using
PHP Code:
Player.getHumans().forEach(player -> {
    
player.getMapIcon().create(...);
}); 
or register an PlayerConnectEvent and call your showMapIcons(player) method from there.
Reply


Forum Jump:


Users browsing this thread: 21 Guest(s)