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

@123marvin123 Nope i wasn't thats it thanks!
Reply

We just released a small little update:

- Added VehicleLifecycleHolder

It is the same as PlayerLifecycleHolder, just with vehicles.
Make sure that you initialize the object, BEFORE you create any vehicles.
Here is how to make one:

At first, you need a Class which will contain all the vehicle data. For example, I will make a class called "VehicleData":

PHP код:
public class VehicleData extends VehicleLifecycleObject {
    public 
VehicleData(EventManager eventManagerVehicle vehicle) {
        
super(eventManagervehicle);
    }
    @
Override
    
public void onInit() {
    }
    @
Override
    
public void onDestroy() {
    }
    public 
int getFuel() {
        return 
50;
    }

In this class, you can add this like Fuel, engine state, trunk content etc.

PHP код:
private VehicleLifecycleHolder vehicleLifecycleHolder;
....
vehicleLifecycleHolder = new VehicleLifecycleHolder(eventManager);
vehicleLifecycleHolder.registerClass(VehicleData.class); 
Now, you can create Vehicles like normally:
PHP код:
Vehicle.create(560xyz00000, -1); 
You can access the vehicle data like this:
PHP код:
VehicleData vehicleData vehicleLifecycleHolder.getObject(vehicleVehicleData.class);
int fuel vehicleData.getFuel(); 
When you update your artifacts, make sure that the server uses the newest version of them too!
Reply

Код:
[13:29:18][INFO][ResourceManagerImpl] Load gamemode: Military Conflict
[13:29:18][ERROR][err] java.lang.UnsatisfiedLinkError: net.gtaun.shoebill.SampNa
tiveFunction.addPlayerClassEx(IIFFFFIIIIII)I
[13:29:18][ERROR][err]  at net.gtaun.shoebill.SampNativeFunction.addPlayerClassE
x(Native Method)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.object.impl.WorldImpl.addPlayerCla
ss(WorldImpl.java:83)
[13:29:18][ERROR][err]  at drumyum.mcgm.MCGamemode.onEnable(MCGamemode.java:25)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.resource.Resource.enable(Resource.
java:88)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.resource.ResourceManagerImpl.loadG
amemode(ResourceManagerImpl.java:214)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.resource.ResourceManagerImpl.loadA
llResource(ResourceManagerImpl.java:72)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.ShoebillImpl.loadPluginsAndGamemod
e(ShoebillImpl.java:263)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.ShoebillImpl.access$100(ShoebillIm
pl.java:51)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.ShoebillImpl$1.onGameModeInit(Shoe
billImpl.java:163)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1.lam
bda$onGameModeInit$3(SampCallbackManagerImpl.java:86)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1$$La
mbda$3/22147182.call(Unknown Source)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.util.TryUtils.tryTo(TryUtils.java:
21)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.util.TryUtils.tryTo(TryUtils.java:
14)
[13:29:18][ERROR][err]  at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1.onG
ameModeInit(SampCallbackManagerImpl.java:86)
  Filterscript 'ShoebillFS.amx' loaded.
Number of vehicle models: 0
MCGamemode.java, 25 line:
Код:
world.addPlayerClass(RUSpawnInfo);
RUSpawnInfo:
Код:
public static SpawnInfo RUSpawnInfo = new SpawnInfo(TEAM_SPAWN_LOCATIONS[RU_TEAM_ID], SKIN_SELECT_ANGLE, 285, RU_TEAM_ID, WeaponModel.DEAGLE, 49, WeaponModel.AK47, 120, WeaponModel.MOLTOV, 5);
What's wrong with my code?

UPD: addPlayerClass not support SpawnInfo usage, this code works fine:
Код:
world.addPlayerClass(285, TEAM_SPAWN_LOCATIONS[RU_TEAM_ID].x, TEAM_SPAWN_LOCATIONS[RU_TEAM_ID].y, TEAM_SPAWN_LOCATIONS[RU_TEAM_ID].z, SKIN_SELECT_ANGLE, WeaponModel.DEAGLE.getId(), 50, WeaponModel.AK47.getId(), 120, WeaponModel.MOLTOV.getId(), 5);
and this too:
Код:
world.addPlayerClass
(
	RUSpawnInfo.skinId, 
	RUSpawnInfo.location.x, 
	RUSpawnInfo.location.y, 
	RUSpawnInfo.location.z, 
	RUSpawnInfo.location.angle, 
	RUSpawnInfo.weapon1.getModel().getId(), 
	RUSpawnInfo.weapon1.getAmmo(), 
	RUSpawnInfo.weapon2.getModel().getId(), 
	RUSpawnInfo.weapon2.getAmmo(), 
	RUSpawnInfo.weapon3.getModel().getId(), 
	RUSpawnInfo.weapon3.getAmmo()
);
Reply

Are you sure that you use the latest library and native dll ?

The current one is for 0.3z R2-4, you can see your current version at the startup.
Reply

I updated all libs and natives from ci.gtaun.net, if that's what you mean. Ok, I just use second variant.

Could you please show me how to work with dialogs?
For example, I want to show registation form for connected player:
Код:
p.showDialog(123, DialogStyle.INPUT, "Регистрация", "Введите пароль:", "Далее", "Выход");
but I can't use integer as dialog id, I must use DialogId class, but I can't find information how to use it.
Reply

@DrumYum:

You can use shoebill-common for easy dialog-creation. If you don't have shoebill-common in your project, you can use maven:

PHP код:
<dependency>
    <
groupId>net.gtaun</groupId>
    <
artifactId>shoebill-common</artifactId>
    <
version>1.0-SNAPSHOT</version>
    <
type>jar</type>
    <
scope>compile</scope>
</
dependency
or download the newest library here:
http://ci.gtaun.net/job/shoebill-common/

And this is how you can create a InputDialog :
PHP код:
        InputDialog.create(playerrootEventManager)
                .
caption("Login for Player " player.getName())
                .
message("Please enter the password for account " player.getName())
                .
buttonCancel("Disconnect")
                .
buttonOk("Login")
                .
onClickOk((inputDialogs) -> player.sendMessage(Color.ORANGE"You entered the password " s))
                .
onClickCancel(abstractDialog -> player.kick())
                .
build()
                .
show(); 
If you don't want to use shoebill-common, you can create a DialogId like this (not recommended):
PHP код:
DialogId myDialog DialogId.create();
//Or
DialogId myDialog2 DialogId.create((dialogIdplayer1ii1s) -> {
            
player1.sendMessage(Color.RED"Response");
            return 
true;
        }); 
Reply

What is .build()?
Reply

@DrumYum: The .build() method returns the Dialog instance.

For example:

PHP код:
InputDialog loginDialog InputDialog.create(playerrootEventManager
                .
caption("Login for Player " player.getName()) 
                .
message("Please enter the password for account " player.getName()) 
                .
buttonCancel("Disconnect"
                .
buttonOk("Login"
                .
onClickOk((inputDialogs) -> player.sendMessage(Color.ORANGE"You entered the password " s)) 
                .
onClickCancel(abstractDialog -> player.kick()) 
                .
build();
loginDialog.setCaption("New caption");
loginDialog.show(); 
The same can be done to all other dialog types. With this, you can loop through a collection of items and add them to the dialog.

PHP код:
ListDialog myListDialog ListDialog.(...).build();
for(
int i 020i++) {
    
myListDialog.addItem("Item nr." i);
}
myListDialog.show(); 
Reply

Thanks for that!

New questions:
1. VehicleUpdateDamageEvent is OnVehicleDamageStatusUpdate in Pawn?
2. VehicleUpdateEvent has no analogue in Pawn, is it like OnPlayerUpdate but for vehicles?
3. What is the difference between these lines?
Код:
playerLifecycleHolder.registerClass(PlayerMC.class, (eventManager, p) -> new PlayerMC(eventManager, p));
playerLifecycleHolder.registerClass(PlayerMC.class);
Reply

1. Yes
2. Yes, this is a special event.
3. The difference is that the first method will let you create a instance in your own way. Maybe you want to use a other constructor if the player has a special name or is a npc.
Reply

Thanks again!

Is it real to run server from button "Run" in Eclipse without using Maven?
Reply

What do you mean with "Is it real"? If you mean if it's possible, then I don't know if Eclipse has the ability to launch the server after the build has finished.
Reply

Ok.

Can you please tell more about EventManager and about .createChildNode in it.
Why I should registerHandler in childNode if I can do it in rootEventManager? What is the difference?
Reply

You can create ChildNodes for different things. It's like making groups for events of the same kind.
For example, you can create a EventManagerNode for all VehicleEvents, and a EventManagerNode for all PlayerEvents.

You can unsubscribe to all VehicleEvents if you destroy just the node. So, if you mix all your events into one Manager, and you want to remove some events, you need to unregister all the events manually. When you use Nodes, you can just destroy the node, and all the registered events in this node will be destroyed.

PHP код:
        EventManagerNode vehicleEventNode eventManager.createChildNode();
        
vehicleEventNode.registerHandler(VehicleCreateEvent.class, (e) -> {
        });
        
vehicleEventNode.registerHandler(VehicleDestroyEvent.class, (e) -> {
        });
        
EventManagerNode playerEventNode eventManager.createChildNode();
        
playerEventNode.registerHandler(PlayerConnectEvent.class, (e) -> {
        });
        
playerEventNode.registerHandler(PlayerDisconnectEvent.class, (e) -> {
        });
        
//Don't need vehicle events anymore, so just destroy. Player Events will still remain
        
vehicleEventNode.cancelAll();
        
vehicleEventNode.destroy(); 
If you mix all together, you can't delete just VehicleEvents.
Reply

It's best samp plugin in the world, If developers will add support of connection between Pawn scripts and Shoebill I'll be happy.
Reply

Thank you very much for your post. We are currently working on Shoebill 1.1.

Following things are planned:

- Coexist with pawn gamemodes / filterscripts
- Native support for other plugins (streaming, FNPC etc.)
- More calculation functions for data classes
- Proxy Support (Pending)

If you have anything other you want us to implement, please let us know.
Maybe you can present your finished work with shoebill here or give us the link.
This would make us really happy.
Reply

I'll release my project after opening server on it. Now it's main problem.
I can't start server on hosting, CentOS.

I uploaded jre8_x86, installed it by rpm.
I modified startup.sh:
Код:
export JAVA_HOME=/usr/java/jre1.8.0_25
export LD_LIBRARY_PATH=.:$JAVA_HOME/lib/i386/server:$JAVA_HOME/lib/i386/client:/usr/local/lib
./samp03svr
Then "sh startup.sh", but it showed me this:
Код:
Started server on port: 7777, with maxplayers: 20 lanmode is OFF.

Shoebill Dependency Manager 1.0-SNAPSHOT Build 49 (for net.gtaun:shoebill-api:1.0)
Build date: 2014-05-26 22:19:10 CST (+0800)
Resolving dependencies...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Skipped artifact example-lvdm-1.0-SNAPSHOT (Gamemode)
Missing artifact descriptor for org.yaml:snakeyaml:jar:1.13
Missing artifact descriptor for org.slf4j:slf4j-api:jar:1.7.2
Missing artifact descriptor for net.gtaun:util-event:jar:1.0-SNAPSHOT
Missing artifact descriptor for org.slf4j:slf4j-api:jar:1.7.7
Missing artifact descriptor for net.gtaun:shoebill-launcher:jar:1.0-SNAPSHOT
Missing artifact descriptor for org.slf4j:slf4j-log4j12:jar:1.7.7
Missing artifact descriptor for net.gtaun.mk:mk-plugin-manager:jar:1.0-SNAPSHOT
Missing artifact descriptor for net.gtaun.shoebill:example-vehicle-manager-plugin:jar:1.0-SNAPSHOT
Missing artifact descriptor for net.gtaun:shoebill-common:jar:1.0-SNAPSHOT
org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at net.gtaun:shoebill-runtime:jar:1.0-SNAPSHOT -> net.gtaun:shoebill-api:jar:1.0-SNAPSHOT -> net.gtaun:shoebill-utilities:jar:1.0-SNAPSHOT -> org.apache.commons:commons-lang3:jar:3.3.1
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:303)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:337)
        at net.gtaun.shoebill.dependency.ShoebillDependencyManager.resolveDependencies(ShoebillDependencyManager.java:223)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at net.gtaun.shoebill.ShoebillLauncher.resolveDependencies(ShoebillLauncher.java:55)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.commons:commons-lang3:jar:3.3.1
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:370)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:537)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:521)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:421)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:375)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:363)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:506)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:470)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:375)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:363)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:506)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:470)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:375)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:363)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:506)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:470)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:375)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:363)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:266)
        ... 7 more
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Cannot access central (http://repo1.maven.org/maven2/) in offline mode and the artifact org.apache:apache:pom:13 has not been downloaded from it before.
        at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
        at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:817)
        at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:669)
        at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:307)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:361)
        ... 26 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Cannot access central (http://repo1.maven.org/maven2/) in offline mode and the artifact org.apache:apache:pom:13 has not been downloaded from it before.
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:462)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:264)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:241)
        at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
        ... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Cannot access central (http://repo1.maven.org/maven2/) in offline mode and the artifact org.apache:apache:pom:13 has not been downloaded from it before.
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:409)
        ... 33 more
Caused by: org.eclipse.aether.transfer.RepositoryOfflineException: Cannot access central (http://repo1.maven.org/maven2/) in offline mode
        at org.eclipse.aether.internal.impl.DefaultOfflineController.checkOffline(DefaultOfflineController.java:87)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:405)
        ... 33 more
java.lang.IllegalArgumentException: dependency node or collect request missing
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:375)
        at net.gtaun.shoebill.dependency.ShoebillDependencyManager.resolveDependencies(ShoebillDependencyManager.java:235)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at net.gtaun.shoebill.ShoebillLauncher.resolveDependencies(ShoebillLauncher.java:55)
Can you say what I did wrong? Or create please Linux installation tutorial. (I'm new at Linux)
Reply

Please make sure that you are not in offline mode!

To verify:

1. open shoebill folder and open the file resources.yml
2. make sure that the line "offlineMode:" says false
3. If not, change it to "offlineMode: false"
Reply

I made it false, because server couldn't start at all with true, I forgot to say this. I need to set it to true?
Reply

No, it's important to set it to false, that dependency manager can download all artifacts.
Is your server connected to the internet? Maybe shoebill is blocked by a firewall.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)