Added TimeUtil.java

Removed double gems.

Removed extra world uninitialize.

Changed AccountAdministrator to use UUID.
This commit is contained in:
Jonathan Williams 2014-05-13 22:13:48 -05:00
parent 12041b0d72
commit 6af5d9205b
7 changed files with 47 additions and 14 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ update
Reference
/Plugins/Test
src

Binary file not shown.

View File

@ -182,18 +182,6 @@ public class MapUtil
entity.remove();
}
for (Object entity : ((CraftWorld) world).getHandle().entityList)
{
if (entity instanceof net.minecraft.server.v1_7_R3.Entity)
{
((net.minecraft.server.v1_7_R3.Entity) entity).dead = true;
((net.minecraft.server.v1_7_R3.Entity) entity).valid = false;
((net.minecraft.server.v1_7_R3.Entity) entity).world = null;
}
}
((CraftWorld) world).getHandle().entityList.clear();
CraftServer server = (CraftServer) plugin.getServer();
CraftWorld craftWorld = (CraftWorld) world;

View File

@ -0,0 +1,44 @@
package mineplex.core.common.util;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
public class TimeUtil
{
private static List<Entry<String, Long>> _timingList = new ArrayList<Entry<String, Long>>();
private static Object _timingLock = new Object();
public static void start(String title)
{
synchronized(_timingLock)
{
_timingList.add(new AbstractMap.SimpleEntry<String, Long>(title, System.currentTimeMillis()));
}
}
public static void stop(String title)
{
synchronized(_timingLock)
{
Collections.reverse(_timingList);
for (Iterator<Entry<String, Long>> iterator = _timingList.iterator(); iterator.hasNext();)
{
Entry<String, Long> entry = iterator.next();
if (entry.getKey().equalsIgnoreCase(title))
{
System.out.println(title + " took " + (System.currentTimeMillis() - entry.getValue()) + "ms");
iterator.remove();
break;
}
}
Collections.reverse(_timingList);
}
}
}

View File

@ -30,7 +30,7 @@ public class GameGemManager implements Listener
{
ArcadeManager Manager;
boolean DoubleGem = true;
boolean DoubleGem = false;
public GameGemManager(ArcadeManager manager)
{

View File

@ -67,7 +67,7 @@
{
using (var repository = _repositoryFactory.CreateRepository())
{
var account = repository.Where<Account>(x => x.Name == loginToken.Name).FirstOrDefault() ?? CreateAccount(loginToken, repository);
var account = repository.Where<Account>(x => x.Uuid == loginToken.Uuid).FirstOrDefault() ?? CreateAccount(loginToken, repository);
account.LoadNavigationProperties(repository.Context);
var edited = false;

Binary file not shown.