diff --git a/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java b/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java index 67a04c331..dd9898f6f 100644 --- a/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java +++ b/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java @@ -49,7 +49,7 @@ public class DDoSProtectionSwitcher //{ //if (_repository.switchToDDOSProt()) //{ - /* + System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date())); DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, @@ -111,7 +111,7 @@ public class DDoSProtectionSwitcher + idBuilder.toString()).Execute(); System.out.println("Deleted " + recordsToDelete.size() + " records."); } -*/ +/* // Switching US Bungees switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201"); switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49"); @@ -133,7 +133,7 @@ public class DDoSProtectionSwitcher switchServer("10.32.214.250", "69.175.4.38", "107.6.129.250", "69.175.4.37", "107.6.129.249"); switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37"); switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97"); - +*/ /* // Switching EU Bungees switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33"); diff --git a/Website/LOC.Website.Common/Contexts/Repository.cs b/Website/LOC.Website.Common/Contexts/Repository.cs index de90ffa75..9b19981d9 100644 --- a/Website/LOC.Website.Common/Contexts/Repository.cs +++ b/Website/LOC.Website.Common/Contexts/Repository.cs @@ -69,6 +69,10 @@ } throw; } + catch (Exception e) + { + Log("ERROR", PREFIX + String.Join("; ", e.InnerException.InnerException.Message)); + } } public virtual void Delete(TEntity entity) where TEntity : class diff --git a/Website/LOC.Website.Common/LOC.Website.Common.csproj b/Website/LOC.Website.Common/LOC.Website.Common.csproj index bcce2c618..4cd3ebb12 100644 --- a/Website/LOC.Website.Common/LOC.Website.Common.csproj +++ b/Website/LOC.Website.Common/LOC.Website.Common.csproj @@ -58,6 +58,7 @@ + diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs index 67a0492bb..663de3fa6 100644 --- a/Website/LOC.Website.Common/Models/AccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -15,6 +15,7 @@ using Data; using LOC.Website.Common.Contexts; using System.Data.Entity.Infrastructure; + using System.Transactions; public class AccountAdministrator : IAccountAdministrator { @@ -556,81 +557,89 @@ if (rank == null) return account.Rank.ToString(); - account.Rank = rank; - account.RankExpire = DateTime.Now.AddMonths(1); - account.RankPerm = token.Perm; + var expire = DateTime.Now.AddMonths(1).AddMilliseconds(-DateTime.Now.Millisecond); - repository.Edit(account); - - if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm) + using (var transaction = new TransactionScope()) { - addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0); - addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0); - addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0); - addAccountTransaction(repository, account, "A Barbarians Life Bomber", 0, 0); - addAccountTransaction(repository, account, "The Bridges Archer", 0, 0); - addAccountTransaction(repository, account, "The Bridges Bomber", 0, 0); - addAccountTransaction(repository, account, "The Bridges Brawler", 0, 0); - addAccountTransaction(repository, account, "The Bridges Miner", 0, 0); - addAccountTransaction(repository, account, "Castle Siege Castle Assassin", 0, 0); - addAccountTransaction(repository, account, "Castle Siege Castle Brawler", 0, 0); - addAccountTransaction(repository, account, "Castle Siege Castle Knight", 0, 0); - addAccountTransaction(repository, account, "Castle Siege Undead Archer", 0, 0); - addAccountTransaction(repository, account, "Castle Siege Undead Zombie", 0, 0); - addAccountTransaction(repository, account, "Death Tag Runner Archer", 0, 0); - addAccountTransaction(repository, account, "Death Tag Runner Traitor", 0, 0); - addAccountTransaction(repository, account, "Dragon Escape Disruptor", 0, 0); - addAccountTransaction(repository, account, "Dragon Escape Warper", 0, 0); - addAccountTransaction(repository, account, "Dragons Marksman", 0, 0); - addAccountTransaction(repository, account, "Dragons Pyrotechnic", 0, 0); - addAccountTransaction(repository, account, "Block Hunt Instant Hider", 0, 0); - addAccountTransaction(repository, account, "Block Hunt Shocking Hider", 0, 0); - addAccountTransaction(repository, account, "Block Hunt Radar Hunter", 0, 0); - addAccountTransaction(repository, account, "Block Hunt TNT Hunter", 0, 0); - addAccountTransaction(repository, account, "Super Paintball Machine Gun", 0, 0); - addAccountTransaction(repository, account, "Super Paintball Shotgun", 0, 0); - addAccountTransaction(repository, account, "One in the Quiver Brawler", 0, 0); - addAccountTransaction(repository, account, "One in the Quiver Enchanter", 0, 0); - addAccountTransaction(repository, account, "Runner Archer", 0, 0); - addAccountTransaction(repository, account, "Runner Frosty", 0, 0); - addAccountTransaction(repository, account, "Sheep Quest Archer", 0, 0); - addAccountTransaction(repository, account, "Sheep Quest Brute", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Blaze", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Chicken", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Mad Cow", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Creeper", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Enderman", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Undead Knight", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Magma Cube", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Pig", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Skeletal Horse", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Sky Squid", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Snowman", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Witch", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Wither", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Wither Skeleton", 0, 0); - addAccountTransaction(repository, account, "Super Smash Mobs Wolf", 0, 0); - addAccountTransaction(repository, account, "Snake Super Snake", 0, 0); - addAccountTransaction(repository, account, "Snake Other Snake", 0, 0); - addAccountTransaction(repository, account, "Sneaky Assassins Ranged Assassin", 0, 0); - addAccountTransaction(repository, account, "Sneaky Assassins Revealer", 0, 0); - addAccountTransaction(repository, account, "Super Spleef Archer", 0, 0); - addAccountTransaction(repository, account, "Super Spleef Brawler", 0, 0); - addAccountTransaction(repository, account, "Squid Shooter Squid Blaster", 0, 0); - addAccountTransaction(repository, account, "Squid Shooter Squid Sniper", 0, 0); - addAccountTransaction(repository, account, "Survival Games Archer", 0, 0); - addAccountTransaction(repository, account, "Survival Games Assassin", 0, 0); - addAccountTransaction(repository, account, "Survival Games Beastmaster", 0, 0); - addAccountTransaction(repository, account, "Survival Games Bomber", 0, 0); - addAccountTransaction(repository, account, "Survival Games Brawler", 0, 0); - addAccountTransaction(repository, account, "Survival Games Necromancer", 0, 0); - addAccountTransaction(repository, account, "Turf Wars Infiltrator", 0, 0); - addAccountTransaction(repository, account, "Turf Wars Shredder", 0, 0); - addAccountTransaction(repository, account, "Zombie Survival Survivor Archer", 0, 0); - addAccountTransaction(repository, account, "Zombie Survival Survivor Rogue", 0, 0); - } + account.Rank = rank; + account.RankExpire = expire; + account.RankPerm = token.Perm; - repository.CommitChanges(); + repository.CommitChanges(); + + repository.Edit(account); + + if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm) + { + addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0); + addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0); + addAccountTransaction(repository, account, "A Barbarians Life Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Archer", 0, 0); + addAccountTransaction(repository, account, "The Bridges Bomber", 0, 0); + addAccountTransaction(repository, account, "The Bridges Brawler", 0, 0); + addAccountTransaction(repository, account, "The Bridges Miner", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Assassin", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Brawler", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Castle Knight", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Archer", 0, 0); + addAccountTransaction(repository, account, "Castle Siege Undead Zombie", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Death Tag Runner Traitor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Disruptor", 0, 0); + addAccountTransaction(repository, account, "Dragon Escape Warper", 0, 0); + addAccountTransaction(repository, account, "Dragons Marksman", 0, 0); + addAccountTransaction(repository, account, "Dragons Pyrotechnic", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Instant Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Shocking Hider", 0, 0); + addAccountTransaction(repository, account, "Block Hunt Radar Hunter", 0, 0); + addAccountTransaction(repository, account, "Block Hunt TNT Hunter", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Machine Gun", 0, 0); + addAccountTransaction(repository, account, "Super Paintball Shotgun", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Brawler", 0, 0); + addAccountTransaction(repository, account, "One in the Quiver Enchanter", 0, 0); + addAccountTransaction(repository, account, "Runner Archer", 0, 0); + addAccountTransaction(repository, account, "Runner Frosty", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Archer", 0, 0); + addAccountTransaction(repository, account, "Sheep Quest Brute", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Blaze", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Chicken", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Mad Cow", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Creeper", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Enderman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Undead Knight", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Magma Cube", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Pig", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Skeletal Horse", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Sky Squid", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Snowman", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Witch", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wither Skeleton", 0, 0); + addAccountTransaction(repository, account, "Super Smash Mobs Wolf", 0, 0); + addAccountTransaction(repository, account, "Snake Super Snake", 0, 0); + addAccountTransaction(repository, account, "Snake Other Snake", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Ranged Assassin", 0, 0); + addAccountTransaction(repository, account, "Sneaky Assassins Revealer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Archer", 0, 0); + addAccountTransaction(repository, account, "Super Spleef Brawler", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Blaster", 0, 0); + addAccountTransaction(repository, account, "Squid Shooter Squid Sniper", 0, 0); + addAccountTransaction(repository, account, "Survival Games Archer", 0, 0); + addAccountTransaction(repository, account, "Survival Games Assassin", 0, 0); + addAccountTransaction(repository, account, "Survival Games Beastmaster", 0, 0); + addAccountTransaction(repository, account, "Survival Games Bomber", 0, 0); + addAccountTransaction(repository, account, "Survival Games Brawler", 0, 0); + addAccountTransaction(repository, account, "Survival Games Necromancer", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Infiltrator", 0, 0); + addAccountTransaction(repository, account, "Turf Wars Shredder", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Archer", 0, 0); + addAccountTransaction(repository, account, "Zombie Survival Survivor Rogue", 0, 0); + } + + repository.CommitChanges(); + transaction.Complete(); + } _logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString()); } diff --git a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml index f6af927bc..618741760 100644 --- a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml +++ b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml @@ -614,7 +614,7 @@ - + @@ -622,7 +622,7 @@ - + @@ -692,9 +692,9 @@ - + - + diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 04d379ca9..ccd7b71e7 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ