Removed the bedrock metadata system.

This commit is contained in:
Harrison Deng 2020-04-21 02:55:18 -05:00
parent d44b059457
commit 4fc824f94f
9 changed files with 0 additions and 235 deletions

View File

@ -1,46 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import java.util.List;
import org.bukkit.World;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
public class IslandBedrockMetadataHelper {
World world;
Plugin plugin;
public IslandBedrockMetadataHelper(Plugin owningPlugin, World world) {
this.world = world;
this.plugin = owningPlugin;
}
public void setIslandBedrockMetadata(int worldX, int worldZ, IslandFixedMetadata metadata) {
world.getBlockAt(worldX, 0, worldZ).setMetadata(metadata.getIslandMetadataType().toString(), metadata);
}
public void setIslandBedrockMetadataPack(int worldX, int worldZ, IslandMetadataPack pack) {
setIslandBedrockMetadata(worldX, worldZ, pack.mainBiomeMetadata);
setIslandBedrockMetadata(worldX, worldZ, pack.shoreBiomeMetadata);
setIslandBedrockMetadata(worldX, worldZ, pack.temperatureMetadata);
setIslandBedrockMetadata(worldX, worldZ, pack.islandTIUDMetadata);
setIslandBedrockMetadata(worldX, worldZ, pack.ownerMetadata);
}
/**
* Gets the metadata stored in the bedrock at the given coordinates.
* @param worldX The x coordinate of the world.
* @param worldZ The z coordinate of the world.
* @param type the type of island metadata to retrieve.
* @return the island bedrock metadata at that location.
*/
public IslandFixedMetadata getIslandBedrockMetadata(int worldX, int worldZ, IslandMetadataType type) {
List<MetadataValue> potential = world.getBlockAt(worldX, 0, worldZ).getMetadata(type.toString());
for (MetadataValue metadataValue : potential) {
if (metadataValue.getOwningPlugin().equals(plugin)) {
return (IslandFixedMetadata) metadataValue;
}
}
throw new IllegalArgumentException("No metadata was found for given type.");
}
}

View File

@ -1,13 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin;
public abstract class IslandFixedMetadata extends FixedMetadataValue {
public IslandFixedMetadata(Plugin owningPlugin, Object value) {
super(owningPlugin, value);
}
public abstract IslandMetadataType getIslandMetadataType();
}

View File

@ -1,20 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import org.bukkit.block.Biome;
import org.bukkit.plugin.Plugin;
public class IslandMainBiomeMetadata extends IslandFixedMetadata {
public IslandMainBiomeMetadata(Plugin owningPlugin, Biome value) {
super(owningPlugin, value);
}
public Biome getMainBiome() {
return (Biome) this.value();
}
@Override
public IslandMetadataType getIslandMetadataType() {
return IslandMetadataType.mainBiome;
}
}

View File

@ -1,58 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import java.util.UUID;
import org.bukkit.block.Biome;
import org.bukkit.plugin.Plugin;
public class IslandMetadataPack {
public IslandMainBiomeMetadata mainBiomeMetadata;
public IslandShoreBiomeMetadata shoreBiomeMetadata;
public IslandTemperatureMetadata temperatureMetadata;
public IslandTUIDMetadata islandTIUDMetadata;
public IslandOwnerMetadata ownerMetadata;
public void setMainBiome(Biome biome, Plugin owningPlugin) {
mainBiomeMetadata = new IslandMainBiomeMetadata(owningPlugin, biome);
}
public Biome getMainBiome() {
return mainBiomeMetadata.getMainBiome();
}
public void setShoreBiome(Biome biome, Plugin owningPlugin) {
shoreBiomeMetadata = new IslandShoreBiomeMetadata(owningPlugin, biome);
}
public Biome getShoreBiome() {
return shoreBiomeMetadata.getShoreBiome();
}
public void setTemperature(float temperature, Plugin owningPlugin) {
temperatureMetadata = new IslandTemperatureMetadata(owningPlugin, temperature);
}
public float getTemperature() {
return temperatureMetadata.getTemperature();
}
public void setTUID(String tiud, Plugin owningPlugin) {
islandTIUDMetadata = new IslandTUIDMetadata(owningPlugin, tiud);
}
public void setTUID(int worldX, int worldZ, Plugin owningPlugin) {
setTUID((String.valueOf(worldX) + String.valueOf(worldZ)), owningPlugin);
}
public String getTUID() {
return islandTIUDMetadata.getIUID();
}
public void setOwner(UUID uuid, Plugin owningPlugin) {
ownerMetadata = new IslandOwnerMetadata(owningPlugin, uuid);
}
public UUID getOwner() {
return ownerMetadata.getUUID();
}
}

View File

@ -1,19 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
public enum IslandMetadataType {
mainBiome("main_biome"),
shoreBiome("shore_biome"),
temperature("temperature"),
TIUD("temp_island_unique_id"),
ownerUUID("owner_UUID");
private String key;
private IslandMetadataType(String key) {
this.key = key;
}
@Override
public String toString() {
return this.key;
}
}

View File

@ -1,21 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import java.util.UUID;
import org.bukkit.plugin.Plugin;
public class IslandOwnerMetadata extends IslandFixedMetadata {
public IslandOwnerMetadata(Plugin owningPlugin, UUID value) {
super(owningPlugin, value);
}
public UUID getUUID() {
return (UUID) this.value();
}
@Override
public IslandMetadataType getIslandMetadataType() {
return IslandMetadataType.ownerUUID;
}
}

View File

@ -1,20 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import org.bukkit.block.Biome;
import org.bukkit.plugin.Plugin;
public class IslandShoreBiomeMetadata extends IslandFixedMetadata {
public IslandShoreBiomeMetadata(Plugin owningPlugin, Biome value) {
super(owningPlugin, value);
}
public Biome getShoreBiome() {
return (Biome) this.value();
}
@Override
public IslandMetadataType getIslandMetadataType() {
return IslandMetadataType.shoreBiome;
}
}

View File

@ -1,19 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import org.bukkit.plugin.Plugin;
public class IslandTUIDMetadata extends IslandFixedMetadata {
public IslandTUIDMetadata(Plugin owningPlugin, String value) {
super(owningPlugin, value);
}
public String getIUID() {
return asString();
}
@Override
public IslandMetadataType getIslandMetadataType() {
return IslandMetadataType.TIUD;
}
}

View File

@ -1,19 +0,0 @@
package ca.recrown.islandsurvivalcraft.islandbedrockmetadata;
import org.bukkit.plugin.Plugin;
public class IslandTemperatureMetadata extends IslandFixedMetadata {
public IslandTemperatureMetadata(Plugin owningPlugin, Float value) {
super(owningPlugin, value);
}
public float getTemperature() {
return ((Float) this.value()).floatValue();
}
@Override
public IslandMetadataType getIslandMetadataType() {
return IslandMetadataType.temperature;
}
}