1
0
forked from xjboss/KCauldronX

Some portion of optimizations:

* Clear outgoing packet queue after player disconnect
* Disable sleep between chunk saving
* Put 2x4096 bytes instead 2048x4 bytes for region file aligment
* Using map to search player by name instead iterating over all players
* Some tweaks for decorations (item frames, maps)
This commit is contained in:
Prototik
2015-10-18 23:58:28 +07:00
parent 299cf0ed96
commit 7defe0bb29
17 changed files with 225 additions and 41 deletions

View File

@ -1,6 +1,9 @@
package org.bukkit.craftbukkit.map;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.map.MapCanvas;
@ -8,6 +11,8 @@ import org.bukkit.map.MapCursorCollection;
import org.bukkit.map.MapRenderer;
import org.bukkit.map.MapView;
import net.minecraft.world.storage.MapData;
public class CraftMapRenderer extends MapRenderer {
private final net.minecraft.world.storage.MapData worldMap;
@ -32,14 +37,14 @@ public class CraftMapRenderer extends MapRenderer {
cursors.removeCursor(cursors.getCursor(0));
}
for (Object key : worldMap.playersVisibleOnMap.keySet()) {
for (Map.Entry<UUID, MapData.MapCoord> key : worldMap.playersVisibleOnMap.entrySet()) {
// If this cursor is for a player check visibility with vanish system
Player other = Bukkit.getPlayerExact((String) key);
Player other = Bukkit.getPlayer(key.getKey());
if (other != null && !player.canSee(other)) {
continue;
}
net.minecraft.world.storage.MapData.MapCoord decoration = (net.minecraft.world.storage.MapData.MapCoord) worldMap.playersVisibleOnMap.get(key);
MapData.MapCoord decoration = key.getValue();
cursors.addCursor(decoration.centerX, decoration.centerZ, (byte) (decoration.iconRotation & 15), decoration.iconSize);
}
}