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 - 26.01.2015

Can you show me your implementation of your commands, please?

If you don't use the commandManager from shoebill-common, then you have to use

event.setProcessed()

when your command was handled correctly


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

I use the commandManager. It worked before the last update. I didn't change anything in my code (in cmds part)


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

also clearAnimations isn't working for me


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

I tried the command manager in my project, and it's working fine. I downloaded all the artifacts from server and native from updater. Maybe you have some old version of shoebill-common, runtime or plugin? Please use the provided update-shoebill.bat/sh file and download newest plugin / launcher. I will take a look at clearAnimations later, please post your code here. Maybe you have some samp related bug in there.


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

Код:
eventManagerNode.registerHandler(PlayerTextEvent.class, HandlerPriority.BOTTOM, (e) ->
{
...
                player.applyAnimation("PED", "IDLE_chat", 4.1f, 1, 1, 1, 1, 1, 1);

                Timer.create(text.length() * 100 + 1000, 1, (factualInterval) ->
                {
                    player.clearAnimations(1);
                }).start();
});



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

I see your problem. If you create a Timer in a function, it will be destroyed by GC even before it has been executed.
You need to make a global variable and then assign it, so it won't be destroyed by Garbage Collector.


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

I used this construction in another places and it works well. I tested my code with println() messages in console and a timer works right


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

This is a bug in samp I think -> https://github.com/Y-Less/sa-mp-fixes/issues/4

You can use this to cancel the animation:

player.clearAnimations(1);
player.applyAnimation("CARRY", "crry_prtial", 1.0f, 0, 0, 0, 0, 0, 0);


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

Thank you! Bun now I have another problem.. In IDEA I can't resolve shoebill-common. I checked pom.xml, but everything is ok. Is the problem in my side?


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

I pushed a update, you can add this repo to your repositories:

<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>

then you should received it now


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

ok, thanks, I got it!


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 26.01.2015

I can't fix "Unknown command" messages, so here is my cmds handler:

Код:
		eventManagerNode.registerHandler(PlayerCommandEvent.class, HandlerPriority.MONITOR, (e) ->
		{
			Player player = e.getPlayer();
			PlayerData playerData = playerLifecycleHolder.getObject(player, PlayerData.class);

			if(!playerData.isAllowedCmds())
			{
				e.setProcessed();
			}
		});
		
		eventManagerNode.registerHandler(PlayerCommandEvent.class, HandlerPriority.BOTTOM, (e) ->
		{
			Player player = e.getPlayer();
			player.sendMessage(Color.RED, "Неизвестная команда. Введите /help для помощи.");
			e.setProcessed();
		});
I'm also using commangManager and in differrent handlers add smth like that: commandManager.registerCommands(new AdminCommands(rootEventManager, playerLifecycleHolder));

I updated all, that I can


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

At first, this is how to implement a custom check before the command is executed (e.g. for a admin level check):

Код:
class AdminCommands {
    private HashMap<String, Integer> adminLevels;

    public AdminCommands() {
        adminLevels = new WeakHashMap<>();
        adminLevels.put("kick", 2);
    }

    @BeforeCheck
    public boolean beforeCheck(Player p, String cmd, String params) {
        if(!adminLevels.containsKey(cmd))
            return false;
        //Get player data
        if(playerData.getAdminLevel() >= adminLevels.get(cmd)) return true;  //Return true = command is allowed to execute
        //Maybe write some message that he's not allowed:
        p.sendMessage(Color.GRAY, "You are not allowed to execute command /" + cmd);        
        return false; // return false, command is not allowed to execute
    }

    @Command
    public boolean kick(Player player, Player target) {....}
}
Do you use the provided amx files in your server.cfg?


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 27.01.2015

Quote:
Originally Posted by mk124
Посмотреть сообщение
Do you use the provided amx files in your server.cfg?
in full server package there are no any amx files (connects with shoebill) in server.cfg and in folders or I'm not right?


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - kapilb - 27.01.2015

great


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

@kapilb: Thank you
@SetupDLL: There should be a filter script and a gamemode, your server.cfg should contain this:

gamemode0 bare 1
filterscripts base


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 27.01.2015

I can't remove them? (I removed fs and changed gm to a blank gm)
And will the repo.gtaun.net work?


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

no, if you remove them, you have to use some other pawn gamemode which includes all callbacks or use a fully working one.


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 27.01.2015

Can I delete repo.gtaun.net? It is not available


Re: [SNAPSHOT][Java 8] Shoebill 1.0 - SA-MP Java Development Kit - SetupDLL - 27.01.2015

oh, sorry, now it works)