Bug with Town Assistant, region owners
apengstrom opened this issue ยท 12 comments
I discovered a nice little bug today. Apparently, we checked dynmap and found region owners for the territories in some of our towns that should not have been owners. It seems anyone that was ever promoted to assistant was listed as an owner of the region, and could do stuff that they shouldn't have been able to do. Some of these region owners didn't even exist as town members anymore, and thats the primary concern. Here's a few things that really should be checked on.
- If player at any point is removed from the town somehow or quit the town themselves, their ownership over the territories and regions should be removed. If they were assistant, that should also be removed.
- Any assistants that are demoted should have their ownership over the territories removed.
- It seems anytime I try to demote these assistants, whether they are in the town or not, it gives me a message that the player has not played on the server before. This is wrong. Some of these people were just on the other day. I should note, this command is being run in a Multiverse world, and it is not the default world for the server. Not sure if that has anything to do with it or not. The players were definitely at one point in this world, though.
If you need anymore info let me know and I can get some screenshots. Thanks!
EDIT:
[14:00:20] [Server thread/INFO]: Starting minecraft server version 1.7.2
[14:00:20] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-1231 (MC: 1.7.2) (Implementing API version 1.7.2-R0.3-SNAPSHOT)
[14:00:22] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v5.5.9-SNAPSHOT:3000-ab0d170,master
[14:00:22] [Server thread/INFO]: [Multiverse-Core] Loading Multiverse-Core v2.5-b676
[14:00:22] [Server thread/INFO]: [WorldGuard] Loading WorldGuard v5.8.1-SNAPSHOT:1268-2df3290,master
[14:00:22] [Server thread/INFO]: [MCTowns] Loading MCTowns v2.4.0-SNAPSHOT
Hm, well it's intentional that assistants are added to territories, since an Assistant is literally a mayor except that they can't delete the town, kick the mayor/other assistants, and add other assistants.
They should've been removed though if they're demoted or kicked from the town. I'll check it out.
if (!p.hasPlayedBefore()) {
localSender.sendMessage(ERR + playerName + " has never played on this server before.");
return;
}
hasPlayedBefore() will return false if you've typed in an incorrect name; that's what it's checking for here. Not sure how this could go wrong. (Still checking though).
I think the primary issue here, which may resolve any other possible concerns, is that players (after being removed from the town or removed as an assistant, not exactly sure which one) are not being removed from the territory. If hasPlayedBefore continues to be an issue after that, then maybe address it then? The remaining players on territories creates a security issue for us. Thanks for looking into it!
By the way, do you have Skype by any chance? I'd like to collaborate / communicate through there if possible. Honestly, I'd really love to help out with the project in general, I'm just a complete noob at git, compilation of java git projects, etc. I'm a web programmer and I know ColdFusion, PHP, and work with javascript, Ajax, Jquery fluently. So Java code itself is easy enough to write. Perhaps we can discuss and I can take a stab at getting a dev environment set up to explore the project.
I just checked the code for removing players from towns, and when a player is removed from a town, it should remove them from everything (Territories & Plots) in the town.
Let me throw up a test server and poke around.
Oh, and I don't use Skype, sorry.
I do have a wiki article about setting up MCTowns, it's here: https://github.com/jmhertlein/MCTowns/wiki/MCTowns-Programmer's-Guide
It shows you how to clone the repo, compile with maven, and switch to the dev branch. Lemme know if it's confusing or anything.
I found the problem. I blame worldguard. They store player names as all lower case, and apparently removing "Notch" won't remove "notch".
Fixed in commit e078a9b
(One line change -.-)
Nice. Yeah, I think it is safe to assume WorldGuard defaults things to lowercase in most situations. I've had that issue with a couple other plugins before. Thanks!
If you wait for Jenkins to check github again (checks every hour) it'll have a jar for you to test.
Thanks. My server's host had an issue yesterday, and the VPS crashed. I'll get to testing everything tonight, now that it's back up.
Here's another use case to add to the list of things that should be fixed.
I created a town, added the mayor and he added an assistant. I then proceeded to buy a territory selection for them. The mayor had permissions automatically, but the assistant did not become an owner of the bought territory.
EDIT: This is using the latest from jenkins
Fixed in f682b23