verstaubt

This commit is contained in:
BuildTools 2018-01-15 12:27:22 +01:00
parent 78d6d7eaa4
commit 91a042abb5
19 changed files with 597 additions and 524 deletions

View File

@ -20,77 +20,73 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.11.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: eu.univento:commons:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" 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" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" 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: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" 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" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-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.11.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="library" name="Maven: com.boydti:fawe-api:latest" level="project" />
<orderEntry type="library" name="Maven: com.sk89q:worldguard:6.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.fabiozumbi12:redprotect:1.9.6" level="project" />
<orderEntry type="library" name="Maven: org.primesoft:BlocksHub:2.0" level="project" />
<orderEntry type="library" name="Maven: com.sk89q.worldedit:worldedit-core:6.1.3-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.plotsquared:plotsquared-api:latest" level="project" />
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.1.1" level="project" />
<orderEntry type="library" name="Maven: co.aikar:fastutil-lite:1.0" level="project" />
<orderEntry type="module" module-name="Commons" />
<orderEntry type="library" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler-proxy:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-socks:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-http:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-http2:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.8.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.7.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.7.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.7.0" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-redis-client:3.4.1" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-mysql-postgresql-client:3.4.1" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-sql-common:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.1" level="project" />
<orderEntry type="library" name="Maven: com.github.mauricio:postgresql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" name="Maven: com.github.mauricio:db-async-common_2.12:0.2.21" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.7" level="project" />
<orderEntry type="library" name="Maven: org.joda:joda-convert:1.8.1" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" name="Maven: com.github.mauricio:mysql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-mongo-client:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:3.4.1" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-rabbitmq-client:3.4.1" level="project" />
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:3.6.5" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-web-client:3.4.2" level="project" />
<orderEntry type="library" name="Maven: io.vertx:vertx-web-common:3.4.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: io.sentry:sentry:1.2.2" level="project" />
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
<orderEntry type="library" name="Maven: com.google.dagger:dagger:2.14.1" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="module" module-name="Core" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-bukkit:3.4.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-core:3.4.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.dmulloy2:PacketWrapper:master-2b4bfddd12-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-bukkit:3.6.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: pl.kacperduras:tasket-core:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: pl.kacperduras:tasket-bukkit:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.github.lordakkarin:nbt:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:5.0.0.Alpha2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-common:5.0.0.Alpha2" level="project" />
<orderEntry type="module" module-name="Commons" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: ai.api:libai:1.4.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler-proxy:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-socks:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http2:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.7.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-redis-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mysql-postgresql-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-sql-common:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:postgresql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:db-async-common_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.joda:joda-convert:1.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:mysql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mongo-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-async:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:bson:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-rabbitmq-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.rabbitmq:amqp-client:3.6.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" 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" scope="PROVIDED" 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" scope="PROVIDED" 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" scope="PROVIDED" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:simple:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:core:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:dense64:0.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.gitlab:java-gitlab-api:1.2.7" level="project" />
</component>
</module>

24
pom.xml
View File

@ -55,27 +55,13 @@
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -91,6 +77,12 @@
<version>latest</version>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Core</artifactId>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="target2" level="project" />
<orderEntry type="library" name="target" level="project" />
<orderEntry type="library" name="target1" level="project" />
<orderEntry type="library" name="Kartoffelsuppe" level="project" />
<orderEntry type="library" name="Core" level="project" />
<orderEntry type="library" name="FakeCore" level="project" />
<orderEntry type="library" name="test-1.0-SNAPSHOT-jar-with-dependencies" level="project" />
<orderEntry type="module" module-name="FakeCore" />
<orderEntry type="module" module-name="Core" />
</component>
</module>

View File

@ -1,32 +1,34 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento;
import eu.univento.commons.server.ServerType;
import eu.univento.core.Core;
import eu.univento.core.api.Config;
import eu.univento.core.api.command.CommandFramework;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.teamvento.commands.PlotInfo;
import eu.univento.teamvento.commands.WorldCommands;
import eu.univento.teamvento.generator.GeneratorManager;
import eu.univento.teamvento.listener.Events;
import eu.univento.teamvento.listener.JoinQuit;
import eu.univento.teamvento.listener.MenuEvents;
import eu.univento.teamvento.listener.SignInteract;
import eu.univento.teamvento.generator.GeneratorManager;
import eu.univento.teamvento.plot.PlotManager;
import org.bukkit.*;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Sheep;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import java.io.File;
import java.util.Random;
/**
* @author joethei
@ -35,53 +37,25 @@ import java.util.Random;
public class TeamVento extends JavaPlugin {
private static final File file = new File("plugins/Core", "worlds.yml");
private static final FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
@Getter private static final File configFile = new File("plugins/Core", "worlds.yml");
@Getter private static final FileConfiguration cfg = YamlConfiguration.loadConfiguration(configFile);
public static File getConfigFile() {
return file;
}
public static FileConfiguration getCfg() {
return cfg;
}
private static TeamVento instance;
public static TeamVento getInstance() {
return instance;
}
private Random random = new Random();
@Getter private static TeamVento instance;
@Override
public void onEnable() {
instance = this;
/*
if(Bukkit.getWorld("plots") == null) {
WorldCreator creator = new WorldCreator("plots");
creator.generator(new VoidGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
Bukkit.createWorld(creator);
getCfg().set("plots", "void");
try {
getCfg().save(getConfigFile());
} catch (IOException e) {
e.printStackTrace();
}
}
*/
CommandFramework commandFramework = new CommandFramework(this);
commandFramework.registerCommands(new WorldCommands());
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new JoinQuit(), getInstance());
pm.registerEvents(new SignInteract(), getInstance());
pm.registerEvents(new MenuEvents(), getInstance());
pm.registerEvents(new Events(), getInstance());
pm.registerEvents(new JoinQuit(), this);
pm.registerEvents(new SignInteract(), this);
pm.registerEvents(new MenuEvents(), this);
pm.registerEvents(new Events(), this);
//new PlotInfo(this, "plotinfo", "info about a plot", "pi");
new PlotInfo(this, "plotinfo", "info about a plot", "pi");
for(String world : getCfg().getKeys(true)) {
World loadedWorld = Bukkit.createWorld(GeneratorManager.getWorldCreator(world, getCfg().getString(world)));
@ -90,35 +64,10 @@ public class TeamVento extends JavaPlugin {
loadedWorld.setAnimalSpawnLimit(0);
}
ServerSettings.setServerType(ServerType.TEAM_BUILD);
ServerSettings.setGameMode(GameMode.CREATIVE);
//PlotManager.update();
//PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Bukkit.getWorlds().stream().filter(world -> world.getTime() > 7698).forEach(world -> world.setTime(0)), 100 * 20L, 20L);
ServerSettings.setup(ServerType.TEAM_BUILD, GameMode.CREATIVE);
PlotManager.update();
//Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Bukkit.getWorlds().stream().filter(world -> world.getTime() > 7698).forEach(world -> world.setTime(0)), 100 * 20L, 20L);
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Events.redstone = 0, 1L, 10 * 20L);
Bukkit.getScheduler().runTaskTimer(this, () -> {
for(CustomPlayer player : Core.getOnlinePlayers()) {
if(player.getItemInHand().getType() == Material.SHEARS) {
Sheep sheep = (Sheep) player.getWorld().spawnEntity(player.getEyeLocation(), EntityType.SHEEP);
sheep.setColor(DyeColor.values()[random.nextInt(DyeColor.values().length)]);
sheep.setVelocity(new Vector(random.nextDouble() * (random.nextBoolean() ? 1 : -1), 2, random.nextDouble() * (random.nextBoolean() ? 1 : -1)));
sheep.setAI(true);
Bukkit.getScheduler().runTaskLater(this, () -> {
Location loc = sheep.getEyeLocation();
final Firework firework = (Firework) player.getWorld().spawnEntity(loc, EntityType.FIREWORK);
FireworkMeta meta = firework.getFireworkMeta();
FireworkEffect effect = FireworkEffect.builder().withColor(sheep.getColor().getColor()).with(FireworkEffect.Type.BALL).build();
meta.addEffect(effect);
firework.setFireworkMeta(meta);
Bukkit.getScheduler().runTaskLater(this, firework::detonate, 1L);
sheep.remove();
}, 20L);
}
}
}, 20L, 10L);
}
@Override

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.commands;
import eu.univento.commons.player.rank.Rank;
@ -7,7 +12,6 @@ import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.plot.Plot;
import eu.univento.teamvento.plot.PlotManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -24,17 +28,17 @@ public class PlotInfo extends AutoCommand<TeamVento>{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
if(PlotManager.getPlotByLocation(p.getLocation()) != null) {
if(PlotManager.isPlot(p.getLocation())) {
Plot plot = PlotManager.getPlotByLocation(p.getLocation());
assert plot != null;
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
PlotManager.getCreatedDate(plot.getOwner()).whenComplete((instant, throwable) -> {
p.sendMessage("§eName: " + plot.getName());
p.sendMessage("§eErsteller: " + NameFetcher.getRequest(plot.getOwner()));
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
p.sendMessage("§eErstellt am: " + instant.toString());
p.sendMessage("§eKontakt: " + plot.getContact());
p.sendMessage("§eBiom: " + plot.getBiome().name());
p.sendMessage("§eZeit: " + plot.getTime().name());
p.sendMessage("§Wetter: " + plot.getWeather().name());
p.sendMessage("§eWetter: " + plot.getWeather().name());
});
}else{
p.sendMessage("§cHier ist leider kein Plot");

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.commands;
import eu.univento.commons.player.rank.Rank;
@ -21,7 +26,15 @@ import java.util.stream.Collectors;
*/
public class WorldCommands {
@Command(name = "world.teleport", aliases = {"wtp"}, description = "teleport through the worlds", usage = "/world teleport <World>", rank = Rank.JrSupporter, inGameOnly = true)
@Command(name ="world", description = "all world commands", usage = "/world", rank = Rank.Sound)
public void world(CommandArgs args) {
args.getSender().sendMessage("/world list");
args.getSender().sendMessage("/world teleport <world>");
args.getSender().sendMessage("/world create <name> <generator>");
args.getSender().sendMessage("/world import <name> <generator>");
}
@Command(name = "world.teleport", aliases = {"wtp"}, description = "teleport through the worlds", usage = "/world teleport <World>", rank = Rank.Sound, inGameOnly = true)
public void teleport(CommandArgs args) {
if(args.length() == 1) {
if(Bukkit.getWorld(args.getArg(0)) != null) {
@ -39,7 +52,7 @@ public class WorldCommands {
return Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toCollection(LinkedList::new));
}
@Command(name = "world.list", aliases = {"wl"}, description = "list all worlds", usage = "/world list", rank = Rank.JrSupporter)
@Command(name = "world.list", aliases = {"wl"}, description = "list all worlds", usage = "/world list", rank = Rank.Sound)
public void list(CommandArgs args) {
args.getSender().sendMessage("§cAll worlds");
for(String world : TeamVento.getCfg().getKeys(true)) {
@ -47,10 +60,10 @@ public class WorldCommands {
}
}
@Command(name = "world.import", aliases = "wi", description = "import already existing worlds", usage = "/world import <name> <generator>", rank = Rank.Admin)
@Command(name = "world.import", aliases = {"wi"} , description = "import already existing worlds", usage = "/world import <name> <generator>", rank = Rank.Admin)
public void importWorld(CommandArgs args) {
if(args.length() == 2) {
if(Bukkit.getWorld(args.getArg(0)) == null && !new File(args.getArg(0)).exists()) {
if(Bukkit.getWorld(args.getArg(0)) == null && new File(args.getArg(0)).exists()) {
Bukkit.createWorld(GeneratorManager.getWorldCreator(args.getArg(0), args.getArg(1)));
TeamVento.getCfg().set(args.getArg(0), args.getArg(1));
try {
@ -59,16 +72,16 @@ public class WorldCommands {
e.printStackTrace();
}
args.getSender().sendMessage("§ayour world has been imported");
}else args.getSender().sendMessage("3cthe chosen world already exists");
}else args.getSender().sendMessage("§cthe chosen world already exists");
}else {
args.getSender().sendMessage("§cplease use /world import <name> <generator>");
}
}
@Command(name = "world.create", aliases = "wc", description = "create new worlds", usage = "/world create <name> <generator>", rank = Rank.SrBuilder)
@Command(name = "world.create", aliases = {"wc"}, description = "create new worlds", usage = "/world create <name> <generator>", rank = Rank.SrBuilder)
public void create(CommandArgs args) {
if(args.length() == 2) {
if(Bukkit.getWorld(args.getArg(0)) == null && GeneratorManager.getWorldCreator(args.getArg(0), args.getArg(1)) != null) {
if(Bukkit.getWorld(args.getArg(0)) == null && GeneratorManager.getWorldCreator(args.getArg(1), args.getArg(1)) != null) {
Bukkit.createWorld(GeneratorManager.getWorldCreator(args.getArg(0), args.getArg(1)));
TeamVento.getCfg().set(args.getArg(0), args.getArg(1));
try {

View File

@ -0,0 +1,100 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.generator;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.util.noise.PerlinOctaveGenerator;
import org.bukkit.util.noise.SimplexOctaveGenerator;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* @author joethei
* @version 1.0
*/
public class CustomGenerator extends ChunkGenerator {
private double scale = 32.0; //how far apart the tops of the hills are
private double threshold = 0.0; // the cutoff point for terrain
private int middle = 70; // the "middle" of the road
public List<BlockPopulator> getDefaultPopulators(World world) {
ArrayList<BlockPopulator> populators = new ArrayList<>();
populators.add(new CustomPopulator());
return populators;
}
/*
* Sets a block in the chunk. If the Block section doesn't exist, it allocates it.
* [y>>4] the section id (y/16)
* the math for the second offset confuses me
*/
void setBlock(int x, int y, int z, byte[][] chunk, Material material) {
if (chunk[y >> 4] == null)
chunk[y >> 4] = new byte[16 * 16 * 16];
if (!(y <= 256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0))
return; //Out of bounds
try {
chunk[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = (byte) material.getId();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
//Generates block sections. Each block section is 16*16*16 blocks, stacked above each other. //There are world height / 16 sections. section number is world height / 16 (>>4)
//returns a byte[world height / 16][], formatted [section id][Blocks]. If there are no blocks in a section, it need not be allocated.
public byte[][] generateBlockSections(World world, Random rand, int ChunkX, int ChunkZ, BiomeGrid biomes) {
Random random = new Random(world.getSeed());
SimplexOctaveGenerator gen = new SimplexOctaveGenerator(random, 8);
PerlinOctaveGenerator gen2 = new PerlinOctaveGenerator(world.getSeed(), 8);
byte[][] chunk = new byte[world.getMaxHeight() / 16][];
gen2.setScale(1 / scale);
gen.setScale(1 / scale); //The distance between peaks of the terrain. Scroll down more to see what happens when you play with this
double threshold = this.threshold; //scroll down to see what happens when you play with this.
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
int real_x = x + ChunkX * 16;
int real_z = z + ChunkZ * 16;
double height = middle + gen2.noise(real_x, real_z, 0.5, 0.5) * middle / 3; // generate some smoother terrain
for (int y = 1; y < height && y < 256; y++) {
if (y > middle - middle / 3) {
double noise = gen.noise(real_x, y, real_z, 0.5, 0.5);
if (noise > threshold) //explained above
setBlock(x, y, z, chunk, Material.STONE); //set the block solid
} else {
setBlock(x, y, z, chunk, Material.STONE);
}
}
}
}
return chunk;
}
}
class CustomPopulator extends BlockPopulator {
@Override
public void populate(World world, Random random, Chunk chunk) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
world.getBlockAt(x + chunk.getX() * 16, 64, z + chunk.getZ() * 16).setType(Material.GRASS);
}
}
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.generator;
import org.bukkit.Material;
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;
/**
* @author joethei
* @version 1.0
*/
public class DevGenerator extends ChunkGenerator{
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
return Arrays.asList(new BlockPopulator[0]);
}
@Override
public boolean canSpawn(World world, int x, int z) {
return true;
}
private int xyzToByte(int x, int y, int z) {
return (x * 16 + z) * 128 + y;
}
@Override
public byte[] generate(World world, Random random, int chunkx, int chunkz) {
byte[] result = new byte[32768];
for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) {
for(int y = 0; y < 256; y++) {
if(y > 0 && y < 100) result[xyzToByte(x, y, z)] = (byte) Material.SANDSTONE.getId();
if(y == 0) result[xyzToByte(x, y, z)] = (byte) Material.BEDROCK.getId();
}
}
}
return result;
}
}

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.generator;
/**
@ -7,5 +12,8 @@ package eu.univento.teamvento.generator;
public enum Generator {
NORMAL,
FLAT,
VOID;
VOID,
WATER,
DEV,
CUSTOM
}

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.generator;
import org.bukkit.World;
@ -6,26 +11,46 @@ import org.bukkit.WorldType;
/**
* @author joethei
* @version 0.1
* @version 1.0
*/
public class GeneratorManager {
public static WorldCreator getWorldCreator(String name, String generator) {
WorldCreator creator = new WorldCreator(name);
if(generator.equals("normal")) {
creator.environment(World.Environment.NORMAL);
creator.type(WorldType.NORMAL);
switch (generator) {
case "normal":
creator.environment(World.Environment.NORMAL);
creator.type(WorldType.NORMAL);
break;
case "flat":
creator.environment(World.Environment.NORMAL);
creator.type(WorldType.FLAT);
creator.generateStructures(false);
break;
case "void":
creator.generator(new VoidGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
break;
case "water":
creator.generator(new WaterGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
break;
case "dev":
creator.generator(new DevGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
break;
case "custom":
creator.generator(new CustomGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
break;
default:
return null;
}
if(generator.equals("flat")) {
creator.environment(World.Environment.NORMAL);
creator.type(WorldType.FLAT);
creator.generateStructures(false);
}
if(generator.equals("void")) {
creator.generator(new VoidGenerator());
creator.type(WorldType.CUSTOMIZED);
creator.generateStructures(false);
}else return null;
return creator;
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.generator;
import org.bukkit.Material;
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;
/**
* @author joethei
* @version 1.0
*/
public class WaterGenerator extends ChunkGenerator {
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
return Arrays.asList(new BlockPopulator[0]);
}
@Override
public boolean canSpawn(World world, int x, int z) {
return true;
}
private int xyzToByte(int x, int y, int z) {
return (x * 16 + z) * 128 + y;
}
@Override
public byte[] generate(World world, Random random, int chunkx, int chunkz) {
byte[] result = new byte[32768];
for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) {
for(int y = 0; y < 256; y++) {
if(y > 1 && y < 22) result[xyzToByte(x, y, z)] = (byte) Material.STATIONARY_WATER.getId();
if(y == 1) result[xyzToByte(x, y, z)] = (byte) Material.SAND.getId();
if(y == 0) result[xyzToByte(x, y, z)] = (byte) Material.BEDROCK.getId();
}
}
}
return result;
}
}

View File

@ -1,7 +1,10 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.listener;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.Config;
import eu.univento.core.api.events.MoveEventFilter;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento;
@ -9,7 +12,10 @@ import eu.univento.teamvento.plot.Plot;
import eu.univento.teamvento.plot.PlotManager;
import eu.univento.teamvento.plot.Time;
import eu.univento.teamvento.plot.Weather;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.WeatherType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
@ -20,10 +26,12 @@ import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
@ -38,7 +46,7 @@ import java.util.UUID;
/**
* @author joethei
* @version 0.3
* @version 1.0
*/
public class Events implements Listener {
@ -222,7 +230,6 @@ public class Events implements Listener {
e.setCancelled(true);
}
/*
@EventHandler
public void onPickup(PlayerPickupItemEvent e) {
e.setCancelled(true);
@ -248,7 +255,6 @@ public class Events implements Listener {
e.setCancelled(true);
}
}
*/
@EventHandler
public void onConsume(PlayerItemConsumeEvent e) {
@ -271,7 +277,7 @@ public class Events implements Listener {
public void onBlockMove(MoveEventFilter.PlayerBlockMoveEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
//plot enter
if (PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
if (!PlotManager.isPlot(e.getFrom()) && PlotManager.isPlot(e.getTo())) {
Plot plot = PlotManager.getPlotByLocation(e.getTo());
assert plot != null;
p.setPlayerTime(plot.getTime().getValue(), false);
@ -290,7 +296,7 @@ public class Events implements Listener {
}
}
//plot leave
if (PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
if (PlotManager.isPlot(e.getFrom()) && !PlotManager.isPlot(e.getTo())) {
p.setPlayerTime(Time.DAY.getValue(), false);
p.setPlayerWeather(WeatherType.CLEAR);
p.clearPotionEffects();
@ -298,28 +304,13 @@ public class Events implements Listener {
lightningTasks.get(p).cancel();
lightningTasks.remove(p);
}
if (e.getTo().getY() <= -5) {
if (!PlotManager.hasPlot(p)) {
p.teleport(Config.readLocation("Build.Locs.Spawn"));
return;
}
Plot plot = PlotManager.getPlotByPlayer(p);
assert plot != null;
Location loc = plot.getSpawn();
p.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F));
}
Block up = p.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
if (p.getLocation().getBlock().getType() == Material.GOLD_PLATE && up.getType() == Material.COAL_BLOCK && p.getDatabasePlayer().isAllowed(Rank.JrSupporter)) {
p.teleport(Bukkit.getWorld("Planning").getSpawnLocation());
p.setGameMode(GameMode.ADVENTURE);
}
}
@EventHandler
public void onTeleport(PlayerTeleportEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
//plot enter
if (PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
if (!PlotManager.isPlot(e.getFrom()) && PlotManager.isPlot(e.getTo())) {
Plot plot = PlotManager.getPlotByLocation(e.getTo());
assert plot != null;
p.setPlayerTime(plot.getTime().getValue(), false);
@ -338,7 +329,7 @@ public class Events implements Listener {
}
}
//plot leave
if (PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
if (PlotManager.isPlot(e.getFrom()) && !PlotManager.isPlot(e.getTo())) {
p.setPlayerTime(Time.DAY.getValue(), false);
p.setPlayerWeather(WeatherType.CLEAR);
p.clearPotionEffects();
@ -385,6 +376,7 @@ public class Events implements Listener {
public void onEntityShootBow(EntityShootBowEvent e) {
if (e.getEntityType() != EntityType.PLAYER) return;
CustomPlayer p = CustomPlayer.getPlayer(e.getEntity().getName());
assert p != null;
if (p.getUniqueId().toString().equals("682ebd10-3661-49ec-ba4d-4f24b761b1a7")) {
Projectile projectile = (Projectile) e.getProjectile();
projectile.setCustomNameVisible(true);

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.listener;
import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.plot.Plot;
import eu.univento.teamvento.plot.PlotManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -14,7 +21,7 @@ import org.bukkit.inventory.meta.ItemMeta;
/**
* @author joethei
* @version 0.1
* @version 1.0
*/
public class JoinQuit implements Listener {
@ -24,8 +31,7 @@ public class JoinQuit implements Listener {
public void onJoin(PlayerJoinEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
e.setJoinMessage(null);
p.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getPrefix() + p.getName() + p.getDatabasePlayer().getRank().getSuffix() + "ist beigetreten"));
p.resetAttackSpeed();
p.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getPrefix() + p.getName() + "§7ist beigetreten"));
if (PlotManager.hasPlot(p)) {
Plot plot = PlotManager.getPlotByPlayer(p);
assert plot != null;
@ -37,7 +43,10 @@ public class JoinQuit implements Listener {
p.getInventory().setItem(8, menu);
}
}
p.teleport(Bukkit.getWorld("world").getSpawnLocation());
p.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> {
if(rank == Rank.Player) p.teleport(new Location(Bukkit.getWorld("plots"), 11.4D, 24.0D, 25.5D, -90.5F, 1.5F));
});
/*
String[] text;
@ -52,13 +61,15 @@ public class JoinQuit implements Listener {
Hologram holo = new Hologram(new ItemStack(Material.GRASS), text, Config.readLocation("Build.Locs.Holo"));
holograms.put(p, holo);
holo.showPlayer(p);
*/
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
e.setQuitMessage(p.getDatabasePlayer().getRank().getPrefix() + p.getName() + p.getDatabasePlayer().getRank().getSuffix() + "ist von uns gegangen");
e.setQuitMessage(p.getDatabasePlayer().getRank().getPrefix() + p.getName() + "§7ist von uns gegangen");
//holograms.remove(p);
}
}

View File

@ -1,12 +1,17 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.listener;
import eu.univento.commons.player.rank.Rank;
import eu.univento.commons.player.uuid.NameFetcher;
import eu.univento.commons.player.uuid.UUIDFetcher;
import eu.univento.core.Core;
import eu.univento.core.api.gui.AnvilGUI;
import eu.univento.core.api.gui.inventory.InventoryGUI;
import eu.univento.core.api.gui.inventory.PagedInventoryGUI;
import eu.univento.core.api.items.ItemBuilder;
import eu.univento.core.api.items.PageInventory;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.plot.*;
@ -25,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList;
import java.util.Map;
/**
* @author joethei
@ -40,7 +45,27 @@ public class MenuEvents implements Listener{
InventoryManager inventoryManager = new InventoryManager(p);
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")) {
p.openInventory(inventoryManager.getMainInventory());
if(p.getDatabasePlayer().getRank() == Rank.Player) p.openInventory(inventoryManager.getPlayerInventory());
else {
InventoryGUI gui = new InventoryGUI(p, 27, "§eErweiterungen");
gui.addItem(0, new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner("MHF_Apple").name("§eKöpfe").build(), customPlayer -> {
customPlayer.closeInventory();
InventoryGUI headsMainGui = new InventoryGUI(customPlayer, 9, "§eKöpfe");
headsMainGui.addItem(0, new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner("MHF_Chest").name("§eBlöcke").build(), player -> {
player.closeInventory();
PagedInventoryGUI pagedInventoryGUI = new PagedInventoryGUI(player, "§eBlöcke");
for(Map.Entry<String, String> entry : Core.getHeadDB().getBlocks().entrySet()) {
pagedInventoryGUI.addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullUrl(entry.getValue()).name(entry.getKey()).build(), clickedPlayer -> {
clickedPlayer.closeInventory();
clickedPlayer.getInventory().addItem(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullUrl(entry.getValue()).name(entry.getKey()).build());
});
}
pagedInventoryGUI.open();
});
headsMainGui.open();
});
gui.open();
}
}
}
}
@ -56,23 +81,21 @@ public class MenuEvents implements Listener{
if(!e.getCurrentItem().getItemMeta().hasDisplayName()) return;
Plot plot = PlotManager.getPlotByPlayer(p);
assert plot != null;
if(e.getInventory().getName().equals(inventoryManager.getMainInventory().getName())) {
if(e.getInventory().getName().equals(inventoryManager.getPlayerInventory().getName())) {
e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.BED) {
p.closeInventory();
Location loc = plot.getSpawn();
p.teleport(new Location(Bukkit.getWorld("plots"), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F));
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§ePlot zurücksetzen")) {
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eGrundstück zurücksetzen")) {
p.setFlying(true);
PlotManager.resetPlot(plot);
p.closeInventory();
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eFertig")) {
p.closeInventory();
if(plot.hasName() && plot.hasContact())
p.openInventory(inventoryManager.getReadyInventory());
else
p.sendMessage("§cName und Kontaktinformationen müssen angegeben werden");
p.openInventory(inventoryManager.getReadyInventory());
}
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eBiom ändern")) {
p.closeInventory();
@ -93,14 +116,16 @@ public class MenuEvents implements Listener{
if(e.getCurrentItem().getType() == Material.MINECART) {
p.closeInventory();
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
/*
PageInventory inventory = new PageInventory("§eTeleport", p, true);
ArrayList<ItemStack> items = new ArrayList<>();
for(Plot plots : PlotManager.getPlots()) {
String name = NameFetcher.getRequest(plot.getOwner());
items.add(new ItemBuilder(Material.SKULL_ITEM).durability((short) 3).skullOwner(name).name("§e" + plots.getName()).lore("§evon " + name).make());
items.add(new ItemBuilder(p, Material.SKULL_ITEM).durability((short) 3).skullOwner(name).name("§e" + plots.getName()).lore("§evon " + name).build());
}
inventory.setPages(items);
inventory.openInventory();
*/
});
}
}

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.listener;
import eu.univento.core.api.player.CustomPlayer;
@ -11,9 +16,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.ArrayList;
import java.util.List;
public class SignInteract implements Listener {
@EventHandler
@ -30,59 +32,8 @@ public class SignInteract implements Listener {
p.setFlying(true);
} else {
PlotManager.createPlot(p);
}
}
if(e.getClickedBlock().getType() == Material.SPONGE) {
generateSpiral(0, 0, 10);
}
}
}
public void generateSpiral(int midX, int midZ, int radius) {
int x = midX;
int z = midZ;
int f = 1;
List<Point> points = new ArrayList<>();
while(f <= radius * 2) {
for(int e = z + f; z < e; z++) {
points.add(new Point(x, z));
}
for(int e = x + f; x < e; x++) {
points.add(new Point(x, z));
}
f++;
for(int e = z - f; z > e; z--) {
points.add(new Point(x, z));
}
for(int e = x - f; x > e; x--) {
points.add(new Point(x, z));
}
f++;
}
for(int e = z + f - 1; z < e; z++) {
points.add(new Point(x, z));
}
for(Point point : points)
new Location(Bukkit.getWorld("plots"), point.getX(), 100, point.getZ()).getBlock().setType(Material.BEDROCK);
}
public class Point{
private int x;
private int z;
public int getX() {
return this.x;
}
public int getZ() {
return this.z;
}
public Point(int x, int z) {
this.x = x;
this.z = z;
}
@Override
public String toString() {
return "{" + this.x + " | " + this.z + "}";
}
}
}

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.teamvento.plot;
import eu.univento.core.api.items.ItemBuilder;
@ -24,22 +29,22 @@ public class InventoryManager {
this.player = player;
}
public Inventory getMainInventory() {
public Inventory getPlayerInventory() {
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());
//inv.setItem(0, new ItemBuilder(player, Material.MINECART).name("§eZu anderen Plots teleportieren").build());
//inv.setItem(8, new ItemBuilder(player, Material.LADDER).name("§eEinstellungen").build());
inv.setItem(1, new ItemBuilder(Material.WATCH).name("§eZeit ändern").build());
inv.setItem(7, new ItemBuilder(Material.DOUBLE_PLANT).durability((short) 4).name("§eBiom ändern").build());
inv.setItem(13, new ItemBuilder(Material.BED).durability((short) 8).name("§ezu deinem Grundstück").build());
inv.setItem(19, new ItemBuilder(Material.DOUBLE_PLANT).name("§eWetter ändern").build());
//inv.setItem(20, new ItemBuilder(player, Material.SKULL_ITEM).durability((short) 3).skullOwner("conorf1807").build());
Dye resetDye = new Dye();
resetDye.setColor(DyeColor.RED);
ItemStack reset = resetDye.toItemStack(1);
ItemMeta resetMeta = reset.getItemMeta();
resetMeta.setDisplayName("§ePlot zurücksetzen");
resetMeta.setDisplayName("§eGrundstück zurücksetzen");
reset.setItemMeta(resetMeta);
Dye readyDye = new Dye();
@ -49,8 +54,8 @@ public class InventoryManager {
readyMeta.setDisplayName("§eFertig");
ready.setItemMeta(readyMeta);