diff --git a/TeamVento.iml b/TeamVento.iml
new file mode 100644
index 0000000..c1fc520
--- /dev/null
+++ b/TeamVento.iml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..3dac417
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,87 @@
+
+
+ 4.0.0
+
+ eu.univento
+ TeamVento
+ 1.0-SNAPSHOT
+ jar
+
+ Univento.eu TeamVento
+ http://univento.eu
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.5.1
+
+
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2-beta-5
+
+
+
+ eu.univento.teamvento.TeamVento
+
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+
+
+
+ org.bukkit
+ craftbukkit
+ 1.9.2-R0.1-SNAPSHOT
+ provided
+
+
+ org.bukkit
+ bukkit
+ 1.9.2-R0.1-SNAPSHOT
+ provided
+
+
+ org.spigotmc
+ spigot-api
+ 1.9.2-R0.1-SNAPSHOT
+ provided
+
+
+ eu.univento
+ Core
+ 1.0-SNAPSHOT
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/Prebuild.java b/src/main/java/eu/univento/teamvento/commands/Prebuild.java
new file mode 100644
index 0000000..af99a19
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/Prebuild.java
@@ -0,0 +1,69 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.core.api.server.ServerSettings;
+import eu.univento.core.commands.Build;
+import eu.univento.teamvento.TeamVento;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class Prebuild extends AutoCommand {
+
+
+ public Prebuild(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if(p.isAllowed(Ranks.HeadBuilder)) {
+ if(args.length == 1) {
+ if(Bukkit.getPlayer(args[0]) != null) {
+ CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]));
+ if(Build.getPlayers().containsKey(t)) {
+ ItemStack[] content = Build.getPlayers().get(t);
+ t.getInventory().setContents(content);
+ Build.getPlayers().remove(t);
+ t.setGameMode(ServerSettings.getGameMode());
+ t.sendMessage(t.getMessages().PREFIX() + t.getMessages().Core_BUILD_OFF());
+ }else {
+ Build.getPlayers().put(t, t.getInventory().getContents());
+ t.sendMessage(t.getMessages().PREFIX() + t.getMessages().Core_BUILD_ON());
+ t.getInventory().clear();
+ t.setGameMode(GameMode.CREATIVE);
+ t.teleport(Bukkit.getWorld("vorbauen").getSpawnLocation());
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NOT_ONLINE(args[0]));
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cplease use /prebuild ");
+ }
+ }else{
+ p.sendMessage(p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/Set.java b/src/main/java/eu/univento/teamvento/commands/Set.java
new file mode 100644
index 0000000..77ce9f4
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/Set.java
@@ -0,0 +1,75 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.map.Cuboid;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import eu.univento.teamvento.utils.WorldEdit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class Set extends AutoCommand{
+
+ public Set(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if(p.isAllowed(Ranks.Builder)) {
+ Material material;
+ if(args.length == 0) {
+ material = p.getInventory().getItemInMainHand().getType();
+ setBlocks(material, p);
+ }
+ if(args.length == 1) {
+ if(Material.getMaterial(args[0]) != null) {
+ material = Material.getMaterial(args[0]);
+ setBlocks(material, p);
+ }else{
+ int id = Integer.parseInt(args[0]);
+ material = Material.getMaterial(id);
+ setBlocks(material, p);
+ }
+
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cYou need to give me some kind of stuff");
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+
+ void setBlocks(Material material, CustomPlayer p) {
+ if(material.isBlock()) {
+ Cuboid cb = new Cuboid(WorldEdit.getPos1(p).getLocation(), WorldEdit.getPos2(p).getLocation());
+ for(Block b : cb.getBlocks()) {
+ b.setType(material);
+ }
+ p.sendMessage(p.getMessages().PREFIX() + "§ayou have changed the material of the blocks");
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cthe item needs to be a block");
+ }
+ }
+}
diff --git a/src/main/java/eu/univento/teamvento/commands/Setloc.java b/src/main/java/eu/univento/teamvento/commands/Setloc.java
new file mode 100644
index 0000000..0feba29
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/Setloc.java
@@ -0,0 +1,59 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.Config;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.2
+ */
+public class Setloc extends AutoCommand{
+
+ /**
+ * @param plugin main class
+ * @param command command to execute
+ * @param description describes the command
+ * @param aliases aliases of command
+ */
+ public Setloc(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ Messages msgs = new Messages(p);
+ if(p.isAllowed(Ranks.Admin)) {
+ if(args.length == 1) {
+ Config.write("Build.Locs." + args[0], p.getLocation());
+ p.sendMessage("§aLocation gesetzt");
+ System.out.println("Location gesetzt " + args[0]);
+ }else {
+ p.sendMessage("§6Nutze /setloc ");
+ }
+ }else {
+ p.sendMessage(msgs.NO_PERMS());
+ }
+ }else {
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return false;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ List list = new ArrayList<>();
+ list.add("Spawn");
+ return list;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldCreate.java b/src/main/java/eu/univento/teamvento/commands/WorldCreate.java
new file mode 100644
index 0000000..c99af52
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/WorldCreate.java
@@ -0,0 +1,78 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import eu.univento.teamvento.utils.VoidGenerator;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.WorldCreator;
+import org.bukkit.WorldType;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class WorldCreate extends AutoCommand{
+
+ public WorldCreate(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if(p.isAllowed(Ranks.HeadBuilder)) {
+ if(args.length == 2) {
+ if(Bukkit.getWorld(args[0]) == null && (args[1].equalsIgnoreCase("normal") || args[1].equalsIgnoreCase("flat") || args[1].equalsIgnoreCase("void"))) {
+ WorldCreator creator = new WorldCreator(args[0]);
+ if(args[1].equalsIgnoreCase("normal")) {
+ creator.environment(World.Environment.NORMAL);
+ creator.type(WorldType.NORMAL);
+ }
+ if(args[1].equalsIgnoreCase("flat")) {
+ creator.environment(World.Environment.NORMAL);
+ creator.type(WorldType.FLAT);
+ creator.generateStructures(false);
+ }
+ if(args[1].equalsIgnoreCase("void")) {
+ creator.generator(new VoidGenerator());
+ creator.type(WorldType.CUSTOMIZED);
+ creator.generateStructures(false);
+ }
+ Bukkit.createWorld(creator);
+ TeamVento.getCfg().set("worlds", TeamVento.getCfg().getStringList("worlds").add(args[0]));
+ try {
+ TeamVento.getCfg().save(TeamVento.getConfigFile());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ p.sendMessage(p.getMessages().PREFIX() + "§aYour world has been created");
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cPlease use /worldcreate ");
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cPlease use /worldcreate ");
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldImport.java b/src/main/java/eu/univento/teamvento/commands/WorldImport.java
new file mode 100644
index 0000000..ddae73a
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/WorldImport.java
@@ -0,0 +1,60 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import org.bukkit.Bukkit;
+import org.bukkit.WorldCreator;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class WorldImport extends AutoCommand{
+
+ public WorldImport(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if (p.isAllowed(Ranks.HeadBuilder)) {
+ if(args.length == 1) {
+ if(Bukkit.getWorld(args[0]) == null) {
+ Bukkit.createWorld(new WorldCreator(args[0]));
+ TeamVento.getCfg().set("worlds", TeamVento.getCfg().getStringList("worlds").add(args[0]));
+ try {
+ TeamVento.getCfg().save(TeamVento.getConfigFile());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ p.sendMessage(p.getMessages().PREFIX() + "§ayour world has been imported");
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cthe chosen world already exists");
+ }
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cplease use /worldimport ");
+ }
+ }else{
+ p.sendMessage(p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldList.java b/src/main/java/eu/univento/teamvento/commands/WorldList.java
new file mode 100644
index 0000000..b5022cc
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/WorldList.java
@@ -0,0 +1,45 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class WorldList extends AutoCommand {
+
+ public WorldList(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if(p.isAllowed(Ranks.Supporter)) {
+ p.sendMessage("§cAll worlds");
+ for(String world : TeamVento.getCfg().getStringList("worlds")) {
+ p.sendMessage("§a- " + world);
+ }
+ }else{
+ p.sendMessage(p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldTP.java b/src/main/java/eu/univento/teamvento/commands/WorldTP.java
new file mode 100644
index 0000000..25197e8
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/commands/WorldTP.java
@@ -0,0 +1,52 @@
+package eu.univento.teamvento.commands;
+
+import eu.univento.core.api.AutoCommand;
+import eu.univento.core.api.languages.Messages;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.TeamVento;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class WorldTP extends AutoCommand{
+
+ public WorldTP(TeamVento plugin, String command, String description, String... aliases) {
+ super(plugin, command, description, aliases);
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String label, String[] args) {
+ if(sender instanceof Player) {
+ CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
+ if(p.isAllowed(Ranks.Supporter)) {
+ if(args.length == 1) {
+ if(Bukkit.getWorld(args[0]) != null) {
+ p.teleport(Bukkit.getWorld(args[0]).getSpawnLocation());
+ p.sendMessage(p.getMessages().PREFIX() + "§aDu hast die Welt gewechselt");
+ }else{
+ p.sendMessage(p.getMessages().PREFIX() + "§cDie Welt " + args[0] + " exsistiert nicht");
+ }
+ }else {
+ p.sendMessage(p.getMessages().PREFIX() + "§cDie Anzahl der Argumente stimmt nicht");
+ }
+ }else{
+ p.sendMessage(p.getMessages().NO_PERMS());
+ }
+ }else{
+ sender.sendMessage(Messages.Console.NOT_A_PLAYER);
+ }
+ return true;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String label, String[] args) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/listener/Events.java b/src/main/java/eu/univento/teamvento/listener/Events.java
new file mode 100644
index 0000000..5650663
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/listener/Events.java
@@ -0,0 +1,65 @@
+package eu.univento.teamvento.listener;
+
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.utils.PlotManager;
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
+
+/**
+ * @author joethei
+ * @version 0.2
+ */
+public class Events implements Listener{
+
+ @EventHandler
+ public void onWeatherChange(WeatherChangeEvent e) {
+ e.setCancelled(true);
+ }
+
+
+ @EventHandler
+ public void onTramp(PlayerInteractEvent e) {
+ if(e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL) {
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler
+ public void onEntityExplode(EntityExplodeEvent e) {
+ e.blockList().clear();
+ }
+
+ @EventHandler
+ public void onBlockBreak(BlockBreakEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ if(PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
+ if(!p.isAllowed(Ranks.Builder)) {
+ e.setCancelled(true);
+ }
+ }
+ else if(!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) {
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler
+ public void onBlockPlace(BlockPlaceEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ if(PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
+ if(!p.isAllowed(Ranks.Builder)) {
+ e.setCancelled(true);
+ }
+ }
+ else if(!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) {
+ e.setCancelled(true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/listener/JoinQuit.java b/src/main/java/eu/univento/teamvento/listener/JoinQuit.java
new file mode 100644
index 0000000..f1439c5
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/listener/JoinQuit.java
@@ -0,0 +1,39 @@
+package eu.univento.teamvento.listener;
+
+import eu.univento.core.api.Config;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class JoinQuit implements Listener {
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ e.setJoinMessage(null);
+ if(p.getRank() == Ranks.Builder || p.getRank() == Ranks.HeadBuilder) {
+ Bukkit.broadcastMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
+ }else {
+ p.teleport(Config.readLocation("Build.Locs.Spawn"));
+ }
+ p.setCollidable(false);
+ }
+
+ @EventHandler
+ public void onQuit(PlayerQuitEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ if(p.getRank() == Ranks.Builder || p.getRank() == Ranks.HeadBuilder)
+ e.setQuitMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
+ else
+ e.setQuitMessage(null);
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/listener/PositionSetter.java b/src/main/java/eu/univento/teamvento/listener/PositionSetter.java
new file mode 100644
index 0000000..22fd361
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/listener/PositionSetter.java
@@ -0,0 +1,36 @@
+package eu.univento.teamvento.listener;
+
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.core.api.player.Ranks;
+import eu.univento.teamvento.utils.WorldEdit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class PositionSetter implements Listener{
+
+ @EventHandler
+ public void onInteract(PlayerInteractEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ Block b = e.getClickedBlock();
+ ItemStack item = p.getInventory().getItemInMainHand();
+ if (p.isAllowed(Ranks.Builder)) {
+ if(e.getAction() == Action.LEFT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
+ WorldEdit.setPos1(p, b);
+ p.sendMessage(p.getMessages().PREFIX() + "§aset pos1");
+ }
+ if(e.getAction() == Action.RIGHT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
+ WorldEdit.setPos2(p, b);
+ p.sendMessage(p.getMessages().PREFIX() + "§aset pos2");
+ }
+ }
+ }
+}
diff --git a/src/main/java/eu/univento/teamvento/listener/SignInteract.java b/src/main/java/eu/univento/teamvento/listener/SignInteract.java
new file mode 100644
index 0000000..c17c406
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/listener/SignInteract.java
@@ -0,0 +1,29 @@
+package eu.univento.teamvento.listener;
+
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.teamvento.utils.PlotManager;
+import org.bukkit.block.Sign;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.player.PlayerInteractEvent;
+
+public class SignInteract implements Listener {
+
+ @EventHandler
+ public void onInteract(PlayerInteractEvent e) {
+ CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
+ if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ if(e.getClickedBlock() instanceof Sign) {
+ Sign sign = (Sign) e.getClickedBlock();
+ if(sign.getLine(0).equalsIgnoreCase("teleport")) {
+ if(PlotManager.hasPlot(p)) {
+ p.teleport(PlotManager.getPlotByPlayer(p).getSpawn());
+ }else{
+
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/utils/Plot.java b/src/main/java/eu/univento/teamvento/utils/Plot.java
new file mode 100644
index 0000000..3bd3c44
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/utils/Plot.java
@@ -0,0 +1,45 @@
+package eu.univento.teamvento.utils;
+
+import eu.univento.core.api.map.Cuboid;
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.Location;
+
+import java.util.UUID;
+
+public class Plot {
+
+ private Cuboid area;
+ private UUID owner;
+ private Location spawn;
+
+ public Plot(Cuboid area, UUID owner, Location spawn) {
+ this.area = area;
+ this.owner = owner;
+ this.spawn = spawn;
+ }
+
+ public boolean isInPlot(Location location) {
+ return area.containsLocation(location);
+ }
+
+ public boolean isInPlot(CustomPlayer player) {
+ return area.containsLocation(player.getLocation());
+ }
+
+ public boolean isOwner(CustomPlayer p) {
+ return p.getUniqueId().equals(owner);
+ }
+
+ public Cuboid getArea() {
+ return area;
+ }
+
+ public UUID getOwner() {
+ return owner;
+ }
+
+ public Location getSpawn() {
+ return spawn;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/utils/PlotManager.java b/src/main/java/eu/univento/teamvento/utils/PlotManager.java
new file mode 100644
index 0000000..cf07cd0
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/utils/PlotManager.java
@@ -0,0 +1,112 @@
+package eu.univento.teamvento.utils;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.CursorType;
+import com.mongodb.client.FindIterable;
+import eu.univento.core.Core;
+import eu.univento.core.api.map.Cuboid;
+import eu.univento.core.api.player.CustomPlayer;
+import eu.univento.teamvento.TeamVento;
+import org.bson.Document;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class PlotManager {
+
+ private static ArrayList plots = new ArrayList<>();
+
+ public static void update() {
+ FindIterable cursor = Core.getMongoDB().getDatabase().getCollection("plots").find();
+ for(Document doc : cursor) {
+ String uuid = doc.getString("uuid");
+ Plot plot = new Plot(new Cuboid(getLocation(uuid, "minPos"), getLocation(uuid, "maxPos")), UUID.fromString(uuid), getLocation(uuid, "Spawn"));
+ plots.add(plot);
+ }
+ }
+
+ public static Plot getPlotByPlayer(CustomPlayer p) {
+ for(Plot plot : plots) {
+ if(plot.isOwner(p)) return plot;
+ }
+ return null;
+ }
+
+ public static boolean hasPlot(CustomPlayer p) {
+ return getPlotByPlayer(p) != null;
+ }
+
+ public static void generatePlot(Plot plot) {
+ Cuboid area = plot.getArea();
+ area.getUpperLocation().setY(plot.getArea().getLowerY());
+ int i = 0;
+ for(Block b : area.getBlocks()) {
+ i++;
+ Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), () -> b.setType(Material.GRASS), i * 20L);
+ }
+
+ }
+
+ public static void createPlot(Plot plot) {
+ Document doc = new Document("uuid", plot.getOwner().toString());
+
+ HashMap maxPos = new HashMap<>();
+ maxPos.put("X", plot.getArea().getUpperX());
+ maxPos.put("Y", plot.getArea().getUpperY());
+ maxPos.put("Z", plot.getArea().getUpperZ());
+
+ HashMap minPos = new HashMap<>();
+ minPos.put("X", plot.getArea().getLowerX());
+ minPos.put("Y", plot.getArea().getLowerY());
+ minPos.put("Z", plot.getArea().getLowerZ());
+
+ HashMap spawn = new HashMap<>();
+ spawn.put("X", plot.getSpawn().getX());
+ spawn.put("Y", plot.getSpawn().getY());
+ spawn.put("Z", plot.getSpawn().getZ());
+ spawn.put("Yaw", plot.getSpawn().getYaw());
+ spawn.put("Pitch", plot.getSpawn().getPitch());
+
+ doc.put("maxPos", new BasicDBObject(maxPos));
+ doc.put("minPos", new BasicDBObject(minPos));
+ doc.put("Spawn", new BasicDBObject(spawn));
+
+ Core.getMongoDB().getDatabase().getCollection("plots").insertOne(doc);
+ }
+
+ public static Plot getPlotByLocation(Location location) {
+ for(Plot plot : plots) {
+ if(plot.isInPlot(location)) return plot;
+ }
+ return null;
+ }
+
+ private static Location getLocation(String uuid, String name) {
+ Map map = getMapFromDatabase(uuid, "Pos");
+ if(map.containsKey("Yaw"))
+ return new Location(Bukkit.getWorld("plots"), (double)map.get("X"), (double)map.get("Y"), (double)map.get("Z"), (float)map.get("Yaw"), (float)map.get("Pitch"));
+ else
+ return new Location(Bukkit.getWorld("plots"), (double) map.get("X"), (double) map.get("Y"), (double) map.get("Z"));
+ }
+
+ private static Object getObjectFromDatbase(String uuid, String name) {
+ FindIterable cursor = Core.getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
+ cursor.cursorType(CursorType.NonTailable);
+
+ Document doc = cursor.first();
+ if (doc == null) return null;
+
+ return doc.get(name);
+ }
+
+ private static Map getMapFromDatabase(String uuid, String name) {
+ return (Map) getObjectFromDatbase(uuid, name);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/utils/VoidGenerator.java b/src/main/java/eu/univento/teamvento/utils/VoidGenerator.java
new file mode 100644
index 0000000..edbafe0
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/utils/VoidGenerator.java
@@ -0,0 +1,30 @@
+package eu.univento.teamvento.utils;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.generator.BlockPopulator;
+import org.bukkit.generator.ChunkGenerator;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+public class VoidGenerator extends ChunkGenerator{
+
+ public List getDefaultPopulators(World world) {
+ return Arrays.asList(new BlockPopulator[0]);
+ }
+
+ public boolean canSpawn(World world, int x, int z) {
+ return true;
+ }
+
+ public byte[] generate(World world, Random random, int chunkX, int chunkZ) {
+ return new byte[32768];
+ }
+
+ public Location getFixedSpawnLocation(World world, Random random) {
+ return new Location(world, 0, 128, 0);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/utils/WorldEdit.java b/src/main/java/eu/univento/teamvento/utils/WorldEdit.java
new file mode 100644
index 0000000..76c15b6
--- /dev/null
+++ b/src/main/java/eu/univento/teamvento/utils/WorldEdit.java
@@ -0,0 +1,42 @@
+package eu.univento.teamvento.utils;
+
+import eu.univento.core.api.player.CustomPlayer;
+import org.bukkit.block.Block;
+
+import java.util.HashMap;
+
+/**
+ * @author joethei
+ * @version 0.1
+ */
+public class WorldEdit {
+
+ private static HashMap pos1 = new HashMap<>();
+ private static HashMap pos2 = new HashMap<>();
+
+ public static Block getPos1(CustomPlayer p) {
+ return pos1.containsKey(p) ? pos1.get(p) : null;
+ }
+
+ public static Block getPos2(CustomPlayer p) {
+ return pos2.containsKey(p) ? pos2.get(p) : null;
+ }
+
+ public static void setPos1(CustomPlayer p, Block b) {
+ if(pos1.containsKey(p)) {
+ pos1.remove(p);
+ }
+ pos1.put(p, b);
+ }
+
+ public static void setPos2(CustomPlayer p, Block b) {
+ if(pos2.containsKey(p)) {
+ pos2.remove(p);
+ }
+ pos2.put(p, b);
+ }
+
+ public static boolean hasSetPos(CustomPlayer p) {
+ return pos1.containsKey(p) && pos2.containsKey(p);
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
new file mode 100644
index 0000000..517bf96
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,6 @@
+main: eu.univento.teamvento.TeamVento
+name: TeamVento
+version: 0.1
+author: joethei
+website: http://univento.eu/team/TeamVento
+description: Plugin for univento build server
\ No newline at end of file