Fixed bug in Arcade with client manager.

This commit is contained in:
Jonathan Williams 2014-07-01 21:42:00 -07:00
parent 41c4d5a0a8
commit 9514f6391e
4 changed files with 235 additions and 230 deletions

View File

@ -69,8 +69,8 @@ public class Arcade extends JavaPlugin
//Static Modules //Static Modules
CommandCenter.Initialize(this); CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); _clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(clientManager); CommandCenter.Instance.setClientManager(_clientManager);
ItemStackFactory.Initialize(this, false); ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this); Recharge.Initialize(this);
@ -81,7 +81,7 @@ public class Arcade extends JavaPlugin
new MessageManager(this, _clientManager, preferenceManager); new MessageManager(this, _clientManager, preferenceManager);
AntiStack antistack = new AntiStack(this); AntiStack antistack = new AntiStack(this);
Portal portal = new Portal(this, clientManager); Portal portal = new Portal(this, _clientManager);
Creature creature = new Creature(this); Creature creature = new Creature(this);
Spawn spawn = new Spawn(this); Spawn spawn = new Spawn(this);
Teleport teleport = new Teleport(this, _clientManager, spawn); Teleport teleport = new Teleport(this, _clientManager, spawn);

View File

@ -17,6 +17,7 @@
[StringLength(40)] [StringLength(40)]
public string Name { get; set; } public string Name { get; set; }
[StringLength(100)]
public string Uuid { get; set; } public string Uuid { get; set; }
public Rank Rank { get; set; } public Rank Rank { get; set; }

View File

@ -69,7 +69,7 @@
{ {
var account = repository.Where<Account>(x => x.Uuid == loginToken.Uuid).FirstOrDefault() ?? CreateAccount(loginToken, repository); var account = repository.Where<Account>(x => x.Uuid == loginToken.Uuid).FirstOrDefault() ?? CreateAccount(loginToken, repository);
account.LoadNavigationProperties(repository.Context); account.LoadNavigationProperties(repository.Context);
account.LastLogin = (long)TimeUtil.GetCurrentMilliseconds(); bool edited = false;
// Expire punishments // Expire punishments
if (account.Punishments != null) if (account.Punishments != null)
@ -77,6 +77,7 @@
foreach (var expiredPunishment in account.Punishments.Where(x => x.Active && (x.Duration - 0d) > 0 && TimeUtil.GetCurrentMilliseconds() > (x.Time + (x.Duration * 3600000)))) foreach (var expiredPunishment in account.Punishments.Where(x => x.Active && (x.Duration - 0d) > 0 && TimeUtil.GetCurrentMilliseconds() > (x.Time + (x.Duration * 3600000))))
{ {
expiredPunishment.Active = false; expiredPunishment.Active = false;
edited = true;
} }
} }
@ -84,6 +85,7 @@
if (String.IsNullOrEmpty(account.Uuid) && !String.IsNullOrEmpty(loginToken.Uuid)) if (String.IsNullOrEmpty(account.Uuid) && !String.IsNullOrEmpty(loginToken.Uuid))
{ {
account.Uuid = loginToken.Uuid; account.Uuid = loginToken.Uuid;
edited = true;
} }
// Expire ranks // Expire ranks
@ -91,8 +93,10 @@
{ {
account.Rank = repository.Where<Rank>(x => x.Name == "ALL").First(); account.Rank = repository.Where<Rank>(x => x.Name == "ALL").First();
repository.Attach(account.Rank); repository.Attach(account.Rank);
edited = true;
} }
if (edited)
repository.CommitChanges(); repository.CommitChanges();
return account; return account;
@ -511,7 +515,7 @@
repository.CommitChanges(); repository.CommitChanges();
return rank.Name; return rank.Name.ToString();
} }
} }

File diff suppressed because it is too large Load Diff