~ refactoring
This commit is contained in:
parent
dab8184020
commit
78d6d7eaa4
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
TeamVento.iml
|
|
@ -1,6 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module com.demonwav.mcdev.MinecraftModuleTypes="PAPER_MODULE_TYPE" org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module 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="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>PAPER</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<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" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
@ -11,34 +20,77 @@
|
||||||
</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: com.destroystokyo.paper:paper-api:1.11-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.11.2-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" scope="PROVIDED" 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" scope="PROVIDED" name="Maven: junit:junit:4.10" 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" scope="PROVIDED" 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.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" 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" 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.17" 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" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-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.ow2.asm:asm-all:5.0.4" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.11-R0.1-SNAPSHOT" 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:bukkit:1.11-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.11-R0.1-SNAPSHOT" 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="Core" scope="PROVIDED" />
|
<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: 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="module" module-name="Commons" scope="PROVIDED" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: ai.api:libai:1.4.8" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:2.4.5" 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: org.slf4j:slf4j-api:1.7.16" 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: 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: 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: 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: 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-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: 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="library" scope="PROVIDED" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" 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>
|
</component>
|
||||||
</module>
|
</module>
|
31
pom.xml
31
pom.xml
|
@ -51,20 +51,14 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>univentoEU</id>
|
|
||||||
<url>http://dev.joethei.de:8081/repository/public/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
<groupId>com.destroystokyo.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.11-R0.1-SNAPSHOT</version>
|
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
|
@ -77,23 +71,32 @@
|
||||||
<version>1.11-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.11-R0.1-SNAPSHOT</version>
|
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.16.10</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.boydti</groupId>
|
||||||
|
<artifactId>fawe-api</artifactId>
|
||||||
|
<version>latest</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>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.16.10</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,20 +1,32 @@
|
||||||
package eu.univento.teamvento;
|
package eu.univento.teamvento;
|
||||||
|
|
||||||
|
import eu.univento.commons.server.ServerType;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.Config;
|
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.core.api.server.ServerSettings;
|
||||||
import eu.univento.teamvento.commands.*;
|
import eu.univento.teamvento.commands.WorldCommands;
|
||||||
import eu.univento.teamvento.listener.*;
|
import eu.univento.teamvento.listener.Events;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.listener.JoinQuit;
|
||||||
import eu.univento.teamvento.utils.VoidGenerator;
|
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 org.bukkit.*;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
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.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -39,64 +51,79 @@ public class TeamVento extends JavaPlugin {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Core.getInstance().registerPlugin(this);
|
|
||||||
instance = this;
|
instance = this;
|
||||||
PluginManager pm = Bukkit.getPluginManager();
|
/*
|
||||||
pm.registerEvents(new JoinQuit(), this);
|
if(Bukkit.getWorld("plots") == null) {
|
||||||
pm.registerEvents(new Events(), this);
|
WorldCreator creator = new WorldCreator("plots");
|
||||||
pm.registerEvents(new PositionSetter(), this);
|
creator.generator(new VoidGenerator());
|
||||||
pm.registerEvents(new SignInteract(), this);
|
creator.type(WorldType.CUSTOMIZED);
|
||||||
pm.registerEvents(new MenuEvents(), this);
|
creator.generateStructures(false);
|
||||||
|
Bukkit.createWorld(creator);
|
||||||
|
getCfg().set("plots", "void");
|
||||||
|
try {
|
||||||
|
getCfg().save(getConfigFile());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
new Setloc(this, "setloc", "sets locations");
|
CommandFramework commandFramework = new CommandFramework(this);
|
||||||
new WorldTP(this, "worldteleport", "teleports players to other worlds", "wtp");
|
commandFramework.registerCommands(new WorldCommands());
|
||||||
new WorldCreate(this, "worldcreate", "creates new worlds", "wc");
|
|
||||||
new WorldImport(this, "worldimport", "imports worlds", "wi");
|
PluginManager pm = Bukkit.getPluginManager();
|
||||||
new Set(this, "set", "sets the material of selected blocks");
|
pm.registerEvents(new JoinQuit(), getInstance());
|
||||||
new Sel(this, "sel", "removes block selection");
|
pm.registerEvents(new SignInteract(), getInstance());
|
||||||
new WorldList(this, "worldlist", "lists all worlds", "wl");
|
pm.registerEvents(new MenuEvents(), getInstance());
|
||||||
new PlotInfo(this, "plotinfo", "info about a plot", "pi");
|
pm.registerEvents(new Events(), getInstance());
|
||||||
|
|
||||||
|
//new PlotInfo(this, "plotinfo", "info about a plot", "pi");
|
||||||
|
|
||||||
for(String world : getCfg().getKeys(true)) {
|
for(String world : getCfg().getKeys(true)) {
|
||||||
String generator = getCfg().getString(world);
|
World loadedWorld = Bukkit.createWorld(GeneratorManager.getWorldCreator(world, getCfg().getString(world)));
|
||||||
WorldCreator creator = new WorldCreator(world);
|
loadedWorld.setDifficulty(Difficulty.HARD);
|
||||||
creator.generateStructures(false);
|
|
||||||
if(generator.equals("normal")) {
|
|
||||||
creator.environment(World.Environment.NORMAL);
|
|
||||||
creator.type(WorldType.NORMAL);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
Bukkit.createWorld(creator);
|
|
||||||
World loadedWorld = Bukkit.getWorld(world);
|
|
||||||
loadedWorld.setDifficulty(Difficulty.PEACEFUL);
|
|
||||||
loadedWorld.setPVP(false);
|
loadedWorld.setPVP(false);
|
||||||
loadedWorld.setAnimalSpawnLimit(0);
|
loadedWorld.setAnimalSpawnLimit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ServerSettings.setServerType(ServerType.TEAM_BUILD);
|
||||||
ServerSettings.setGameMode(GameMode.CREATIVE);
|
ServerSettings.setGameMode(GameMode.CREATIVE);
|
||||||
ServerSettings.setBuild(false);
|
//PlotManager.update();
|
||||||
PlotManager.update();
|
//PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
|
||||||
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);
|
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().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
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
Config.write(PlotManager.getLastPlot().getOwner().toString());
|
Config.write(PlotManager.getLastPlot().getOwner().toString());
|
||||||
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
|
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
|
||||||
Core.getInstance().unregisterPlugin(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,12 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
import eu.univento.commons.player.rank.Rank;
|
||||||
|
import eu.univento.commons.player.uuid.NameFetcher;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.utils.UUIDFetcher;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.Plot;
|
import eu.univento.teamvento.plot.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.plot.PlotManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -30,7 +29,7 @@ public class PlotInfo extends AutoCommand<TeamVento>{
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
p.sendMessage("§eName: " + plot.getName());
|
p.sendMessage("§eName: " + plot.getName());
|
||||||
p.sendMessage("§eErsteller: " + UUIDFetcher.getName(plot.getOwner()));
|
p.sendMessage("§eErsteller: " + NameFetcher.getRequest(plot.getOwner()));
|
||||||
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
|
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
|
||||||
p.sendMessage("§eKontakt: " + plot.getContact());
|
p.sendMessage("§eKontakt: " + plot.getContact());
|
||||||
p.sendMessage("§eBiom: " + plot.getBiome().name());
|
p.sendMessage("§eBiom: " + plot.getBiome().name());
|
||||||
|
@ -41,10 +40,8 @@ public class PlotInfo extends AutoCommand<TeamVento>{
|
||||||
p.sendMessage("§cHier ist leider kein Plot");
|
p.sendMessage("§cHier ist leider kein Plot");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage(p.getMessages().NO_PERMS());
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Sel extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
public Sel(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
|
||||||
WorldEdit.setPos1(p, null);
|
|
||||||
WorldEdit.setPos2(p, null);
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "selection cleared");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.schematic.Cuboid;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class Set extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
public Set(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
|
||||||
Material material;
|
|
||||||
if(args.length == 0) {
|
|
||||||
material = p.getInventory().getItemInMainHand().getType();
|
|
||||||
setBlocks(material, p);
|
|
||||||
}
|
|
||||||
if(args.length == 1) {
|
|
||||||
if(Material.getMaterial(args[0]) != null) {
|
|
||||||
material = Material.getMaterial(args[0]);
|
|
||||||
setBlocks(material, p);
|
|
||||||
}else{
|
|
||||||
int id = Integer.parseInt(args[0]);
|
|
||||||
material = Material.getMaterial(id);
|
|
||||||
setBlocks(material, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cYou need to give me some kind of stuff");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBlocks(Material material, CustomPlayer p) {
|
|
||||||
if(material.isBlock()) {
|
|
||||||
if(WorldEdit.getPos1(p) == null || WorldEdit.getPos2(p) == null) {
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§ca location has not been set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Cuboid cb = new Cuboid(WorldEdit.getPos1(p).getLocation(), WorldEdit.getPos2(p).getLocation());
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
|
||||||
long i = 0;
|
|
||||||
for(Block b : cb.getBlocks()) {
|
|
||||||
i++;
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), () -> b.setType(material), i / 90);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§ayou have changed the material of the blocks");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cthe item needs to be a block");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.Config;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.2
|
|
||||||
*/
|
|
||||||
public class Setloc extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param plugin main class
|
|
||||||
* @param command commons to execute
|
|
||||||
* @param description describes the commons
|
|
||||||
* @param aliases aliases of commons
|
|
||||||
*/
|
|
||||||
public Setloc(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
Messages msgs = new Messages(p);
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
|
|
||||||
if(args.length == 1) {
|
|
||||||
Config.write("Build.Locs." + args[0], p.getLocation());
|
|
||||||
p.sendMessage("§aLocation gesetzt");
|
|
||||||
}else {
|
|
||||||
p.sendMessage("§6Nutze /setloc <Ort>");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
p.sendMessage(msgs.NO_PERMS());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
list.add("Spawn");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.rank.Rank;
|
||||||
|
import eu.univento.core.api.command.Command;
|
||||||
|
import eu.univento.core.api.command.CommandArgs;
|
||||||
|
import eu.univento.core.api.command.Completer;
|
||||||
|
import eu.univento.teamvento.TeamVento;
|
||||||
|
import eu.univento.teamvento.generator.GeneratorManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class WorldCommands {
|
||||||
|
|
||||||
|
@Command(name = "world.teleport", aliases = {"wtp"}, description = "teleport through the worlds", usage = "/world teleport <World>", rank = Rank.JrSupporter, inGameOnly = true)
|
||||||
|
public void teleport(CommandArgs args) {
|
||||||
|
if(args.length() == 1) {
|
||||||
|
if(Bukkit.getWorld(args.getArg(0)) != null) {
|
||||||
|
args.getPlayer().teleport(Bukkit.getWorld(args.getArg(0)).getSpawnLocation());
|
||||||
|
args.getPlayer().sendMessage("§aDu hast die Welt gewechselt");
|
||||||
|
}else {
|
||||||
|
args.getPlayer().sendMessage("§cDie Welt " + args.getArg(0) + " exsistiert nicht");
|
||||||
|
}
|
||||||
|
}else args.getPlayer().sendMessage("§cDie Anzahl der Argumente stimmt nicht");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Completer(name = "world.teleport", aliases = "wtp")
|
||||||
|
public List<String> teleportCompletor(CommandArgs args) {
|
||||||
|
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)
|
||||||
|
public void list(CommandArgs args) {
|
||||||
|
args.getSender().sendMessage("§cAll worlds");
|
||||||
|
for(String world : TeamVento.getCfg().getKeys(true)) {
|
||||||
|
args.getSender().sendMessage("§a-" + world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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()) {
|
||||||
|
Bukkit.createWorld(GeneratorManager.getWorldCreator(args.getArg(0), args.getArg(1)));
|
||||||
|
TeamVento.getCfg().set(args.getArg(0), args.getArg(1));
|
||||||
|
try {
|
||||||
|
TeamVento.getCfg().save(TeamVento.getConfigFile());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
args.getSender().sendMessage("§ayour world has been imported");
|
||||||
|
}else args.getSender().sendMessage("3cthe 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)
|
||||||
|
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) {
|
||||||
|
Bukkit.createWorld(GeneratorManager.getWorldCreator(args.getArg(0), args.getArg(1)));
|
||||||
|
TeamVento.getCfg().set(args.getArg(0), args.getArg(1));
|
||||||
|
try {
|
||||||
|
TeamVento.getCfg().save(TeamVento.getConfigFile());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
args.getSender().sendMessage("§aYour world has been created");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else args.getSender().sendMessage("§cPlease use /world create <name> <generator>");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,78 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import eu.univento.teamvento.utils.VoidGenerator;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.WorldType;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class WorldCreate extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
public WorldCreate(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
|
||||||
if(args.length == 2) {
|
|
||||||
if(Bukkit.getWorld(args[0]) == null && (args[1].equalsIgnoreCase("normal") || args[1].equalsIgnoreCase("flat") || args[1].equalsIgnoreCase("void"))) {
|
|
||||||
WorldCreator creator = new WorldCreator(args[0]);
|
|
||||||
if(args[1].equalsIgnoreCase("normal")) {
|
|
||||||
creator.environment(World.Environment.NORMAL);
|
|
||||||
creator.type(WorldType.NORMAL);
|
|
||||||
}
|
|
||||||
if(args[1].equalsIgnoreCase("flat")) {
|
|
||||||
creator.environment(World.Environment.NORMAL);
|
|
||||||
creator.type(WorldType.FLAT);
|
|
||||||
creator.generateStructures(false);
|
|
||||||
}
|
|
||||||
if(args[1].equalsIgnoreCase("void")) {
|
|
||||||
creator.generator(new VoidGenerator());
|
|
||||||
creator.type(WorldType.CUSTOMIZED);
|
|
||||||
creator.generateStructures(false);
|
|
||||||
}
|
|
||||||
Bukkit.createWorld(creator);
|
|
||||||
TeamVento.getCfg().set(args[0], args[1]);
|
|
||||||
try {
|
|
||||||
TeamVento.getCfg().save(TeamVento.getConfigFile());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§aYour world has been created");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cPlease use /worldcreate <name> <normal, flat, void>");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cPlease use /worldcreate <name> <normal, flat, void>");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class WorldImport extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
public WorldImport(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if (p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
|
||||||
if(args.length == 1) {
|
|
||||||
if(Bukkit.getWorld(args[0]) == null) {
|
|
||||||
Bukkit.createWorld(new WorldCreator(args[0]));
|
|
||||||
TeamVento.getCfg().set(args[0], args[1]);
|
|
||||||
try {
|
|
||||||
TeamVento.getCfg().save(TeamVento.getConfigFile());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§ayour world has been imported");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cthe chosen world already exists");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cplease use /worldimport <name>");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class WorldList extends AutoCommand<TeamVento> {
|
|
||||||
|
|
||||||
public WorldList(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
|
||||||
p.sendMessage("§cAll worlds");
|
|
||||||
for(String world : TeamVento.getCfg().getKeys(true)) {
|
|
||||||
TextComponent text = new TextComponent("§a- " + world);
|
|
||||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wtp " + world));
|
|
||||||
text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("In die Welt").create()));
|
|
||||||
p.spigot().sendMessage(text);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
package eu.univento.teamvento.commands;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.AutoCommand;
|
|
||||||
import eu.univento.core.api.languages.Messages;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class WorldTP extends AutoCommand<TeamVento>{
|
|
||||||
|
|
||||||
public WorldTP(TeamVento plugin, String command, String description, String... aliases) {
|
|
||||||
super(plugin, command, description, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
||||||
if(sender instanceof Player) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
||||||
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
|
||||||
if(args.length == 1) {
|
|
||||||
if(Bukkit.getWorld(args[0]) != null) {
|
|
||||||
p.teleport(Bukkit.getWorld(args[0]).getSpawnLocation());
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§aDu hast die Welt gewechselt");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cDie Welt " + args[0] + " exsistiert nicht");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§cDie Anzahl der Argumente stimmt nicht");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(p.getMessages().NO_PERMS());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
||||||
return Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toCollection(ArrayList::new));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.univento.teamvento.generator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public enum Generator {
|
||||||
|
NORMAL,
|
||||||
|
FLAT,
|
||||||
|
VOID;
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.univento.teamvento.generator;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.WorldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.generator;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
|
@ -1,48 +1,49 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
import eu.univento.commons.player.rank.Rank;
|
||||||
import eu.univento.core.Core;
|
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
import eu.univento.core.api.events.MoveEventFilter;
|
import eu.univento.core.api.events.MoveEventFilter;
|
||||||
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.utils.Plot;
|
import eu.univento.teamvento.plot.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.plot.PlotManager;
|
||||||
import eu.univento.teamvento.utils.Time;
|
import eu.univento.teamvento.plot.Time;
|
||||||
import eu.univento.teamvento.utils.Weather;
|
import eu.univento.teamvento.plot.Weather;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Projectile;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
import org.bukkit.event.world.StructureGrowEvent;
|
import org.bukkit.event.world.StructureGrowEvent;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
import org.bukkit.util.EulerAngle;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.3
|
* @version 0.3
|
||||||
*/
|
*/
|
||||||
public class Events implements Listener{
|
public class Events implements Listener {
|
||||||
|
|
||||||
public static int redstone;
|
public static int redstone = 0;
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
private final HashMap<CustomPlayer, BukkitTask> lightningTasks = new HashMap<>();
|
private final HashMap<CustomPlayer, BukkitTask> lightningTasks = new HashMap<>();
|
||||||
|
|
||||||
|
@ -59,35 +60,35 @@ public class Events implements Listener{
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPlace(BlockPlaceEvent e) {
|
public void onBlockPlace(BlockPlaceEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onHangingPlace(HangingPlaceEvent e) {
|
public void onHangingPlace(HangingPlaceEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
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 {
|
} else {
|
||||||
e.setCancelled(true);
|
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());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||||
}else{
|
} else {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,13 +97,13 @@ public class Events implements Listener{
|
||||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getDamager());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getDamager());
|
||||||
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) {
|
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 {
|
} else {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +122,7 @@ public class Events implements Listener{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlock().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -131,7 +132,7 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockRedstone(BlockRedstoneEvent e) {
|
public void onBlockRedstone(BlockRedstoneEvent e) {
|
||||||
if(e.getBlock().getWorld().getName().equalsIgnoreCase("EinfachAFK")) return;
|
if (e.getBlock().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||||
redstone++;
|
redstone++;
|
||||||
if (redstone > 100) {
|
if (redstone > 100) {
|
||||||
e.getBlock().setType(Material.SIGN_POST);
|
e.getBlock().setType(Material.SIGN_POST);
|
||||||
|
@ -147,11 +148,11 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent e) {
|
public void onCreatureSpawn(CreatureSpawnEvent e) {
|
||||||
if(e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM) return;
|
//if(e.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM) e.setCancelled(true);
|
||||||
if(PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) {
|
//if(e.getSpawnReason() != CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) e.setCancelled(true);
|
||||||
e.setCancelled(true);
|
e.getEntity().setAI(false);
|
||||||
return;
|
e.getEntity().setSilent(true);
|
||||||
}
|
if (e.getEntity().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||||
Plot plot = PlotManager.getPlotByLocation(e.getEntity().getLocation());
|
Plot plot = PlotManager.getPlotByLocation(e.getEntity().getLocation());
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
if (e.getEntity().getType() != EntityType.ITEM_FRAME && e.getEntity().getType() != EntityType.ARMOR_STAND && e.getEntity().getType() != EntityType.PAINTING) {
|
if (e.getEntity().getType() != EntityType.ITEM_FRAME && e.getEntity().getType() != EntityType.ARMOR_STAND && e.getEntity().getType() != EntityType.PAINTING) {
|
||||||
|
@ -159,6 +160,12 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDeath(EntityDeathEvent e) {
|
||||||
|
e.getDrops().clear();
|
||||||
|
e.setDroppedExp(0);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockFromTo(BlockFromToEvent e) {
|
public void onBlockFromTo(BlockFromToEvent e) {
|
||||||
Material type = e.getBlock().getType();
|
Material type = e.getBlock().getType();
|
||||||
|
@ -167,7 +174,14 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPiston(BlockPistonEvent e) {
|
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||||
|
if (e.getBlock().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||||
|
if (e.getBlock().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,33 +194,35 @@ public class Events implements Listener{
|
||||||
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
||||||
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (block.getType() == Material.FIRE) {
|
if (block.getType() == Material.FIRE) {
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
if (e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
|
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDrop(PlayerDropItemEvent e) {
|
public void onDrop(PlayerDropItemEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPickup(PlayerPickupItemEvent e) {
|
public void onPickup(PlayerPickupItemEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -219,8 +235,8 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent e) {
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
if(e.getClickedInventory() instanceof PlayerInventory) {
|
if (e.getClickedInventory() instanceof PlayerInventory) {
|
||||||
if(e.getSlot() == 8 || e.getHotbarButton() == 8) {
|
if (e.getSlot() == 8 || e.getHotbarButton() == 8) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,10 +244,11 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onSwapHands(PlayerSwapHandItemsEvent e) {
|
public void onSwapHands(PlayerSwapHandItemsEvent e) {
|
||||||
if(e.getPlayer().getInventory().getHeldItemSlot() == 8) {
|
if (e.getPlayer().getInventory().getHeldItemSlot() == 8) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onConsume(PlayerItemConsumeEvent e) {
|
public void onConsume(PlayerItemConsumeEvent e) {
|
||||||
|
@ -241,31 +258,31 @@ public class Events implements Listener{
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBucketEmpty(PlayerBucketEmptyEvent e) {
|
public void onBucketEmpty(PlayerBucketEmptyEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlockClicked().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlockClicked().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBucketFill(PlayerBucketFillEvent e) {
|
public void onBucketFill(PlayerBucketFillEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlockClicked().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlockClicked().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockMove(MoveEventFilter.PlayerBlockMoveEvent e) {
|
public void onBlockMove(MoveEventFilter.PlayerBlockMoveEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
//plot enter
|
//plot enter
|
||||||
if(PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
if (PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
||||||
Plot plot = PlotManager.getPlotByLocation(e.getTo());
|
Plot plot = PlotManager.getPlotByLocation(e.getTo());
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
p.setPlayerTime(plot.getTime().getValue(), false);
|
p.setPlayerTime(plot.getTime().getValue(), false);
|
||||||
p.setPlayerWeather(plot.getWeatherType());
|
p.setPlayerWeather(plot.getWeatherType());
|
||||||
if(!plot.isOwner(p) && !plot.getOwner().equals(UUID.fromString("c35f6ece-c430-4fc0-b61e-18b55be19ee3")))
|
if (!plot.isOwner(p) && !plot.getOwner().equals(UUID.fromString("c35f6ece-c430-4fc0-b61e-18b55be19ee3")))
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 2));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 2));
|
||||||
if(plot.getWeather() == Weather.THUNDER) {
|
if (plot.getWeather() == Weather.THUNDER) {
|
||||||
BukkitTask task = Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> {
|
BukkitTask task = Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int r = random.nextInt(100);
|
int r = random.nextInt(100);
|
||||||
if(r < 30) {
|
if (r < 30) {
|
||||||
p.strikeLightning(plot.getArea().getRandomLocation());
|
p.strikeLightning(plot.getArea().getRandomLocation());
|
||||||
}
|
}
|
||||||
}, 2L, 50L);
|
}, 2L, 50L);
|
||||||
|
@ -273,16 +290,16 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//plot leave
|
//plot leave
|
||||||
if(PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
|
if (PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
|
||||||
p.setPlayerTime(Time.DAY.getValue(), false);
|
p.setPlayerTime(Time.DAY.getValue(), false);
|
||||||
p.setPlayerWeather(WeatherType.CLEAR);
|
p.setPlayerWeather(WeatherType.CLEAR);
|
||||||
p.clearPotionEffects();
|
p.clearPotionEffects();
|
||||||
if(lightningTasks.containsKey(p))
|
if (lightningTasks.containsKey(p))
|
||||||
lightningTasks.get(p).cancel();
|
lightningTasks.get(p).cancel();
|
||||||
lightningTasks.remove(p);
|
lightningTasks.remove(p);
|
||||||
}
|
}
|
||||||
if(e.getTo().getY() <= -5) {
|
if (e.getTo().getY() <= -5) {
|
||||||
if(!PlotManager.hasPlot(p)) {
|
if (!PlotManager.hasPlot(p)) {
|
||||||
p.teleport(Config.readLocation("Build.Locs.Spawn"));
|
p.teleport(Config.readLocation("Build.Locs.Spawn"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -292,16 +309,9 @@ public class Events implements Listener{
|
||||||
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));
|
||||||
}
|
}
|
||||||
Block up = p.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
|
Block up = p.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
|
||||||
Block down = p.getLocation().subtract(0.0D, 2.0D, 0.0D).getBlock();
|
if (p.getLocation().getBlock().getType() == Material.GOLD_PLATE && up.getType() == Material.COAL_BLOCK && p.getDatabasePlayer().isAllowed(Rank.JrSupporter)) {
|
||||||
if(p.getLocation().getBlock().getType() == Material.GOLD_PLATE && up.getType() == Material.COAL_BLOCK) {
|
p.teleport(Bukkit.getWorld("Planning").getSpawnLocation());
|
||||||
Core.getCommons().getLoggingHandler().getTeamVento().info("Platte und Coal");
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
if(down.getType() == Material.COMMAND_CHAIN && p.getDatabasePlayer().isAllowed(Rank.Supporter)){
|
|
||||||
p.teleport(Bukkit.getWorld("EinfachAFK").getSpawnLocation());
|
|
||||||
p.setGameMode(GameMode.ADVENTURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(up.getType() == Material.COAL_BLOCK && down.getType() == Material.COMMAND_CHAIN) {
|
|
||||||
Core.getCommons().getLoggingHandler().getTeamVento().info("Coal und Chain");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,18 +319,18 @@ public class Events implements Listener{
|
||||||
public void onTeleport(PlayerTeleportEvent e) {
|
public void onTeleport(PlayerTeleportEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
//plot enter
|
//plot enter
|
||||||
if(PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
if (PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
||||||
Plot plot = PlotManager.getPlotByLocation(e.getTo());
|
Plot plot = PlotManager.getPlotByLocation(e.getTo());
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
p.setPlayerTime(plot.getTime().getValue(), false);
|
p.setPlayerTime(plot.getTime().getValue(), false);
|
||||||
p.setPlayerWeather(plot.getWeatherType());
|
p.setPlayerWeather(plot.getWeatherType());
|
||||||
if(!plot.isOwner(p) && !plot.getOwner().equals(UUID.fromString("c35f6ece-c430-4fc0-b61e-18b55be19ee3")))
|
if (!plot.isOwner(p) && !plot.getOwner().equals(UUID.fromString("c35f6ece-c430-4fc0-b61e-18b55be19ee3")))
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 2));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 2));
|
||||||
if(plot.getWeather() == Weather.THUNDER) {
|
if (plot.getWeather() == Weather.THUNDER) {
|
||||||
BukkitTask task = Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> {
|
BukkitTask task = Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int r = random.nextInt(100);
|
int r = random.nextInt(100);
|
||||||
if(r < 30) {
|
if (r < 30) {
|
||||||
p.strikeLightning(plot.getArea().getRandomLocation());
|
p.strikeLightning(plot.getArea().getRandomLocation());
|
||||||
}
|
}
|
||||||
}, 2L, 50L);
|
}, 2L, 50L);
|
||||||
|
@ -328,11 +338,11 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//plot leave
|
//plot leave
|
||||||
if(PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
|
if (PlotManager.getPlotByLocation(e.getFrom()) != null && PlotManager.getPlotByLocation(e.getTo()) == null) {
|
||||||
p.setPlayerTime(Time.DAY.getValue(), false);
|
p.setPlayerTime(Time.DAY.getValue(), false);
|
||||||
p.setPlayerWeather(WeatherType.CLEAR);
|
p.setPlayerWeather(WeatherType.CLEAR);
|
||||||
p.clearPotionEffects();
|
p.clearPotionEffects();
|
||||||
if(lightningTasks.containsKey(p))
|
if (lightningTasks.containsKey(p))
|
||||||
lightningTasks.get(p).cancel();
|
lightningTasks.get(p).cancel();
|
||||||
lightningTasks.remove(p);
|
lightningTasks.remove(p);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +355,7 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockGrow(BlockGrowEvent e) {
|
public void onBlockGrow(BlockGrowEvent e) {
|
||||||
if(e.getBlock().getType() != Material.CROPS)
|
if (e.getBlock().getType() != Material.CROPS)
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +367,7 @@ public class Events implements Listener{
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onMultiPlace(BlockMultiPlaceEvent e) {
|
public void onMultiPlace(BlockMultiPlaceEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!PlotManager.isAllowedToBuild(p, e.getBlockPlaced().getLocation())) e.setCancelled(true);
|
if (!PlotManager.isAllowedToBuild(p, e.getBlockPlaced().getLocation())) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -373,19 +383,32 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityShootBow(EntityShootBowEvent e) {
|
public void onEntityShootBow(EntityShootBowEvent e) {
|
||||||
if(e.getEntityType() != EntityType.PLAYER) return;
|
if (e.getEntityType() != EntityType.PLAYER) return;
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getEntity().getName());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getEntity().getName());
|
||||||
if(p.getUniqueId().toString().equals("682ebd10-3661-49ec-ba4d-4f24b761b1a7")) {
|
if (p.getUniqueId().toString().equals("682ebd10-3661-49ec-ba4d-4f24b761b1a7")) {
|
||||||
Projectile projectile = (Projectile) e.getProjectile();
|
Projectile projectile = (Projectile) e.getProjectile();
|
||||||
projectile.setCustomNameVisible(true);
|
projectile.setCustomNameVisible(true);
|
||||||
projectile.setCustomName("§cNope " + p.getDisplayName() + ", Nope");
|
projectile.setCustomName("§cNope " + p.getDisplayName() + ", Nope");
|
||||||
projectile.setPassenger(projectile.getWorld().spawnEntity(projectile.getLocation(), EntityType.CHICKEN));
|
projectile.setGravity(false);
|
||||||
|
projectile.setGlowing(true);
|
||||||
|
projectile.setBounce(false);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), projectile::remove,3 * 20L);
|
||||||
}
|
}
|
||||||
|
if(p.getUniqueId().toString().equals("c35f6ece-c430-4fc0-b61e-18b55be19ee3")) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
for(int i = 0; i < 100; i++) {
|
||||||
|
p.getWorld().spawnArrow(p.getEyeLocation(), new Vector(poop(), (random.nextInt(1200) - 200) / 1000, poop()), 1.2F, 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double poop() {
|
||||||
|
return random.nextBoolean() ? random.nextDouble() : -random.nextDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileHit(ProjectileHitEvent e) {
|
public void onProjectileHit(ProjectileHitEvent e) {
|
||||||
if(e.getEntity().getPassenger() != null) {
|
if (e.getEntity().getPassenger() != null) {
|
||||||
e.getEntity().getPassenger().remove();
|
e.getEntity().getPassenger().remove();
|
||||||
e.getEntity().remove();
|
e.getEntity().remove();
|
||||||
}
|
}
|
||||||
|
@ -393,7 +416,7 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent e) {
|
public void onProjectileLaunch(ProjectileLaunchEvent e) {
|
||||||
if(e.getEntityType() == EntityType.FISHING_HOOK || e.getEntityType() == EntityType.SNOWBALL) {
|
if (e.getEntityType() == EntityType.FISHING_HOOK || e.getEntityType() == EntityType.SNOWBALL) {
|
||||||
if (e.getEntity().getShooter() instanceof Player) {
|
if (e.getEntity().getShooter() instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity().getShooter());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity().getShooter());
|
||||||
if (p.getUniqueId().toString().equals("682ebd10-3661-49ec-ba4d-4f24b761b1a7")) {
|
if (p.getUniqueId().toString().equals("682ebd10-3661-49ec-ba4d-4f24b761b1a7")) {
|
||||||
|
@ -403,4 +426,35 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||||
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
|
if(e.getItem() == null || e.getItem().getType() != Material.STICK) return;
|
||||||
|
if(p.getLocation().clone().add(0, -1, 0).getBlock().getType() != Material.GRASS) return;
|
||||||
|
final Block target = p.getTargetBlock((Set<Material>) null, 50);
|
||||||
|
if(target == null) return;
|
||||||
|
new BukkitRunnable() {
|
||||||
|
Location loc = p.getLocation();
|
||||||
|
int i = 0;
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final ArmorStand armorStand = (ArmorStand) loc.getWorld().spawnEntity(loc.clone().add(random.nextDouble() * 2 -1, -1, random.nextDouble() * 2 -1), EntityType.ARMOR_STAND);
|
||||||
|
armorStand.setVisible(true);
|
||||||
|
armorStand.setGravity(false);
|
||||||
|
armorStand.setArms(true);
|
||||||
|
armorStand.setHeadPose(new EulerAngle(Math.toRadians(random.nextInt(360)), Math.toRadians(random.nextInt(360)), Math.toRadians(random.nextInt(360))));
|
||||||
|
armorStand.setHelmet(new ItemStack(Material.GRASS));
|
||||||
|
Bukkit.getScheduler().runTaskLater(TeamVento.getInstance(), armorStand::remove, 40L);
|
||||||
|
i++;
|
||||||
|
if(i > 50) {
|
||||||
|
loc.getWorld().createExplosion(loc, 3);
|
||||||
|
for(Entity entity : loc.getWorld().getNearbyEntities(loc, 8, 8, 8)) {
|
||||||
|
if(entity instanceof LivingEntity) entity.setVelocity(new Vector(0, 2, 0));
|
||||||
|
}
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,8 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
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.plot.Plot;
|
||||||
import eu.univento.teamvento.utils.Plot;
|
import eu.univento.teamvento.plot.PlotManager;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
|
||||||
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;
|
||||||
|
@ -17,25 +12,24 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
public class JoinQuit implements Listener {
|
public class JoinQuit implements Listener {
|
||||||
|
|
||||||
public static final HashMap<CustomPlayer, Hologram> holograms = new HashMap<>();
|
//public static final HashMap<CustomPlayer, Hologram> holograms = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
e.setJoinMessage(null);
|
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.resetAttackSpeed();
|
||||||
if(PlotManager.hasPlot(p)) {
|
if (PlotManager.hasPlot(p)) {
|
||||||
Plot plot = PlotManager.getPlotByPlayer(p);
|
Plot plot = PlotManager.getPlotByPlayer(p);
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
if(!plot.isReady()) {
|
if (!plot.isReady()) {
|
||||||
ItemStack menu = new ItemStack(Material.WATCH);
|
ItemStack menu = new ItemStack(Material.WATCH);
|
||||||
ItemMeta menuMeta = menu.getItemMeta();
|
ItemMeta menuMeta = menu.getItemMeta();
|
||||||
menuMeta.setDisplayName("§eErweiterungen");
|
menuMeta.setDisplayName("§eErweiterungen");
|
||||||
|
@ -43,30 +37,28 @@ public class JoinQuit implements Listener {
|
||||||
p.getInventory().setItem(8, menu);
|
p.getInventory().setItem(8, menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
|
p.teleport(Bukkit.getWorld("world").getSpawnLocation());
|
||||||
Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
|
|
||||||
else
|
|
||||||
p.teleport(Config.readLocation("Build.Locs.Spawn"));
|
|
||||||
|
|
||||||
|
/*
|
||||||
String[] text;
|
String[] text;
|
||||||
if(PlotManager.hasPlot(p))
|
if(PlotManager.hasPlot(p))
|
||||||
text = new String[]{"§eZu deinem Plot teleportieren", "|", "|", "▼"};
|
text = new String[]{"§eZu deinem Plot teleportieren", "|", "|", "▼"};
|
||||||
else
|
else
|
||||||
text = new String[]{"§eNeues Plot erstellen", "|", "|", "▼",};
|
text = new String[]{"§eNeues Plot erstellen", "|", "|", "▼",};
|
||||||
|
|
||||||
|
|
||||||
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(new ItemStack(Material.GRASS), 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);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent e) {
|
public void onQuit(PlayerQuitEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
e.setQuitMessage(null);
|
e.setQuitMessage(p.getDatabasePlayer().getRank().getPrefix() + p.getName() + p.getDatabasePlayer().getRank().getSuffix() + "ist von uns gegangen");
|
||||||
holograms.remove(p);
|
//holograms.remove(p);
|
||||||
if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
|
|
||||||
Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
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.Core;
|
||||||
import eu.univento.core.api.gui.AnvilGUI;
|
import eu.univento.core.api.gui.AnvilGUI;
|
||||||
import eu.univento.core.api.items.ItemBuilder;
|
import eu.univento.core.api.items.ItemBuilder;
|
||||||
import eu.univento.core.api.items.PageInventory;
|
import eu.univento.core.api.items.PageInventory;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
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.plot.*;
|
||||||
import net.gpedro.integrations.slack.SlackMessage;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -27,6 +27,11 @@ import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
public class MenuEvents implements Listener{
|
public class MenuEvents implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -91,7 +96,7 @@ public class MenuEvents implements Listener{
|
||||||
PageInventory inventory = new PageInventory("§eTeleport", p, true);
|
PageInventory inventory = new PageInventory("§eTeleport", p, true);
|
||||||
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 = 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(Material.SKULL_ITEM).durability((short) 3).skullOwner(name).name("§e" + plots.getName()).lore("§evon " + name).make());
|
||||||
}
|
}
|
||||||
inventory.setPages(items);
|
inventory.setPages(items);
|
||||||
|
@ -105,9 +110,6 @@ public class MenuEvents implements Listener{
|
||||||
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"));
|
||||||
SlackMessage message = new SlackMessage("#bauevent", p.getName(), " ist nun fertig mit bauen");
|
|
||||||
message.setIcon("http://cravatar.eu/head/" + p.getUniqueId().toString());
|
|
||||||
Core.getCommons().getSlackHandler().getSlackAPI().call(message);
|
|
||||||
}
|
}
|
||||||
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Nein"))
|
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("Nein"))
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
|
@ -196,7 +198,6 @@ public class MenuEvents implements Listener{
|
||||||
event.setWillClose(true);
|
event.setWillClose(true);
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy(true);
|
||||||
plot.setName(event.getName());
|
plot.setName(event.getName());
|
||||||
p.refreshExperience();
|
|
||||||
}else{
|
}else{
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy(true);
|
||||||
event.setWillClose(true);
|
event.setWillClose(true);
|
||||||
|
@ -216,7 +217,6 @@ public class MenuEvents implements Listener{
|
||||||
event.setWillClose(true);
|
event.setWillClose(true);
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy(true);
|
||||||
plot.setContact(event.getName());
|
plot.setContact(event.getName());
|
||||||
p.refreshExperience();
|
|
||||||
}else{
|
}else{
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy(true);
|
||||||
event.setWillClose(true);
|
event.setWillClose(true);
|
||||||
|
@ -235,7 +235,7 @@ public class MenuEvents implements Listener{
|
||||||
if(e.getCurrentItem().getType() == Material.SKULL_ITEM) {
|
if(e.getCurrentItem().getType() == Material.SKULL_ITEM) {
|
||||||
SkullMeta skull = (SkullMeta) e.getCurrentItem().getItemMeta();
|
SkullMeta skull = (SkullMeta) e.getCurrentItem().getItemMeta();
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
Plot tpPlot = PlotManager.getPlotByOwner(UUIDFetcher.getUUID(skull.getOwner()).toString());
|
Plot tpPlot = PlotManager.getPlotByOwner(UUIDFetcher.getRequest(skull.getOwner()).toString());
|
||||||
assert tpPlot != null;
|
assert tpPlot != null;
|
||||||
Location loc = tpPlot.getSpawn();
|
Location loc = tpPlot.getSpawn();
|
||||||
Bukkit.getScheduler().runTask(TeamVento.getInstance(), () -> p.teleport(new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F)));
|
Bukkit.getScheduler().runTask(TeamVento.getInstance(), () -> p.teleport(new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), 89.0F, 6.0F)));
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
package eu.univento.teamvento.listener;
|
|
||||||
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class PositionSetter implements Listener{
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInteract(PlayerInteractEvent e) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
|
||||||
Block b = e.getClickedBlock();
|
|
||||||
ItemStack item = p.getInventory().getItemInMainHand();
|
|
||||||
if (p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
|
||||||
if(e.getAction() == Action.LEFT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
|
|
||||||
WorldEdit.setPos1(p, b);
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§aset pos1");
|
|
||||||
}
|
|
||||||
if(e.getAction() == Action.RIGHT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
|
|
||||||
WorldEdit.setPos2(p, b);
|
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§aset pos2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.teamvento.utils.Plot;
|
import eu.univento.teamvento.plot.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.plot.PlotManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -27,6 +27,7 @@ public class SignInteract implements Listener {
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
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));
|
||||||
|
p.setFlying(true);
|
||||||
} else {
|
} else {
|
||||||
PlotManager.createPlot(p);
|
PlotManager.createPlot(p);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
import eu.univento.core.api.items.ItemBuilder;
|
import eu.univento.core.api.items.ItemBuilder;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
|
@ -1,11 +1,7 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
import com.mongodb.CursorType;
|
|
||||||
import com.mongodb.client.FindIterable;
|
|
||||||
import eu.univento.core.Core;
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.schematic.Cuboid;
|
import eu.univento.core.api.schematic.Cuboid;
|
||||||
import org.bson.Document;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -121,26 +117,14 @@ public class Plot {
|
||||||
}
|
}
|
||||||
|
|
||||||
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()));
|
return null;
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
return doc.get(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStringFromDatabase(String name) {
|
private String getStringFromDatabase(String name) {
|
||||||
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
|
return "";
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
|
||||||
|
|
||||||
Document doc = cursor.first();
|
|
||||||
if (doc == null) return null;
|
|
||||||
|
|
||||||
return doc.getString(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
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 lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -36,7 +35,6 @@ interface PlotAction {
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
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);
|
|
||||||
player.sendHologram(new ItemStack(Material.GRASS), Config.readLocation("Build.Locs.Holo"), "§eZu deinem Plot teleportieren", "|", "|", "▼");
|
player.sendHologram(new ItemStack(Material.GRASS), Config.readLocation("Build.Locs.Holo"), "§eZu deinem Plot teleportieren", "|", "|", "▼");
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,14 +1,11 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
import com.mongodb.BasicDBObject;
|
import eu.univento.commons.player.rank.Rank;
|
||||||
import com.mongodb.CursorType;
|
|
||||||
import com.mongodb.client.FindIterable;
|
|
||||||
import eu.univento.commons.player.Rank;
|
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.schematic.Cuboid;
|
import eu.univento.core.api.schematic.Cuboid;
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import org.bson.Document;
|
import io.vertx.core.json.JsonObject;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -17,7 +14,9 @@ import org.bukkit.block.Block;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.LinkedBlockingDeque;
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,13 +44,16 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update() {
|
public static void update() {
|
||||||
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find();
|
Core.getCommons().getDatabaseManager().getMongoDB().getClient().find("plots", null, res -> {
|
||||||
for (Document doc : cursor) {
|
if(res.succeeded()) {
|
||||||
String uuid = doc.getString("uuid");
|
for(JsonObject json : res.result()) {
|
||||||
Plot plot = new Plot(new Cuboid(getLocation(uuid, "minPos"), getLocation(uuid, "maxPos")), UUID.fromString(uuid), getLocation(uuid, "Spawn"));
|
String uuid = json.getString("uuid");
|
||||||
plots.add(plot);
|
Plot plot = new Plot(new Cuboid(getLocation(uuid, "minPos"), getLocation(uuid, "maxPos")), UUID.fromString(uuid), getLocation(uuid, "Spawn"));
|
||||||
plot.setBiome(plot.getBiome());
|
plots.add(plot);
|
||||||
}
|
plot.setBiome(plot.getBiome());
|
||||||
|
}
|
||||||
|
}else res.cause().printStackTrace();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plot getPlotByPlayer(CustomPlayer p) {
|
public static Plot getPlotByPlayer(CustomPlayer p) {
|
||||||
|
@ -366,7 +368,7 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addPlotToDatabase(Plot plot) {
|
static void addPlotToDatabase(Plot plot) {
|
||||||
Document doc = new Document("uuid", plot.getOwner().toString());
|
JsonObject json = new JsonObject().put("uuid", plot.getOwner().toString());
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
||||||
HashMap<String, Object> maxPos = new HashMap<>();
|
HashMap<String, Object> maxPos = new HashMap<>();
|
||||||
|
@ -384,19 +386,13 @@ public class PlotManager {
|
||||||
spawn.put("Y", plot.getSpawn().getY());
|
spawn.put("Y", plot.getSpawn().getY());
|
||||||
spawn.put("Z", plot.getSpawn().getZ());
|
spawn.put("Z", plot.getSpawn().getZ());
|
||||||
|
|
||||||
doc.put("created", date);
|
json.put("created", date).put("maxPos", new JsonObject(maxPos)).put("minPos", new JsonObject(minPos)).put("Spawn", new JsonObject(spawn)).put("time", Time.DAY.name())
|
||||||
doc.put("maxPos", new BasicDBObject(maxPos));
|
.put("weather", Weather.CLEAR.name()).put("biome", Biome.PLAINS.name()).put("name", "§cunbenanntes Plot").put("contact", "").put("ready", false);
|
||||||
doc.put("minPos", new BasicDBObject(minPos));
|
|
||||||
doc.put("Spawn", new BasicDBObject(spawn));
|
|
||||||
doc.put("time", Time.DAY.name());
|
|
||||||
doc.put("weather", Weather.CLEAR.name());
|
|
||||||
doc.put("biome", Biome.PLAINS.name());
|
|
||||||
doc.put("name", "§cunbenanntes Plot");
|
|
||||||
doc.put("contact", "");
|
|
||||||
doc.put("ready", false);
|
|
||||||
|
|
||||||
|
Core.getCommons().getDatabaseManager().getMongoDB().getClient().insert("plots", json, res -> {
|
||||||
|
if(res.failed()) res.cause().printStackTrace();
|
||||||
|
});
|
||||||
|
|
||||||
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").insertOne(doc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPlot(Location location) {
|
private static boolean isPlot(Location location) {
|
||||||
|
@ -415,7 +411,7 @@ public class PlotManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date getCreatedDate(String uuid) {
|
public static CompletableFuture<Instant> getCreatedDate(String uuid) {
|
||||||
return getDateFromDatabase(uuid);
|
return getDateFromDatabase(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,24 +430,22 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Date getDateFromDatabase(String uuid) {
|
private static CompletableFuture<Instant> getDateFromDatabase(String uuid) {
|
||||||
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
CompletableFuture<Instant> future = new CompletableFuture<>();
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
Core.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("plots", new JsonObject().put("uuid", uuid), null, res -> {
|
||||||
|
if(res.succeeded()) future.complete(res.result().getInstant("created"));
|
||||||
Document doc = cursor.first();
|
else res.cause().printStackTrace();
|
||||||
if (doc == null) return null;
|
});
|
||||||
|
return future;
|
||||||
return doc.getDate("created");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getObjectFromDatbase(String uuid, String name) {
|
private static CompletableFuture<Object> getObjectFromDatbase(String uuid, String name) {
|
||||||
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
CompletableFuture<Object> future = new CompletableFuture<>();
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
Core.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("plots", new JsonObject().put("uuid", uuid), null, res -> {
|
||||||
|
if(res.succeeded()) future.complete(res.result().getValue(name));
|
||||||
Document doc = cursor.first();
|
else res.cause().printStackTrace();
|
||||||
if (doc == null) return null;
|
});
|
||||||
|
return future;
|
||||||
return doc.get(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, Object> getMapFromDatabase(String uuid, String name) {
|
private static Map<String, Object> getMapFromDatabase(String uuid, String name) {
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.univento.teamvento.utils;
|
package eu.univento.teamvento.plot;
|
||||||
|
|
||||||
public enum Weather {
|
public enum Weather {
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package eu.univento.teamvento.utils;
|
|
||||||
|
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class WorldEdit {
|
|
||||||
|
|
||||||
private static final HashMap<CustomPlayer, Block> pos1 = new HashMap<>();
|
|
||||||
private static final HashMap<CustomPlayer, Block> pos2 = new HashMap<>();
|
|
||||||
|
|
||||||
public static Block getPos1(CustomPlayer p) {
|
|
||||||
return pos1.containsKey(p) ? pos1.get(p) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getPos2(CustomPlayer p) {
|
|
||||||
return pos2.containsKey(p) ? pos2.get(p) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setPos1(CustomPlayer p, Block b) {
|
|
||||||
if(pos1.containsKey(p)) {
|
|
||||||
pos1.remove(p);
|
|
||||||
}
|
|
||||||
pos1.put(p, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setPos2(CustomPlayer p, Block b) {
|
|
||||||
if(pos2.containsKey(p)) {
|
|
||||||
pos2.remove(p);
|
|
||||||
}
|
|
||||||
pos2.put(p, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasSetPos(CustomPlayer p) {
|
|
||||||
return pos1.containsKey(p) && pos2.containsKey(p);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue