Perf: Visualizations
This commit is contained in:
parent
8efe087a16
commit
b9ffd917e8
|
|
@ -55,36 +55,35 @@ public class Visualization
|
|||
//reverts a visualization by sending another block change list, this time with the real world block values
|
||||
public static void Revert(Player player)
|
||||
{
|
||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
if(!player.isOnline()) return;
|
||||
|
||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
|
||||
Visualization visualization = playerData.currentVisualization;
|
||||
|
||||
if(playerData.currentVisualization != null)
|
||||
{
|
||||
if(player.isOnline())
|
||||
{
|
||||
//locality
|
||||
int minx = player.getLocation().getBlockX() - 100;
|
||||
int minz = player.getLocation().getBlockZ() - 100;
|
||||
int maxx = player.getLocation().getBlockX() + 100;
|
||||
int maxz = player.getLocation().getBlockZ() + 100;
|
||||
|
||||
//remove any elements which are too far away
|
||||
visualization.removeElementsOutOfRange(visualization.elements, minx, minz, maxx, maxz);
|
||||
//locality
|
||||
int minx = player.getLocation().getBlockX() - 100;
|
||||
int minz = player.getLocation().getBlockZ() - 100;
|
||||
int maxx = player.getLocation().getBlockX() + 100;
|
||||
int maxz = player.getLocation().getBlockZ() + 100;
|
||||
|
||||
//remove any elements which are too far away
|
||||
visualization.removeElementsOutOfRange(visualization.elements, minx, minz, maxx, maxz);
|
||||
|
||||
//send real block information for any remaining elements
|
||||
for(int i = 0; i < visualization.elements.size(); i++)
|
||||
{
|
||||
VisualizationElement element = visualization.elements.get(i);
|
||||
|
||||
//send real block information for any remaining elements
|
||||
for(int i = 0; i < visualization.elements.size(); i++)
|
||||
{
|
||||
VisualizationElement element = visualization.elements.get(i);
|
||||
|
||||
//check player still in world where visualization exists
|
||||
if(i == 0)
|
||||
{
|
||||
if(!player.getWorld().equals(element.location.getWorld())) return;
|
||||
}
|
||||
|
||||
player.sendBlockChange(element.location, element.realMaterial, element.realData);
|
||||
}
|
||||
//check player still in world where visualization exists
|
||||
if(i == 0)
|
||||
{
|
||||
if(!player.getWorld().equals(element.location.getWorld())) return;
|
||||
}
|
||||
|
||||
player.sendBlockChange(element.location, element.realMaterial, element.realData);
|
||||
}
|
||||
|
||||
playerData.currentVisualization = null;
|
||||
|
|
@ -180,7 +179,7 @@ public class Visualization
|
|||
int maxx = locality.getBlockX() + 100;
|
||||
int maxz = locality.getBlockZ() + 100;
|
||||
|
||||
final int STEP = 5;
|
||||
final int STEP = 10;
|
||||
|
||||
//top line
|
||||
for(int x = smallx + STEP; x < bigx - STEP / 2; x += STEP)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user