mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Playing the memory reduction game - lets reduce the use of "new".
This commit is contained in:
parent
6035f9e50b
commit
ee6b93e208
@ -91,21 +91,25 @@ public class TFM_RollbackManager
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<RollbackEntry> getEntriesAtLocation(Location location)
|
public static List<RollbackEntry> getEntriesAtLocation(final Location location)
|
||||||
{
|
{
|
||||||
location = location.clone();
|
final int testX = location.getBlockX();
|
||||||
|
final short testY = (short) location.getBlockY();
|
||||||
|
final int testZ = location.getBlockZ();
|
||||||
|
final String testWorldName = location.getWorld().getName();
|
||||||
|
|
||||||
List<RollbackEntry> entries = new ArrayList<RollbackEntry>();
|
List<RollbackEntry> entries = new ArrayList<RollbackEntry>();
|
||||||
for (String playername : PLAYER_HISTORY_MAP.keySet())
|
for (String playername : PLAYER_HISTORY_MAP.keySet())
|
||||||
{
|
{
|
||||||
for (RollbackEntry entry : PLAYER_HISTORY_MAP.get(playername))
|
for (RollbackEntry entry : PLAYER_HISTORY_MAP.get(playername))
|
||||||
{
|
{
|
||||||
if (entry.getLocation().equals(location))
|
if (testX == entry.x && testY == entry.y && testZ == entry.z && testWorldName.equals(entry.getWorldName()))
|
||||||
{
|
{
|
||||||
entries.add(0, entry);
|
entries.add(0, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +148,9 @@ public class TFM_RollbackManager
|
|||||||
// Use of primitives to decrease overhead
|
// Use of primitives to decrease overhead
|
||||||
private final String author;
|
private final String author;
|
||||||
private final String worldName;
|
private final String worldName;
|
||||||
private final int x;
|
public final int x;
|
||||||
private final short y;
|
public final short y;
|
||||||
private final int z;
|
public final int z;
|
||||||
private final short blockId;
|
private final short blockId;
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final boolean isBreak;
|
private final boolean isBreak;
|
||||||
@ -203,7 +207,7 @@ public class TFM_RollbackManager
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY()
|
public short getY()
|
||||||
{
|
{
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
@ -236,5 +240,10 @@ public class TFM_RollbackManager
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getWorldName()
|
||||||
|
{
|
||||||
|
return worldName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user