I think something like what you are referring to already exists and is called garry's mod
Posts by Minotorious
A new update is now available, introducing seasons and more!
Latest hotfix: 0.8.0.1 (2024-12-20)
Latest hotfix: 0.8.0.1 (2024-12-20)
-
-
I thought it could not be me because my code was so simple.
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
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.
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.
-
Could you please remove the line player.setListenForKeyInput(false); from where you have it listening for the Esc key to be pressed and close your GUI? (it is in ListGui.class file, disableGui() method, line number 99)
It is causing the clients to stop listening for keys and thus key events for other plugins that are not re-enabling it ( player.setListenForKeyInput(true); ) via a command like yours are not triggered.
Thanks
PS: if you do not have the time to do it I could do it myself but then I would need your permission to re-publish your plug-in without that line.
-
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.
variables declared in one plugin cannot have any impact on another, this is part of how Java is built as a language you can have the same name for two different methods doing completely different things and as long as they are in different packages (like two different plugins necessarily are) they have no problem coexisting.
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.
yes if another plugin turns it to false then it is false for the player that used the other plugin. I cannot understand why someone would turn that off like that since it can interfere with other plugins but after a quick look at the Teleport plugin's code I am pretty sure you found the culprit.
-
yes exactly
-
I did not know that players can see how many plugins are installed.
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.
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();
}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).
-
sorry, this Part is for angriff.
ah ok sorry I got confused there for a minute
Took out Server Tool and it worked for over an hour but it is wood setting that causes the loss
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.
I take that back. If I TP it kills it.
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.
-
Have you ever tried out your plugin?
what do you mean if I have ever tried out my plugin? if you are referring to ServerTools yes we run it on our server Artisan's Realm for almost a year now. I am confused
-
well it is not broke your friend if you don't make them an admin can have the permission (just add them to a permission group that has it set to true) only classic admins cannot use custom permissions and in the Steam p2p the host is a mandatory classic admin.
-
that has never been reported before are you sure you didn't mine the ore by accident or you didn't change the ore type the detector is looking for?
Could you post a video of it for us to see what exactly is going on?
-
yes to use the keepinventory permission this is currently the only way. To run a local dedicated 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.
placing blocks or using the ServerTools heal, time of day, or weather commands cannot unregister the key. Even if another plugin unregistered the key your plugin will still receive it as input when that key is pressed. The only way your plugin will not receive a key input is if your or another plugin has used the player.disableClientsideKeys(blablabla)
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.Tested the code I posted above for 1 hour on my world and it never stopped working.
-
well not that specific one no but there is no way for the keys to unregister themselves.
I know @yahwho has a plugin using quite a few registered keys on his server running without problems.
Also @yahgiggle has the auto-AreaProtection plugin using registered keys and that plugin too has no problems running indefinitely.
Then @noci too has created the Teleport plugin that uses registered keys and again has no problem running indefinitely.
Thus I have to assume the problem lies with your plugin and not the RW API methods as if this was not the case all 3 aforementioned plugins would stop after some time.
-
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.
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.
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
You're welcome If you need anything else just let me know
-
Since you are the host you are automatically a "classic" admin on the "server/LAN Game" this means the server overwrites your permissions to the "classic" admin ones which set keepinventory=false.
To avoid that you need to set a proper server via steamCMD (see here for how to: Set up a server with SteamCMD ) and set in the server.properties file the settings_admins_allpermissions=false (default is true).
Then you need to create permission groups on your server similarly to I assume you have already done to test on your SP/LAN world and then add yourself and your friends to a permission group that includes keepinventory=true. This way you will have that setting enabled in game.
We each set keep inventory to true, but it does not work.
When you say you set it to true, you mean in the in game settings correct? These settings only apply in SP not Servers or LAN (including Steam p2p) games.
If we log out and load the game solo, the one we share or our own, it goes to true, and we keep inventory.
Yes in SP your personal settings apply but in Steam p2p or Servers the server side settings only apply.
-
Well it worked and failed the same again after an hour or so of building things..
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
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?
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
-
It could be possible another listener plugin is causing it.
plugin listeners are independent, i.e. if two plugins are listening for the same key then when the key is pressed both plugins will receive the event and do whatever they should do with that key. Another plugin cannot interfere with your plugin in such a way at least.
/// no admin check for X////
what do you mean by admin check for X? just a line if (player.isAdmin())? or how do you check the key against a player being an admin?
I just copied the code you posted and tested it on my world and it works as it should, so your problem must be somewhere else in the plugin.
PS: without using the event.isPressed() method in the PlayerKeyEvent the method's code is triggered twice, once on press and once on release of the key
Java -
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 unfortunately this is how it is, and without being able to see the actual code that might be causing the error there is no way to debug.
Imagine I told you I have a painting and I don't like how blue the sky is on it and want advice on changing it. Then I describe it as blue and say I don't think the shade fits very well and expect your opinion without showing the actual painting to you. How would you know if I have to make it lighter, darker, or leave it as is? You can't possibly give an opinion based on my explanation of what is there without seeing it The same applies to code, without the full script I can't possibly tell what could cause your keys to unregister or your plugin to crash.
So the question is can a key register become unregistered?
To that the answer is simple. No. Unless you unregister it via the plugin there is no way for it to just decide "I don't like being registered let's quit". It just can't happen unless the whole game's internal methods crash and all hell breaks loose. Maybe red's code is not as robust as Google's or Facebook's (not saying it isn't just a maybe for the sake of the argument) to never experience issues but still it is not like the game has tonnes of serious destructive bugs or breaks down every few minutes.
PS: it is not like I am on purpose trying not to help you out, but without actual information it is not easy to just guess about these things
-
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
-
About the setting "settings_admin_allpermissions" in the server.properties file: If it's set to true, it means that owners/admins (i.e. all players which are set up as "admin" in the server.properties file) are not affected by permissions, they always have full access to all commands etc. If you set it to false, owners/admins will be treated like all other players, i.e. it depends on which permission group they're assigned to.
just a small comment from my side, if you need the keep inventory permission as true then you must set settings_admin_allpermissions to false as the server overwrites it to false by default