@@ -0,0 +1,2340 @@
+/*%0A * Copyright (c) 2016 MCPhoton %3Chttp://mcphoton.org%3E and contributors.%0A *%0A * This file is part of the Photon Server Implementation %3Chttps://github.com/mcphoton/Photon-Server%3E.%0A *%0A * The Photon Server Implementation is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * The Photon Server Implementation is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program. If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage org.mcphoton.impl.world;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport org.mcphoton.world.ChunkColumn;%0Aimport org.mcphoton.world.ChunkSection;%0Aimport org.mcphoton.world.World;%0A%0A/**%0A * A thread-safe implementation of ChunkColumn.%0A *%0A * @author TheElectronWill%0A */%0Apublic class SafeChunkColumn implements ChunkColumn %7B%0A%0A%09private final int x, z;%0A%09private final World world;%0A%09private final byte%5B%5D biomesData;%0A%09private final ChunkSection%5B%5D sections;%0A%09private final Collection%3CChunkSection%3E unmodifiableCollection;%0A%0A%09public SafeChunkColumn(int x, int z, World world) %7B%0A%09%09this(x, z, world, new ChunkSection%5B16%5D, new byte%5B256%5D);%0A%09%7D%0A%0A%09public SafeChunkColumn(int x, int z, World world, ChunkSection%5B%5D sections, byte%5B%5D biomesData) %7B%0A%09%09this.x = x;%0A%09%09this.z = z;%0A%09%09this.world = world;%0A%09%09this.sections = sections;%0A%09%09unmodifiableCollection = Collections.unmodifiableList(Arrays.asList(sections));%0A%09%09this.biomesData = biomesData;%0A%09%7D%0A%0A%09@Override%0A%09public int getX() %7B%0A%09%09return x;%0A%09%7D%0A%0A%09@Override%0A%09public int getZ() %7B%0A%09%09return z;%0A%09%7D%0A%0A%09@Override%0A%09public World getWorld() %7B%0A%09%09return world;%0A%09%7D%0A%0A%09@Override%0A%09public Collection%3CChunkSection%3E getSections() %7B%0A%09%09return unmodifiableCollection;%0A%09%7D%0A%0A%09@Override%0A%09public synchronized int getBiomeId(int x, int z) %7B%0A%09%09return biomesData%5Bz %3C%3C 4 %7C x%5D;%0A%09%7D%0A%0A%09@Override%0A%09public synchronized void setBiomeId(int x, int z, int biomeId) %7B%0A%09%09biomesData%5Bz %3C%3C 4 %7C x%5D = (byte) biomeId;%0A%09%7D%0A%0A%7D%0A

Implement ChunkColumn