Posts by angriff

A new update is now available, introducing seasons and more!
Latest hotfix: 0.8.0.1 (2024-12-20)

    well that is the thing if you had posted the whole plugin code from the beginning I would have definitely known too and we would have checked for other plugins sooner than 30 posts after :D

    No unfortunately the only way would be to enable it via a command or have a timer checking if it is enabled and re-enabling it if not. I posted on the Teleport plugin's thread and hopefully the problem will be fixed once the creator sees it.

    Well a test project for me can look pretty messy and embarrassing with bad attempts commented out. I,also, have some things I am working on that well I wish to remain unique to my server at least until I turn them on in the public server.

    I thought it could not be me because my code was so simple.
    Is there not a way to hide/trap/protect my player from that or reset? I am not up for rewriting that code but if I have too I am comfortable I can come with a basic system but it was not on my agenda.


    Sorry for accusing ST of it.. It was I thought the only plugin I was invoking when I was building.. but obviously not.. Thanks for the confirmation.
    Thanks for the pointer on Player player. I am glad I was not going crazy and crying Wolf!

    So If I turn on setListenForKeyInput(true) and another plugin turns it false when I use that plugin that plugin then it I no longer look at keys? I guess I need to look at a way to always turn it back on and not just rely on Spawnin Event to set up the ListenForKeyINput for a KeyinputEvent plugin.

    pretty sure it is TP .. I changed player to the event recompiled loaded it up. Then turned on TP and when the GUI goes away it turns off my key input. ServerTools is back on also but this only happens with a Teleport point move after the GUI goes away.


    public Server server;
    private long target;
    private String targetName;
    //private Player player;
    private Timer Itime;


    @Override
    public void onEnable(){
    registerEventListener (this);
    }


    @EventMethod
    public void onPlayerSpawnEvent (PlayerSpawnEvent event){
    Player player;
    player = event.getPlayer();
    player.registerKeys(KeyInput.KEY_R);
    player.registerKeys(KeyInput.KEY_X);
    player.setListenForKeyInput(true);
    server = getServer();
    }

    yes exactly

    Ok well likely comes from not know exactly what the heck I am doing... and examples I see always make that Public. I can see the wisdom of declaring in each event with that overwrite event in the database event. It does make all the players turn green in Netbeans :/


    I will have to look at that other plug in.. If TP or other plugin for that matter is declaring it global would that affect this plugin then ? I was under the impression private would not let it.

    players cannot see how many plugins are installed but ofc if they try common commands for example /pnb and it works then they know that this plugin is installed.

    This part looks fine to me though there is nothing in it really.
    But just a comment why are you saving the player and the player's name as global field variables? that makes no sense as this way previous values can be called in by accident if you don't reinitialise the variables correctly somewhere else in the plugin (i.e. inside the events for instance).

    Are you talking about the private Player player;?

    ah ok sorry I got confused there for a minute :D

    ServerTools is not touching keys at all, the full code for it is available on my github and you can check for yourself that it is neither registering, unregistering or in any other way fiddling with your keys. ?(

    When you say I TP, how are you doing that? Console? Plugin? If a plugin which one? You really need to provide more information for us to help out :/ For starters a full list of all plugins/scripts used. Then what exactly you are doing that leads to your keys not working, a video would go a long way to help as well.

    sorry, this Part is for angriff.



    ah ok sorry I got confused there for a minute :D

    ServerTools is not touching keys at all, the full code for it is available on my github and you can check for yourself that it is neither registering, unregistering or in any other way fiddling with your keys. ?(

    When you say I TP, how are you doing that? Console? Plugin? If a plugin which one? You really need to provide more information for us to help out :/ For starters a full list of all plugins/scripts used. Then what exactly you are doing that leads to your keys not working, a video would go a long way to help as well.

    I am just now looking at it again. I put the Servertool back in. I have Teleport 1.3.2 installed and if I teleport with that plug in the registered keys no longer work until I reload the plugins. Funny the other day i had another plugin that was writing to a database when someone teleported. The database wrote that teleporters name instead of the event player. I thought it was a anomaly but remembered I had seen something like that before.


    Not wanting to accuse anybody of anything because I don't understand half of it but the person that did after I asked him what he did remarks about the types of plugins I had. I did not know that players can see how many plugins are installed. Maybe it is nothing but I have removed TP and will see if there is some other issue.. The last time I thought I had an issue it turned out to be just a trailing space typo.. :/X/ . Could it be my declarations? Or is there a problem with one plugin turning off key events and another not protecting itself from that ?


    public class Projector extends Plugin implements Listener {
    public Server server;
    private long target;
    private String targetName;
    private Player player;
    private Timer Itime;


    @EventMethod
    public void onPlayerSpawnEvent (PlayerSpawnEvent event){
    player = event.getPlayer();
    player.registerKeys(KeyInput.KEY_R);
    player.registerKeys(KeyInput.KEY_X);
    player.setListenForKeyInput(true);
    server = getServer();
    }

    Alrighty then! you say registered not command so, I will compile and run yours.. I am willing to bet I get the same thing. I am telling you there is nothing different in our codes. I will take the code to my test server and wipe it an check it out.
    I am not going to uplug all the plugins I have rom yagiggle and noci and the like from my main server.


    PS this happens when I am busy placing blocks.. There is only one other Plugin I am activating between blocks and that is your old servertool routine to change the time, heal<feed> me and set the weather while nobody else is on the server. Who knows.. I do like that plug in.

    hmm ok well as I said before without seeing the actual, full plugin code I have run out of ideas :/ The problem could as simple as one digit or a single letter or a bracket.

    You're welcome :) If you need anything else just let me know :)

    Have you tried running your code for an extensive time. Could it be that player is not final? Wierd .. I will just re-initiated the keys I guess if that works over time.

    hmm are you using unregisterKeys() anywhere in your code? Then the problem is obviously not caused by the two methods you posted above, it must be somewhere else in the plugin :/

    What exactly you want to run even when no player's are online? onEnable is only called once when the plugin/server starts it is never called again. It is used to initialise things the plugin needs to function so you could set a timer to check something every few seconds if that is what you need. Can you explain what you want to do in more detail? Then I will be able to help more :/

    • No the code is exactly that one simple set of codes .. there is nothing big about it. As I said it is a testing code I will build upon it later but it has been running in background until I can expand upon it. the Plugin sets up 2 keys and says you pushed the key and this is the game date. The first key is admin only and now looks for admin and sends out a 10 distanct raycast and returns the NPC type. It was just recently modified to show a player but it had the disappearing act before it was changed.. TWO KEYS that is it simple testing nothing fancy.
    • LOL I want to keep track of the days and handle some under the table continuously changing game mechanics. You pretty much answered it. Thanks

    Seperate question Minos.. I am so used to making things happen on events.. I want it to run even when there are no players on can I just use onEnable are is there a better spot to put the code?

    Yes I have tried it both ways it was really just a testing routine for me to figure out how to grab things with keypresses.


    yes I guess i did not copy that part about the day.


    int gdays = server.getGameTime(Time.Unit.Days);


    Yes when the R is pressed under the detection I have if (player.isAdmin()){


    I dont do that for the X key.


    Well it worked and failed the same again after an hour or so of building things..

    Fair enough. Well looking at it. It cant be the admin because I dont check for that on this if statement . For it to work consistently on two servers that long . It could be possible another listener plugin is causing it. The problem of looking at the test server is it is not under stress with things being placed and movement. If it works once I cannot imaging a simple I did not check if the X key was mapped in the server... I know when I used the Q i both activated it and threw away what I was holding :rolleyes:



    public void onPlayerSpawnEvent (PlayerSpawnEvent event){
    Player player = event.getPlayer();
    player.registerKeys(KeyInput.KEY_X);
    player.setListenForKeyInput(true);
    server = getServer();
    }


    @EventMethod
    public void onPlayerKeyEvent (PlayerKeyEvent event){
    Player player = event.getPlayer();
    //// some if statement similar looking for R.. that has nested Admin check////
    /// no admin check for X////
    if(event.getKeyCode()== KeyInput.KEY_X ){
    player.sendTextMessage("current Game Day = "+ gdays);
    }



    What happens is neither X nor R will work until a 'RP' plugin reload

    without the full code no clue unfortunately :/


    code in general doesn't just stop working because it decides to do so, there must be either an error causing it to stop functioning or some other problem there :/


    also if it is always at exactly 30 minutes then it is definitely an error in the code, such consistency is not common for small random bugs

    Always the same response... I have not seen code suddenly stop before unless something else is changing parameters. Unfortunately I cannot restart just the one plug in I have to restart them all.


    Well the 30 minutes seems to be imprecise. It is a keypress routine that gets the current day. I was trying to test the capabilities as well as get the moonphase but not sure about finding that so went back to day. No player has spawned on the server during the time but there area allot of con commands such as weather and health. So the question is can a key register become unregistered? It does look to see if I am Admin.

    What would cause a plugin to just stop? I have a plugin that assigns a few keys for special instructions. The plugin works for about 30 minutes then suddenly stops. The keys become unregistered. If I reload the plugins with RP then they work again.
    They are not assigned as attributes for the player maybe I need to do that is possible but I am not sure what causes the plugin suddenly to not work anymore. Any ideas?

    @yahwho is right, this function gets the player which is considered as "hostile" by the npc. E.g. if you attack a pig, the pig considers you as hostile and runs away (once the distance between the npc and you is great enough, the "hostile status" will be removed again). If there is currently no "hostile player", this function returns null ;)

    Oh ok makes the Goat attack you no doubt. :!: