14.08.2016, 18:42
[Plugin] Shoebill 1.1 - SA-MP Java Development Kit
15.08.2016, 09:06
PHP код:
eventManagerNode.registerHandler(PlayerTextEvent.class, (e) -> {
e.disallow();
});
22.08.2016, 08:26
Found some confused bug:
https://github.com/Shoebill/shoebill...scription.java at line: 116
catch (NullPointerException e)
{
throw new FileNotFoundException(configFilename);
}
I had NPE but file was found (wrong configuration syntax)
Please do not throw FileNotFoundException in that case. Its very confusing!
https://github.com/Shoebill/shoebill...scription.java at line: 116
catch (NullPointerException e)
{
throw new FileNotFoundException(configFilename);
}
I had NPE but file was found (wrong configuration syntax)
Please do not throw FileNotFoundException in that case. Its very confusing!
24.08.2016, 15:11
Hello Everybody,
I suggest using netbeans for this API. It is very easy to use and you wont struggle to build your project. I am just struggling on connecting a mysql database to my project.
Thanks for the API. This has helped me a lot. Currently studying Java at university so it is not so difficult for me either.
I suggest using netbeans for this API. It is very easy to use and you wont struggle to build your project. I am just struggling on connecting a mysql database to my project.
Thanks for the API. This has helped me a lot. Currently studying Java at university so it is not so difficult for me either.
24.08.2016, 19:44
Hello!
I'm using hibernate orm to load player data to the game.
Could you show me a good solution how to attach player DB data to Player object?
As I don't want to keep DB objects in the PlayerHelper static list and fork it every time when I need data.
Something like: player.setVarString but for Object
I'm using hibernate orm to load player data to the game.
Could you show me a good solution how to attach player DB data to Player object?
As I don't want to keep DB objects in the PlayerHelper static list and fork it every time when I need data.
Something like: player.setVarString but for Object
11.09.2016, 21:01
(
Последний раз редактировалось diclofoss; 11.09.2016 в 23:37.
)
Hello!
Found some issue. For Menu class there is no onSelectMenu function. This is not suitible to handle common MenuSelectedEvent and keep gamemode flow somewhere. Instad of this I created a class with static methods:
How to use:
In main gamemode class:
In somewhere where you need to create a menu (for example "skin shop"):
UPD: Dev team! Please validate my code, i think that synchronized can help the onSelectMenu for concurrent removing elements from arraylist
Found some issue. For Menu class there is no onSelectMenu function. This is not suitible to handle common MenuSelectedEvent and keep gamemode flow somewhere. Instad of this I created a class with static methods:
PHP код:
package ru.samp_net;
import java.util.ArrayList;
import java.util.List;
import net.gtaun.shoebill.event.menu.MenuSelectedEvent;
import net.gtaun.shoebill.object.Menu;
import net.gtaun.util.event.EventManager;
import net.gtaun.util.event.EventManagerNode;
/**
*
* @author Philipp Khlupin
*/
public class MenuController {
@FunctionalInterface
public static interface SelectMenuEvent {
public void onSelect(MenuSelectedEvent event);
}
private static EventManagerNode eventManagerNode;
private static List<Menu> menuList;
private static List<SelectMenuEvent> eventList;
public static void init(EventManager rootEventManager) {
eventManagerNode = rootEventManager.createChildNode();
menuList = new ArrayList<>();
eventList = new ArrayList<>();
setupEventHandlers();
}
public static void createMenuHandler(Menu menu, SelectMenuEvent event) {
menuList.add(menu);
eventList.add(event);
}
private static void setupEventHandlers() {
eventManagerNode.registerHandler(MenuSelectedEvent.class, (event) -> onSelectMenu(event));
}
public static void destroy() {
menuList.clear();
}
private static synchronized void onSelectMenu(MenuSelectedEvent event) {
SelectMenuEvent menuEvent;
for (int i = 0; i < menuList.size(); i++) {
if (event.getMenu().getId() == menuList.get(i).getId()) {
menuEvent = eventList.get(i);
menuEvent.onSelect(event);
menuList.remove(i);
eventList.remove(i);
return;
}
}
}
}
In main gamemode class:
PHP код:
protected void onEnable() throws Throwable {
EventManager eventManager = getEventManager();
//...
MenuController.init(eventManager);
//...
}
PHP код:
private void drawMenu(RolePlayer rolePlayer) {
Menu menu = SampObjectManager.get().createMenu("Choose skin", 1, 50.0f, 160.0f, 110.0f, 0.0f);
menu.setColumnHeader(0, "Choose skin");
menu.addItem(0, ">> Next");
menu.addItem(0, "<< Previous");
menu.addItem(0, "Done");
menu.show(rolePlayer.getPlayer());
MenuController.createMenuHandler(menu, (event) -> {
switch (event.getRow()) {
case 1:
// Show next skin
drawMenu(rolePlayer);
break;
case 2:
// Show previous skin
drawMenu(rolePlayer);
break;
default:
// Save changes
break;
}
});
}
16.09.2016, 20:11
Hello!
Could you help me with this issue:
In PlayerKeyStateChange event I can only handle old key but not new one:
Here what I found in Shoebill runtime code class, as you may see you did not propogate new key value at all:
How could I handle new key?
Could you help me with this issue:
In PlayerKeyStateChange event I can only handle old key but not new one:
Here what I found in Shoebill runtime code class, as you may see you did not propogate new key value at all:
PHP код:
@Override
public boolean onPlayerKeyStateChange(int playerId, int keys, int oldKeys) {
try {
Player player = sampObjectStore.getPlayer(playerId);
PlayerKeyStateChangeEvent event = new PlayerKeyStateChangeEvent(player, new PlayerKeyStateImpl(player, oldKeys));
rootEventManager.dispatchEvent(event, player);
return event.getResponse() > 0;
} catch (Throwable e) {
e.printStackTrace();
return false;
}
}
16.09.2016, 20:12
@diclofoss: With player.getKeyState();
16.09.2016, 20:14
Thank you
19.09.2016, 23:40
@mk124 Hello! Could you share me some example with streamer-wrapper?
28.09.2016, 18:49
Hello! Is it possible that your Maven repository is down?
I get messages like this:
Failed to read artifact descriptor for net.gtaunhoebill-api:jar:1.2-SNAPSHOT
I get messages like this:
Failed to read artifact descriptor for net.gtaunhoebill-api:jar:1.2-SNAPSHOT
28.09.2016, 18:51
@The King's Bastard: Hi, you are right, our hoster is currently doing some maintenance work on our hosting system. It should be back soon.
28.09.2016, 18:53
(
Последний раз редактировалось The King's Bastard; 28.09.2016 в 20:43.
)
Alright! Thank you very much for your really fast answer!
//EDIT: How long do you think it will take until the repository is up again?
//EDIT: How long do you think it will take until the repository is up again?
29.09.2016, 16:33
The repository is now back online.
29.09.2016, 19:53
Let's say I'd like to use Guava:
Everything is compiling fine, but when I want to start the server, I'm getting a
java.lang.NoClassDefFoundError for example for the Strings class in Guava (which has the function isNullOrEmpty()) for example. Obviously the build process is not including those dependencies in the final JAR file.
How do I get Shoebill to load those dependencies (maybe from a repository)?
Код:
<dependency> <groupId>com.******.guava</groupId> <artifactId>guava</artifactId> <version>19.0</version> </dependency>
java.lang.NoClassDefFoundError for example for the Strings class in Guava (which has the function isNullOrEmpty()) for example. Obviously the build process is not including those dependencies in the final JAR file.
How do I get Shoebill to load those dependencies (maybe from a repository)?
29.09.2016, 19:54
You have to add guava to your needed runtime libraries in the resources.yml. It should look like this:
Код:
runtimes: - ... - com.******.guava:guava:19.0
29.09.2016, 20:16
Alright, this works fine. Thanks!
Now I'd like to use Hibernate 5.2.2, but the problem is that somehow the server can't seem to find the the EntityManager. I do have a META-INF/persistence.xml in the resources directory just as gamemode.yml.
Do you know what I could be doing wrong?
I'm also loading Hibernate-entitymanager, just like Guava:
In my unit test, everything works fine as well and the EntityManager can be created. So somehow it must be unable to find persistence.xml? Because I know that the Hibernate classes are loaded.
The exception I get:
Now I'd like to use Hibernate 5.2.2, but the problem is that somehow the server can't seem to find the the EntityManager. I do have a META-INF/persistence.xml in the resources directory just as gamemode.yml.
Do you know what I could be doing wrong?
I'm also loading Hibernate-entitymanager, just like Guava:
Код:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.2.2.Final</version> </dependency>
The exception I get:
Код:
[22:41:26][ERROR][err] javax.persistence.PersistenceException: No Persistence provider for EntityManager named newventuras [22:41:26][ERROR][err] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61) [22:41:26][ERROR][err] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) [22:41:26][ERROR][err] at ch.leadrian.samp.newventuras.NewVenturas.onEnable(NewVenturas.java:26) [22:41:26][ERROR][err] at net.gtaun.shoebill.resource.Resource.enable(Resource.java:91) [22:41:26][ERROR][err] at net.gtaun.shoebill.resource.ResourceManagerImpl.loadGamemode(ResourceManagerImpl.java:179) [22:41:26][ERROR][err] at net.gtaun.shoebill.resource.ResourceManagerImpl.loadAllResource(ResourceManagerImpl.java:62) [22:41:26][ERROR][err] at net.gtaun.shoebill.ShoebillImpl.loadPluginsAndGamemode(ShoebillImpl.java:289) [22:41:26][ERROR][err] at net.gtaun.shoebill.ShoebillImpl.access$100(ShoebillImpl.java:47) [22:41:26][ERROR][err] at net.gtaun.shoebill.ShoebillImpl$1.onAmxLoad(ShoebillImpl.java:233) [22:41:26][ERROR][err] at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1.lambda$null$80(SampCallbackManagerImpl.java:60) [22:41:26][ERROR][err] at net.gtaun.shoebill.util.TryUtils.tryTo(TryUtils.java:21) [22:41:26][ERROR][err] at net.gtaun.shoebill.util.TryUtils.tryTo(TryUtils.java:14) [22:41:26][ERROR][err] at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1.lambda$onAmxLoad$81(SampCallbackManagerImpl.java:60) [22:41:26][ERROR][err] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [22:41:26][ERROR][err] at java.util.concurrent.ConcurrentLinkedQueue$CLQSpliterator.forEachRemaining(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [22:41:26][ERROR][err] at java.util.stream.ReferencePipeline.forEach(Unknown Source) [22:41:26][ERROR][err] at net.gtaun.shoebill.samp.SampCallbackManagerImpl$1.onAmxLoad(SampCallbackManagerImpl.java:60)
30.09.2016, 10:35
@The King's Bastard: You should look into the generated .jar if the persistence.xml file is at the correct path. I don't think I can help you with that, because I have no idea of these persistence frameworks.
30.09.2016, 15:07
Hello, I am trying to get the server working on my Windows desktop.
I have followed the video guide linked in the main post and I downloaded the full package. I made sure that I have the latest JDK installed, I have set the environment variable (JRE_HOME).
When I start the server I get the following:
As you can see, it does not give a reason why the Shoebill plugin failed to load.
I have followed the video guide linked in the main post and I downloaded the full package. I made sure that I have the latest JDK installed, I have set the environment variable (JRE_HOME).
When I start the server I get the following:
Код:
SA-MP Dedicated Server ---------------------- v0.3.7-R2, ©2005-2015 SA-MP Team [16:58:17] filterscripts = "" (string) [16:58:17] [16:58:17] Server Plugins [16:58:17] -------------- [16:58:17] Loading plugin: Shoebill [16:58:17] Failed. [16:58:17] Loaded 0 plugins. [16:58:17] [16:58:17] Filterscripts [16:58:17] --------------- [16:58:17] Loaded 0 filterscripts. [16:58:17] Number of vehicle models: 0
30.09.2016, 18:16
(
Последний раз редактировалось The King's Bastard; 30.09.2016 в 19:17.
)
Hello mk124
In the generated JAR, persistence.xml is in META-INF.
Is there any way to enable ALL console output? Because during the unit tests I'm seeing console output from Hibernate that does not show up in the SAMP console or in the logs...
This could be helpful for me to find out what I'm doing wrong.
Thanks in advance!
// EDIT:
Well I also tried EclipseLink instead of Hibernate, same problem: Everything works fine during unit test, but when I run the server, it doesn't.
In the generated JAR, persistence.xml is in META-INF.
Is there any way to enable ALL console output? Because during the unit tests I'm seeing console output from Hibernate that does not show up in the SAMP console or in the logs...
This could be helpful for me to find out what I'm doing wrong.
Thanks in advance!
// EDIT:
Well I also tried EclipseLink instead of Hibernate, same problem: Everything works fine during unit test, but when I run the server, it doesn't.
« Next Oldest | Next Newest »
Users browsing this thread: 15 Guest(s)