-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restoring Attack Speed #11
Comments
The plugin sets an attribute on players with the attack speed, that attribute must be reversed so you would have to keep the plugin enabled and set the attack speed to the default 4 in the config file until all the people that were set to the new speed are set back. |
I see, I will have to keep it on then for a bit so that during the week people can log in to get the reverted mechanics. Now what if I later just remove the plugin and somebody hadn't logged in when I made changes? Would they be still be set to fast attackspeeds as deault? |
Yes, they would still be set to fast attack speed if they had logged in 2016-08-23 21:35 GMT+01:00 Yohan Vervatwala notifications@github.com:
|
So now I've made changes disabled features, done a restart, on my client I see on a sword attack speed as 1.6 but a few users are reporting an attackspeed of 1021.6 and can spam click. |
Try keeping the old attack speed enabled but setting the speed to 4 Il 23/ago/2016 22:25, "Yohan Vervatwala" notifications@github.com ha
|
I've realized now that once a feature is disabled when config is reloaded it only affects people who are currently online, so now what is happening is some people have one version of pvp (1.8) some some back to default (1.9) |
I understand (sort of) that the plugin changes some player NBT data or something but it would really be nice if there was a config once reloaded would change it for everyone (people who arent online either) since players on a server can be of different timezones and there might not be an admin to reload the plugin. |
Due to efficiency features, when you disable the module the plugin no longer peforms any check. This means that if you want to revert everyone back (including people who are offline) you must keep the module enabled and set the speed to 4 (default for 1.8). I'm not sure if it is possible to change the attack speed for offline players but I'll have a look. |
There seems to be a way to get a list of all players including offline players but we can't get the world they're in nor edit their attributes in any reasonable manner. |
Ok thank you @gvlfm78 , apologies for the confusion and thank you for helping me through it. |
I might have another look at this some other time, but for now it doesn't seem to be possible. |
Why not just reset a player's attributes upon logout? Should be possible, shouldn't it? |
Depends on the timing of events, but it's not a bad idea. That might be a better solution.
|
PlayerQuitEvent is called right before the player gets disconnected, so the player is stil loaded in memory. @EventHandler( priority = EventPriority.HIGHEST )
public void onPlayerQuit( PlayerQuitEvent e )
{
Player player = e.getPlayer();
AttributeInstance attribute = player.getAttribute( Attribute.GENERIC_ATTACK_SPEED );
double baseValue = attribute.getBaseValue();
if ( baseValue != 4 )
{
attribute.setBaseValue( 4 );
player.saveData();
}
} |
Well that makes our job easy :P
|
Indeed that would work. I believe the original reason for not doing that was to have the least amount of listeners/operations for the plugin to be as efficient as possible, I never considered anyone would want to get rid of the plugin after having allowed their playerbase on. |
@gvlfm78 it is still something to be considered that a plugin could be removed after it was put in. I am not a programmer by any stretch but as a user (simple server admin) I would think some easier kind of reset would be in place. |
Here's the problem: to my knowledge, we don't' have access to the attack speeds of offline players. Now even if we implemented a better system, you'd still have a bunch of offline players that would have the wrong attack speed. I can do some checking though to see if we have access to the offline players, if so then we can probably figure something out. |
How about something that refreshes the config as the player logs in? like right now when i am online i just reload the plugin just so i know it changes some of the old players attack speed |
If you enable the combat coold-down module and set the speed to 4 players will be set back to 1.9 speeds upon entering the server. |
:o So if we use OCM and one day decide to remove it, some players would be stuck with faster combat compared to new players? Seems extremely inefficient for large community servers. Can't wait for every single person to login once to be 'reset'. :s |
We haven't found a way yet to edit the Attributes of offline player, but by adding kukelekuuk00's code anyone that installs the plugin after it's been added should not have this problem. I'm still looking around if there's a practical way to edit offline player's attributes. |
Hopefully you are able to find a way. :) Don't want to be stuck with some players being broken permanently if the plugin is ever removed in the future. Would be nice to reset everyone's attributes before removal. |
Any update to this problem? |
Really the only way I can think of is to crawl through all playerdata files and manually modify the NBT. I think the server would have to be offline for this though.... Anyways it wouldn't be easy to say the least, but it might be possible. I guess I can look into it... |
I have put @kukelekuuk00 's fix in place for version 1.0.2, so that in the meantime at least new installs will not have the same problem. |
Would it be possible to create a temporary offline tool to use on all player files in the world folder to reset their attack speed to default? I don't want to be stuck with broken users forever. :( |
@mibby I've done it once before to restore players inventories by reading their playerdata files, so I should be able to use that as a starting point. Sorry for the inconvenience this has caused you :/ |
It just sets the AttackSpeed NBT tag to 4 (assuming default 1.9/10+ value) for all players? Won't corrupt the player.dat file? |
Nope, won't corrupt it. And yes, sets it to 4.
I tested it myself.
|
Thanks. I'll give it a try later today. :) Does OCM modify any other player NBT strings? Or was it just attack speed which should now revert on logout? |
It was only modifying attack speed I believe... and it wasn't using the NBT system. The Bukkit API itself lets you change a player's attack speed without any NMS / Reflection, but there just wasn't any way to do that for offline players. So instead I just wrote OCMFixer to read all the playerdata files and change the attribute value. It should be 100% safe, I wrote some protections into the code so if it doesn't find the right NBT structure in the file it just kinda fails silently without touching the file. |
@mibby If you enabled the old armour values, which causes the plugin to add a large armour toughness value to armour pieces upon wearing them, those values won't be removed upon removing the plugin as players could have easily put the armour pieces in chests etc. |
@mibby |
Assuming OCM doesn't set the attack speed value to the player.dat file anymore (removing it on logout), I hope so. :P I did run the plugin and read command on the world. No way of fully knowing without using an NBT editor and looking at every user file. |
Just look at a few that haven't been online in a while. To make sure. And @gvlfm78 it does reset on logout now, right? |
If you have the module enabled it does. This means that those that haven't logged it since before the update will still have the fast attack speed and you'll have to use Rayzr's utility if you're uninstalling or disabling the module. |
I have made the plugin set armour NBT tags to default when armour is unequipped or the player leave the server. This means from version 1.1.1 of OCM removing OCM should leave no trace. |
When plugin was removed, swords and weapons still crafted with high attack speed? How would I change it back to its 1.9 default?
The text was updated successfully, but these errors were encountered: