+ 1.11 Update

This commit is contained in:
Johannes Theiner 2016-11-24 20:00:03 +01:00
parent 140f8dc0d0
commit dab8184020
14 changed files with 244 additions and 398 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module com.demonwav.mcdev.MinecraftModuleTypes="PAPER_MODULE_TYPE" org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
@ -11,42 +11,34 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.15" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="CloudCommons" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="Commons" /> <orderEntry type="module" module-name="Core" scope="PROVIDED" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.8" level="project" /> <orderEntry type="module" module-name="Commons" scope="PROVIDED" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.9.4" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TheHolyWaffle:TeamSpeak-3-Java-API:v1.0.13" level="project" />
<orderEntry type="library" name="Maven: com.github.theholywaffle:teamspeak3-api:1.0.14-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
<orderEntry type="module" module-name="Core" /> <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="module-library">
<library name="Maven: eu.the5zig.mod:mod:1.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/../Core/local-maven-repo/The5zigMod.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component> </component>
</module> </module>

35
pom.xml
View File

@ -51,39 +51,48 @@
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>univentoEU</id>
<url>http://dev.joethei.de:8081/repository/public/</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>CloudCommons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>eu.univento</groupId> <groupId>eu.univento</groupId>
<artifactId>Core</artifactId> <artifactId>Core</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -18,8 +18,9 @@ import java.io.File;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class TeamVento extends JavaPlugin { public class TeamVento extends JavaPlugin {
private static final File file = new File("plugins/Core", "worlds.yml"); private static final File file = new File("plugins/Core", "worlds.yml");

View File

@ -77,8 +77,12 @@ public class Events implements Listener{
@EventHandler @EventHandler
public void onHangingBreakByEntity(HangingBreakByEntityEvent e) { public void onHangingBreakByEntity(HangingBreakByEntityEvent e) {
if(e.getRemover() instanceof Projectile) { if(e.getRemover() instanceof Projectile) {
if(((Projectile) e.getRemover()).getShooter() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter()); CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter());
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true); if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
}else {
e.setCancelled(true);
}
} }
if(e.getRemover() instanceof Player) { if(e.getRemover() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getRemover()); CustomPlayer p = CustomPlayer.getPlayer((Player) e.getRemover());
@ -95,8 +99,12 @@ public class Events implements Listener{
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true); if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
} }
if(e.getDamager() instanceof Projectile) { if(e.getDamager() instanceof Projectile) {
if(((Projectile) e.getDamager()).getShooter() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter()); CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter());
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true); if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
}else {
e.setCancelled(true);
}
} }
} }

View File

@ -7,7 +7,7 @@ import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento; import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.Plot; import eu.univento.teamvento.utils.Plot;
import eu.univento.teamvento.utils.PlotManager; import eu.univento.teamvento.utils.PlotManager;
import net.minecraft.server.v1_10_R1.EnumParticle; import net.minecraft.server.v1_11_R1.EnumParticle;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -56,7 +56,7 @@ public class JoinQuit implements Listener {
Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> p.playParticle(Config.readLocation("Build.Locs.Holo").add(0.0D, 1.0D, 0.0D), EnumParticle.SPELL_WITCH, 0.4F, 10), 20L, 5L); Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> p.playParticle(Config.readLocation("Build.Locs.Holo").add(0.0D, 1.0D, 0.0D), EnumParticle.SPELL_WITCH, 0.4F, 10), 20L, 5L);
Hologram holo = new Hologram(text, Config.readLocation("Build.Locs.Holo")); Hologram holo = new Hologram(new ItemStack(Material.GRASS), text, Config.readLocation("Build.Locs.Holo"));
holograms.put(p, holo); holograms.put(p, holo);
holo.showPlayer(p); holo.showPlayer(p);
} }

View File

@ -9,7 +9,6 @@ import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.utils.UUIDFetcher; import eu.univento.core.api.utils.UUIDFetcher;
import eu.univento.teamvento.TeamVento; import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.*; import eu.univento.teamvento.utils.*;
import net.gpedro.integrations.slack.SlackApi;
import net.gpedro.integrations.slack.SlackMessage; import net.gpedro.integrations.slack.SlackMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -33,10 +32,10 @@ public class MenuEvents implements Listener{
@EventHandler @EventHandler
public void onInteract(PlayerInteractEvent e) { public void onInteract(PlayerInteractEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
Inventorys invs = new Inventorys(p); InventoryManager inventoryManager = new InventoryManager(p);
if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) { if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
if(p.getItemInHand().getType() == Material.WATCH && p.getItemInHand().getItemMeta().getDisplayName().equals("§eErweiterungen")) { if(p.getItemInHand().getType() == Material.WATCH && p.getItemInHand().getItemMeta().getDisplayName().equals("§eErweiterungen")) {
p.openInventory(invs.getMainInventory()); p.openInventory(inventoryManager.getMainInventory());
} }
} }
} }
@ -44,7 +43,7 @@ public class MenuEvents implements Listener{
@EventHandler @EventHandler
public void onInventoryClick(InventoryClickEvent e) { public void onInventoryClick(InventoryClickEvent e) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked()); CustomPlayer p = CustomPlayer.getPlayer((Player) e.getWhoClicked());
Inventorys invs = new Inventorys(p); InventoryManager inventoryManager = new InventoryManager(p);
if(e.isShiftClick() && e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eErweiterungen")) e.setCancelled(true); if(e.isShiftClick() && e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eErweiterungen")) e.setCancelled(true);
if(!PlotManager.hasPlot(p)) return; if(!PlotManager.hasPlot(p)) return;
if(e.getCurrentItem() == null) return; if(e.getCurrentItem() == null) return;
@ -52,17 +51,13 @@ public class MenuEvents implements Listener{
if(!e.getCurrentItem().getItemMeta().hasDisplayName()) return; if(!e.getCurrentItem().getItemMeta().hasDisplayName()) return;
Plot plot = PlotManager.getPlotByPlayer(p); Plot plot = PlotManager.getPlotByPlayer(p);
assert plot != null; assert plot != null;
if(e.getInventory().getName().equals(invs.getMainInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getMainInventory().getName())) {
e.setCancelled(true); e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.BED) { if(e.getCurrentItem().getType() == Material.BED) {
p.closeInventory(); p.closeInventory();
Location loc = plot.getSpawn(); Location loc = plot.getSpawn();
p.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F)); p.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F));
} }
if(e.getCurrentItem().getType() == Material.LEASH) {
p.closeInventory();
p.openInventory(invs.getAnimalsInventory());
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§ePlot zurücksetzen")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§ePlot zurücksetzen")) {
PlotManager.resetPlot(plot); PlotManager.resetPlot(plot);
p.closeInventory(); p.closeInventory();
@ -70,25 +65,25 @@ public class MenuEvents implements Listener{
if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eFertig")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eFertig")) {
p.closeInventory(); p.closeInventory();
if(plot.hasName() && plot.hasContact()) if(plot.hasName() && plot.hasContact())
p.openInventory(invs.getReadyInventory()); p.openInventory(inventoryManager.getReadyInventory());
else else
p.sendMessage("§cName und Kontaktinformationen müssen angegeben werden"); p.sendMessage("§cName und Kontaktinformationen müssen angegeben werden");
} }
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eBiom ändern")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eBiom ändern")) {
p.closeInventory(); p.closeInventory();
p.openInventory(invs.getBiomeInventory()); p.openInventory(inventoryManager.getBiomeInventory());
} }
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eWetter ändern")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eWetter ändern")) {
p.closeInventory(); p.closeInventory();
p.openInventory(invs.getWeatherInventory()); p.openInventory(inventoryManager.getWeatherInventory());
} }
if(e.getCurrentItem().getType() == Material.WATCH) { if(e.getCurrentItem().getType() == Material.WATCH) {
p.closeInventory(); p.closeInventory();
p.openInventory(invs.getTimeInventory()); p.openInventory(inventoryManager.getTimeInventory());
} }
if(e.getCurrentItem().getType() == Material.LADDER) { if(e.getCurrentItem().getType() == Material.LADDER) {
p.closeInventory(); p.closeInventory();
p.openInventory(invs.getSettingsInventory()); p.openInventory(inventoryManager.getSettingsInventory());
} }
if(e.getCurrentItem().getType() == Material.MINECART) { if(e.getCurrentItem().getType() == Material.MINECART) {
p.closeInventory(); p.closeInventory();
@ -97,28 +92,27 @@ public class MenuEvents implements Listener{
ArrayList<ItemStack> items = new ArrayList<>(); ArrayList<ItemStack> items = new ArrayList<>();
for(Plot plots : PlotManager.getPlots()) { for(Plot plots : PlotManager.getPlots()) {
String name = UUIDFetcher.getName(plots.getOwner()); String name = UUIDFetcher.getName(plots.getOwner());
items.add(new ItemBuilder(Material.SKULL_ITEM).durability().skullOwner(name).name("§e" + plots.getName()).lore("§evon " + name).make()); items.add(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(name).name("§e" + plots.getName()).lore("§evon " + name).make());
} }
inventory.setPages(items); inventory.setPages(items);
inventory.openInventory(); inventory.openInventory();
}); });
} }
} }
if(e.getInventory().getName().equals(invs.getReadyInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getReadyInventory().getName())) {
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Ja")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Ja")) {
p.closeInventory(); p.closeInventory();
plot.setReady(); plot.setReady();
p.getInventory().remove(p.getInventory().getItem(8)); p.getInventory().remove(p.getInventory().getItem(8));
Core.getOnlinePlayers().stream().filter(player -> player.getDatabasePlayer().isAllowed(Rank.Builder)).forEach(player -> player.sendMessage("§a[Plot]§e" + p.getName() + " ist fertig")); Core.getOnlinePlayers().stream().filter(player -> player.getDatabasePlayer().isAllowed(Rank.Builder)).forEach(player -> player.sendMessage("§a[Plot]§e" + p.getName() + " ist fertig"));
SlackApi api = new SlackApi("https://hooks.slack.com/services/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");
SlackMessage message = new SlackMessage("#bauevent", p.getName(), " ist nun fertig mit bauen"); SlackMessage message = new SlackMessage("#bauevent", p.getName(), " ist nun fertig mit bauen");
message.setIcon("http://cravatar.eu/head/" + p.getUniqueId().toString()); message.setIcon("http://cravatar.eu/head/" + p.getUniqueId().toString());
api.call(message); Core.getCommons().getSlackHandler().getSlackAPI().call(message);
} }
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Nein")) if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Nein"))
p.closeInventory(); p.closeInventory();
} }
if(e.getInventory().getName().equals(invs.getBiomeInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getBiomeInventory().getName())) {
e.setCancelled(true); e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.WATER_LILY) { if(e.getCurrentItem().getType() == Material.WATER_LILY) {
p.closeInventory(); p.closeInventory();
@ -153,7 +147,7 @@ public class MenuEvents implements Listener{
plot.setBiome(Biome.JUNGLE); plot.setBiome(Biome.JUNGLE);
} }
} }
if(e.getInventory().getName().equals(invs.getTimeInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getTimeInventory().getName())) {
e.setCancelled(true); e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.MILK_BUCKET) { if(e.getCurrentItem().getType() == Material.MILK_BUCKET) {
p.closeInventory(); p.closeInventory();
@ -176,7 +170,7 @@ public class MenuEvents implements Listener{
if(plot.isInPlot(p.getLocation()))p.setPlayerTime(Time.NIGHT.getValue(), false); if(plot.isInPlot(p.getLocation()))p.setPlayerTime(Time.NIGHT.getValue(), false);
} }
} }
if(e.getInventory().getName().equals(invs.getWeatherInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getWeatherInventory().getName())) {
e.setCancelled(true); e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.DOUBLE_PLANT) { if(e.getCurrentItem().getType() == Material.DOUBLE_PLANT) {
p.closeInventory(); p.closeInventory();
@ -194,45 +188,45 @@ public class MenuEvents implements Listener{
if(plot.isInPlot(p.getLocation()))p.setPlayerWeather(WeatherType.DOWNFALL); if(plot.isInPlot(p.getLocation()))p.setPlayerWeather(WeatherType.DOWNFALL);
} }
} }
if(e.getInventory().getName().equals(invs.getSettingsInventory().getName())) { if(e.getInventory().getName().equals(inventoryManager.getSettingsInventory().getName())) {
e.setCancelled(true); e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.SIGN) { if(e.getCurrentItem().getType() == Material.SIGN) {
AnvilGUI gui = new AnvilGUI(p, event -> { AnvilGUI gui = new AnvilGUI(p, event -> {
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) { if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
event.setWillClose(); event.setWillClose(true);
event.setWillDestroy(); event.setWillDestroy(true);
plot.setName(event.getName()); plot.setName(event.getName());
p.refreshExperience(); p.refreshExperience();
}else{ }else{
event.setWillDestroy(); event.setWillDestroy(true);
event.setWillClose(); event.setWillClose(true);
} }
}); });
ItemStack name = new ItemStack(Material.SIGN); ItemStack name = new ItemStack(Material.SIGN);
ItemMeta nameMeta = name.getItemMeta(); ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName(plot.getName() == null ? "§cunbennantes Plot" : plot.getName()); nameMeta.setDisplayName(plot.getName() == null ? "§cunbennantes Plot" : plot.getName());
name.setItemMeta(nameMeta); name.setItemMeta(nameMeta);
gui.setSlot(name); gui.setSlot(AnvilGUI.AnvilSlot.INPUT_RIGHT, name);
gui.open(); gui.open();
} }
if(e.getCurrentItem().getType() == Material.NAME_TAG) { if(e.getCurrentItem().getType() == Material.NAME_TAG) {
AnvilGUI gui = new AnvilGUI(p, event -> { AnvilGUI gui = new AnvilGUI(p, event -> {
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) { if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
event.setWillClose(); event.setWillClose(true);
event.setWillDestroy(); event.setWillDestroy(true);
plot.setContact(event.getName()); plot.setContact(event.getName());
p.refreshExperience(); p.refreshExperience();
}else{ }else{
event.setWillDestroy(); event.setWillDestroy(true);
event.setWillClose(); event.setWillClose(true);
} }
}); });
ItemStack name = new ItemStack(Material.NAME_TAG); ItemStack name = new ItemStack(Material.NAME_TAG);
ItemMeta nameMeta = name.getItemMeta(); ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName(plot.getContact() == null ? "§cKontaktdaten" : plot.getContact()); nameMeta.setDisplayName(plot.getContact() == null ? "§cKontaktdaten" : plot.getContact());
name.setItemMeta(nameMeta); name.setItemMeta(nameMeta);
gui.setSlot(name); gui.setSlot(AnvilGUI.AnvilSlot.INPUT_RIGHT, name);
gui.open(); gui.open();
} }

View File

@ -43,23 +43,23 @@ public class SignInteract implements Listener {
int z = midZ; int z = midZ;
int f = 1; int f = 1;
List<Point> points = new ArrayList<>(); List<Point> points = new ArrayList<>();
while(f <= radius * 2) { // der Radius ist Länge der Strecke zwischen dem Rand und dem Mittelpunkt ohne die Mitte selbst, in deinem Beispiel 2. while(f <= radius * 2) {
for(int e = z + f; z < e; z++) { // nach oben for(int e = z + f; z < e; z++) {
points.add(new Point(x, z)); points.add(new Point(x, z));
} }
for(int e = x + f; x < e; x++) { // nach rechts for(int e = x + f; x < e; x++) {
points.add(new Point(x, z)); points.add(new Point(x, z));
} }
f++; // die Linie muss ja eins länger sein, sonst würde es sich überschneiden f++;
for(int e = z - f; z > e; z--) { // nach unten for(int e = z - f; z > e; z--) {
points.add(new Point(x, z)); points.add(new Point(x, z));
} }
for(int e = x - f; x > e; x--) { // nach links for(int e = x - f; x > e; x--) {
points.add(new Point(x, z)); points.add(new Point(x, z));
} }
f++; // dasselbe wie oben f++;
} // dann alles von vorne, bis man in der unteren linken Ecke mit dem vorgegebenen Radius angelangt ist. }
for(int e = z + f - 1; z < e; z++) { // nach oben damit die Spirale fertigestellt wird for(int e = z + f - 1; z < e; z++) {
points.add(new Point(x, z)); points.add(new Point(x, z));
} }
for(Point point : points) for(Point point : points)

View File

@ -0,0 +1,111 @@
package eu.univento.teamvento.utils;
import eu.univento.core.api.items.ItemBuilder;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye;
/**
* @author joethei
* @version 1.0
*/
public class InventoryManager {
private final CustomPlayer player;
public InventoryManager(CustomPlayer player) {
this.player = player;
}
public Inventory getMainInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eGrundstücksverwaltung");
inv.setItem(0, new ItemBuilder(Material.MINECART).name("§eZu anderen Plots teleportieren").make());
inv.setItem(2, new ItemBuilder(Material.DOUBLE_PLANT).data(4).name("§eBiom ändern").make());
inv.setItem(8, new ItemBuilder(Material.LADDER).name("§eEinstellungen").make());
inv.setItem(10, new ItemBuilder(Material.WATCH).name("§eZeit ändern").make());
inv.setItem(13, new ItemBuilder(Material.BED).name("§ezu deinem Plot").make());
inv.setItem(16, new ItemBuilder(Material.DOUBLE_PLANT).name("§eWetter ändern").make());
inv.setItem(20, new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner("conorf1807").make());
Dye resetDye = new Dye();
resetDye.setColor(DyeColor.RED);
ItemStack reset = resetDye.toItemStack(1);
ItemMeta resetMeta = reset.getItemMeta();
resetMeta.setDisplayName("§ePlot zurücksetzen");
reset.setItemMeta(resetMeta);
Dye readyDye = new Dye();
readyDye.setColor(DyeColor.LIME);
ItemStack ready = readyDye.toItemStack(1);
ItemMeta readyMeta = ready.getItemMeta();
readyMeta.setDisplayName("§eFertig");
ready.setItemMeta(readyMeta);
inv.setItem(18, reset);
inv.setItem(26, ready);
return inv;
}
public Inventory getReadyInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§ePlot fertig ?");
inv.setItem(5, new ItemBuilder(Material.WOOL).color(Color.LIME).name("Ja").make());
inv.setItem(10, new ItemBuilder(Material.WOOL).color(Color.RED).name("Nein").make());
return inv;
}
public Inventory getBiomeInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eBiom ändern");
inv.setItem(0, new ItemBuilder(Material.STAINED_CLAY).durability((short) 1).name("§eMessa").make());
inv.setItem(4, new ItemBuilder(Material.SAPLING).durability((short) 3).name("§eDschungel").make());
inv.setItem(8, new ItemBuilder(Material.WATER_LILY).name("§eSumpfgebiet").make());
inv.setItem(11, new ItemBuilder(Material.SAPLING).name("Wald").make());
inv.setItem(15, new ItemBuilder(Material.LONG_GRASS).durability((short) 1).name("§eFlachland").make());
inv.setItem(18, new ItemBuilder(Material.DEAD_BUSH).name("§eWüste").make());
inv.setItem(22, new ItemBuilder(Material.SNOW_BALL).name("§eTundra").make());
return inv;
}
public Inventory getSettingsInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eEinstellungen");
inv.setItem(10, new ItemBuilder(Material.SIGN).name("§eName ändern").make());
inv.setItem(16, new ItemBuilder(Material.NAME_TAG).name("§eKontaktmöglichkeiten").make());
return inv;
}
public Inventory getTimeInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eZeit ändern");
inv.setItem(10, new ItemBuilder(Material.MILK_BUCKET).name("§eMorgen").make());
inv.setItem(12, new ItemBuilder(Material.DOUBLE_PLANT).name("§eTag").make());
inv.setItem(14, new ItemBuilder(Material.BEETROOT_SOUP).name("§eAbend").make());
inv.setItem(16, new ItemBuilder(Material.COAL).name("§eNacht").durability((short) 1).make());
return inv;
}
public Inventory getWeatherInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eWetter ändern");
inv.setItem(11, new ItemBuilder(Material.DOUBLE_PLANT).name("§eSonne").make());
inv.setItem(13, new ItemBuilder(Material.WATER_BUCKET).name("§eRegen").make());
inv.setItem(15, new ItemBuilder(Material.BLAZE_ROD).name("§eGewitter").make());
return inv;
}
}

View File

@ -1,253 +0,0 @@
package eu.univento.teamvento.utils;
import eu.univento.core.api.items.ItemBuilder;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.Dye;
public class Inventorys {
private final CustomPlayer player;
public Inventorys(CustomPlayer player) {
this.player = player;
}
public Inventory getMainInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eGrundstücksverwaltung");
ItemStack teleport = new ItemStack(Material.MINECART);
ItemMeta teleportMeta = teleport.getItemMeta();
teleportMeta.setDisplayName("§eZu anderen Plots teleportieren");
teleport.setItemMeta(teleportMeta);
ItemStack biome = new ItemStack(Material.DOUBLE_PLANT, 1, (short) 4);
ItemMeta biomeMeta = biome.getItemMeta();
biomeMeta.setDisplayName("§eBiom ändern");
biome.setItemMeta(biomeMeta);
ItemStack animals = new ItemStack(Material.LEASH);
ItemMeta animalsMeta = animals.getItemMeta();
animalsMeta.setDisplayName("§eTiere");
animals.setItemMeta(animalsMeta);
ItemStack settings = new ItemStack(Material.LADDER);
ItemMeta settingsMeta = settings.getItemMeta();
settingsMeta.setDisplayName("§eEinstellungen");
settings.setItemMeta(settingsMeta);
ItemStack time = new ItemStack(Material.WATCH);
ItemMeta timeMeta = time.getItemMeta();
timeMeta.setDisplayName("§eZeit ändern");
time.setItemMeta(timeMeta);
ItemStack home = new ItemStack(Material.BED);
ItemMeta homeMeta = home.getItemMeta();
homeMeta.setDisplayName("§ezu deinem Plot");
home.setItemMeta(homeMeta);
ItemStack weather = new ItemStack(Material.DOUBLE_PLANT);
ItemMeta weatherMeta = weather.getItemMeta();
weatherMeta.setDisplayName("§eWetter ändern");
weather.setItemMeta(weatherMeta);
Dye resetDye = new Dye();
resetDye.setColor(DyeColor.RED);
ItemStack reset = resetDye.toItemStack(1);
ItemMeta resetMeta = reset.getItemMeta();
resetMeta.setDisplayName("§ePlot zurücksetzen");
reset.setItemMeta(resetMeta);
ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta skullMeta = (SkullMeta) skulls.getItemMeta();
skullMeta.setOwner("conorf1807");
skullMeta.setDisplayName("§eKöpfe");
skulls.setItemMeta(skullMeta);
ItemStack particle = new ItemStack(Material.BLAZE_POWDER);
ItemMeta particleMeta = particle.getItemMeta();
particleMeta.setDisplayName("§ePartikel");
particle.setItemMeta(particleMeta);
Dye readyDye = new Dye();
readyDye.setColor(DyeColor.LIME);
ItemStack ready = readyDye.toItemStack(1);
ItemMeta readyMeta = ready.getItemMeta();
readyMeta.setDisplayName("§eFertig");
ready.setItemMeta(readyMeta);
inv.setItem(0, teleport);
inv.setItem(2, biome);
//inv.setItem(6, animals);
inv.setItem(8, settings);
inv.setItem(10, time);
inv.setItem(13, home);
inv.setItem(16, weather);
inv.setItem(18, reset);
inv.setItem(20, skulls);
//inv.setItem(24, particle);
inv.setItem(26, ready);
return inv;
}
public Inventory getReadyInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§ePlot fertig ?");
inv.setItem(5, new ItemBuilder(Material.WOOL).color(Color.LIME).name("Ja").make());
inv.setItem(10, new ItemBuilder(Material.WOOL).color(Color.RED).name("Nein").make());
return inv;
}
public Inventory getBiomeInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eBiom ändern");
ItemStack mesa = new ItemStack(Material.STAINED_CLAY, 1, (short) 1);
ItemMeta mesaMeta = mesa.getItemMeta();
mesaMeta.setDisplayName("§eMesa");
mesa.setItemMeta(mesaMeta);
ItemStack jungle = new ItemStack(Material.SAPLING, 1, (short) 3);
ItemMeta jungleMeta = jungle.getItemMeta();
jungleMeta.setDisplayName("§eDschungel");
jungle.setItemMeta(jungleMeta);
ItemStack swamp = new ItemStack(Material.WATER_LILY);
ItemMeta swampMeta = swamp.getItemMeta();
swampMeta.setDisplayName("§eSumpfgebiet");
swamp.setItemMeta(swampMeta);
ItemStack forest = new ItemStack(Material.SAPLING);
ItemMeta forestMeta = forest.getItemMeta();
forestMeta.setDisplayName("§eWald");
forest.setItemMeta(forestMeta);
ItemStack flatland = new ItemStack(Material.LONG_GRASS, 1, (short) 1);
ItemMeta flatlandMeta = flatland.getItemMeta();
flatlandMeta.setDisplayName("§eFlachland");
flatland.setItemMeta(flatlandMeta);
ItemStack desert = new ItemStack(Material.DEAD_BUSH);
ItemMeta desertMeta = desert.getItemMeta();
desertMeta.setDisplayName("§eWüste");
desert.setItemMeta(desertMeta);
ItemStack taiga = new ItemStack(Material.LONG_GRASS, 1, (short) 2);
ItemMeta taigaMeta = taiga.getItemMeta();
taigaMeta.setDisplayName("§eTaiga");
taiga.setItemMeta(taigaMeta);
ItemStack tundra = new ItemStack(Material.SNOW_BALL);
ItemMeta tundraMeta = tundra.getItemMeta();
tundraMeta.setDisplayName("§eTundra");
tundra.setItemMeta(tundraMeta);
inv.setItem(0, mesa);
inv.setItem(4, jungle);
inv.setItem(8, swamp);
inv.setItem(11, forest);
inv.setItem(15, flatland);
inv.setItem(18, desert);
inv.setItem(22, taiga);
inv.setItem(26, tundra);
return inv;
}
public Inventory getSettingsInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eEinstellungen");
ItemStack name = new ItemStack(Material.SIGN);
ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName("§eName ändern");
name.setItemMeta(nameMeta);
ItemStack contact = new ItemStack(Material.NAME_TAG);
ItemMeta contactMeta = contact.getItemMeta();
contactMeta.setDisplayName("§eKontaktmöglichkeiten");
contact.setItemMeta(contactMeta);
inv.setItem(10, name);
inv.setItem(16, contact);
return inv;
}
public Inventory getTimeInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eZeit ändern");
ItemStack morning = new ItemStack(Material.MILK_BUCKET);
ItemMeta morningMeta = morning.getItemMeta();
morningMeta.setDisplayName("§eMorgen");
morning.setItemMeta(morningMeta);
ItemStack day = new ItemStack(Material.DOUBLE_PLANT);
ItemMeta dayMeta = day.getItemMeta();
dayMeta.setDisplayName("§eTag");
day.setItemMeta(dayMeta);
ItemStack evening = new ItemStack(Material.BEETROOT_SOUP);
ItemMeta eveningMeta = evening.getItemMeta();
eveningMeta.setDisplayName("§eAbend");
evening.setItemMeta(eveningMeta);
ItemStack night = new ItemStack(Material.COAL, 1, (short) 1);
ItemMeta nightMeta = night.getItemMeta();
nightMeta.setDisplayName("§eNacht");
night.setItemMeta(nightMeta);
inv.setItem(10, morning);
inv.setItem(12, day);
inv.setItem(14, evening);
inv.setItem(16, night);
return inv;
}
public Inventory getWeatherInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eWetter ändern");
ItemStack sun = new ItemStack(Material.DOUBLE_PLANT);
ItemMeta sunMeta = sun.getItemMeta();
sunMeta.setDisplayName("§eSonne");
sun.setItemMeta(sunMeta);
ItemStack rain = new ItemStack(Material.WATER_BUCKET);
ItemMeta rainMeta = rain.getItemMeta();
rainMeta.setDisplayName("§eRegen");
rain.setItemMeta(rainMeta);
ItemStack thunder = new ItemStack(Material.BLAZE_ROD);
ItemMeta thunderMeta = thunder.getItemMeta();
thunderMeta.setDisplayName("§eGewitter");
thunder.setItemMeta(thunderMeta);
inv.setItem(11, sun);
inv.setItem(13, rain);
inv.setItem(15, thunder);
return inv;
}
public Inventory getAnimalsInventory() {
Inventory inv = Bukkit.createInventory(player, 27, "§eTiere spawnen");
ItemStack pig = new ItemStack(Material.COOKED_BEEF);
ItemMeta pigMeta = pig.getItemMeta();
pigMeta.setDisplayName("Schwein gehabt");
pig.setItemMeta(pigMeta);
inv.setItem(0, pig);
return inv;
}
}

View File

@ -14,10 +14,13 @@ import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import java.util.ArrayList;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
/**
* @author joethei
* @version 1.0
*/
public class Plot { public class Plot {
private final Cuboid area; private final Cuboid area;
@ -117,14 +120,6 @@ public class Plot {
return WeatherType.valueOf(getWeather().name()); return WeatherType.valueOf(getWeather().name());
} }
private Map<String, Object> getMapFromDatabase(String name) {
return (Map<String, Object>) getObjectFromDatbase(name);
}
private ArrayList<Object> getArrayListFromDatabase(String name) {
return (ArrayList<Object>) getObjectFromDatbase(name);
}
private Object getObjectFromDatbase(String name) { private Object getObjectFromDatbase(String name) {
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString())); FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
cursor.cursorType(CursorType.NonTailable); cursor.cursorType(CursorType.NonTailable);
@ -148,8 +143,4 @@ public class Plot {
private void setInDatabase(String name, Object obj) { private void setInDatabase(String name, Object obj) {
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document(name, obj))); Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document(name, obj)));
} }
private void setInDatabase(ArrayList<Map<String, String>> obj) {
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document("animals", obj)));
}
} }

View File

@ -1,17 +1,18 @@
package eu.univento.teamvento.utils; package eu.univento.teamvento.utils;
import eu.univento.core.api.Config; import eu.univento.core.api.Config;
import eu.univento.core.api.Hologram;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento; import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.listener.JoinQuit; import eu.univento.teamvento.listener.JoinQuit;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
interface PlotAction { interface PlotAction {
@ -36,8 +37,7 @@ interface PlotAction {
Location loc = plot.getSpawn(); Location loc = plot.getSpawn();
player.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F)); player.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F));
JoinQuit.holograms.get(player).hidePlayer(player); JoinQuit.holograms.get(player).hidePlayer(player);
Hologram holo = new Hologram(new String[]{"§eZu deinem Plot teleportieren", "|", "|", ""}, Config.readLocation("Build.Locs.Holo")); player.sendHologram(new ItemStack(Material.GRASS), Config.readLocation("Build.Locs.Holo"), "§eZu deinem Plot teleportieren", "|", "|", "");
holo.showPlayer(player);
} }
} }

View File

@ -20,6 +20,11 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.*; import java.util.*;
import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingDeque;
/**
* @author joethei
* @version 1.0
*/
public class PlotManager { public class PlotManager {
private static Queue<PlotAction> queue = new LinkedBlockingDeque<>(); private static Queue<PlotAction> queue = new LinkedBlockingDeque<>();
@ -65,7 +70,7 @@ public class PlotManager {
new PlotAction.Create(p).execute(); new PlotAction.Create(p).execute();
}else { }else {
queue.offer(new PlotAction.Create(p)); queue.offer(new PlotAction.Create(p));
p.sendMessage("Du wurdest zu Warteschlange hinzugefügt: " + queue.size()); p.sendMessage("Du wurdest zur Warteschlange hinzugefügt: (" + queue.size() + ")");
} }
} }
@ -259,10 +264,10 @@ public class PlotManager {
north.getBlock().setType(Material.STONE); north.getBlock().setType(Material.STONE);
south.getBlock().setType(Material.ACACIA_STAIRS); south.getBlock().setType(Material.ACACIA_STAIRS);
boolean westPlot = getPlotByLocation(west) != null; boolean westPlot = isPlot(west);
boolean eastPlot = getPlotByLocation(east) != null; boolean eastPlot = isPlot(east);
boolean northPlot = getPlotByLocation(north) != null; boolean northPlot = isPlot(north);
boolean southPlot = getPlotByLocation(south) != null; boolean southPlot = isPlot(south);
if (westPlot && eastPlot && northPlot && southPlot) { if (westPlot && eastPlot && northPlot && southPlot) {
Bukkit.broadcastMessage("Plot im Westen"); Bukkit.broadcastMessage("Plot im Westen");
@ -394,6 +399,10 @@ public class PlotManager {
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").insertOne(doc); Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").insertOne(doc);
} }
private static boolean isPlot(Location location) {
return getPlotByLocation(location) != null;
}
public static Plot getPlotByLocation(Location location) { public static Plot getPlotByLocation(Location location) {
for (Plot plot : plots) for (Plot plot : plots)
if (plot.isInPlot(location)) return plot; if (plot.isInPlot(location)) return plot;
@ -415,33 +424,6 @@ public class PlotManager {
return new Location(Bukkit.getWorld("plots"), Double.valueOf(String.valueOf(map.get("X"))), Double.valueOf(String.valueOf(map.get("Y"))), Double.valueOf(String.valueOf(map.get("Z")))); return new Location(Bukkit.getWorld("plots"), Double.valueOf(String.valueOf(map.get("X"))), Double.valueOf(String.valueOf(map.get("Y"))), Double.valueOf(String.valueOf(map.get("Z"))));
} }
private static List<Location> spiral(int midX, int midZ, int radius) {
int x = midX;
int z = midZ;
int f = 1;
List<Location> locations = new ArrayList<>();
while(f <= radius * 2) {
for(int i = z + f; z < i; z++) {
locations.add(new Location(Bukkit.getWorld("plots"), x, 25, z));
}
for(int i = z + f; z > i; x++) {
locations.add(new Location(Bukkit.getWorld("plots"), x, 25, z));
}
f++;
for(int i = z -f; z > i; z--) {
locations.add(new Location(Bukkit.getWorld("plots"), x, 25, z));
}
for(int i = x - f; x > i; x--) {
locations.add(new Location(Bukkit.getWorld("plots"), x, 25, z));
}
f++;
}
for(int i = z + f - 1; z < i; z++) {
locations.add(new Location(Bukkit.getWorld("plots"), x, 25, z));
}
return locations;
}
public static boolean isAllowedToBuild(CustomPlayer p, Location loc) { public static boolean isAllowedToBuild(CustomPlayer p, Location loc) {
if(loc.getWorld().getName().equalsIgnoreCase("plots")) { if(loc.getWorld().getName().equalsIgnoreCase("plots")) {
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return true; if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return true;

View File

@ -1,5 +1,10 @@
package eu.univento.teamvento.utils; package eu.univento.teamvento.utils;
/**
* @author joethei
* @version 1.0
*/
public enum Time { public enum Time {
MORNING(0), MORNING(0),
DAY(6000), DAY(6000),

View File

@ -1,6 +1,12 @@
package eu.univento.teamvento.utils; package eu.univento.teamvento.utils;
public enum Weather { public enum Weather {
/**
* @author joethei
* @version 1.0
*/
CLEAR, CLEAR,
DOWNFALL, DOWNFALL,
THUNDER THUNDER