~ refactoring
This commit is contained in:
parent
dab8184020
commit
78d6d7eaa4
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
TeamVento.iml
|
@ -1,6 +1,15 @@
|
||||
<?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">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<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-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
@ -11,34 +20,77 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<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: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" 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.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: 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: 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:bukkit:1.11-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit: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" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.boydti:fawe-api:latest" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sk89q:worldguard:6.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.fabiozumbi12:redprotect:1.9.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.primesoft:BlocksHub:2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sk89q.worldedit:worldedit-core:6.1.3-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.plotsquared:plotsquared-api:latest" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: co.aikar:fastutil-lite:1.0" level="project" />
|
||||
<orderEntry type="module" module-name="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="library" scope="PROVIDED" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:2.4.5" 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: ai.api:libai:1.4.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler-proxy:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-socks:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http2:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver-dns:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-dns:4.1.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.7.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.7.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.7.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-redis-client:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mysql-postgresql-client:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-sql-common:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:postgresql-async_2.12:0.2.21" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:db-async-common_2.12:0.2.21" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.joda:joda-convert:1.8.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:mysql-async_2.12:0.2.21" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mongo-client:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-async:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-core:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:bson:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-rabbitmq-client:3.4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.rabbitmq:amqp-client:3.6.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TheHolyWaffle:TeamSpeak-3-Java-API:v1.0.13" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.nsp:JSkills:master-0.9.0-g8b333ec-15" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:simple:0.28" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:core:0.28" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:dense64:0.28" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.gitlab:java-gitlab-api:1.2.7" level="project" />
|
||||
</component>
|
||||
</module>
|
31
pom.xml
31
pom.xml
@ -51,20 +51,14 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>univentoEU</id>
|
||||
<url>http://dev.joethei.de:8081/repository/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
@ -77,23 +71,32 @@
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>eu.univento</groupId>
|
||||
<artifactId>Core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,20 +1,32 @@
|
||||
package eu.univento.teamvento;
|
||||
|
||||
import eu.univento.commons.server.ServerType;
|
||||
import eu.univento.core.Core;
|
||||
import eu.univento.core.api.Config;
|
||||
import eu.univento.core.api.command.CommandFramework;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.core.api.server.ServerSettings;
|
||||
import eu.univento.teamvento.commands.*;
|
||||
import eu.univento.teamvento.listener.*;
|
||||
import eu.univento.teamvento.utils.PlotManager;
|
||||
import eu.univento.teamvento.utils.VoidGenerator;
|
||||
import eu.univento.teamvento.commands.WorldCommands;
|
||||
import eu.univento.teamvento.listener.Events;
|
||||
import eu.univento.teamvento.listener.JoinQuit;
|
||||
import eu.univento.teamvento.listener.MenuEvents;
|
||||
import eu.univento.teamvento.listener.SignInteract;
|
||||
import eu.univento.teamvento.generator.GeneratorManager;
|
||||
import eu.univento.teamvento.plot.PlotManager;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
@ -39,64 +51,79 @@ public class TeamVento extends JavaPlugin {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Random random = new Random();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Core.getInstance().registerPlugin(this);
|
||||
instance = this;
|
||||
PluginManager pm = Bukkit.getPluginManager();
|
||||
pm.registerEvents(new JoinQuit(), this);
|
||||
pm.registerEvents(new Events(), this);
|
||||
pm.registerEvents(new PositionSetter(), this);
|
||||
pm.registerEvents(new SignInteract(), this);
|
||||
pm.registerEvents(new MenuEvents(), this);
|
||||
/*
|
||||
if(Bukkit.getWorld("plots") == null) {
|
||||
WorldCreator creator = new WorldCreator("plots");
|
||||
creator.generator(new VoidGenerator());
|
||||
creator.type(WorldType.CUSTOMIZED);
|
||||
creator.generateStructures(false);
|
||||
Bukkit.createWorld(creator);
|
||||
getCfg().set("plots", "void");
|
||||
try {
|
||||
getCfg().save(getConfigFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
new Setloc(this, "setloc", "sets locations");
|
||||
new WorldTP(this, "worldteleport", "teleports players to other worlds", "wtp");
|
||||
new WorldCreate(this, "worldcreate", "creates new worlds", "wc");
|
||||
new WorldImport(this, "worldimport", "imports worlds", "wi");
|
||||
new Set(this, "set", "sets the material of selected blocks");
|
||||
new Sel(this, "sel", "removes block selection");
|
||||
new WorldList(this, "worldlist", "lists all worlds", "wl");
|
||||
new PlotInfo(this, "plotinfo", "info about a plot", "pi");
|
||||
CommandFramework commandFramework = new CommandFramework(this);
|
||||
commandFramework.registerCommands(new WorldCommands());
|
||||
|
||||
PluginManager pm = Bukkit.getPluginManager();
|
||||
pm.registerEvents(new JoinQuit(), getInstance());
|
||||
pm.registerEvents(new SignInteract(), getInstance());
|
||||
pm.registerEvents(new MenuEvents(), getInstance());
|
||||
pm.registerEvents(new Events(), getInstance());
|
||||
|
||||
//new PlotInfo(this, "plotinfo", "info about a plot", "pi");
|
||||
|
||||
for(String world : getCfg().getKeys(true)) {
|
||||
String generator = getCfg().getString(world);
|
||||
WorldCreator creator = new WorldCreator(world);
|
||||
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);
|
||||
World loadedWorld = Bukkit.createWorld(GeneratorManager.getWorldCreator(world, getCfg().getString(world)));
|
||||
loadedWorld.setDifficulty(Difficulty.HARD);
|
||||
loadedWorld.setPVP(false);
|
||||
loadedWorld.setAnimalSpawnLimit(0);
|
||||
}
|
||||
|
||||
|
||||
ServerSettings.setServerType(ServerType.TEAM_BUILD);
|
||||
ServerSettings.setGameMode(GameMode.CREATIVE);
|
||||
ServerSettings.setBuild(false);
|
||||
PlotManager.update();
|
||||
PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
|
||||
//PlotManager.update();
|
||||
//PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> Bukkit.getWorlds().stream().filter(world -> world.getTime() > 7698).forEach(world -> world.setTime(0)), 100 * 20L, 20L);
|
||||
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
|
||||
public void onDisable() {
|
||||
Config.write(PlotManager.getLastPlot().getOwner().toString());
|
||||
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
|
||||
Core.getInstance().unregisterPlugin(this);
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
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.languages.Messages;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.core.api.utils.UUIDFetcher;
|
||||
import eu.univento.teamvento.TeamVento;
|
||||
import eu.univento.teamvento.utils.Plot;
|
||||
import eu.univento.teamvento.utils.PlotManager;
|
||||
import eu.univento.teamvento.plot.Plot;
|
||||
import eu.univento.teamvento.plot.PlotManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -30,7 +29,7 @@ public class PlotInfo extends AutoCommand<TeamVento>{
|
||||
assert plot != null;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
||||
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("§eKontakt: " + plot.getContact());
|
||||
p.sendMessage("§eBiom: " + plot.getBiome().name());
|
||||
@ -41,10 +40,8 @@ public class PlotInfo extends AutoCommand<TeamVento>{
|
||||
p.sendMessage("§cHier ist leider kein Plot");
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(p.getMessages().NO_PERMS());
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(Messages.Console.NOT_A_PLAYER);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
11
src/main/java/eu/univento/teamvento/generator/Generator.java
Normal file
11
src/main/java/eu/univento/teamvento/generator/Generator.java
Normal file
@ -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.World;
|
@ -1,48 +1,49 @@
|
||||
package eu.univento.teamvento.listener;
|
||||
|
||||
import eu.univento.commons.player.Rank;
|
||||
import eu.univento.core.Core;
|
||||
import eu.univento.commons.player.rank.Rank;
|
||||
import eu.univento.core.api.Config;
|
||||
import eu.univento.core.api.events.MoveEventFilter;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.teamvento.TeamVento;
|
||||
import eu.univento.teamvento.utils.Plot;
|
||||
import eu.univento.teamvento.utils.PlotManager;
|
||||
import eu.univento.teamvento.utils.Time;
|
||||
import eu.univento.teamvento.utils.Weather;
|
||||
import eu.univento.teamvento.plot.Plot;
|
||||
import eu.univento.teamvento.plot.PlotManager;
|
||||
import eu.univento.teamvento.plot.Time;
|
||||
import eu.univento.teamvento.plot.Weather;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
* @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<>();
|
||||
|
||||
@ -59,35 +60,35 @@ public class Events implements Listener{
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
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
|
||||
public void onBlockPlace(BlockPlaceEvent e) {
|
||||
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
|
||||
public void onHangingPlace(HangingPlaceEvent e) {
|
||||
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
|
||||
public void onHangingBreakByEntity(HangingBreakByEntityEvent e) {
|
||||
if(e.getRemover() instanceof Projectile) {
|
||||
if(((Projectile) e.getRemover()).getShooter() instanceof Player) {
|
||||
if (e.getRemover() instanceof Projectile) {
|
||||
if (((Projectile) e.getRemover()).getShooter() instanceof Player) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter());
|
||||
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
}else {
|
||||
if (!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
if(e.getRemover() instanceof Player) {
|
||||
if (e.getRemover() instanceof Player) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getRemover());
|
||||
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
}else{
|
||||
if (!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -96,13 +97,13 @@ public class Events implements Listener{
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager() instanceof Player) {
|
||||
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(((Projectile) e.getDamager()).getShooter() instanceof Player) {
|
||||
if (e.getDamager() instanceof Projectile) {
|
||||
if (((Projectile) e.getDamager()).getShooter() instanceof Player) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter());
|
||||
if(!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
}else {
|
||||
if (!PlotManager.isAllowedToBuild(p, e.getEntity().getLocation())) e.setCancelled(true);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -121,7 +122,7 @@ public class Events implements Listener{
|
||||
return;
|
||||
}
|
||||
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
|
||||
@ -131,7 +132,7 @@ public class Events implements Listener{
|
||||
|
||||
@EventHandler
|
||||
public void onBlockRedstone(BlockRedstoneEvent e) {
|
||||
if(e.getBlock().getWorld().getName().equalsIgnoreCase("EinfachAFK")) return;
|
||||
if (e.getBlock().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||
redstone++;
|
||||
if (redstone > 100) {
|
||||
e.getBlock().setType(Material.SIGN_POST);
|
||||
@ -147,11 +148,11 @@ public class Events implements Listener{
|
||||
|
||||
@EventHandler
|
||||
public void onCreatureSpawn(CreatureSpawnEvent e) {
|
||||
if(e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM) return;
|
||||
if(PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
//if(e.getSpawnReason() != CreatureSpawnEvent.SpawnReason.CUSTOM) e.setCancelled(true);
|
||||
//if(e.getSpawnReason() != CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) e.setCancelled(true);
|
||||
e.getEntity().setAI(false);
|
||||
e.getEntity().setSilent(true);
|
||||
if (e.getEntity().getWorld().getName().equalsIgnoreCase("world")) return;
|
||||
Plot plot = PlotManager.getPlotByLocation(e.getEntity().getLocation());
|
||||
assert plot != null;
|
||||
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
|
||||
public void onBlockFromTo(BlockFromToEvent e) {
|
||||
Material type = e.getBlock().getType();
|
||||
@ -167,7 +174,14 @@ public class Events implements Listener{
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -180,33 +194,35 @@ public class Events implements Listener{
|
||||
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
||||
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||
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(!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
||||
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (!PlotManager.isAllowedToBuild(p, e.getClickedBlock().getLocation())) e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent e) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||
if(e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
||||
if(!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
||||
if (e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
||||
if (!PlotManager.isAllowedToBuild(p, e.getRightClicked().getLocation())) e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
|
||||
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
|
||||
public void onDrop(PlayerDropItemEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onPickup(PlayerPickupItemEvent e) {
|
||||
e.setCancelled(true);
|
||||
@ -219,8 +235,8 @@ public class Events implements Listener{
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
if(e.getClickedInventory() instanceof PlayerInventory) {
|
||||
if(e.getSlot() == 8 || e.getHotbarButton() == 8) {
|
||||
if (e.getClickedInventory() instanceof PlayerInventory) {
|
||||
if (e.getSlot() == 8 || e.getHotbarButton() == 8) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -228,10 +244,11 @@ public class Events implements Listener{
|
||||
|
||||
@EventHandler
|
||||
public void onSwapHands(PlayerSwapHandItemsEvent e) {
|
||||
if(e.getPlayer().getInventory().getHeldItemSlot() == 8) {
|
||||
if (e.getPlayer().getInventory().getHeldItemSlot() == 8) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onConsume(PlayerItemConsumeEvent e) {
|
||||
@ -241,31 +258,31 @@ public class Events implements Listener{
|
||||
@EventHandler
|
||||
public void onBucketEmpty(PlayerBucketEmptyEvent e) {
|
||||
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
|
||||
public void onBucketFill(PlayerBucketFillEvent e) {
|
||||
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
|
||||
public void onBlockMove(MoveEventFilter.PlayerBlockMoveEvent e) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||
//plot enter
|
||||
if(PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
||||
if (PlotManager.getPlotByLocation(e.getFrom()) == null && PlotManager.getPlotByLocation(e.getTo()) != null) {
|
||||
Plot plot = PlotManager.getPlotByLocation(e.getTo());
|
||||
assert plot != null;
|
||||
p.setPlayerTime(plot.getTime().getValue(), false);
|
||||
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));
|
||||
if(plot.getWeather() == Weather.THUNDER) {
|
||||
if (plot.getWeather() == Weather.THUNDER) {
|
||||
BukkitTask task = Bukkit.getScheduler().runTaskTimerAsynchronously(TeamVento.getInstance(), () -> {
|
||||
Random random = new Random();
|
||||
int r = random.nextInt(100);
|
||||
if(r < 30) {
|
||||
if (r < 30) {
|
||||
p.strikeLightning(plot.getArea().getRandomLocation());
|
||||
}
|
||||
}, 2L, 50L);
|
||||