summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2022-04-25 18:50:36 +0200
committerLeonard Kugis <leonard@kug.is>2022-04-25 18:50:36 +0200
commit9e2ddeb55321b09086a5a27254197d783847e6e3 (patch)
tree620e4a7b326df2a77fff51aff390e0a6bef43631
Initial commitHEADmaster
-rwxr-xr-x.classpath36
-rw-r--r--.gitignore171
-rwxr-xr-x.project23
-rwxr-xr-xdependency-reduced-pom.xml90
-rwxr-xr-xpom.xml102
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Commander.java56
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Constants.java59
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Game.java294
-rwxr-xr-xsrc/main/java/com/encrox/zombie/GameListener.java159
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Lobby.java72
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Map.java118
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Misc.java12
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Mob.java41
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Schematic.java117
-rwxr-xr-xsrc/main/java/com/encrox/zombie/Zombie.java245
-rwxr-xr-xsrc/main/java/com/encrox/zombie/ZombieWorld.java79
-rwxr-xr-xsrc/main/java/com/encrox/zombie/interactable/Chest.java27
-rwxr-xr-xsrc/main/java/com/encrox/zombie/interactable/Interactable.java23
-rwxr-xr-xsrc/main/java/com/encrox/zombie/interactable/Lever.java38
-rwxr-xr-xsrc/main/java/com/encrox/zombie/interactable/Powerup.java22
-rwxr-xr-xsrc/main/resources/config.json4
-rwxr-xr-xsrc/main/resources/descriptor.json59
-rwxr-xr-xsrc/main/resources/lang/de-DE.properties2
-rwxr-xr-xsrc/main/resources/lang/en-GB.properties28
-rwxr-xr-xsrc/main/resources/plugin.yml9
-rwxr-xr-xsrc/main/resources/schematics/test.schematicbin0 -> 187 bytes
-rwxr-xr-xtarget/classes/config.json4
-rwxr-xr-xtarget/classes/descriptor.json59
-rwxr-xr-xtarget/classes/lang/de-DE.properties2
-rwxr-xr-xtarget/classes/lang/en-GB.properties28
-rwxr-xr-xtarget/classes/plugin.yml9
-rwxr-xr-xtarget/classes/schematics/test.schematicbin0 -> 187 bytes
-rwxr-xr-xtarget/maven-archiver/pom.properties5
-rwxr-xr-xtarget/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst0
-rwxr-xr-xtarget/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst15
-rwxr-xr-xtarget/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst0
36 files changed, 2008 insertions, 0 deletions
diff --git a/.classpath b/.classpath
new file mode 100755
index 0000000..16c89cc
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9d02df8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,171 @@
+
+# Created by https://www.toptal.com/developers/gitignore/api/eclipse,java,windows,linux,macos
+# Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,java,windows,linux,macos
+
+### Eclipse ###
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+.apt_generated_test/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
+# Uncomment this line if you wish to ignore the project description file.
+# Typically, this file would be tracked if it contains build/dependency configurations:
+#.project
+
+### Eclipse Patch ###
+# Spring Boot Tooling
+.sts4-cache/
+
+### Java ###
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+replay_pid*
+
+### Linux ###
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### macOS Patch ###
+# iCloud generated files
+*.icloud
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.toptal.com/developers/gitignore/api/eclipse,java,windows,linux,macos
diff --git a/.project b/.project
new file mode 100755
index 0000000..ff9fa73
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>zombie</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
new file mode 100755
index 0000000..c1adb1e
--- /dev/null
+++ b/dependency-reduced-pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.encrox</groupId>
+ <artifactId>zombie</artifactId>
+ <name>Zombie</name>
+ <version>0.0.1-SNAPSHOT</version>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>plugin.yml</include>
+ <include>config.json</include>
+ <include>descriptor.json</include>
+ </includes>
+ </resource>
+ <resource>
+ <targetPath>schematics</targetPath>
+ <directory>src/main/resources/schematics</directory>
+ <includes>
+ <include>test.schematic</include>
+ </includes>
+ </resource>
+ <resource>
+ <targetPath>lang</targetPath>
+ <directory>src/main/resources/lang</directory>
+ <includes>
+ <include>de-DE.properties</include>
+ <include>en-GB.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.6.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration />
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.bukkit</groupId>
+ <artifactId>craftbukkit</artifactId>
+ <version>1.8</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sk89q</groupId>
+ <artifactId>worldedit</artifactId>
+ <version>6.1.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sk89q</groupId>
+ <artifactId>worldguard</artifactId>
+ <version>6.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.comphenix</groupId>
+ <artifactId>protocollib</artifactId>
+ <version>4.2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.encrox</groupId>
+ <artifactId>instancedregions</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
+
diff --git a/pom.xml b/pom.xml
new file mode 100755
index 0000000..27724f8
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,102 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.encrox</groupId>
+ <artifactId>zombie</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Zombie</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.bukkit</groupId>
+ <artifactId>craftbukkit</artifactId>
+ <version>1.8</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sk89q</groupId>
+ <artifactId>worldedit</artifactId>
+ <version>6.1.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sk89q</groupId>
+ <artifactId>worldguard</artifactId>
+ <version>6.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.comphenix</groupId>
+ <artifactId>protocollib</artifactId>
+ <version>4.2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.encrox</groupId>
+ <artifactId>instancedregions</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160810</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jnbt</groupId>
+ <artifactId>jnbt</artifactId>
+ <version>1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>plugin.yml</include>
+ <include>config.json</include>
+ <include>descriptor.json</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources/schematics</directory>
+ <targetPath>schematics</targetPath>
+ <includes>
+ <include>test.schematic</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources/lang</directory>
+ <targetPath>lang</targetPath>
+ <includes>
+ <include>de-DE.properties</include>
+ <include>en-GB.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.6.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration></configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/src/main/java/com/encrox/zombie/Commander.java b/src/main/java/com/encrox/zombie/Commander.java
new file mode 100755
index 0000000..40e77eb
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Commander.java
@@ -0,0 +1,56 @@
+package com.encrox.zombie;
+
+import org.bukkit.ChatColor;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class Commander implements CommandExecutor {
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] args) {
+ try {
+ if(sender instanceof Player) {
+ Player player = (Player)sender;
+ switch(args[0]) {
+ case "lobby":
+ switch(args[1]) {
+ case "create":
+ if(player.hasPermission("zombie.create")) {
+ player.sendMessage(Zombie.createLobby(player, args[2], args[3]));
+ } else {
+ player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("no_permission"));
+ }
+ break;
+ case "join":
+ if(player.hasPermission("zombie.join")) {
+ if(args.length == 3) {
+ player.sendMessage(Zombie.joinLobby(player, args[2]));
+ } else {
+ player.sendMessage(Zombie.listLobbies());
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("no_permission"));
+ }
+ break;
+ case "leave":
+ player.sendMessage(Zombie.removePlayer(player));
+ break;
+ case "start":
+ player.sendMessage(Zombie.start(player));
+ break;
+ }
+ break;
+ }
+ } else {
+ sender.sendMessage(Zombie.lang.getProperty("no_player"));
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Constants.java b/src/main/java/com/encrox/zombie/Constants.java
new file mode 100755
index 0000000..50e7491
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Constants.java
@@ -0,0 +1,59 @@
+package com.encrox.zombie;
+
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+
+import com.sk89q.worldedit.blocks.ItemType;
+
+public class Constants {
+
+ public static class Game {
+
+ public static final Material[] ITEMSET = new Material[] {
+ Material.WOOD_HOE,
+ Material.WOOD_PICKAXE,
+ Material.WOOD_SPADE,
+ Material.WOOD_SWORD,
+ Material.STONE_AXE,
+ Material.STONE_HOE,
+ Material.STONE_PICKAXE,
+ Material.STONE_SPADE,
+ Material.STONE_SWORD,
+ Material.IRON_AXE,
+ Material.IRON_HOE,
+ Material.IRON_PICKAXE,
+ Material.IRON_SPADE,
+ Material.IRON_SWORD,
+ Material.GOLD_AXE,
+ Material.GOLD_HOE,
+ Material.GOLD_PICKAXE,
+ Material.GOLD_SPADE,
+ Material.GOLD_SWORD,
+ Material.DIAMOND_AXE,
+ Material.DIAMOND_HOE,
+ Material.DIAMOND_PICKAXE,
+ Material.DIAMOND_SPADE,
+ Material.DIAMOND_SWORD,
+ Material.BOW,
+ Material.ARROW,
+ Material.LEATHER_HELMET,
+ Material.LEATHER_CHESTPLATE,
+ Material.LEATHER_LEGGINGS,
+ Material.LEATHER_BOOTS,
+ Material.GOLD_HELMET,
+ Material.GOLD_CHESTPLATE,
+ Material.GOLD_LEGGINGS,
+ Material.GOLD_BOOTS,
+ Material.IRON_HELMET,
+ Material.IRON_CHESTPLATE,
+ Material.IRON_LEGGINGS,
+ Material.IRON_BOOTS,
+ Material.CHAINMAIL_HELMET,
+ Material.CHAINMAIL_CHESTPLATE,
+ Material.CHAINMAIL_LEGGINGS,
+ Material.CHAINMAIL_BOOTS
+ };
+
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Game.java b/src/main/java/com/encrox/zombie/Game.java
new file mode 100755
index 0000000..ae6ff4a
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Game.java
@@ -0,0 +1,294 @@
+package com.encrox.zombie;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.Sign;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.material.MaterialData;
+import org.bukkit.util.BlockVector;
+
+import com.encrox.instancedregions.InstancedProtectedCuboidRegion;
+import com.encrox.zombie.interactable.Chest;
+import com.encrox.zombie.interactable.Interactable;
+import com.encrox.zombie.interactable.Lever;
+import com.encrox.zombie.interactable.Powerup;
+
+public class Game {
+
+ private volatile ArrayList<Player> players, frozen;
+ private volatile Map map;
+ private volatile HashMap<Player,Integer> stats;
+ private volatile InstancedProtectedCuboidRegion region;
+ private volatile Mob[] mobs;
+ private volatile ArrayList<Mob> mobsRound;
+ public volatile ArrayList<Integer> watchdog;
+ private volatile int round;
+ private volatile boolean done;
+ private volatile Interactable[] inters;
+ private volatile com.sk89q.worldedit.BlockVector min;
+
+ public Game(ArrayList<Player> players, Map map) {
+ this.players = players;
+ this.map = map;
+ stats = new HashMap<Player,Integer>();
+ region = Zombie.zombieWorld.allocate(map.getSchematic());
+ mobs = map.getMobs();
+ mobsRound = new ArrayList<Mob>();
+ watchdog = new ArrayList<Integer>();
+ frozen = new ArrayList<Player>();
+ BlockVector spawn = map.getSpawn();
+ min = region.getMinimumPoint();
+ Powerup[] powerups = map.getPowerups();
+ Lever[] levers = map.getLevers();
+ inters = new Interactable[powerups.length+levers.length+1];
+ for(int i = 0; i<levers.length; i++) {
+ inters[i] = levers[i];
+ }
+ for(int i = 0; i<powerups.length; i++) {
+ BlockVector bv = powerups[i].getBlockVector();
+ Block block = Zombie.zombieWorld.getWorld().getBlockAt(min.getBlockX()+bv.getBlockX(), 64+bv.getBlockY(), min.getBlockZ()+bv.getBlockZ());
+ inters[powerups.length+i] = powerups[i];
+ block.setType(Material.SIGN_POST);
+ Sign sign = (Sign)block.getState();
+ //sign.setData(new MaterialData(Material.WALL_SIGN));
+ sign.setLine(0, "[ZombieItem]");
+ String itemStr = powerups[i].getItem().toString();
+ sign.setLine(1, itemStr);
+ int len1 = itemStr.length(), len2 = sign.getLine(1).length();
+ if(len2 < len1)
+ sign.setLine(2, itemStr.substring(len2));
+ if((len2 += sign.getLine(2).length()) < len1)
+ sign.setLine(3, itemStr.substring(len2));
+ sign.update();
+ }
+ Chest relChest = (Chest)Misc.random(map.getChests());
+ inters[inters.length-1] = relChest;
+ BlockVector bv = relChest.getBlockVector();
+ Block block = Zombie.zombieWorld.getWorld().getBlockAt(min.getBlockX()+bv.getBlockX(), 64+bv.getBlockY(), min.getBlockZ()+bv.getBlockZ());
+ block.setType(Material.CHEST);
+ org.bukkit.material.Chest c = new org.bukkit.material.Chest();
+ c.setFacingDirection(relChest.getFacing());
+ block.setData(c.getData());
+ block.getState().update();
+ region.apply();
+ Player player;
+ for(int i = 0, size = players.size(); i<size; i++) {
+ player = players.get(i);
+ stats.put(player, 1000000);
+ region.addPlayer(player);
+ player.teleport(new Location(Zombie.zombieWorld.getWorld(), -1000, 64, -1000));
+ Bukkit.getScheduler().runTaskLater(Zombie.plugin, new Runnable() {
+ Player player;
+ @Override
+ public void run() {
+ player.teleport(new Location(Zombie.zombieWorld.getWorld(), min.getBlockX()+spawn.getBlockX()+.5, 64+spawn.getBlockY(), min.getBlockZ()+spawn.getBlockZ()+.5));
+ }
+ public Runnable setPlayer(Player player) {
+ this.player = player;
+ return this;
+ }
+ }.setPlayer(player), 120L);
+ }
+ /*
+ Bukkit.getScheduler().runTask(Zombie.plugin, new Runnable() {
+ @Override
+ public void run() {
+ Mob current;
+ int amount = 1;
+ com.sk89q.worldedit.BlockVector min = region.getMinimumPoint();
+ LivingEntity entity;
+ for(int round = 1; round < Integer.MAX_VALUE; round++) {
+ announce(ChatColor.YELLOW + Zombie.lang.getProperty("game_round").replace("%round%", ""+round));
+ for(int i = 0, size = mobs.size(); i<size; i++) {
+ current = mobs.get(i);
+ if(current.spawn(round)) {
+ mobsRound.add(current);
+ }
+ }
+ for(int i = 0; i<amount; i++) {
+ for(int x = 0, size = mobsRound.size(); x<size; x++) {
+ current = mobsRound.get(x);
+ entity = Zombie.zombieWorld.getWorld().spawnCreature(new Location(Zombie.zombieWorld.getWorld(), min.getBlockX()+current.bv.getBlockX(), 64+current.bv.getBlockY(), min.getBlockZ()+current.bv.getBlockZ()), current.type);
+ entity.setMaxHealth(entity.getMaxHealth() + round);
+ entity.setHealth(entity.getMaxHealth());
+ watchdog.add(entity.getEntityId());
+ }
+ }
+ while(!watchdog.isEmpty());
+ }
+ }
+ });
+ */
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ Mob current;
+ com.sk89q.worldedit.BlockVector min = region.getMinimumPoint();
+ for(round = 1; round < Integer.MAX_VALUE; round++) {
+ announce(ChatColor.YELLOW + Zombie.lang.getProperty("game_round").replace("%round%", ""+round));
+ mobsRound.clear();
+ for(int i = 0; i<mobs.length; i++) {
+ if(mobs[i].spawn(round)) {
+ mobsRound.add(mobs[i]);
+ }
+ }
+ done = false;
+ Bukkit.getScheduler().runTask(Zombie.plugin, new Runnable() {
+ @Override
+ public void run() {
+ LivingEntity entity;
+ Mob current;
+ for(int i = 0, amount = 10 + round; i<amount; i++) {
+ for(int x = 0, size = mobsRound.size(); x<size; x++) {
+ current = mobsRound.get(x);
+ entity = Zombie.zombieWorld.getWorld().spawnCreature(new Location(Zombie.zombieWorld.getWorld(), min.getBlockX()+current.bv.getBlockX(), 64+current.bv.getBlockY(), min.getBlockZ()+current.bv.getBlockZ()), current.type);
+ entity.setMaxHealth(entity.getMaxHealth() + round);
+ entity.setHealth(entity.getMaxHealth());
+ watchdog.add(entity.getEntityId());
+ }
+ }
+ done = true;
+ }
+ });
+ while(!done);
+ while(!watchdog.isEmpty());
+ }
+ }
+ }).start();
+
+ }
+
+ public ArrayList<Player> getPlayers() {
+ return players;
+ }
+
+ public void playerDeath(Player player) {
+ if(!frozen.contains(player)) {
+ announce(ChatColor.RED + Zombie.lang.getProperty("game_player_fell").replace("%player%", player.getName()));
+ player.teleport(player.getLocation().add(0, -1, 0));
+ player.setHealth(.5);
+ frozen.add(player);
+ Bukkit.getScheduler().runTaskTimer(Zombie.plugin, new Runnable() {
+ int t = 30;
+ @Override
+ public void run() {
+ if(frozen.contains(player)) {
+ if(t == 0) {
+ announce(ChatColor.RED + Zombie.lang.getProperty("game_player_died").replace("%player%", player.getName()));
+ frozen.remove(player);
+ players.remove(player);
+ player.setHealth(player.getMaxHealth());
+ //TODO: Teleport back outta dungeon
+ } else {
+ announce(ChatColor.YELLOW + Zombie.lang.getProperty("game_revive_countdown").replace("%player%", player.getName()).replace("%seconds%", ""+t));
+ t-=5;
+ }
+ }
+ }
+ }, 0, 100);
+ }
+ }
+
+ public boolean isFrozen(Player player) {
+ return frozen.contains(player);
+ }
+
+ public void revive(Player from, Player to) {
+ if(frozen.contains(to)) {
+ frozen.remove(to);
+ to.teleport(to.getLocation().add(0, -1, 0));
+ to.setHealth(to.getMaxHealth());
+ }
+ }
+
+ public void randomizeChest() {
+ Block block = Zombie.zombieWorld.getWorld().getBlockAt(getAbsoluteLocation(inters[inters.length-1].getBlockVector()));
+ block.setType(Material.AIR);
+ block.getState().update();
+ Chest relChest = (Chest)Misc.random(map.getChests());
+ inters[inters.length-1] = relChest;
+ block = Zombie.zombieWorld.getWorld().getBlockAt(getAbsoluteLocation(relChest.getBlockVector()));
+ block.setType(Material.CHEST);
+ org.bukkit.material.Chest c = new org.bukkit.material.Chest();
+ c.setFacingDirection(relChest.getFacing());
+ block.setData(c.getData());
+ block.getState().update();
+ }
+
+ public void announce(String text) {
+ for(int i = 0, size = players.size(); i<size; i++) {
+ players.get(i).sendMessage(text);
+ }
+ }
+
+ public void addPoints(Player player, int amount) {
+ int newPoints = stats.get(player)+amount;
+ stats.put(player, newPoints);
+ player.sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("game_points").replace("%points%", ""+newPoints));
+ }
+
+ public void substractPoints(Player player, int amount) {
+ int newPoints = stats.get(player)-amount;
+ stats.put(player, newPoints);
+ player.sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("game_points").replace("%points%", ""+newPoints));
+ }
+
+ public void addPoints(int amount) {
+ stats.forEach((k,v) -> stats.put(k, v+amount));
+ }
+
+ public int getPoints(Player player) {
+ if(stats.containsKey(player))
+ return stats.get(player);
+ return -1;
+ }
+
+ public Location getAbsoluteLocation(BlockVector relative) {
+ return new Location(Zombie.zombieWorld.getWorld(), min.getX()+relative.getBlockX(), 64+relative.getBlockY(), min.getBlockZ()+relative.getBlockZ());
+ }
+
+ /*
+ public Powerup getPowerup(Block block) {
+ for(int i = 0; i<powerups.length; i++) {
+ if(Zombie.zombieWorld.getWorld().getBlockAt(min.getBlockX()+powerups[i].bv.getBlockX(), 64+powerups[i].bv.getBlockY(), min.getBlockZ()+powerups[i].bv.getBlockZ()).equals(block)) {
+ return powerups[i];
+ }
+ }
+ return null;
+ }
+
+ public Lever getLever(Block block) {
+ for(int i = 0; i<levers.length; i++) {
+ if(Zombie.zombieWorld.getWorld().getBlockAt(min.getBlockX()+levers[i].bv.getBlockX(), 64+levers[i].bv.getBlockY(), min.getBlockZ()+levers[i].bv.getBlockZ()).equals(block)) {
+ return levers[i];
+ }
+ }
+ return null;
+ }
+ */
+
+ public Interactable getInteractable(Block block) {
+ BlockVector bv;
+ for(int i = 0; i<inters.length; i++) {
+ bv = inters[i].getBlockVector();
+ if(Zombie.zombieWorld.getWorld().getBlockAt(min.getBlockX()+bv.getBlockX(), 64+bv.getBlockY(), min.getBlockZ()+bv.getBlockZ()).equals(block)) {
+ return inters[i];
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/GameListener.java b/src/main/java/com/encrox/zombie/GameListener.java
new file mode 100755
index 0000000..4d88aba
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/GameListener.java
@@ -0,0 +1,159 @@
+package com.encrox.zombie;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Random;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.inventory.ItemStack;
+
+import com.encrox.zombie.interactable.Chest;
+import com.encrox.zombie.interactable.Interactable;
+import com.encrox.zombie.interactable.Lever;
+import com.encrox.zombie.interactable.Powerup;
+
+public class GameListener implements Listener {
+
+ @EventHandler
+ public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
+ if(e.getEntity() instanceof Player) {
+ Player player = (Player)e.getEntity();
+ if(player.getHealth() <= e.getDamage()) {
+ Game current;
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ current = Zombie.games.get(i);
+ if(current.getPlayers().contains(player)) {
+ current.playerDeath(player);
+ e.setCancelled(true);
+ }
+ }
+ }
+ } else {
+ if(e.getDamager() instanceof Player) {
+ int id = e.getEntity().getEntityId();
+ Player player = (Player)e.getDamager();
+ Game current;
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ current = Zombie.games.get(i);
+ if(current.watchdog.contains(id)) {
+ if(current.getPlayers().contains(player)) {
+ int amount = (int)Math.round(e.getFinalDamage());
+ current.addPoints(player, amount);
+ player.sendMessage(ChatColor.GREEN + Zombie.lang.getProperty("game_points_gained").replace("%points%", ""+amount));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onPlayerMove(PlayerMoveEvent e) {
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ if(Zombie.games.get(i).isFrozen(e.getPlayer())) {
+ e.setCancelled(true);
+ }
+ }
+ }
+
+ @EventHandler
+ public void onPlayerInteract(PlayerInteractEvent e) {
+ try {
+ Player player = e.getPlayer();
+ Game current;
+ if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ current = Zombie.games.get(i);
+ if(current.getPlayers().contains(player)) {
+ Block block = e.getClickedBlock();
+ Interactable inter = current.getInteractable(block);
+ if(inter != null) {
+ int cost = inter.getCost();
+ if(current.getPoints(player) >= cost) {
+ player.sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("game_paid").replace("%amount%", ""+cost));
+ current.substractPoints(player, cost);
+ if(inter instanceof Chest) {
+ if(Math.random() > 0.25) {
+ ItemStack item = new ItemStack((Material)Misc.random(Constants.Game.ITEMSET));
+ Enchantment ench;
+ while(!(ench = (Enchantment)Misc.random(Enchantment.values())).canEnchantItem(item));
+ item.addEnchantment(ench, 1+(new Random().nextInt(Integer.MAX_VALUE)%(ench.getMaxLevel()-1)));
+ player.getInventory().addItem(item);
+ } else {
+ player.getInventory().addItem(new ItemStack(Material.SKULL_ITEM));
+ current.randomizeChest();
+ }
+ e.setCancelled(true);
+ } else if(inter instanceof Powerup) {
+ Powerup powerup = (Powerup)inter;
+ player.getInventory().addItem(powerup.getItem());
+ } else if(inter instanceof Lever) {
+ Lever lever = (Lever)inter;
+ if(lever.isToggled()) {
+ player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("game_impossible"));
+ current.addPoints(player, cost);
+ e.setCancelled(true);
+ } else {
+ lever.toggle();
+ }
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("game_no_points").replace("%amount%", ""+cost));
+ e.setCancelled(true);
+ }
+ }
+ }
+ }
+ }
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @EventHandler
+ public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
+ Game current;
+ Player from = e.getPlayer();
+ if(e.getRightClicked() instanceof Player) {
+ Player to = (Player)e.getRightClicked();
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ current = Zombie.games.get(i);
+ if(current.getPlayers().contains(from) && current.getPlayers().contains(to)) {
+ if(current.isFrozen(to)) {
+ current.revive(from, to);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void onEntityDeath(EntityDeathEvent e) {
+ int id = e.getEntity().getEntityId();
+ Game current;
+ for(int i = 0, size = Zombie.games.size(); i<size; i++) {
+ current = Zombie.games.get(i);
+ if(current.watchdog.contains(id)) {
+ current.addPoints(1000);
+ current.watchdog.remove((Integer)id);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Lobby.java b/src/main/java/com/encrox/zombie/Lobby.java
new file mode 100755
index 0000000..c33c3c3
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Lobby.java
@@ -0,0 +1,72 @@
+package com.encrox.zombie;
+
+import java.util.ArrayList;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
+public class Lobby {
+
+ private ArrayList<Player> players;
+ private Player creator;
+ private String identifier;
+ private Map map;
+
+ public Lobby(Player creator, String identifier, Map map) {
+ this.creator = creator;
+ this.identifier = identifier;
+ this.map = map;
+ players = new ArrayList<Player>();
+ players.add(creator);
+ }
+
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public Player getCreator() {
+ return creator;
+ }
+
+ public boolean containsPlayer(Player player) {
+ if(creator.equals(player)) return true;
+ return players.contains(player);
+ }
+
+ public void removePlayer(Player player) {
+ if(creator.equals(player)) {
+ for(int i = 0, size = players.size(); i<size; i++) {
+ players.get(i).sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("lobby_disbanded"));
+ }
+ Zombie.lobbies.remove(this);
+ return;
+ }
+ if(players.contains(player)) {
+ for(int i = 0, size = players.size(); i<size; i++) {
+ players.get(i).sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("lobby_left").replace("%player%", player.getName()));
+ }
+ players.remove(player);
+ }
+ }
+
+ public void addPlayer(Player player) {
+ players.add(player);
+ for(int i = 0, size = players.size(); i<size; i++) {
+ players.get(i).sendMessage(ChatColor.YELLOW + Zombie.lang.getProperty("lobby_joined").replace("%player%", player.getName()));
+ }
+ }
+
+ public int getMax() {
+ return map.getPlayers();
+ }
+
+ public int getCurrent() {
+ return players.size();
+ }
+
+ public void start() {
+ Zombie.games.add(new Game(players, map));
+ Zombie.lobbies.remove(this);
+ }
+
+}
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<levers.length; i++) {
+ JSONObject lever = leversArray.getJSONObject(i);
+ JSONArray position = lever.getJSONArray("position");
+ JSONArray othersLever = lever.getJSONArray("toggle");
+ Lever[] others = new Lever[othersLever.length()];
+ for(int x = 0; x<others.length; x++)
+ others[x] = levers[othersLever.getInt(x)];
+ levers[i] = new Lever(new BlockVector(position.getInt(0), position.getInt(1), position.getInt(2)), lever.getInt("cost"), others);
+ }
+ JSONArray mobsArray = descriptor.getJSONArray("mobs");
+ mobs = new Mob[mobsArray.length()];
+ for(int i = 0; i<mobs.length; i++) {
+ JSONObject mob = mobsArray.getJSONObject(i);
+ JSONArray position = mob.getJSONArray("position");
+ JSONArray leversMob = mob.getJSONArray("levers");
+ Lever[] levers = new Lever[leversMob.length()];
+ for(int x = 0; x<levers.length; x++)
+ levers[x] = this.levers[leversMob.getInt(x)];
+ mobs[i] = new Mob(EntityType.fromId(mob.getInt("type")), new BlockVector(position.getInt(0), position.getInt(1), position.getInt(2)), mob.getString("rounds"), levers);
+ }
+ JSONArray chestsArray = descriptor.getJSONArray("chests");
+ chests = new Chest[chestsArray.length()];
+ for(int i = 0; i<chests.length; i++) {
+ JSONObject chest = chestsArray.getJSONObject(i);
+ JSONArray position = chest.getJSONArray("position");
+ chests[i] = new Chest(new BlockVector(position.getInt(0), position.getInt(1), position.getInt(2)), chest.getInt("cost"), chest.getString("facing"));
+ }
+ JSONArray powerupsArray = descriptor.getJSONArray("powerups");
+ powerups = new Powerup[powerupsArray.length()];
+ for(int i = 0; i<powerups.length; i++) {
+ JSONObject powerup = powerupsArray.getJSONObject(i);
+ JSONArray position = powerup.getJSONArray("position");
+ JSONObject enchantment = powerup.getJSONObject("enchantment");
+ ItemStack item = new ItemStack(Material.getMaterial(powerup.getString("item")));
+ String enchStr = enchantment.getString("type");
+ if(!enchStr.equals("")) {
+ Enchantment ench = Enchantment.getByName(enchStr);
+ if(ench.canEnchantItem(item)) {
+ item.addEnchantment(ench, enchantment.getInt("level"));
+ } else {
+ Zombie.logger.warning(Zombie.lang.getProperty("plugin_enchantment"));
+ }
+ }
+ powerups[i] = new Powerup(new BlockVector(position.getInt(0), position.getInt(1), position.getInt(2)), item, powerup.getInt("cost"));
+ }
+ }
+
+ public int getPlayers() {
+ return players;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Schematic getSchematic() {
+ return schematic;
+ }
+
+ public BlockVector getSpawn() {
+ return spawn;
+ }
+
+ public Mob[] getMobs() {
+ return mobs;
+ }
+
+ public Chest[] getChests() {
+ return chests;
+ }
+
+ public Powerup[] getPowerups() {
+ return powerups;
+ }
+
+ public Lever[] getLevers() {
+ return levers;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Misc.java b/src/main/java/com/encrox/zombie/Misc.java
new file mode 100755
index 0000000..feeab8b
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Misc.java
@@ -0,0 +1,12 @@
+package com.encrox.zombie;
+
+import java.util.Random;
+
+public class Misc {
+
+ public static Object random(Object[] arr) {
+ int rnd = new Random().nextInt(arr.length);
+ return arr[rnd];
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Mob.java b/src/main/java/com/encrox/zombie/Mob.java
new file mode 100755
index 0000000..82958a3
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Mob.java
@@ -0,0 +1,41 @@
+package com.encrox.zombie;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.bukkit.entity.EntityType;
+import org.bukkit.util.BlockVector;
+
+import com.encrox.zombie.interactable.Lever;
+
+public class Mob {
+
+ public EntityType type;
+ public BlockVector bv;
+ public String rounds;
+ public Lever[] levers;
+
+ public Mob(EntityType type, BlockVector bv, String rounds, Lever[] levers) {
+ this.type = type;
+ this.bv = bv;
+ this.rounds = rounds;
+ this.levers = levers;
+ }
+
+ public boolean spawn(int round) {
+ for(int i = 0; i<levers.length; i++) {
+ if(!levers[i].isToggled())
+ return false;
+ }
+ ScriptEngineManager factory = new ScriptEngineManager();
+ ScriptEngine engine = factory.getEngineByName("JavaScript");
+ try {
+ return (boolean)engine.eval(rounds.replace("%round%", ""+round));
+ } catch (ScriptException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Schematic.java b/src/main/java/com/encrox/zombie/Schematic.java
new file mode 100755
index 0000000..16d4f5b
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Schematic.java
@@ -0,0 +1,117 @@
+/*
+ * Dynamic Schematic object
+ *
+ * Currently not supporting entities.
+ */
+
+package com.encrox.zombie;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.bukkit.Material;
+import org.jnbt.ByteArrayTag;
+import org.jnbt.CompoundTag;
+import org.jnbt.ListTag;
+import org.jnbt.NBTInputStream;
+import org.jnbt.ShortTag;
+import org.jnbt.StringTag;
+import org.jnbt.Tag;
+
+public class Schematic {
+
+ public int width, height, length, dataReadIndex, dataWriteIndex, blockReadIndex, blockWriteIndex;
+ public String materials;
+ public byte[] blocks, data;
+ public List<Tag> entities, tileEntities;
+ public File file;
+
+ public Schematic(int width, int height, int length, String materials, byte[] blocks, byte[] data, List<Tag> entities, List<Tag> tileEntities) {
+ this.width = width;
+ this.height = height;
+ this.length = length;
+ this.materials = materials;
+ this.blocks = blocks;
+ this.data = data;
+ this.entities = entities;
+ this.tileEntities = tileEntities;
+ blockReadIndex = 0;
+ blockWriteIndex = 0;
+ dataReadIndex = 0;
+ dataWriteIndex = 0;
+ }
+
+ public Schematic(File file) {
+ this.file = file;
+ CompoundTag schematicTag = null;
+ try {
+ NBTInputStream in = new NBTInputStream(new FileInputStream(file));
+ schematicTag = (CompoundTag)in.readTag();
+ in.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Map<String,Tag> schematic = schematicTag.getValue();
+ width = ((ShortTag)schematic.get("Width")).getValue();
+ height = ((ShortTag)schematic.get("Height")).getValue();
+ length = ((ShortTag)schematic.get("Length")).getValue();
+ materials = ((StringTag)schematic.get("Materials")).getValue();
+ blocks = ((ByteArrayTag)schematic.get("Blocks")).getValue();
+ data = ((ByteArrayTag)schematic.get("Data")).getValue();
+ entities = ((ListTag)schematic.get("Entities")).getValue();
+ tileEntities = ((ListTag)schematic.get("TileEntities")).getValue();
+ blockReadIndex = 0;
+ blockWriteIndex = 0;
+ dataReadIndex = 0;
+ dataWriteIndex = 0;
+ }
+
+ public byte getBlockIdAt(int x, int y, int z) {
+ return blocks[(y*length + z)*width + x];
+ }
+
+ public byte getNextBlock() {
+ return blocks[blockReadIndex++];
+ }
+
+ public byte getDataAt(int x, int y, int z) {
+ return data[(y*length + z)*width + x];
+ }
+
+ public byte getNextData() {
+ return data[dataReadIndex++];
+ }
+
+ public void setBlockIdAt(int x, int y, int z, byte blockId) {
+ blocks[(y*length + z)*width + x] = blockId;
+ }
+
+ public void setNextBlock(byte blockId) {
+ blocks[blockWriteIndex++] = blockId;
+ }
+
+ public void setDataAt(int x, int y, int z, byte newData) {
+ data[(y*length + z)*width + x] = newData;
+ }
+
+ public void setNextData(byte newData) {
+ data[dataWriteIndex++] = newData;
+ }
+
+ public void write(File file) {
+
+ }
+
+ public void reset() {
+ blockReadIndex = 0;
+ blockWriteIndex = 0;
+ dataReadIndex = 0;
+ dataWriteIndex = 0;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/Zombie.java b/src/main/java/com/encrox/zombie/Zombie.java
new file mode 100755
index 0000000..d687f6e
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/Zombie.java
@@ -0,0 +1,245 @@
+package com.encrox.zombie;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.bukkit.WorldEditPlugin;
+
+public class Zombie extends JavaPlugin {
+
+ public static Plugin plugin;
+ public static Logger logger;
+ public static PluginDescriptionFile pdf;
+ public static Properties lang;
+ public static JSONObject config;
+ public static JSONArray schematicDescriptors;
+ public static File schematicsDirectory;
+ public static WorldEditPlugin we;
+ public static ArrayList<Map> maps;
+ public static ArrayList<Lobby> lobbies;
+ public static ArrayList<Game> games;
+ public static ZombieWorld zombieWorld;
+ public static Commander commander;
+
+ public void onEnable() {
+ pdf = getDescription();
+ logger = Logger.getLogger("Minecraft");
+ if(setupMyself() && setupWorldEdit()) {
+ plugin = this;
+ commander = new Commander();
+ getCommand("zombie").setExecutor(commander);
+ logger.info(pdf.getName() + " " + pdf.getVersion() + " has been enabled.");
+ } else {
+ logger.info(pdf.getName() + " " + pdf.getVersion() + " has been disabled.");
+ }
+ }
+
+ public boolean setupWorldEdit() {
+ we = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit");
+ return (we != null);
+ }
+
+ public boolean setupMyself() {
+ if(!this.getDataFolder().exists())
+ this.getDataFolder().mkdirs();
+ schematicsDirectory = new File(this.getDataFolder(), "schematics");
+ if(!schematicsDirectory.exists())
+ schematicsDirectory.mkdirs();
+ File configFile = new File(this.getDataFolder(), "config.json");
+ if(!configFile.exists()) {
+ BufferedInputStream bis;
+ FileOutputStream out;
+ try {
+ bis = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("config.json"));
+ out = new FileOutputStream(configFile);
+ int current;
+ while((current = bis.read()) != -1) {
+ out.write(current);
+ }
+ bis.close();
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ BufferedReader br;
+ StringBuilder sb = new StringBuilder();
+ String line;
+ try {
+ br = new BufferedReader(new FileReader(configFile));
+ while((line = br.readLine()) != null)
+ sb.append(line);
+ br.close();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ return false;
+ }
+ config = new JSONObject(sb.toString());
+ zombieWorld = new ZombieWorld(this, Bukkit.getWorld(config.getString("world")));
+ File schematicDescriptorFile = new File(schematicsDirectory, "descriptor.json");
+ if(!schematicDescriptorFile.exists()) {
+ int current;
+ try {
+ BufferedInputStream bis = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("descriptor.json"));
+ FileOutputStream out = new FileOutputStream(schematicDescriptorFile);
+ while((current = bis.read()) != -1) {
+ out.write(current);
+ }
+ bis.close();
+ out.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ try {
+ BufferedInputStream bis = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("schematics/test.schematic"));
+ FileOutputStream out = new FileOutputStream(new File(schematicsDirectory, "test.schematic"));
+ while((current = bis.read()) != -1) {
+ out.write(current);
+ }
+ bis.close();
+ out.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ sb = new StringBuilder();
+ try {
+ br = new BufferedReader(new FileReader(schematicDescriptorFile));
+ while((line = br.readLine()) != null)
+ sb.append(line);
+ br.close();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ return false;
+ }
+ schematicDescriptors = new JSONArray(sb.toString());
+ lang = new Properties();
+ try {
+ //TODO
+ lang.load(getClass().getClassLoader().getResourceAsStream("lang/" + config.getString("locale") + ".properties"));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+ maps = new ArrayList<Map>();
+ lobbies = new ArrayList<Lobby>();
+ games = new ArrayList<Game>();
+ for(int i = 0, len = schematicDescriptors.length(); i<len; i++) {
+ maps.add(new Map(schematicDescriptors.getJSONObject(i)));
+ }
+ Bukkit.getPluginManager().registerEvents(new GameListener(), this);
+ return true;
+ }
+
+ public void onDisable() {
+ logger.info(pdf.getName() + " " + pdf.getVersion() + " has been disabled.");
+ }
+
+ public static String createLobby(Player creator, String identifier, String map) {
+ for(int i = 0, size = lobbies.size(); i<size; i++) {
+ if(lobbies.get(i).getIdentifier().equals(identifier)) {
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_create_identifier"));
+ }
+ if(lobbies.get(i).containsPlayer(creator)) {
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_create_membership"));
+ }
+ }
+ for(int i = 0, size = maps.size(); i<size; i++) {
+ if(maps.get(i).getName().equals(map)) {
+ lobbies.add(new Lobby(creator, identifier, maps.get(i)));
+ return (ChatColor.GREEN + Zombie.lang.getProperty("lobby_create_success"));
+ }
+ }
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_create_map"));
+ }
+
+ public static String removePlayer(Player player) {
+ for(int i = 0, size = lobbies.size(); i<size; i++) {
+ if(lobbies.get(i).containsPlayer(player)) {
+ lobbies.get(i).removePlayer(player);
+ return (ChatColor.GREEN + Zombie.lang.getProperty("lobby_leave_success"));
+ }
+ }
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_leave_membership"));
+ }
+
+ public static String joinLobby(Player player, String identifier) {
+ int size = lobbies.size();
+ Lobby current;
+ for(int i = 0; i<size; i++) {
+ current = lobbies.get(i);
+ if(current.containsPlayer(player)) {
+ current.removePlayer(player);
+ }
+ }
+ for(int i = 0; i<size; i++) {
+ current = lobbies.get(i);
+ if(current.getIdentifier().equals(identifier)) {
+ if(current.getCurrent() < current.getMax()) {
+ current.addPlayer(player);
+ return (ChatColor.GREEN + Zombie.lang.getProperty("lobby_join_success"));
+ }
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_join_full"));
+ }
+ }
+ return (ChatColor.RED + Zombie.lang.getProperty("lobby_join_identifier"));
+ }
+
+ public static String listLobbies() {
+ String out = ChatColor.WHITE + lang.getProperty("lobby_list") + "\n";
+ Lobby current;
+ for(int i = 0, size = lobbies.size(); i<size; i++) {
+ current = lobbies.get(i);
+ if(current.getCurrent() < current.getMax()) {
+ out += ChatColor.GREEN;
+ } else {
+ out += ChatColor.RED;
+ }
+ out += current.getIdentifier() + ChatColor.WHITE + ", ";
+ }
+ return out;
+ }
+
+ public static String start(Player player) {
+ Lobby current;
+ for(int i = 0, size = lobbies.size(); i<size; i++) {
+ current = lobbies.get(i);
+ if(current.getCreator().equals(player)) {
+ current.start();
+ return (ChatColor.GREEN + lang.getProperty("lobby_start_success"));
+ }
+ }
+ return (ChatColor.GREEN + lang.getProperty("lobby_start_failed"));
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/com/encrox/zombie/ZombieWorld.java b/src/main/java/com/encrox/zombie/ZombieWorld.java
new file mode 100755
index 0000000..52ddea8
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/ZombieWorld.java
@@ -0,0 +1,79 @@
+package com.encrox.zombie;
+
+import java.util.ArrayList;
+
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.plugin.Plugin;
+
+import com.encrox.instancedregions.InstancedProtectedCuboidRegion;
+import com.sk89q.worldedit.BlockVector;
+import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
+import com.sk89q.worldguard.protection.regions.ProtectedRegion;
+
+public class ZombieWorld {
+
+ private Plugin plugin;
+ private World world;
+ private ArrayList<ProtectedRegion> regions;
+ private int lastX;
+
+ public ZombieWorld(Plugin plugin, World world) {
+ this.world = world;
+ this.plugin = plugin;
+ regions = new ArrayList<ProtectedRegion>();
+ lastX = 0;
+ }
+
+ public InstancedProtectedCuboidRegion allocate(int width, int length) {
+ BlockVector min, max;
+ InstancedProtectedCuboidRegion region;
+ for(int i = 0; true; i+=16) {
+ if(new ProtectedCuboidRegion("current", (min = new BlockVector(lastX+i, 0, 0)), (max = new BlockVector(lastX+i+width, 255, length))).getIntersectingRegions(regions).isEmpty()) {
+ region = new InstancedProtectedCuboidRegion(plugin, world, ""+min.getBlockX(), min, max);
+ regions.add(region);
+ return region;
+ }
+ }
+ }
+
+ public InstancedProtectedCuboidRegion allocate(Schematic schematic) {
+ BlockVector min, max;
+ InstancedProtectedCuboidRegion region;
+ for(int i = 0; true; i+=16) {
+ if(new ProtectedCuboidRegion("current", (min = new BlockVector(lastX+i, 0, 0)), (max = new BlockVector(lastX+i+schematic.width, 255, schematic.length))).getIntersectingRegions(regions).isEmpty()) {
+ region = new InstancedProtectedCuboidRegion(plugin, world, ""+min.getBlockX(), min, max);
+ schematic.reset();
+ for(int y = 0; y<schematic.height; y++) {
+ for(int z = 0; z<schematic.length; z++) {
+ for(int x = 0; x<schematic.width; x++) {
+ //System.out.println("block set at: (" + (min.getBlockX()+x) + ", " + (64+y) + ", " + (min.getBlockZ()+z) + ")");
+ world.getBlockAt(min.getBlockX()+x, 64+y, min.getBlockZ()+z).setType(Material.getMaterial(schematic.getBlockIdAt(x, y, z)));
+ world.getBlockAt(min.getBlockX()+x, 64+y, min.getBlockZ()+z).setData(schematic.getDataAt(x, y, z));;
+ }
+ }
+ }
+ regions.add(region);
+ return region;
+ }
+ }
+ }
+
+ //YOU STILL HAVE TO DISPOSE THE INSTANCED REGION MANUALLY!
+ public void deallocate(InstancedProtectedCuboidRegion region) {
+ BlockVector min = region.getMinimumPoint(), max = region.getMaximumPoint();
+ for(int y = min.getBlockY(), ymax = max.getBlockY(); y<ymax; y++) {
+ for(int z = min.getBlockZ(), zmax = max.getBlockZ(); z<zmax; z++) {
+ for(int x = min.getBlockX(), xmax = max.getBlockX(); x<xmax; x++) {
+ world.getBlockAt(x, y, z).setType(Material.AIR);
+ }
+ }
+ }
+ regions.remove(region);
+ }
+
+ public World getWorld() {
+ return world;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/interactable/Chest.java b/src/main/java/com/encrox/zombie/interactable/Chest.java
new file mode 100755
index 0000000..10045a2
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/interactable/Chest.java
@@ -0,0 +1,27 @@
+package com.encrox.zombie.interactable;
+
+import org.bukkit.block.BlockFace;
+import org.bukkit.util.BlockVector;
+
+public class Chest extends Interactable {
+
+ private BlockFace facing;
+
+ public Chest(BlockVector bv, int cost, BlockFace facing) {
+ super(bv, cost);
+ this.facing = facing;
+ }
+
+ public Chest(BlockVector bv, int cost, String facing) {
+ this(bv, cost, BlockFace.valueOf(facing));
+ }
+
+ public Chest(BlockVector bv, int cost) {
+ this(bv, cost, BlockFace.NORTH);
+ }
+
+ public BlockFace getFacing() {
+ return facing;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/interactable/Interactable.java b/src/main/java/com/encrox/zombie/interactable/Interactable.java
new file mode 100755
index 0000000..9bc4dc3
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/interactable/Interactable.java
@@ -0,0 +1,23 @@
+package com.encrox.zombie.interactable;
+
+import org.bukkit.util.BlockVector;
+
+public abstract class Interactable {
+
+ private BlockVector bv;
+ private int cost;
+
+ public Interactable(BlockVector bv, int cost) {
+ this.bv = bv;
+ this.cost = cost;
+ }
+
+ public int getCost() {
+ return cost;
+ }
+
+ public BlockVector getBlockVector() {
+ return bv;
+ }
+
+}
diff --git a/src/main/java/com/encrox/zombie/interactable/Lever.java b/src/main/java/com/encrox/zombie/interactable/Lever.java
new file mode 100755
index 0000000..4776f39
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/interactable/Lever.java
@@ -0,0 +1,38 @@
+package com.encrox.zombie.interactable;
+
+import org.bukkit.util.BlockVector;
+
+public class Lever extends Interactable {
+
+ private boolean toggle;
+ private Lever[] others;
+
+ public Lever(BlockVector bv, int cost, boolean toggle, Lever[] others) {
+ super(bv, cost);
+ this.toggle = toggle;
+ this.others = others;
+ }
+
+ public Lever(BlockVector bv, int cost, Lever[] others) {
+ this(bv, cost, false, others);
+ }
+
+ public Lever(BlockVector bv, int cost, boolean toggle) {
+ this(bv, cost, toggle, new Lever[0]);
+ }
+
+ public Lever(BlockVector bv, int cost) {
+ this(bv, cost, false);
+ }
+
+ public void toggle() {
+ toggle = !toggle;
+ for(int i = 0; i<others.length; i++)
+ others[i].toggle();
+ }
+
+ public boolean isToggled() {
+ return toggle;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/com/encrox/zombie/interactable/Powerup.java b/src/main/java/com/encrox/zombie/interactable/Powerup.java
new file mode 100755
index 0000000..e1ca0d2
--- /dev/null
+++ b/src/main/java/com/encrox/zombie/interactable/Powerup.java
@@ -0,0 +1,22 @@
+package com.encrox.zombie.interactable;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.BlockVector;
+
+public class Powerup extends Interactable {
+
+ private ItemStack item;
+
+ public Powerup(BlockVector bv, ItemStack item, int cost) {
+ super(bv, cost);
+ this.item = item;
+ }
+
+ public ItemStack getItem() {
+ return item;
+ }
+
+}
diff --git a/src/main/resources/config.json b/src/main/resources/config.json
new file mode 100755
index 0000000..d074011
--- /dev/null
+++ b/src/main/resources/config.json
@@ -0,0 +1,4 @@
+{
+ "locale": "en-GB",
+ "world": "instance"
+} \ No newline at end of file
diff --git a/src/main/resources/descriptor.json b/src/main/resources/descriptor.json
new file mode 100755
index 0000000..1852c2c
--- /dev/null
+++ b/src/main/resources/descriptor.json
@@ -0,0 +1,59 @@
+[
+ {
+ "file": "test.schematic",
+ "name": "testmap",
+ "players": 4,
+ "spawn": [ 2, 1, 2 ],
+ "pointMultiplier": 1.0,
+ "mobs": [
+ {
+ "position": [ 2, 1, 2 ],
+ "type": 54,
+ "rounds": "%round% == 1 || %round% == 2",
+ "levers": [ ]
+ },
+ {
+ "position": [ 2, 1, 2 ],
+ "type": 51,
+ "rounds": "%round% > 2",
+ "levers": [ 0 ]
+ }
+ ],
+ "chests": [
+ {
+ "position": [ 2, 1, 1 ],
+ "cost": 1000,
+ "facing": "SOUTH"
+ },
+ {
+ "position": [ 3, 1, 2 ],
+ "cost": 1000,
+ "facing": "WEST"
+ },
+ {
+ "position": [ 2, 1, 3 ],
+ "cost": 1000,
+ "facing": "NORTH"
+ }
+ ],
+ "powerups": [
+ {
+ "position": [ 3, 2, 2 ],
+ "item": "DIAMOND_SWORD",
+ "enchantment":
+ {
+ "type": "DAMAGE_ALL",
+ "level": 1
+ },
+ "cost": 100
+ }
+ ],
+ "levers": [
+ {
+ "position": [ 0, 0, 0 ],
+ "cost": 100,
+ "toggle": [ ]
+ }
+ ]
+ }
+] \ No newline at end of file
diff --git a/src/main/resources/lang/de-DE.properties b/src/main/resources/lang/de-DE.properties
new file mode 100755
index 0000000..fcce013
--- /dev/null
+++ b/src/main/resources/lang/de-DE.properties
@@ -0,0 +1,2 @@
+no_player=Dieser Befehl kann nur durch einen Spieler aufgefuehrt werden.
+no_permission=Du hast keine Rechte fuer diesen Befehl.
diff --git a/src/main/resources/lang/en-GB.properties b/src/main/resources/lang/en-GB.properties
new file mode 100755
index 0000000..c382408
--- /dev/null
+++ b/src/main/resources/lang/en-GB.properties
@@ -0,0 +1,28 @@
+no_player=This command can only be issued by a player.
+no_permission=You dont have permission for this command.
+lobby_create_success=Lobby has been created.
+lobby_create_identifier=A lobby with that identifier already exists.
+lobby_create_membership=You are already in a lobby.
+lobby_create_map=A map with that name does not exist.
+lobby_disbanded=Your lobby has been disbanded.
+lobby_leave_success=You have left the lobby.
+lobby_leave_membership=You are in no lobby.
+lobby_left=%player% left your lobby.
+lobby_joined=%player% joined your lobby.
+lobby_join_full=The specified lobby is full.
+lobby_join_identifier=A lobby with that identifier does not exist.
+lobby_join_success=You joined the lobby.
+lobby_list=List of lobbies:
+lobby_start_success=Game has been started.
+lobby_start_failed=You need to be the creator of a lobby to start a game.
+game_player_fell=%player% fell.
+game_revive_countdown=You got %seconds% seconds left to revive %player%.
+game_player_died=%player% died.
+game_player_revived=%player1% revived %player2%.
+game_round=Round %round% is starting.
+game_points_gained=You gained %points% points.
+game_points=You have %points% points.
+game_paid=You paid %amount% points for this.
+game_no_points=You dont have enough points for this. You need at least %amount%.
+game_impossible=That action is impossible. Youve been refunded.
+plugin_enchantment=The enchantment "%type%" is not applicable on the item "%item%". Ignoring. \ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100755
index 0000000..3d187bd
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,9 @@
+main: com.encrox.zombie.Zombie
+name: Zombie
+version: 1.0
+depend: [InstancedRegions]
+
+commands:
+ zombie:
+ description: Generic zombie command.
+ usage: /zombie help \ No newline at end of file
diff --git a/src/main/resources/schematics/test.schematic b/src/main/resources/schematics/test.schematic
new file mode 100755
index 0000000..1b32d4f
--- /dev/null
+++ b/src/main/resources/schematics/test.schematic
Binary files differ
diff --git a/target/classes/config.json b/target/classes/config.json
new file mode 100755
index 0000000..d074011
--- /dev/null
+++ b/target/classes/config.json
@@ -0,0 +1,4 @@
+{
+ "locale": "en-GB",
+ "world": "instance"
+} \ No newline at end of file
diff --git a/target/classes/descriptor.json b/target/classes/descriptor.json
new file mode 100755
index 0000000..1852c2c
--- /dev/null
+++ b/target/classes/descriptor.json
@@ -0,0 +1,59 @@
+[
+ {
+ "file": "test.schematic",
+ "name": "testmap",
+ "players": 4,
+ "spawn": [ 2, 1, 2 ],
+ "pointMultiplier": 1.0,
+ "mobs": [
+ {
+ "position": [ 2, 1, 2 ],
+ "type": 54,
+ "rounds": "%round% == 1 || %round% == 2",
+ "levers": [ ]
+ },
+ {
+ "position": [ 2, 1, 2 ],
+ "type": 51,
+ "rounds": "%round% > 2",
+ "levers": [ 0 ]
+ }
+ ],
+ "chests": [
+ {
+ "position": [ 2, 1, 1 ],
+ "cost": 1000,
+ "facing": "SOUTH"
+ },
+ {
+ "position": [ 3, 1, 2 ],
+ "cost": 1000,
+ "facing": "WEST"
+ },
+ {
+ "position": [ 2, 1, 3 ],
+ "cost": 1000,
+ "facing": "NORTH"
+ }
+ ],
+ "powerups": [
+ {
+ "position": [ 3, 2, 2 ],
+ "item": "DIAMOND_SWORD",
+ "enchantment":
+ {
+ "type": "DAMAGE_ALL",
+ "level": 1
+ },
+ "cost": 100
+ }
+ ],
+ "levers": [
+ {
+ "position": [ 0, 0, 0 ],
+ "cost": 100,
+ "toggle": [ ]
+ }
+ ]
+ }
+] \ No newline at end of file
diff --git a/target/classes/lang/de-DE.properties b/target/classes/lang/de-DE.properties
new file mode 100755
index 0000000..fcce013
--- /dev/null
+++ b/target/classes/lang/de-DE.properties
@@ -0,0 +1,2 @@
+no_player=Dieser Befehl kann nur durch einen Spieler aufgefuehrt werden.
+no_permission=Du hast keine Rechte fuer diesen Befehl.
diff --git a/target/classes/lang/en-GB.properties b/target/classes/lang/en-GB.properties
new file mode 100755
index 0000000..c382408
--- /dev/null
+++ b/target/classes/lang/en-GB.properties
@@ -0,0 +1,28 @@
+no_player=This command can only be issued by a player.
+no_permission=You dont have permission for this command.
+lobby_create_success=Lobby has been created.
+lobby_create_identifier=A lobby with that identifier already exists.
+lobby_create_membership=You are already in a lobby.
+lobby_create_map=A map with that name does not exist.
+lobby_disbanded=Your lobby has been disbanded.
+lobby_leave_success=You have left the lobby.
+lobby_leave_membership=You are in no lobby.
+lobby_left=%player% left your lobby.
+lobby_joined=%player% joined your lobby.
+lobby_join_full=The specified lobby is full.
+lobby_join_identifier=A lobby with that identifier does not exist.
+lobby_join_success=You joined the lobby.
+lobby_list=List of lobbies:
+lobby_start_success=Game has been started.
+lobby_start_failed=You need to be the creator of a lobby to start a game.
+game_player_fell=%player% fell.
+game_revive_countdown=You got %seconds% seconds left to revive %player%.
+game_player_died=%player% died.
+game_player_revived=%player1% revived %player2%.
+game_round=Round %round% is starting.
+game_points_gained=You gained %points% points.
+game_points=You have %points% points.
+game_paid=You paid %amount% points for this.
+game_no_points=You dont have enough points for this. You need at least %amount%.
+game_impossible=That action is impossible. Youve been refunded.
+plugin_enchantment=The enchantment "%type%" is not applicable on the item "%item%". Ignoring. \ No newline at end of file
diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml
new file mode 100755
index 0000000..3d187bd
--- /dev/null
+++ b/target/classes/plugin.yml
@@ -0,0 +1,9 @@
+main: com.encrox.zombie.Zombie
+name: Zombie
+version: 1.0
+depend: [InstancedRegions]
+
+commands:
+ zombie:
+ description: Generic zombie command.
+ usage: /zombie help \ No newline at end of file
diff --git a/target/classes/schematics/test.schematic b/target/classes/schematics/test.schematic
new file mode 100755
index 0000000..1b32d4f
--- /dev/null
+++ b/target/classes/schematics/test.schematic
Binary files differ
diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties
new file mode 100755
index 0000000..820b62c
--- /dev/null
+++ b/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Fri May 19 23:00:51 CEST 2017
+version=0.0.1-SNAPSHOT
+groupId=com.encrox
+artifactId=zombie
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100755
index 0000000..af3adfa
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,15 @@
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Misc.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Mob.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Lobby.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Zombie.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Map.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\interactable\Chest.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Commander.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\GameListener.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\ZombieWorld.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\interactable\Powerup.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Constants.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\interactable\Interactable.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Schematic.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\Game.java
+C:\Users\Superleo1810\workspace\zombie\src\main\java\com\encrox\zombie\interactable\Lever.java
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst