3
0

Rollback to the state of .152 build with some critical fixes and updates

This commit is contained in:
Sergey Shatunov
2016-01-04 12:38:37 +07:00
parent 40c95e49c0
commit f722fccdce
38 changed files with 406 additions and 1452 deletions

View File

@ -105,13 +105,13 @@ public class KCauldron {
private static boolean sLegacy, sOfficial;
public static boolean isLegacy() {
parseManifest();
return sLegacy;
parseManifest();
return sLegacy;
}
public static boolean isOfficial() {
parseManifest();
return sOfficial;
parseManifest();
return sOfficial;
}
public static File sNewServerLocation;

View File

@ -20,6 +20,7 @@ import kcauldron.updater.KVersionRetriever;
import net.minecraft.entity.Entity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.NextTickListEntry;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
@ -129,22 +130,22 @@ public class KCauldronCommand extends Command {
world.provider.getDimensionName(), world.dimension));
writer.write("Current tick: " + world.worldInfo.getWorldTotalTime() + "\n");
writer.write("\nEntities: ");
writer.write("count - " + world.loadedEntityList_KC.size() + "\n");
for (Entity entity : world.loadedEntityList_KC) {
writer.write("count - " + world.loadedEntityList.size() + "\n");
for (Entity entity : (Iterable<Entity>) world.loadedEntityList) {
writer.write(String.format(" %s at (%.4f;%.4f;%.4f)\n", entity.getClass().getName(),
entity.posX, entity.posY, entity.posZ));
}
writer.write("\nTileEntities: ");
writer.write("count - " + world.loadedTileEntityList_KC.size() + "\n");
for (TileEntity entity : world.loadedTileEntityList_KC) {
writer.write("count - " + world.loadedTileEntityList.size() + "\n");
for (TileEntity entity : (Iterable<TileEntity>) world.loadedTileEntityList) {
writer.write(String.format(" %s at (%d;%d;%d)\n", entity.getClass().getName(), entity.xCoord,
entity.yCoord, entity.zCoord));
}
writer.write("\nLoaded chunks: ");
writer.write("count - " + world.activeChunkSet_CB.size() + "\n");
for (long chunkKey : world.activeChunkSet_CB.keys()) {
final int x = WorldServer.keyToX(chunkKey);
final int z = WorldServer.keyToZ(chunkKey);
writer.write("count - " + world.activeChunkSet.size() + "\n");
for (ChunkCoordIntPair chunkCoords : (Iterable<ChunkCoordIntPair>) world.activeChunkSet) {
final int x = chunkCoords.chunkXPos;
final int z = chunkCoords.chunkZPos;
Chunk chunk = world.chunkProvider.provideChunk(x, z);
if (chunk == null)
continue;

View File

@ -1,57 +0,0 @@
package kcauldron;
import org.bukkit.craftbukkit.SpigotTimings;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.MinecraftException;
public class KCauldronWorldSaveThread extends Thread {
private final MinecraftServer mServer;
private int mLastSaveTick = -1;
private int mNextSaveTick = -1;
public KCauldronWorldSaveThread(MinecraftServer server) {
super(KCauldron.sKCauldronThreadGroup, "KCauldron World Save");
mServer = server;
setPriority(Thread.MIN_PRIORITY);
setDaemon(true);
}
@Override
public void run() {
KLog.get().info("Starting KCauldron World Saver thread...");
try {
while (!isInterrupted()) {
if (mLastSaveTick < 0) {
mLastSaveTick = mServer.tickCounter;
}
mNextSaveTick = mLastSaveTick + mServer.autosavePeriod;
while (mNextSaveTick > mServer.tickCounter) {
try {
sleep((mNextSaveTick - mServer.tickCounter) * 50);
} catch (InterruptedException e) {
return;
}
}
SpigotTimings.worldSaveTimer.startTiming();
try {
mServer.serverConfigManager.saveAllPlayerData();
mServer.saveAllWorlds(true);
} catch (MinecraftException e) {
new RuntimeException("Error occurred during save world", e).printStackTrace();
}
SpigotTimings.worldSaveTimer.stopTiming();
mLastSaveTick = mServer.tickCounter;
}
} finally {
KLog.get().info("Stopping KCauldron World Saver thread...");
}
}
public void stopServer() {
interrupt();
while(isAlive()) {
Thread.yield();
}
}
}

View File

@ -21,12 +21,12 @@ public class DefaultUpdateCallback implements IVersionCheckCallback {
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (hasPermission(player)) {
if (KCauldron.isLegacy()) {
player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on KCauldron, please update your version");
}
if (!KCauldron.isOfficial()) {
player.sendMessage(ChatColor.YELLOW + "We're running on non-official version on KCauldron, please update your version");
}
if (KCauldron.isLegacy()) {
player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on KCauldron, please update your version");
}
if (!KCauldron.isOfficial()) {
player.sendMessage(ChatColor.YELLOW + "We're running on non-official version on KCauldron, please update your version");
}
if (mHasUpdate) {
sendUpdate(player);
}

View File

@ -1,81 +0,0 @@
package kcauldron.wrapper;
import java.util.Collection;
import java.util.Iterator;
public class CollectionWrapper<T, C extends Collection<T>> implements Collection<T> {
protected C mCollection;
public CollectionWrapper(C collection) {
mCollection = collection;
}
@Override
public boolean add(T e) {
return mCollection.add(e);
}
@Override
public boolean addAll(Collection<? extends T> c) {
return mCollection.addAll(c);
}
@Override
public void clear() {
mCollection.clear();
}
@Override
public boolean contains(Object o) {
return mCollection.contains(o);
}
@Override
public boolean containsAll(Collection<?> c) {
return mCollection.containsAll(c);
}
@Override
public boolean isEmpty() {
return mCollection.isEmpty();
}
@Override
public Iterator<T> iterator() {
return mCollection.iterator();
}
@Override
public boolean remove(Object o) {
return mCollection.remove(o);
}
@Override
public boolean removeAll(Collection<?> c) {
return mCollection.removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return mCollection.retainAll(c);
}
@Override
public int size() {
return mCollection.size();
}
@Override
public Object[] toArray() {
return mCollection.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return mCollection.toArray(a);
}
public C unwrap() {
return mCollection;
}
}

View File

@ -1,153 +0,0 @@
package kcauldron.wrapper;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import cpw.mods.fml.common.FMLLog;
public class LinkedHelper<T> {
private final Iterable<T> mIterable;
private volatile Iterator<T> mIndexIterator;
private volatile int mIndex;
private volatile T mIndexValue;
public LinkedHelper(Iterable<T> iterable) {
mIterable = iterable;
}
public synchronized T get(int index) {
if (mIndexIterator == null || mIndex > index) {
mIndexIterator = mIterable.iterator();
mIndex = -1;
}
if (mIndex == index) return mIndexValue;
T value = null;
while (mIndex < index && mIndexIterator.hasNext()) {
value = mIndexIterator.next();
mIndex++;
}
if (mIndex < index) {
mIndexIterator = mIterable.iterator();
mIndex = -1;
while (mIndex < index && mIndexIterator.hasNext()) {
value = mIndexIterator.next();
mIndex++;
}
}
if (mIndex < index) {
FMLLog.bigWarning("LinkedHelper desync, report this to KCauldron tracker!");
}
return mIndexValue = value;
}
public int indexOf(Object o) {
int i = 0;
for (T value : mIterable) {
if (o == null ? value == null : o.equals(value))
return i;
i++;
}
return -1;
}
public int lastIndexOf(Object o) {
if (!(mIterable instanceof List)) {
throw new UnsupportedOperationException();
}
ListIterator<T> iterator = ((List<T>) mIterable).listIterator();
int i = 0;
while (iterator.hasPrevious()) {
T value = iterator.previous();
if (o == null ? value == null : o.equals(value))
return i;
i++;
}
return -1;
}
public ListIterator<T> listIterator() {
if (mIterable instanceof List) {
return ((List<T>) mIterable).listIterator();
}
return new LinkedListIterator<T>(mIterable.iterator(), 0);
}
public ListIterator<T> listIterator(int index) {
if (mIterable instanceof List) {
return ((List<T>) mIterable).listIterator(index);
}
Iterator<T> iterator = mIterable.iterator();
for (int i = 0; i < index; i++)
iterator.next();
return new LinkedListIterator<T>(iterator, index);
}
private static final class LinkedListIterator<T> implements ListIterator<T> {
private final Iterator<T> mIterator;
private final ListIterator<T> mListIterator;
private int mNextIndex;
public LinkedListIterator(Iterator<T> iterator, int index) {
mIterator = iterator;
mListIterator = iterator instanceof ListIterator ? (ListIterator<T>) iterator : null;
mNextIndex = index;
}
private void ensureListIterator() {
if (mListIterator == null)
throw new UnsupportedOperationException();
}
@Override
public void add(T e) {
ensureListIterator();
mListIterator.add(e);
}
@Override
public boolean hasNext() {
return mIterator.hasNext();
}
@Override
public boolean hasPrevious() {
ensureListIterator();
return mListIterator.hasPrevious();
}
@Override
public T next() {
mNextIndex++;
return mIterator.next();
}
@Override
public int nextIndex() {
return mListIterator != null ? mListIterator.nextIndex() : mNextIndex;
}
@Override
public T previous() {
ensureListIterator();
return mListIterator.previous();
}
@Override
public int previousIndex() {
ensureListIterator();
return mListIterator.previousIndex();
}
@Override
public void remove() {
mIterator.remove();
}
@Override
public void set(T e) {
ensureListIterator();
mListIterator.set(e);
}
}
}

View File

@ -1,124 +0,0 @@
package kcauldron.wrapper;
import java.util.Collection;
import java.util.Iterator;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;
public class ProcessingQueue<T> extends QueueWrapper<T> {
public class ProcessingIterator implements Iterator<T> {
private Iterator<T> mRealIterator = mCollection.iterator();
@Override
public boolean hasNext() {
return mRealIterator.hasNext();
}
@Override
public T next() {
return mRealIterator.next();
}
@Override
public void remove() {
mRealIterator.remove();
mSize.decrementAndGet();
}
}
private final AtomicInteger mSize;
@Override
public boolean add(T e) {
boolean result = super.add(e);
if (result) {
mSize.incrementAndGet();
}
return result;
};
@Override
public boolean offer(T e) {
boolean result = super.offer(e);
if (result) {
mSize.incrementAndGet();
}
return result;
}
@Override
public boolean addAll(Collection<? extends T> c) {
boolean result = false;
for (T t : c) {
result |= add(t);
}
return result;
}
@Override
public T remove() {
T result = super.remove();
mSize.decrementAndGet();
return result;
}
@Override
public boolean remove(Object o) {
boolean result = super.remove(o);
if (result) {
mSize.decrementAndGet();
}
return result;
}
@Override
public boolean removeAll(Collection<?> c) {
boolean result = false;
for (Object t : c) {
result |= remove(t);
}
return result;
}
@Override
public boolean retainAll(Collection<?> c) {
boolean result = super.retainAll(c);
if (result) {
mSize.set(mCollection.size());
}
return result;
}
@Override
public T poll() {
T result = super.remove();
if (result != null) {
mSize.decrementAndGet();
}
return result;
}
public ProcessingQueue(Queue<T> collection) {
super(collection);
mSize = new AtomicInteger(collection.size());
}
@Override
public ProcessingIterator iterator() {
return new ProcessingIterator();
}
@Override
public String toString() {
if (size() == 0)
return "[]";
StringBuilder builder = new StringBuilder();
for (T t : this) {
builder.append(',');
builder.append(t == null ? "null" : t.getClass().getSimpleName());
}
builder.setCharAt(0, '[');
builder.append(']');
return builder.toString();
}
}

View File

@ -1,68 +0,0 @@
package kcauldron.wrapper;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import java.util.Queue;
public class QueueToList<T> extends CollectionWrapper<T, Queue<T>> implements List<T> {
private final Queue<T> mQueue;
private final LinkedHelper<T> mHelper;
public QueueToList(Queue<T> queue) {
super(queue);
mQueue = queue;
mHelper = new LinkedHelper<T>(mQueue);
}
@Override
public void add(int index, T element) {
throw new UnsupportedOperationException();
}
@Override
public boolean addAll(int index, Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
@Override
public T get(int index) {
return mHelper.get(index);
}
@Override
public int indexOf(Object o) {
return mHelper.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
return mHelper.lastIndexOf(o);
}
@Override
public ListIterator<T> listIterator() {
return mHelper.listIterator();
}
@Override
public ListIterator<T> listIterator(int index) {
return mHelper.listIterator(index);
}
@Override
public T remove(int index) {
T object = mHelper.get(index);
return mQueue.remove(object) ? object : null;
}
@Override
public T set(int index, T element) {
throw new UnsupportedOperationException();
}
@Override
public List<T> subList(int fromIndex, int toIndex) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,34 +0,0 @@
package kcauldron.wrapper;
import java.util.Queue;
public class QueueWrapper<T> extends CollectionWrapper<T, Queue<T>> implements Queue<T>{
public QueueWrapper(Queue<T> collection) {
super(collection);
}
@Override
public T element() {
return mCollection.element();
}
@Override
public boolean offer(T e) {
return mCollection.offer(e);
}
@Override
public T peek() {
return mCollection.peek();
}
@Override
public T poll() {
return mCollection.poll();
}
@Override
public T remove() {
return mCollection.remove();
}
}

View File

@ -334,15 +334,16 @@ public class CauldronHooks
writer.name("players").value(world.playerEntities.size());
writer.name("loadedChunks").value(world.theChunkProviderServer.loadedChunkHashMap_KC.size());
writer.name("activeChunks").value(world.activeChunkSet.size());
writer.name("entities").value(world.loadedEntityList_KC.size());
writer.name("tiles").value(world.loadedTileEntityList_KC.size());
writer.name("entities").value(world.loadedEntityList.size());
writer.name("tiles").value(world.loadedTileEntityList.size());
TObjectIntHashMap<ChunkCoordIntPair> chunkEntityCounts = new TObjectIntHashMap<ChunkCoordIntPair>();
TObjectIntHashMap<Class> classEntityCounts = new TObjectIntHashMap<Class>();
TObjectIntHashMap<Entity> entityCollisionCounts = new TObjectIntHashMap<Entity>();
Set<ChunkCoordinates> collidingCoords = new HashSet<ChunkCoordinates>();
for (Entity entity : world.loadedEntityList_KC)
for (int i = 0; i < world.loadedEntityList.size(); i++)
{
Entity entity = (Entity) world.loadedEntityList.get(i);
ChunkCoordIntPair chunkCoords = new ChunkCoordIntPair((int) entity.posX >> 4, (int) entity.posZ >> 4);
chunkEntityCounts.adjustOrPutValue(chunkCoords, 1, 1);
classEntityCounts.adjustOrPutValue(entity.getClass(), 1, 1);
@ -365,8 +366,9 @@ public class CauldronHooks
TObjectIntHashMap<ChunkCoordIntPair> chunkTileCounts = new TObjectIntHashMap<ChunkCoordIntPair>();
TObjectIntHashMap<Class> classTileCounts = new TObjectIntHashMap<Class>();
writer.name("tiles").beginArray();
for (TileEntity tile : world.loadedTileEntityList_KC)
for (int i = 0; i < world.loadedTileEntityList.size(); i++)
{
TileEntity tile = (TileEntity) world.loadedTileEntityList.get(i);
if (logAll)
{
writer.beginObject();

View File

@ -7,8 +7,6 @@ import java.util.Date;
import java.util.List;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.cauldron.CauldronHooks;
import net.minecraftforge.cauldron.configuration.BoolSetting;
import net.minecraftforge.cauldron.configuration.IntSetting;
@ -114,11 +112,13 @@ public class CauldronCommand extends Command
sender.sendMessage(ChatColor.GOLD + "Dimension: " + ChatColor.GRAY + world.provider.dimensionId +
ChatColor.GOLD + " Loaded Chunks: " + ChatColor.GRAY + world.theChunkProviderServer.loadedChunkHashMap_KC.size() +
ChatColor.GOLD + " Active Chunks: " + ChatColor.GRAY + world.activeChunkSet.size() +
ChatColor.GOLD + " Entities: " + ChatColor.GRAY + world.loadedEntityList_KC.size() +
ChatColor.GOLD + " Tile Entities: " + ChatColor.GRAY + world.loadedTileEntityList_KC.size()
ChatColor.GOLD + " Entities: " + ChatColor.GRAY + world.loadedEntityList.size() +
ChatColor.GOLD + " Tile Entities: " + ChatColor.GRAY + world.loadedTileEntityList.size()
);
sender.sendMessage(ChatColor.GOLD + " Entities Last Tick: " + ChatColor.GRAY + world.entitiesTicked +
ChatColor.GOLD + " Tiles Last Tick: " + ChatColor.GRAY + world.tilesTicked
ChatColor.GOLD + " Tiles Last Tick: " + ChatColor.GRAY + world.tilesTicked +
ChatColor.GOLD + " Removed Entities: " + ChatColor.GRAY + world.unloadedEntityList.size() +
ChatColor.GOLD + " Removed Tile Entities: " + ChatColor.GRAY + world.field_147483_b.size()
);
}

View File

@ -263,7 +263,6 @@ public final class CraftServer implements Server {
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
ambientSpawn = configuration.getInt("spawn-limits.ambient");
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
console.invalidateWorldSaver();
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
loadIcon();
chunkGCEnabled = configuration.getBoolean("chunk-gc.enabled"); // Cauldron
@ -671,7 +670,7 @@ public final class CraftServer implements Server {
@Override
public List<World> getWorlds() {
return ImmutableList.copyOf(worlds.values());
return new ArrayList<World>(worlds.values());
}
public DedicatedPlayerList getHandle() {
@ -765,7 +764,6 @@ public final class CraftServer implements Server {
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
printSaveWarning = false;
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
console.invalidateWorldSaver();
chunkGCPeriod = configuration.getInt("chunk-gc.period-in-ticks");
chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold");
loadIcon();
@ -1152,7 +1150,7 @@ public final class CraftServer implements Server {
@Override
public Map<String, String[]> getCommandAliases() {
ConfigurationSection section = commandsConfiguration.getConfigurationSection("aliases");
ConfigurationSection section = configuration.getConfigurationSection("aliases");
Map<String, String[]> result = new LinkedHashMap<String, String[]>();
if (section != null) {

View File

@ -683,16 +683,16 @@ public class CraftWorld implements World {
public List<Entity> getEntities() {
List<Entity> list = new ArrayList<Entity>();
for (net.minecraft.entity.Entity mcEnt : world.loadedEntityList_KC) {
//if (o instanceof net.minecraft.entity.Entity) {
//net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
for (Object o : world.loadedEntityList) {
if (o instanceof net.minecraft.entity.Entity) {
net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null) {
list.add(bukkitEntity);
}
//}
}
}
return list;
@ -701,16 +701,16 @@ public class CraftWorld implements World {
public List<LivingEntity> getLivingEntities() {
List<LivingEntity> list = new ArrayList<LivingEntity>();
for (net.minecraft.entity.Entity mcEnt : world.loadedEntityList_KC) {
//if (o instanceof net.minecraft.entity.Entity) {
//net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
for (Object o : world.loadedEntityList) {
if (o instanceof net.minecraft.entity.Entity) {
net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) {
list.add((LivingEntity) bukkitEntity);
}
//}
}
}
return list;
@ -726,9 +726,9 @@ public class CraftWorld implements World {
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> clazz) {
Collection<T> list = new ArrayList<T>();
for (net.minecraft.entity.Entity entity : world.loadedEntityList_KC) {
//if (entity instanceof net.minecraft.entity.Entity) {
Entity bukkitEntity = entity.getBukkitEntity();
for (Object entity: world.loadedEntityList) {
if (entity instanceof net.minecraft.entity.Entity) {
Entity bukkitEntity = ((net.minecraft.entity.Entity) entity).getBukkitEntity();
if (bukkitEntity == null) {
continue;
@ -739,7 +739,7 @@ public class CraftWorld implements World {
if (clazz.isAssignableFrom(bukkitClass)) {
list.add((T) bukkitEntity);
}
//}
}
}
return list;
@ -748,9 +748,9 @@ public class CraftWorld implements World {
public Collection<Entity> getEntitiesByClasses(Class<?>... classes) {
Collection<Entity> list = new ArrayList<Entity>();
for (net.minecraft.entity.Entity entity: world.loadedEntityList_KC) {
//if (entity instanceof net.minecraft.entity.Entity) {
Entity bukkitEntity = entity.getBukkitEntity();
for (Object entity: world.loadedEntityList) {
if (entity instanceof net.minecraft.entity.Entity) {
Entity bukkitEntity = ((net.minecraft.entity.Entity) entity).getBukkitEntity();
if (bukkitEntity == null) {
continue;
@ -764,7 +764,7 @@ public class CraftWorld implements World {
break;
}
}
//}
}
}
return list;
@ -773,15 +773,15 @@ public class CraftWorld implements World {
public List<Player> getPlayers() {
List<Player> list = new ArrayList<Player>();
for (net.minecraft.entity.Entity mcEnt : world.loadedEntityList_KC) {
//if (o instanceof net.minecraft.entity.Entity) {
//net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
for (Object o : world.loadedEntityList) {
if (o instanceof net.minecraft.entity.Entity) {
net.minecraft.entity.Entity mcEnt = (net.minecraft.entity.Entity) o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) {
list.add((Player) bukkitEntity);
}
//}
}
}
return list;

View File

@ -136,8 +136,6 @@ public class SpigotTimings {
public final CustomTimingsHandler tracker;
public final CustomTimingsHandler doTick;
public final CustomTimingsHandler tickEntities;
public final CustomTimingsHandler weatherUpdate;
public final CustomTimingsHandler cleanupCache;
public final CustomTimingsHandler syncChunkLoadTimer;
public final CustomTimingsHandler syncChunkLoadDataTimer;
@ -175,8 +173,6 @@ public class SpigotTimings {
tracker = new CustomTimingsHandler(name + "tracker");
doTick = new CustomTimingsHandler(name + "doTick");
tickEntities = new CustomTimingsHandler(name + "tickEntities");
weatherUpdate = new CustomTimingsHandler(name + "weatherUpdate");
cleanupCache = new CustomTimingsHandler(name + "cleanupCache");
}
}
}

View File

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.MapMaker;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

View File

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

View File

@ -1,18 +0,0 @@
package org.spigotmc;
import gnu.trove.strategy.HashingStrategy;
class CaseInsensitiveHashingStrategy implements HashingStrategy<String> {
private static final long serialVersionUID = -9212222772914758878L;
static final CaseInsensitiveHashingStrategy INSTANCE = new CaseInsensitiveHashingStrategy();
@Override
public int computeHashCode(String object) {
return object.toLowerCase().hashCode();
}
@Override
public boolean equals(String o1, String o2) {
return o1.equalsIgnoreCase(o2);
}
}

View File

@ -1,15 +0,0 @@
package org.spigotmc;
import gnu.trove.map.hash.TCustomHashMap;
import java.util.Map;
public class CaseInsensitiveMap<V> extends TCustomHashMap<String, V> {
public CaseInsensitiveMap() {
super(CaseInsensitiveHashingStrategy.INSTANCE);
}
public CaseInsensitiveMap(Map<? extends String, ? extends V> map) {
super(CaseInsensitiveHashingStrategy.INSTANCE, map);
}
}

View File

@ -90,7 +90,7 @@ public class WatchdogThread extends Thread
log.log(Level.SEVERE, " Dimension:" + world.provider.dimensionId);
log.log(Level.SEVERE,
" Loaded Chunks: " + world.theChunkProviderServer.loadedChunkHashMap_KC.size() + " Active Chunks: " + world.activeChunkSet.size()
+ " Entities: " + world.loadedEntityList_KC.size() + " Tile Entities: " + world.loadedTileEntityList_KC.size());
+ " Entities: " + world.loadedEntityList.size() + " Tile Entities: " + world.loadedTileEntityList.size());
log.log(Level.SEVERE, " Entities Last Tick: " + world.entitiesTicked);
log.log(Level.SEVERE, " Tiles Last Tick: " + world.tilesTicked);
}
@ -155,8 +155,8 @@ public class WatchdogThread extends Thread
log.log(Level.WARNING, " Dimension:" + world.provider.dimensionId);
log.log(Level.WARNING, " Loaded Chunks: " + world.theChunkProviderServer.loadedChunkHashMap_KC.size() +
" Active Chunks: " + world.activeChunkSet.size() +
" Entities: " + world.loadedEntityList_KC.size() +
" Tile Entities: " + world.loadedTileEntityList_KC.size());
" Entities: " + world.loadedEntityList.size() +
" Tile Entities: " + world.loadedTileEntityList.size());
log.log(Level.WARNING, " Entities Last Tick: " + world.entitiesTicked);
log.log(Level.WARNING, " Tiles Last Tick: " + world.tilesTicked);
}