From 9e2ddeb55321b09086a5a27254197d783847e6e3 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Mon, 25 Apr 2022 18:50:36 +0200 Subject: Initial commit --- src/main/java/com/encrox/zombie/Map.java | 118 +++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 src/main/java/com/encrox/zombie/Map.java (limited to 'src/main/java/com/encrox/zombie/Map.java') diff --git a/src/main/java/com/encrox/zombie/Map.java b/src/main/java/com/encrox/zombie/Map.java new file mode 100755 index 0000000..8262ba7 --- /dev/null +++ b/src/main/java/com/encrox/zombie/Map.java @@ -0,0 +1,118 @@ +package com.encrox.zombie; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.BlockVector; +import org.json.JSONArray; +import org.json.JSONObject; + +import com.encrox.zombie.interactable.Chest; +import com.encrox.zombie.interactable.Lever; +import com.encrox.zombie.interactable.Powerup; + +public class Map { + + private Schematic schematic; + private String name; + private int players; + private BlockVector spawn; + private Chest[] chests; + private Mob[] mobs; + private Powerup[] powerups; + private Lever[] levers; + + public Map(JSONObject descriptor) { + this.schematic = new Schematic(new File(Zombie.schematicsDirectory, descriptor.getString("file"))); + this.name = descriptor.getString("name"); + this.players = descriptor.getInt("players"); + JSONArray spawnArray = descriptor.getJSONArray("spawn"); + this.spawn = new BlockVector(spawnArray.getInt(0), spawnArray.getInt(1), spawnArray.getInt(2)); + JSONArray leversArray = descriptor.getJSONArray("levers"); + levers = new Lever[leversArray.length()]; + for(int i = 0; i