Posts by Miwarre


    Alternatively the player.raycast() attempt is already a very good approach. Unfortunately it's not possible to get the actual object position yet (instead just the collision point can be retrieved, which is useless in this case). However, the raycast() Method will be enhanced with the next update (or more preceisely, the "RayCastResult" object) so it will be possible to get the actual object coordinates ^^

    In my case, the problem with RayCastResult is that it does not report the hit object itself in .getCollisionObject(); it only reports something if the hit object is a player or an NPC.

    What I have done for a similar case (Specialty Chests plugin on my github) is the following:

    Java
    <code removed>

    This way I get the chest ID as a chat message when I access a chest only if I have typed my command first. Then I can use that ID in further commands for example.

    Thanks for the code sample. In practice, with all the differences in the details, what I described in post no. 3 above is generically equivalent to your implementation: issue a command and the next chest interaction will be in some way special.


    sorry if I but in but why not use the f key to identify the chest or furnace or crafting table like yahgiggle does in the object protection plugin. it is on a timer to make the command so it doesn't just sit there and wate. You have to reactivate it with the f key after 30 sec or so. On my server we find it works very well. since we use the f key for activating things, opening doors, and chests, it should be fairly intuitive. :)

    Would mind to elaborate a bit? How the F is used to identify an object?

    Also, just a suggestion, please take into concideration the chests that were placed before object protection was placed.

    That's the whole point of all this; limiting to objects placed after the plug-in is installed simplifies some points, but it would be too limiting. But working on all objects requires identify them without any "previous knowledge" of them.

    Hmmm... this seems to me hard to tell. Scenario:

    • Both plug-in A and plug-in B hooks the SomekindofEvent.
    • According to A, one of these events should be cancelled, but according to B it should not.

    I see at least two fuzzy points:

    • If A cancels it (event.setCancelled(true)) and, afterwards, B un-cancels it (event.setCancelled(false)), who wins? the last one?
    • There is no way to be sure that A gets the event before B or of any notification order in general.

    From one point of view, one could say that plug-in A is not the right solution for the task and it should be modified (which might be possible or not).


    From another point of view, this might be a much more general problem and an actual "protocol" should be devised for plug-ins to speak to each other. Still, in general, it might be impossible to tell which of not just two, but n plug-ins dealing with the same matter is right.


    EDIT: oh well, red51 beat me by 5 min!

    Yes, of course ultimately access data would end up in a DB table, with the object ID and access rights.


    My problem, as stated initially, is: how can the I (or the generic user) know the chest ID in order to tell it to the plug-in? Or, in other words, how can the user tells the plug-in "this specific chest", so that the plug-in can work its ID out?

    @Minotorious, thanks for the reply. Perhaps, it would be possible in my case, but probably in a very counter-intuitive way. This is my scenario:


    - In the Area Protection plug-in, an area may restrict access to chests, all the chests of that area.


    - I would like to be able to tell the plug-in: "This specific chest (or furnace or whatever) is no longer restricted, but can be accessed (for taking, for giving or for both) by anyone."


    According to your description, it would be implemented more or less like this:


    • The player issues a command meaning "I want to edit the access rights for a chest"; the command just sets an attribute (say, "chestRights") for the player and does nothing else
    • Each time a player opens a chest, the attribute "chestRights" is looked for; if present, the chest opening is cancelled and the procedure to set the rights for that chest (whatever it actually is) is started instead.


    Would this make sense?

    Summary: I need a way for a player to "point" a specific object (currently, a chest) to a plug-in, telling it to work on that specific object.


    What I tried:


    1) A ray cast to get the object the player is looking at (the player would be required to look at the chest he want to work on); but ray cast result only identify players or NPCs;


    2) Find the chest nearest to the player (the player would be required to move near to the intended chest): but neither World.getAllChests() nor the world DB "Chests" table itself contain the chest position.


    Has anybody been able to solve this point?

    @red51 How hard would it be to create a GuiDropdown menu in the API?


    The way I imagine it, it should be like a small label but with an arrow on the right side, when the player clicks the arrow a scrollable dropdown appears with one value in each row. The values can be predefined by for instance .setRows(int rows) and the text set by .setRowText(int rowNumber, String text)

    I may be biased by RW-Gui architecture, but I would expect each item of the drop-down list -- as well as of other types of menus -- to have:


    • a text (String),
    • an id (int or long),
    • a data Object


    so the item set-up method would be int addItem(String text, int id, Object data), returning the item position on the list/menu.


    I would expect a callback function to be called on item selection, passing the id and the data.

    Hi @Ludy; the origin of the error seems an incomplete installation; either the rwgui/assets/ folder is missing or it does not contains all the images.


    I have re-downloaded the latest plug-in file (rwgui_0_5_1.zip)to check it and it contains all the needed files in the correct places; so, it is a matter of uploading to the server all the plug-in files or, if you have access to a console on the host, simply unZIPping the plug-in file directly in the server plugins directory.


    Please let me know if I can further help you.

    100% agreed!

    (P.s, I wonder what I did wrong with the language plugin and no other developer uses or upgrades, I was not even asked if I could help there, and that's one of my best blunders, I think)

    It is the same for me: I have two back-end plug-ins out since a year and a half and nobody else uses them but myself (RW-Gui even has its source code published since long).


    I presume it is a matter of control: some developers prefer not to depend on someone else to correct bugs or add functions they need. Still, no Java developer would re-invent Apache Commons (but, yes, I agree, Apache Foundation looks a lot more solid than Miwarre... ;) ).

    I wouldn't pay anything for a mod personally.

    Neither would I! :D

    Mods = free + any donations I voluntarily make to the developers that is it. We saw it last time it happened with Bethesda, the creative club fiasko almost brought down the whole company because people are not even willing to pay for mods for Skyrim or Fallout (both much bigger games than RW). So I would say noone will pay for a mod in RW if noone did for Skyrim.

    Agreed. Which gives even more strength to the open source argument...

    Decompiling is not illegal in the US. Any case for distribution for commercial use is in the civil side not criminal side of the law in the US.

    You are right; however, EULA's usually prohibit any form of R.E.; if you do it, you risk being sued; the fact it would be a civil rather than a penal case is only marginally better: being sued by, say, Microsoft is not a pleasant experience (I risked it once upon a time...; it is a long story, but the funny thing is that 20 years later they acknowledged I was right and what I did was in their own interest too!)


    As far as plugins for this game well maybe they should be distributed through steam as DLC and you can charge for them and Steam can audit your files for variations.

    Now, how much would you pay for the Java Area Protection plug-in I am writing? 5 $? How many of the about 120 RW servers currently running would also buy it? Say, 20? That's a grant total of 100$. Taking into account the development time, this amounts to a salary of about 1$ (gross) per hour...


    Even if we double all the figures and we arrive around 4 - 5 $ (gross) per hour, we are still almost an order of magnitude off. So, my position is "Here it is, get it for free; and get the source code too". Not everybody would share that position, I know, but many actually do...

    ok so I start the timer.. I pause the timer.. if I start the timer again does it start all over or begin with the last tick?

    This is a good question and the documentation is not completely clear about it; I am tempted to read it that start() after a pause() starts the timer from the beginning, resetting the initial delay and the repetitions, but you may want to test it, for instance using an initial delay noticeably different from the interval: if this initial delay occurs on re-start(), then it resets the timer to initial conditions.

    if I kill the timer to clean things up after some event .. can I reinitialize the timer with a event method or is it dead forever.

    If you kill a timer, that timer is gone; but of course you can create another! What let you think that you cannot create as many timers as you need / want (memory permitting of course) at any moment you need it?

    ok from the API doc stuff

    Good! The API documentation is your friend, for all these matters!



    Now i just want to know if I can kill a timer and not have to reload the plugin? If I have it running and dont need it for the next few hours until another event should I kill it then let the event re-initialize it with the same name or do I need a new name?



    so let me simplify is there any way to reset the timer to 0 for another start in the future without killing it? Or do you just have to let it expire.. which is a problem if you have executed code by the timer that you may or may not want to execute.

    You are making it much more complex than it is:
    - when you need a timer, create it;
    - when you have done your timed task and no longer need that timer, kill it.


    This is all!

    If I start a timer then kill it. I know from another thread that you cannot restart it if I kill it. Therefore, it is best to pause it.

    It depends: re-creating a new timer when you need it (after having killed a previous timer) may be fine too. May even be better if you need an initial delay.

    The question is if I kill it and I have an action to restart the event method can I use the timer all over again? I would think you could but knowing may save me hours of testing. Thanks

    You gave the answer yourself already: "you cannot restart it if I kill it" (aside: I do not understand what you mean by "I have an action to restart the event method").

    So we need the interpretation of a Qualified person here I see.

    Unfortunately, this is very true (and quite well known). The legislation about distribution and copy right did grow organically into a rather involved mess and the 'simple' understanding of the layman is often wrong: a lawyer (actually a specialised lawyer) is often necessary before committing to significant work or investment.


    The saddest thing is that this has very little to do with protecting authors (as a software author for decades, both as an employee and free lance, I think I know what I am speaking about): mostly it is done to protect corporation investments.


    Is it being decompiled and used for money and profit? Does it use an copyrighted software to function itself?

    These aspects are largely irrelevant: reverse engineering is prohibited in itself, regardless the result is re-distributed or not, is sold or given away for free, or even not re-used in any way and kept secret in a vault (which would make it hard to discover, but a crime nevertheless).


    And, of course, almost all software applications need some other copyrighted software to work (the operating system, if nothing else); this does not makes them "less copyrighted" (if such a clause has any sense) in themselves.
    ____________________


    But perhaps, we can learn something from this all: decompiling a plug-in is illegal, but people will do it, because it is easy.


    However, a plug-in for RW is unlikely to involve any monetary gain: you may be proud your plug-in is used by many RW servers, but this happens if the plug-in is useful and works, not because you kept its source code secret.


    When I started contributing to open source projects (about 15 years ago) where my code was expected to be seen by many other peoples, my coding skill started to improve; I started paying much more attention to documentation, which makes easier for me to maintain my own code, etc, etc.


    So, rather than fighting a battle you will ultimately loose for no gain, release your plug-in as open source: you will not loose any money (because you are not going to getting any anyway) and you will have some coding benefits over time: according to my experience, definitely worth the try.

    I am not a lawyer, so what I know and understand is mostly hearsay and second hand; for any 'serious' matter I would consult a lawyer.


    That said, as far as I know and remember, I think, >> I THINK << that, at least in the EU, every reverse engineering (R.E.) is forbidden and decompilation definitely fall in the reverse engineering class.


    Once upon a time there used to be an exception which allowed R.E. of something else if necessary to make a product of yours interoperating with that something else and if you don't share the result of the R.E. with anybody else; but I have no idea if this is still true.


    This, I believe, the theory in great summary. In practice, as @Minotorious said, Java decompilation is easy and at hand reach of practically everybody; many of us surely decompiled parts of RW own code; for instance one can infer this is how all those lists of objects and items are created (which, on the paper, is a "capital offence", as knowledge is obtained from R.E., used to derive other knowledge and then publicly shared!).


    I presume JIW Games could go after those practices, but it would be quite silly, as they are, SO FAR, in the interest of the game itself. Certainly, if less fair usages of RW decompilation should surface, the reaction of the copyright holder would be far less benign, I imagine.


    If @PatrickBronke is concerned people can read his code, he definitely should not use Java, if possible; but of course for RW plug-ins Java is mandatory. On the other hand, a case could be made that development of new RW plug-ins would benefit from code of existing plug-ins to be freely available and this would ultimately benefit the whole community of users. I myself, I am posting my plug-ins on github, but of course everybody is entitled of his own position on that topic.

    Adding a texture is probably not hard, as you say and I would greatly welcome a roof more similar to the real roofs I see around me.


    However, there are a couple of points to think about:


    1) A block (or a beam or whatever) has the same texture on all its sides: those bent tiles would look great on the block top side, but improbable on the side (or bottom) sides.


    2) These types of texture represent something with a marked 3D look: again they look great when looked down at, but this rarely happens with roofs; usually you look at them from down at an angle and the then obvious 'flatness' of the texture would clash with the look of the objects represented (the bent tiles).


    If these points can be addressed, though, roofs more roof-like ( :S ) would be great ^^ .