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
|
//reverts a visualization by sending another block change list, this time with the real world block values
|
||||||
public static void Revert(Player player)
|
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;
|
Visualization visualization = playerData.currentVisualization;
|
||||||
|
|
||||||
if(playerData.currentVisualization != null)
|
if(playerData.currentVisualization != null)
|
||||||
{
|
{
|
||||||
if(player.isOnline())
|
//locality
|
||||||
{
|
int minx = player.getLocation().getBlockX() - 100;
|
||||||
//locality
|
int minz = player.getLocation().getBlockZ() - 100;
|
||||||
int minx = player.getLocation().getBlockX() - 100;
|
int maxx = player.getLocation().getBlockX() + 100;
|
||||||
int minz = player.getLocation().getBlockZ() - 100;
|
int maxz = 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);
|
||||||
//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
|
//check player still in world where visualization exists
|
||||||
for(int i = 0; i < visualization.elements.size(); i++)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
VisualizationElement element = visualization.elements.get(i);
|
if(!player.getWorld().equals(element.location.getWorld())) return;
|
||||||
|
}
|
||||||
//check player still in world where visualization exists
|
|
||||||
if(i == 0)
|
player.sendBlockChange(element.location, element.realMaterial, element.realData);
|
||||||
{
|
|
||||||
if(!player.getWorld().equals(element.location.getWorld())) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendBlockChange(element.location, element.realMaterial, element.realData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
playerData.currentVisualization = null;
|
playerData.currentVisualization = null;
|
||||||
|
|
@ -180,7 +179,7 @@ public class Visualization
|
||||||
int maxx = locality.getBlockX() + 100;
|
int maxx = locality.getBlockX() + 100;
|
||||||
int maxz = locality.getBlockZ() + 100;
|
int maxz = locality.getBlockZ() + 100;
|
||||||
|
|
||||||
final int STEP = 5;
|
final int STEP = 10;
|
||||||
|
|
||||||
//top line
|
//top line
|
||||||
for(int x = smallx + STEP; x < bigx - STEP / 2; x += STEP)
|
for(int x = smallx + STEP; x < bigx - STEP / 2; x += STEP)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user