Fix for duplicate names in db.

Adjusted staff server whitelist and op list.
This commit is contained in:
Jonathan Williams 2015-04-21 23:35:41 -05:00
parent 2b8137fc66
commit d8ed866ada
4 changed files with 244 additions and 230 deletions

View File

@ -82,10 +82,8 @@ public class StaffServer extends JavaPlugin
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("1def99f1-ae43-4917-a5dc-138dc73aaf36"), "FireStar891"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("a133d8bf-128c-47e1-b63c-33c278371593"), "blondebug"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("52eb645e-58e8-4a3f-a7dc-5c7a5e382232"), "blackfiend"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("0c4dd677-8e84-4755-8e66-f426a16b55bd"), "axegirl"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("d3965dbc-f9cc-4e5d-9306-5be2a23ad6cb"), "Dooskee")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("d3965dbc-f9cc-4e5d-9306-5be2a23ad6cb"), "Dooskee"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh"));
} }
} }

View File

@ -84,7 +84,14 @@
{ {
using (var repository = _repositoryFactory.CreateRepository()) using (var repository = _repositoryFactory.CreateRepository())
{ {
var account = repository.Where<Account>(x => x.Uuid == loginToken.Uuid).FirstOrDefault() ?? (repository.Where<Account>(x => x.Name == loginToken.Name).FirstOrDefault() ?? CreateAccount(loginToken, repository)); var account = repository.Where<Account>(x => x.Uuid == loginToken.Uuid).FirstOrDefault();
if (account == default(Account))
account = repository.Where<Account>(x => x.Name == loginToken.Name).FirstOrDefault();
if (account == default(Account))
account = CreateAccount(loginToken, repository);
account.LoadNavigationProperties(repository.Context); account.LoadNavigationProperties(repository.Context);
account.LastLogin = DateTime.Now.Ticks; account.LastLogin = DateTime.Now.Ticks;
@ -101,15 +108,23 @@
} }
// Insert UUID if not there // Insert UUID if not there
if (String.IsNullOrEmpty(account.Uuid) && !String.IsNullOrEmpty(loginToken.Uuid)) if (String.IsNullOrEmpty(account.Uuid))
{ {
account.Uuid = loginToken.Uuid; if (!String.IsNullOrEmpty(loginToken.Uuid))
account.Uuid = loginToken.Uuid;
} }
// Update account name if changed // Update account name if changed
if (!String.Equals(account.Name, loginToken.Name)) if (!String.Equals(account.Name, loginToken.Name))
{ {
account.Name = loginToken.Name; account.Name = loginToken.Name;
var oldAccount = repository.Where<Account>(x => x.Name == loginToken.Name).FirstOrDefault();
if (oldAccount != null && oldAccount != default(Account))
{
}
} }
/* /*
@ -121,6 +136,7 @@
} }
* */ * */
repository.Edit(account);
repository.CommitChanges(); repository.CommitChanges();
return account; return account;

File diff suppressed because it is too large Load Diff

Binary file not shown.