changed up plot generation again.
This commit is contained in:
parent
48147b61ca
commit
aecd9f572a
|
@ -6,31 +6,29 @@
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.10-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="craftbukkit-1.10.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.10-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="module" module-name="Core" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
<orderEntry type="module" module-name="Commons" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:17.0" 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.15" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.10-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.9-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
|
||||||
<orderEntry type="module" module-name="Core" />
|
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
45
pom.xml
45
pom.xml
|
@ -51,52 +51,7 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.10-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
<version>1.10-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mongodb</groupId>
|
|
||||||
<artifactId>mongo-java-driver</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mongodb</groupId>
|
|
||||||
<artifactId>mongodb-driver-async</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.netty</groupId>
|
|
||||||
<artifactId>netty-all</artifactId>
|
|
||||||
<version>4.0.36.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot-api</artifactId>
|
|
||||||
<version>1.10-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.univento</groupId>
|
<groupId>eu.univento</groupId>
|
||||||
<artifactId>Core</artifactId>
|
<artifactId>Core</artifactId>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.univento.teamvento;
|
package eu.univento.teamvento;
|
||||||
|
|
||||||
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
import eu.univento.core.api.server.ServerSettings;
|
import eu.univento.core.api.server.ServerSettings;
|
||||||
import eu.univento.teamvento.commands.*;
|
import eu.univento.teamvento.commands.*;
|
||||||
|
@ -14,8 +15,6 @@ import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
|
@ -23,8 +22,8 @@ import java.util.logging.Logger;
|
||||||
*/
|
*/
|
||||||
public class TeamVento extends JavaPlugin {
|
public class TeamVento extends JavaPlugin {
|
||||||
|
|
||||||
private static File file = new File("plugins/Core", "worlds.yml");
|
private static final File file = new File("plugins/Core", "worlds.yml");
|
||||||
private static FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
private static final FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||||
|
|
||||||
public static File getConfigFile() {
|
public static File getConfigFile() {
|
||||||
return file;
|
return file;
|
||||||
|
@ -39,14 +38,9 @@ public class TeamVento extends JavaPlugin {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Logger logger = Bukkit.getLogger();
|
|
||||||
|
|
||||||
private static void log(Level level, String string) {
|
|
||||||
logger.log(level, "[" + getInstance().getDescription().getName() + "] " + string);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
Core.getInstance().registerPlugin(this);
|
||||||
instance = this;
|
instance = this;
|
||||||
PluginManager pm = Bukkit.getPluginManager();
|
PluginManager pm = Bukkit.getPluginManager();
|
||||||
pm.registerEvents(new JoinQuit(), this);
|
pm.registerEvents(new JoinQuit(), this);
|
||||||
|
@ -56,13 +50,13 @@ public class TeamVento extends JavaPlugin {
|
||||||
pm.registerEvents(new MenuEvents(), this);
|
pm.registerEvents(new MenuEvents(), this);
|
||||||
|
|
||||||
new Setloc(this, "setloc" , "sets locations");
|
new Setloc(this, "setloc" , "sets locations");
|
||||||
new WorldTP(this, "worldtp", "teleports players to other worlds", "wtp");
|
new WorldTP(this, "teleports players to other worlds", "wtp");
|
||||||
new WorldCreate(this, "worldcreate", "creates new worlds", "wc");
|
new WorldCreate(this, "creates new worlds", "wc");
|
||||||
new WorldImport(this, "worldimport", "imports worlds", "wi");
|
new WorldImport(this, "worldimport", "imports worlds");
|
||||||
new Set(this, "set", "sets the material of selected blocks");
|
new Set(this, "set", "sets the material of selected blocks");
|
||||||
new Sel(this, "sel", "removes block selection");
|
new Sel(this, "sel", "removes block selection");
|
||||||
new WorldList(this, "worldlist", "lists all worlds", "wl");
|
new WorldList(this, "lists all worlds", "wl");
|
||||||
new PlotInfo(this, "plotinfo", "info about a plot", "pi");
|
new PlotInfo(this, "info about a plot", "pi");
|
||||||
new Pack(this, "pack", "sets resource pack");
|
new Pack(this, "pack", "sets resource pack");
|
||||||
|
|
||||||
for(String world : getCfg().getKeys(true)) {
|
for(String world : getCfg().getKeys(true)) {
|
||||||
|
@ -92,18 +86,19 @@ public class TeamVento extends JavaPlugin {
|
||||||
|
|
||||||
|
|
||||||
ServerSettings.setGameMode(GameMode.CREATIVE);
|
ServerSettings.setGameMode(GameMode.CREATIVE);
|
||||||
ServerSettings.setBuild(true);
|
ServerSettings.setBuild(false);
|
||||||
PlotManager.update();
|
PlotManager.update();
|
||||||
PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
|
PlotManager.setLastPlot(PlotManager.getPlotByOwner(Config.readString("lastPlot")));
|
||||||
log(Level.INFO, "Plugin ver." + getDescription().getVersion() + " gestartet");
|
Core.getCommons().getLoggingHandler().getTrashGames().info("Plugin ver." + getDescription().getVersion() + " gestartet");
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
Config.write("lastPlot", PlotManager.getLastPlot().getOwner().toString());
|
Config.write(PlotManager.getLastPlot().getOwner().toString());
|
||||||
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
|
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
|
||||||
log(Level.INFO, "Plugin beendet");
|
Core.getInstance().unregisterPlugin(this);
|
||||||
|
Core.getCommons().getLoggingHandler().getTrashGames().info("Plugin beendet");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 01.07.2016
|
|
||||||
*/
|
*/
|
||||||
public class Pack extends AutoCommand<TeamVento>{
|
public class Pack extends AutoCommand<TeamVento>{
|
||||||
|
|
||||||
|
@ -27,9 +26,7 @@ public class Pack extends AutoCommand<TeamVento>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
if(ResourcePack.valueOf(args[0]) != null) {
|
|
||||||
p.setResourcePack(ResourcePack.valueOf(args[0]).getUrl());
|
p.setResourcePack(ResourcePack.valueOf(args[0]).getUrl());
|
||||||
}else p.sendMessage("§cDieses Pack ist nicht erhätlich");
|
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage("§cDa stimmt was mit den Argumenten nicht");
|
p.sendMessage("§cDa stimmt was mit den Argumenten nicht");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.core.api.utils.UUIDFetcher;
|
import eu.univento.core.api.utils.UUIDFetcher;
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.Plot;
|
import eu.univento.teamvento.utils.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.utils.PlotManager;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
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;
|
||||||
|
@ -26,15 +24,13 @@ public class PlotInfo extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
|
||||||
if(p.isAllowed(Rank.SrBuilder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
||||||
if(PlotManager.getPlotByLocation(p.getLocation()) != null) {
|
if(PlotManager.getPlotByLocation(p.getLocation()) != null) {
|
||||||
Plot plot = PlotManager.getPlotByLocation(p.getLocation());
|
Plot plot = PlotManager.getPlotByLocation(p.getLocation());
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
p.sendMessage("§eErsteller: " + UUIDFetcher.getName(plot.getOwner()));
|
p.sendMessage("§eErsteller: " + UUIDFetcher.getName(plot.getOwner()));
|
||||||
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
|
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
|
||||||
TextComponent pack = new TextComponent("§eResourcePack " + plot.getResourcePack().getName());
|
p.sendMessage("§eResourcePack " + plot.getResourcePack().getName());
|
||||||
pack.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pack " + plot.getResourcePack().name()));
|
|
||||||
//p.spigot().sendMessage(pack);
|
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage("§cHier ist leider kein Plot");
|
p.sendMessage("§cHier ist leider kein Plot");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
import eu.univento.teamvento.utils.WorldEdit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -21,7 +21,7 @@ public class Sel extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.Builder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
||||||
WorldEdit.setPos1(p, null);
|
WorldEdit.setPos1(p, null);
|
||||||
WorldEdit.setPos2(p, null);
|
WorldEdit.setPos2(p, null);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "selection cleared");
|
p.sendMessage(p.getMessages().PREFIX() + "selection cleared");
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
import eu.univento.core.api.languages.Messages;
|
||||||
import eu.univento.core.api.map.Cuboid;
|
import eu.univento.core.api.map.Cuboid;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
import eu.univento.teamvento.utils.WorldEdit;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -29,7 +29,7 @@ public class Set extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.Builder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
||||||
Material material;
|
Material material;
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
material = p.getInventory().getItemInMainHand().getType();
|
material = p.getInventory().getItemInMainHand().getType();
|
||||||
|
@ -62,7 +62,7 @@ public class Set extends AutoCommand<TeamVento>{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBlocks(Material material, CustomPlayer p) {
|
private void setBlocks(Material material, CustomPlayer p) {
|
||||||
if(material.isBlock()) {
|
if(material.isBlock()) {
|
||||||
if(WorldEdit.getPos1(p) == null || WorldEdit.getPos2(p) == null) {
|
if(WorldEdit.getPos1(p) == null || WorldEdit.getPos2(p) == null) {
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§ca location has not been set");
|
p.sendMessage(p.getMessages().PREFIX() + "§ca location has not been set");
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -20,9 +20,9 @@ public class Setloc extends AutoCommand<TeamVento>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin main class
|
* @param plugin main class
|
||||||
* @param command command to execute
|
* @param command commons to execute
|
||||||
* @param description describes the command
|
* @param description describes the commons
|
||||||
* @param aliases aliases of command
|
* @param aliases aliases of commons
|
||||||
*/
|
*/
|
||||||
public Setloc(TeamVento plugin, String command, String description, String... aliases) {
|
public Setloc(TeamVento plugin, String command, String description, String... aliases) {
|
||||||
super(plugin, command, description, aliases);
|
super(plugin, command, description, aliases);
|
||||||
|
@ -33,7 +33,7 @@ public class Setloc extends AutoCommand<TeamVento>{
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
Messages msgs = new Messages(p);
|
Messages msgs = new Messages(p);
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
Config.write("Build.Locs." + args[0], p.getLocation());
|
Config.write("Build.Locs." + args[0], p.getLocation());
|
||||||
p.sendMessage("§aLocation gesetzt");
|
p.sendMessage("§aLocation gesetzt");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.VoidGenerator;
|
import eu.univento.teamvento.utils.VoidGenerator;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -30,7 +30,7 @@ public class WorldCreate extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.SrBuilder)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
||||||
if(args.length == 2) {
|
if(args.length == 2) {
|
||||||
if(Bukkit.getWorld(args[0]) == null && (args[1].equalsIgnoreCase("normal") || args[1].equalsIgnoreCase("flat") || args[1].equalsIgnoreCase("void"))) {
|
if(Bukkit.getWorld(args[0]) == null && (args[1].equalsIgnoreCase("normal") || args[1].equalsIgnoreCase("flat") || args[1].equalsIgnoreCase("void"))) {
|
||||||
WorldCreator creator = new WorldCreator(args[0]);
|
WorldCreator creator = new WorldCreator(args[0]);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
|
@ -27,7 +27,7 @@ public class WorldImport extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if (p.isAllowed(Rank.SrBuilder)) {
|
if (p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
if(Bukkit.getWorld(args[0]) == null) {
|
if(Bukkit.getWorld(args[0]) == null) {
|
||||||
Bukkit.createWorld(new WorldCreator(args[0]));
|
Bukkit.createWorld(new WorldCreator(args[0]));
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -24,7 +24,7 @@ public class WorldList extends AutoCommand<TeamVento> {
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.Supporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||||
p.sendMessage("§cAll worlds");
|
p.sendMessage("§cAll worlds");
|
||||||
for(String world : TeamVento.getCfg().getKeys(true)) {
|
for(String world : TeamVento.getCfg().getKeys(true)) {
|
||||||
p.sendMessage("§a- " + world);
|
p.sendMessage("§a- " + world);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.univento.teamvento.commands;
|
package eu.univento.teamvento.commands;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.AutoCommand;
|
import eu.univento.core.api.AutoCommand;
|
||||||
import eu.univento.core.api.languages.Messages;
|
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.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -28,7 +28,7 @@ public class WorldTP extends AutoCommand<TeamVento>{
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
||||||
if(p.isAllowed(Rank.Supporter)) {
|
if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
if(Bukkit.getWorld(args[0]) != null) {
|
if(Bukkit.getWorld(args[0]) != null) {
|
||||||
p.teleport(Bukkit.getWorld(args[0]).getSpawnLocation());
|
p.teleport(Bukkit.getWorld(args[0]).getSpawnLocation());
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
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.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.core.api.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.Plot;
|
import eu.univento.teamvento.utils.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.utils.PlotManager;
|
||||||
|
@ -23,6 +23,8 @@ 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.InventoryAction;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
|
@ -35,29 +37,22 @@ import org.bukkit.scheduler.BukkitTask;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.2
|
* @version 0.3
|
||||||
*/
|
*/
|
||||||
public class Events implements Listener{
|
public class Events implements Listener{
|
||||||
|
|
||||||
public static int redstone;
|
public static int redstone;
|
||||||
|
|
||||||
private HashMap<CustomPlayer, BukkitTask> lightningTasks = new HashMap<>();
|
private final HashMap<CustomPlayer, BukkitTask> lightningTasks = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWeatherChange(WeatherChangeEvent e) {
|
public void onWeatherChange(WeatherChangeEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onTramp(PlayerInteractEvent e) {
|
|
||||||
if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL)
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent e) {
|
public void onEntityExplode(EntityExplodeEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -66,25 +61,12 @@ 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 (p.isAllowed(Rank.SrDeveloper)) return;
|
if(PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if(!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
|
if(!e.getBlock().getWorld().getName().equals("plots")) e.setCancelled(false);
|
||||||
e.setCancelled(true);
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) e.setCancelled(false);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockPlace(BlockPlaceEvent e) {
|
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
|
||||||
if(PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()) == null) e.setCancelled(true);
|
|
||||||
if(!PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()).isOwner(p)) e.setCancelled(true);
|
|
||||||
if(!e.getBlockPlaced().getWorld().getName().equals("plots")) e.setCancelled(false);
|
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) e.setCancelled(false);
|
|
||||||
/**
|
/**
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (p.isAllowed(Ranks.SrDeveloper)) return;
|
|
||||||
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
|
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -95,15 +77,29 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockCanBuild(BlockCanBuildEvent e) {
|
public void onBlockPlace(BlockPlaceEvent e) {
|
||||||
e.setBuildable(true);
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
|
if(PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()) == null) e.setCancelled(true);
|
||||||
|
if(!PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
|
if(!e.getBlockPlaced().getWorld().getName().equals("plots")) e.setCancelled(false);
|
||||||
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) e.setCancelled(false);
|
||||||
|
/**
|
||||||
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
|
if (p.getDatabasePlayer().isAllowed(Ranks.SrDeveloper)) return;
|
||||||
|
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
|
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) 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 (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
|
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -113,14 +109,14 @@ public class Events implements Listener{
|
||||||
if(e.getRemover() instanceof Projectile) {
|
if(e.getRemover() instanceof Projectile) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter());
|
||||||
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) e.setCancelled(true);
|
if (PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!PlotManager.getPlotByLocation(e.getEntity().getLocation()).isOwner(p)) e.setCancelled(true);
|
if (!PlotManager.getPlotByLocation(e.getEntity().getLocation()).isOwner(p)) 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 (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) e.setCancelled(true);
|
if (PlotManager.getPlotByLocation(e.getEntity().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!PlotManager.getPlotByLocation(e.getEntity().getLocation()).isOwner(p)) e.setCancelled(true);
|
if (!PlotManager.getPlotByLocation(e.getEntity().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}else{
|
}else{
|
||||||
|
@ -133,7 +129,7 @@ public class Events implements Listener{
|
||||||
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 (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getDamager().getLocation()) == null) {
|
if (PlotManager.getPlotByLocation(e.getDamager().getLocation()) == null) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +139,7 @@ public class Events implements Listener{
|
||||||
if(e.getDamager() instanceof Projectile) {
|
if(e.getDamager() instanceof Projectile) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter());
|
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter());
|
||||||
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getEntity().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getDamager().getLocation()) == null) {
|
if (PlotManager.getPlotByLocation(e.getDamager().getLocation()) == null) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -166,7 +162,7 @@ public class Events implements Listener{
|
||||||
}
|
}
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
|
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
if (!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -209,12 +205,14 @@ public class Events implements Listener{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteract(PlayerInteractEvent e) {
|
public void onInteract(PlayerInteractEvent e) {
|
||||||
|
if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL)
|
||||||
|
e.setCancelled(true);
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
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(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if(PlotManager.getPlotByLocation(block.getLocation()) == null) e.setCancelled(true);
|
if(PlotManager.getPlotByLocation(block.getLocation()) == null) e.setCancelled(true);
|
||||||
if(!PlotManager.getPlotByLocation(block.getLocation()).isOwner(p)) e.setCancelled(true);
|
if(!PlotManager.getPlotByLocation(block.getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -232,7 +230,7 @@ public class Events implements Listener{
|
||||||
if (!e.getRightClicked().getWorld().getName().equalsIgnoreCase("plots"))
|
if (!e.getRightClicked().getWorld().getName().equalsIgnoreCase("plots"))
|
||||||
return;
|
return;
|
||||||
if(e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
if(e.getRightClicked().getType() == EntityType.ITEM_FRAME) {
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if(PlotManager.getPlotByLocation(e.getRightClicked().getLocation()) == null) e.setCancelled(true);
|
if(PlotManager.getPlotByLocation(e.getRightClicked().getLocation()) == null) e.setCancelled(true);
|
||||||
if(!PlotManager.getPlotByLocation(e.getRightClicked().getLocation()).isOwner(p)) e.setCancelled(true);
|
if(!PlotManager.getPlotByLocation(e.getRightClicked().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +240,7 @@ public class Events implements Listener{
|
||||||
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
|
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (!e.getRightClicked().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getRightClicked().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if(PlotManager.getPlotByLocation(e.getRightClicked().getLocation()) == null) e.setCancelled(true);
|
if(PlotManager.getPlotByLocation(e.getRightClicked().getLocation()) == null) e.setCancelled(true);
|
||||||
if(!PlotManager.getPlotByLocation(e.getRightClicked().getLocation()).isOwner(p)) e.setCancelled(true);
|
if(!PlotManager.getPlotByLocation(e.getRightClicked().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -250,21 +248,21 @@ public class Events implements Listener{
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDrop(PlayerDropItemEvent e) {
|
public void onDrop(PlayerDropItemEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!p.isAllowed(Rank.SrDeveloper))
|
if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPickup(PlayerPickupItemEvent e) {
|
public void onPickup(PlayerPickupItemEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!p.isAllowed(Rank.SrDeveloper))
|
if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onArrowPickup(PlayerPickupArrowEvent e) {
|
public void onArrowPickup(PlayerPickupArrowEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if(!p.isAllowed(Rank.SrDeveloper))
|
if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +284,13 @@ public class Events implements Listener{
|
||||||
if(e.getCursor().getType() == Material.WATCH) e.setCancelled(true);
|
if(e.getCursor().getType() == Material.WATCH) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
|
if(e.getAction() == InventoryAction.SWAP_WITH_CURSOR) {
|
||||||
|
Core.getCommons().getLoggingHandler().getTeamVento().info("Inventory clicked: Swap with cursor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onConsume(PlayerItemConsumeEvent e) {
|
public void onConsume(PlayerItemConsumeEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -296,7 +301,7 @@ public class Events implements Listener{
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
|
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
|
||||||
return;
|
return;
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if(PlotManager.getPlotByLocation(e.getPlayer().getLocation()) == null) {
|
if(PlotManager.getPlotByLocation(e.getPlayer().getLocation()) == null) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -309,7 +314,7 @@ public class Events implements Listener{
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
|
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
|
||||||
return;
|
return;
|
||||||
if(p.isAllowed(Rank.SrDeveloper)) return;
|
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if(PlotManager.getPlotByLocation(e.getPlayer().getLocation()) == null) e.setCancelled(true);
|
if(PlotManager.getPlotByLocation(e.getPlayer().getLocation()) == null) e.setCancelled(true);
|
||||||
if(!PlotManager.getPlotByLocation(e.getPlayer().getLocation()).isOwner(p)) e.setCancelled(true);
|
if(!PlotManager.getPlotByLocation(e.getPlayer().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -357,14 +362,14 @@ public class Events implements Listener{
|
||||||
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();
|
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) {
|
if(p.getLocation().getBlock().getType() == Material.GOLD_PLATE && up.getType() == Material.COAL_BLOCK) {
|
||||||
Core.log(Level.INFO, "Platte und Coal");
|
Core.getCommons().getLoggingHandler().getTeamVento().info("Platte und Coal");
|
||||||
if(down.getType() == Material.COMMAND_CHAIN && p.isAllowed(Rank.Supporter)){
|
if(down.getType() == Material.COMMAND_CHAIN && p.getDatabasePlayer().isAllowed(Rank.Supporter)){
|
||||||
p.teleport(Config.readLocation("Build.Locs.Planning"));
|
p.teleport(Bukkit.getWorld("EinfachAFK").getSpawnLocation());
|
||||||
p.setGameMode(GameMode.ADVENTURE);
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(up.getType() == Material.COAL_BLOCK && down.getType() == Material.COMMAND_CHAIN) {
|
if(up.getType() == Material.COAL_BLOCK && down.getType() == Material.COMMAND_CHAIN) {
|
||||||
Core.log(Level.INFO, "Coal und Chain");
|
Core.getCommons().getLoggingHandler().getTeamVento().info("Coal und Chain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +393,7 @@ public class Events implements Listener{
|
||||||
public void onMultiPlace(BlockMultiPlaceEvent e) {
|
public void onMultiPlace(BlockMultiPlaceEvent e) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
if (!e.getBlockPlaced().getWorld().getName().equalsIgnoreCase("plots")) return;
|
if (!e.getBlockPlaced().getWorld().getName().equalsIgnoreCase("plots")) return;
|
||||||
if (p.isAllowed(Rank.SrDeveloper)) return;
|
if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
|
||||||
if (PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()) == null) e.setCancelled(true);
|
if (PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()) == null) e.setCancelled(true);
|
||||||
if (!PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()).isOwner(p)) e.setCancelled(true);
|
if (!PlotManager.getPlotByLocation(e.getBlockPlaced().getLocation()).isOwner(p)) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
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.Config;
|
||||||
import eu.univento.core.api.Hologram;
|
import eu.univento.core.api.Hologram;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.teamvento.TeamVento;
|
import eu.univento.teamvento.TeamVento;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.utils.PlotManager;
|
||||||
import net.minecraft.server.v1_10_R1.EnumParticle;
|
import net.minecraft.server.v1_10_R1.EnumParticle;
|
||||||
|
@ -24,7 +24,7 @@ import java.util.HashMap;
|
||||||
*/
|
*/
|
||||||
public class JoinQuit implements Listener {
|
public class JoinQuit implements Listener {
|
||||||
|
|
||||||
static HashMap<CustomPlayer, Hologram> holograms = new HashMap<>();
|
static final HashMap<CustomPlayer, Hologram> holograms = new HashMap<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
|
@ -38,8 +38,8 @@ public class JoinQuit implements Listener {
|
||||||
menu.setItemMeta(menuMeta);
|
menu.setItemMeta(menuMeta);
|
||||||
p.getInventory().setItem(8, menu);
|
p.getInventory().setItem(8, menu);
|
||||||
}
|
}
|
||||||
if(p.getRank() == Rank.Builder || p.getRank() == Rank.SrBuilder)
|
if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
|
||||||
Bukkit.broadcastMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
|
Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
|
||||||
else
|
else
|
||||||
p.teleport(Config.readLocation("Build.Locs.Spawn"));
|
p.teleport(Config.readLocation("Build.Locs.Spawn"));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class JoinQuit implements Listener {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
e.setQuitMessage(null);
|
e.setQuitMessage(null);
|
||||||
holograms.remove(p);
|
holograms.remove(p);
|
||||||
if(p.getRank() == Rank.Builder || p.getRank() == Rank.SrBuilder)
|
if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
|
||||||
Bukkit.broadcastMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
|
Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,10 +26,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class MenuEvents implements Listener{
|
public class MenuEvents implements Listener{
|
||||||
|
|
||||||
|
@ -89,11 +85,11 @@ public class MenuEvents implements Listener{
|
||||||
if(e.getCurrentItem().getType() == Material.MINECART) {
|
if(e.getCurrentItem().getType() == Material.MINECART) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
|
||||||
ScrollingInventory inventory = new ScrollingInventory(p, "§eTeleport", 27);
|
ScrollingInventory inventory = new ScrollingInventory(p, "§eTeleport");
|
||||||
for(Plot plots : PlotManager.getPlots()) {
|
for(Plot plots : PlotManager.getPlots()) {
|
||||||
String name = UUIDFetcher.getName(plots.getOwner());
|
String name = UUIDFetcher.getName(plots.getOwner());
|
||||||
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM)
|
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM)
|
||||||
.durability(3).skullOwner(name)
|
.durability().skullOwner(name)
|
||||||
.name(plot.getName().equals("") ? "§cunbenanntes Plot" : "§e" + plots.getName())
|
.name(plot.getName().equals("") ? "§cunbenanntes Plot" : "§e" + plots.getName())
|
||||||
.lore("§eby " + name)
|
.lore("§eby " + name)
|
||||||
.make());
|
.make());
|
||||||
|
@ -183,45 +179,45 @@ public class MenuEvents implements Listener{
|
||||||
if(e.getCurrentItem().getType() == Material.SIGN) {
|
if(e.getCurrentItem().getType() == Material.SIGN) {
|
||||||
AnvilGUI gui = new AnvilGUI(p, event -> {
|
AnvilGUI gui = new AnvilGUI(p, event -> {
|
||||||
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
|
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
|
||||||
event.setWillClose(true);
|
event.setWillClose();
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy();
|
||||||
plot.setName(event.getName());
|
plot.setName(event.getName());
|
||||||
p.refreshExperience();
|
p.refreshExperience();
|
||||||
}else{
|
}else{
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy();
|
||||||
event.setWillClose(true);
|
event.setWillClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ItemStack name = new ItemStack(Material.SIGN);
|
ItemStack name = new ItemStack(Material.SIGN);
|
||||||
ItemMeta nameMeta = name.getItemMeta();
|
ItemMeta nameMeta = name.getItemMeta();
|
||||||
nameMeta.setDisplayName(plot.getName() == null ? "§cunbennantes Plot" : plot.getName());
|
nameMeta.setDisplayName(plot.getName() == null ? "§cunbennantes Plot" : plot.getName());
|
||||||
name.setItemMeta(nameMeta);
|
name.setItemMeta(nameMeta);
|
||||||
gui.setSlot(AnvilGUI.AnvilSlot.INPUT_LEFT, name);
|
gui.setSlot(name);
|
||||||
|
|
||||||
gui.open();
|
gui.open();
|
||||||
}
|
}
|
||||||
if(e.getCurrentItem().getType() == Material.NAME_TAG) {
|
if(e.getCurrentItem().getType() == Material.NAME_TAG) {
|
||||||
AnvilGUI gui = new AnvilGUI(p, event -> {
|
AnvilGUI gui = new AnvilGUI(p, event -> {
|
||||||
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
|
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
|
||||||
event.setWillClose(true);
|
event.setWillClose();
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy();
|
||||||
plot.setContact(event.getName());
|
plot.setContact(event.getName());
|
||||||
p.refreshExperience();
|
p.refreshExperience();
|
||||||
}else{
|
}else{
|
||||||
event.setWillDestroy(true);
|
event.setWillDestroy();
|
||||||
event.setWillClose(true);
|
event.setWillClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ItemStack name = new ItemStack(Material.NAME_TAG);
|
ItemStack name = new ItemStack(Material.NAME_TAG);
|
||||||
ItemMeta nameMeta = name.getItemMeta();
|
ItemMeta nameMeta = name.getItemMeta();
|
||||||
nameMeta.setDisplayName(plot.getContact() == null ? "§cKontaktdaten hier angeben" : plot.getContact());
|
nameMeta.setDisplayName(plot.getContact() == null ? "§cKontaktdaten hier angeben" : plot.getContact());
|
||||||
name.setItemMeta(nameMeta);
|
name.setItemMeta(nameMeta);
|
||||||
gui.setSlot(AnvilGUI.AnvilSlot.INPUT_LEFT, name);
|
gui.setSlot(name);
|
||||||
|
|
||||||
gui.open();
|
gui.open();
|
||||||
}
|
}
|
||||||
if(e.getCurrentItem().getType() == Material.DIRT) {
|
if(e.getCurrentItem().getType() == Material.DIRT) {
|
||||||
ScrollingInventory inventory = new ScrollingInventory(p, "§eResourcePack", 27);
|
ScrollingInventory inventory = new ScrollingInventory(p, "§eResourcePack");
|
||||||
for(ResourcePack pack : ResourcePack.values()) {
|
for(ResourcePack pack : ResourcePack.values()) {
|
||||||
inventory.addItem(new ItemBuilder(pack.getMaterial()).name(pack.getName())
|
inventory.addItem(new ItemBuilder(pack.getMaterial()).name(pack.getName())
|
||||||
.enchantment(pack.name().equals(plot.getResourcePack().name()) ? Enchantment.ARROW_DAMAGE : null).make());
|
.enchantment(pack.name().equals(plot.getResourcePack().name()) ? Enchantment.ARROW_DAMAGE : null).make());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.univento.teamvento.listener;
|
package eu.univento.teamvento.listener;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.Rank;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.core.api.player.Rank;
|
|
||||||
import eu.univento.teamvento.utils.WorldEdit;
|
import eu.univento.teamvento.utils.WorldEdit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -22,7 +22,7 @@ public class PositionSetter implements Listener{
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||||
Block b = e.getClickedBlock();
|
Block b = e.getClickedBlock();
|
||||||
ItemStack item = p.getInventory().getItemInMainHand();
|
ItemStack item = p.getInventory().getItemInMainHand();
|
||||||
if (p.isAllowed(Rank.Builder)) {
|
if (p.getDatabasePlayer().isAllowed(Rank.Builder)) {
|
||||||
if(e.getAction() == Action.LEFT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
|
if(e.getAction() == Action.LEFT_CLICK_BLOCK && item.getType() == Material.WOOD_AXE) {
|
||||||
WorldEdit.setPos1(p, b);
|
WorldEdit.setPos1(p, b);
|
||||||
p.sendMessage(p.getMessages().PREFIX() + "§aset pos1");
|
p.sendMessage(p.getMessages().PREFIX() + "§aset pos1");
|
||||||
|
|
|
@ -3,13 +3,11 @@ package eu.univento.teamvento.listener;
|
||||||
import eu.univento.core.api.Config;
|
import eu.univento.core.api.Config;
|
||||||
import eu.univento.core.api.Hologram;
|
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.utils.Plot;
|
import eu.univento.teamvento.utils.Plot;
|
||||||
import eu.univento.teamvento.utils.PlotManager;
|
import eu.univento.teamvento.utils.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;
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
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.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.bukkit.material.Dye;
|
||||||
|
|
||||||
public class Inventorys {
|
public class Inventorys {
|
||||||
|
|
||||||
private CustomPlayer player;
|
private final CustomPlayer player;
|
||||||
|
|
||||||
public Inventorys(CustomPlayer player) {
|
public Inventorys(CustomPlayer player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.mongodb.client.FindIterable;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.map.Cuboid;
|
import eu.univento.core.api.map.Cuboid;
|
||||||
import eu.univento.core.api.player.CustomPlayer;
|
import eu.univento.core.api.player.CustomPlayer;
|
||||||
import eu.univento.teamvento.TeamVento;
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
@ -19,9 +18,9 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Plot {
|
public class Plot {
|
||||||
|
|
||||||
private Cuboid area;
|
private final Cuboid area;
|
||||||
private UUID owner;
|
private final UUID owner;
|
||||||
private Location spawn;
|
private final Location spawn;
|
||||||
|
|
||||||
public Plot(Cuboid area, UUID owner, Location spawn) {
|
public Plot(Cuboid area, UUID owner, Location spawn) {
|
||||||
this.area = area;
|
this.area = area;
|
||||||
|
@ -119,7 +118,7 @@ public class Plot {
|
||||||
map.put("Z", String.valueOf(animal.getLocation().getZ()));
|
map.put("Z", String.valueOf(animal.getLocation().getZ()));
|
||||||
ArrayList<Map<String, String>> animals = (ArrayList<Map<String, String>>) getObjectFromDatbase("animals");
|
ArrayList<Map<String, String>> animals = (ArrayList<Map<String, String>>) getObjectFromDatbase("animals");
|
||||||
animals.add(map);
|
animals.add(map);
|
||||||
setInDatabase("animals", animals);
|
setInDatabase(animals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAnimal(Entity animal) {
|
public void removeAnimal(Entity animal) {
|
||||||
|
@ -134,7 +133,7 @@ public class Plot {
|
||||||
map.put("Z", String.valueOf(animal.getLocation().getZ()));
|
map.put("Z", String.valueOf(animal.getLocation().getZ()));
|
||||||
ArrayList<Map<String, String>> list = (ArrayList<Map<String, String>>) getObjectFromDatbase("animals");
|
ArrayList<Map<String, String>> list = (ArrayList<Map<String, String>>) getObjectFromDatbase("animals");
|
||||||
list.remove(map);
|
list.remove(map);
|
||||||
setInDatabase("animals", list);
|
setInDatabase(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +173,7 @@ public class Plot {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getObjectFromDatbase(String name) {
|
private Object getObjectFromDatbase(String name) {
|
||||||
FindIterable<Document> cursor = Core.getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
|
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
|
||||||
Document doc = cursor.first();
|
Document doc = cursor.first();
|
||||||
|
@ -184,7 +183,7 @@ public class Plot {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStringFromDatabase(String name) {
|
private String getStringFromDatabase(String name) {
|
||||||
FindIterable<Document> cursor = Core.getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
|
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", owner.toString()));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
|
||||||
Document doc = cursor.first();
|
Document doc = cursor.first();
|
||||||
|
@ -194,10 +193,10 @@ public class Plot {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInDatabase(String name, String obj) {
|
private void setInDatabase(String name, String obj) {
|
||||||
Core.getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document(name, obj)));
|
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document(name, obj)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInDatabase(String name, ArrayList<Map<String, String>> obj) {
|
private void setInDatabase(ArrayList<Map<String, String>> obj) {
|
||||||
Core.getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document(name, obj)));
|
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").updateOne(new Document("uuid", owner.toString()), new Document("$set", new Document("animals", obj)));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,13 +6,11 @@ import com.mongodb.client.FindIterable;
|
||||||
import eu.univento.core.Core;
|
import eu.univento.core.Core;
|
||||||
import eu.univento.core.api.map.Cuboid;
|
import eu.univento.core.api.map.Cuboid;
|
||||||
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 org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
@ -22,7 +20,7 @@ public class PlotManager {
|
||||||
|
|
||||||
private static boolean reset = false;
|
private static boolean reset = false;
|
||||||
|
|
||||||
private static ArrayList<Plot> plots = new ArrayList<>();
|
private static final ArrayList<Plot> plots = new ArrayList<>();
|
||||||
private static Plot lastPlot;
|
private static Plot lastPlot;
|
||||||
|
|
||||||
public static ArrayList<Plot> getPlots() {
|
public static ArrayList<Plot> getPlots() {
|
||||||
|
@ -38,7 +36,7 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update() {
|
public static void update() {
|
||||||
FindIterable<Document> cursor = Core.getMongoDB().getDatabase().getCollection("plots").find();
|
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find();
|
||||||
for (Document doc : cursor) {
|
for (Document doc : cursor) {
|
||||||
String uuid = doc.getString("uuid");
|
String uuid = doc.getString("uuid");
|
||||||
Plot plot = new Plot(new Cuboid(getLocation(uuid, "minPos"), getLocation(uuid, "maxPos")), UUID.fromString(uuid), getLocation(uuid, "Spawn"));
|
Plot plot = new Plot(new Cuboid(getLocation(uuid, "minPos"), getLocation(uuid, "maxPos")), UUID.fromString(uuid), getLocation(uuid, "Spawn"));
|
||||||
|
@ -60,7 +58,7 @@ public class PlotManager {
|
||||||
|
|
||||||
public static void clearPlot(Plot plot) {
|
public static void clearPlot(Plot plot) {
|
||||||
CustomPlayer p = CustomPlayer.getPlayer(plot.getOwner());
|
CustomPlayer p = CustomPlayer.getPlayer(plot.getOwner());
|
||||||
if(reset) {
|
if (reset) {
|
||||||
p.sendMessage("§cEs wird bereits grade ein Plot bearbeitet.");
|
p.sendMessage("§cEs wird bereits grade ein Plot bearbeitet.");
|
||||||
p.sendMessage("§cBitte versuche es später noch einmal.");
|
p.sendMessage("§cBitte versuche es später noch einmal.");
|
||||||
return;
|
return;
|
||||||
|
@ -121,10 +119,7 @@ public class PlotManager {
|
||||||
long i = 0;
|
long i = 0;
|
||||||
for (Block b : blocks.getBlocks()) {
|
for (Block b : blocks.getBlocks()) {
|
||||||
i++;
|
i++;
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TeamVento.getInstance(), () -> b.setType(Material.DIRT), i / 16);
|
||||||
b.setType(Material.DIRT);
|
|
||||||
Core.getOnlinePlayers().stream().filter(players -> players.hasEffects()).forEachOrdered(players -> players.playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1));
|
|
||||||
}, i / 16);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Cuboid bottom = new Cuboid(new Location(Bukkit.getWorld("plots"), area.getLowerX(), 0.0D, area.getLowerZ()), new Location(Bukkit.getWorld("plots"), area.getUpperX(), 0.0D, area.getUpperZ()));
|
Cuboid bottom = new Cuboid(new Location(Bukkit.getWorld("plots"), area.getLowerX(), 0.0D, area.getLowerZ()), new Location(Bukkit.getWorld("plots"), area.getUpperX(), 0.0D, area.getUpperZ()));
|
||||||
|
@ -233,6 +228,7 @@ public class PlotManager {
|
||||||
|
|
||||||
public static Plot createPlot(CustomPlayer p) {
|
public static Plot createPlot(CustomPlayer p) {
|
||||||
if (lastPlot == null) {
|
if (lastPlot == null) {
|
||||||
|
Bukkit.broadcastMessage("Erstes Plot");
|
||||||
Location lower = new Location(Bukkit.getWorld("plots"), Bukkit.getWorld("plots").getSpawnLocation().getX(), Bukkit.getWorld("plots").getSpawnLocation().getY() - 20.0D, Bukkit.getWorld("plots").getSpawnLocation().getZ());
|
Location lower = new Location(Bukkit.getWorld("plots"), Bukkit.getWorld("plots").getSpawnLocation().getX(), Bukkit.getWorld("plots").getSpawnLocation().getY() - 20.0D, Bukkit.getWorld("plots").getSpawnLocation().getZ());
|
||||||
Location upper = new Location(Bukkit.getWorld("plots"), lower.getX() + 50.0D, lower.getY() + 250.0D, lower.getZ() + 50.0D);
|
Location upper = new Location(Bukkit.getWorld("plots"), lower.getX() + 50.0D, lower.getY() + 250.0D, lower.getZ() + 50.0D);
|
||||||
Cuboid area = new Cuboid(upper, lower);
|
Cuboid area = new Cuboid(upper, lower);
|
||||||
|
@ -251,30 +247,81 @@ public class PlotManager {
|
||||||
north.getBlock().setType(Material.STONE);
|
north.getBlock().setType(Material.STONE);
|
||||||
south.getBlock().setType(Material.ACACIA_STAIRS);
|
south.getBlock().setType(Material.ACACIA_STAIRS);
|
||||||
|
|
||||||
if(PlotManager.getPlotByLocation(south) == null && PlotManager.getPlotByLocation(west) == null && PlotManager.getPlotByLocation(north) == null && PlotManager.getPlotByLocation(east) == null) {
|
Plot westPlot = getPlotByLocation(west);
|
||||||
|
Plot eastPlot = getPlotByLocation(east);
|
||||||
|
Plot northPlot = getPlotByLocation(north);
|
||||||
|
Plot southPlot = getPlotByLocation(south);
|
||||||
|
|
||||||
|
if (westPlot == null && eastPlot == null && northPlot == null && southPlot == null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Westen");
|
||||||
upper.setX(upper.getX() + 55);
|
upper.setX(upper.getX() + 55);
|
||||||
lower.setX(lower.getX() + 55);
|
lower.setX(lower.getX() + 55);
|
||||||
}
|
}
|
||||||
else if(PlotManager.getPlotByLocation(south) == null && PlotManager.getPlotByLocation(west) != null) {
|
if (westPlot == null && eastPlot != null && northPlot == null && southPlot == null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Norden");
|
||||||
|
upper.setZ(upper.getZ() - 55);
|
||||||
|
lower.setZ(lower.getZ() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot == null && eastPlot == null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Osten");
|
||||||
|
upper.setX(upper.getX() - 55);
|
||||||
|
lower.setX(lower.getX() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot != null && eastPlot == null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Osten 2");
|
||||||
|
upper.setX(upper.getX() - 55);
|
||||||
|
lower.setX(lower.getX() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot != null && eastPlot == null && northPlot == null && southPlot == null) {
|
||||||
Bukkit.broadcastMessage("Plot im Süden");
|
Bukkit.broadcastMessage("Plot im Süden");
|
||||||
upper.setZ(upper.getZ() + 55);
|
upper.setZ(upper.getZ() + 55);
|
||||||
lower.setZ(lower.getZ() + 55);
|
lower.setZ(lower.getZ() + 55);
|
||||||
}
|
}
|
||||||
else if(PlotManager.getPlotByLocation(west) == null && PlotManager.getPlotByLocation(north) != null) {
|
if (westPlot != null && eastPlot == null && northPlot != null && southPlot == null) {
|
||||||
Bukkit.broadcastMessage("Plot im Westen");
|
Bukkit.broadcastMessage("Plot im Süden 2");
|
||||||
upper.setX(upper.getX() - 55);
|
upper.setZ(upper.getZ() + 55);
|
||||||
lower.setX(lower.getX() - 55);
|
lower.setZ(upper.getZ() + 55);
|
||||||
}
|
}
|
||||||
else if(PlotManager.getPlotByLocation(east) == null && PlotManager.getPlotByLocation(south) != null && PlotManager.getPlotByLocation(west) != null) {
|
if (westPlot == null && eastPlot == null && northPlot != null && southPlot == null) {
|
||||||
Bukkit.broadcastMessage("Plot im Osten1");
|
Bukkit.broadcastMessage("Plot im Westen 2");
|
||||||
upper.setX(upper.getX() + 55);
|
upper.setX(upper.getX() + 55);
|
||||||
lower.setX(lower.getX() + 55);
|
lower.setX(lower.getX() + 55);
|
||||||
}
|
}
|
||||||
else if(PlotManager.getPlotByLocation(east) != null && PlotManager.getPlotByLocation(south) != null && PlotManager.getPlotByLocation(north) == null) {
|
if (westPlot == null && eastPlot != null && northPlot == null && southPlot == null) {
|
||||||
Bukkit.broadcastMessage("Plot im Norden1");
|
Bukkit.broadcastMessage("Plot im Norden 2");
|
||||||
upper.setZ(upper.getZ() - 55);
|
upper.setZ(upper.getZ() - 55);
|
||||||
lower.setZ(lower.getZ() - 55);
|
lower.setZ(lower.getZ() - 55);
|
||||||
}
|
}
|
||||||
|
if (westPlot == null && eastPlot != null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Norden 3");
|
||||||
|
upper.setZ(upper.getZ() - 55);
|
||||||
|
lower.setZ(lower.getZ() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot == null && eastPlot == null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Osten 3");
|
||||||
|
upper.setX(upper.getX() - 55);
|
||||||
|
lower.setX(lower.getX() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot != null && eastPlot == null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Osten 4");
|
||||||
|
upper.setX(upper.getX() - 55);
|
||||||
|
lower.setX(lower.getX() - 55);
|
||||||
|
}
|
||||||
|
if (westPlot != null && eastPlot == null && northPlot == null && southPlot != null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Süden 3");
|
||||||
|
upper.setZ(upper.getZ() + 55);
|
||||||
|
lower.setZ(lower.getZ() + 55);
|
||||||
|
}
|
||||||
|
if (westPlot == null && eastPlot == null && northPlot != null && southPlot == null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Westen 3");
|
||||||
|
upper.setX(upper.getX() + 55);
|
||||||
|
lower.setX(lower.getX() + 55);
|
||||||
|
}
|
||||||
|
if (westPlot == null && eastPlot != null && northPlot != null && southPlot == null) {
|
||||||
|
Bukkit.broadcastMessage("Plot im Westen 4");
|
||||||
|
upper.setX(upper.getX() + 55);
|
||||||
|
lower.setX(lower.getX() + 55);
|
||||||
|
}
|
||||||
|
|
||||||
Cuboid area = new Cuboid(upper, lower);
|
Cuboid area = new Cuboid(upper, lower);
|
||||||
Location spawn = new Location(Bukkit.getWorld("plots"), lower.getX() + 52.0D, lower.getY() + 25.0D, lower.getZ() + 25.0D);
|
Location spawn = new Location(Bukkit.getWorld("plots"), lower.getX() + 52.0D, lower.getY() + 25.0D, lower.getZ() + 25.0D);
|
||||||
|
@ -315,7 +362,7 @@ public class PlotManager {
|
||||||
doc.put("animals", animals);
|
doc.put("animals", animals);
|
||||||
|
|
||||||
|
|
||||||
Core.getMongoDB().getDatabase().getCollection("plots").insertOne(doc);
|
Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").insertOne(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plot getPlotByLocation(Location location) {
|
public static Plot getPlotByLocation(Location location) {
|
||||||
|
@ -333,7 +380,7 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date getCreatedDate(String uuid) {
|
public static Date getCreatedDate(String uuid) {
|
||||||
return getDateFromDatabase(uuid, "created");
|
return getDateFromDatabase(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Location getLocation(String uuid, String name) {
|
private static Location getLocation(String uuid, String name) {
|
||||||
|
@ -342,18 +389,18 @@ public class PlotManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Date getDateFromDatabase(String uuid, String name) {
|
private static Date getDateFromDatabase(String uuid) {
|
||||||
FindIterable<Document> cursor = Core.getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
|
||||||
Document doc = cursor.first();
|
Document doc = cursor.first();
|
||||||
if (doc == null) return null;
|
if (doc == null) return null;
|
||||||
|
|
||||||
return doc.getDate(name);
|
return doc.getDate("created");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getObjectFromDatbase(String uuid, String name) {
|
private static Object getObjectFromDatbase(String uuid, String name) {
|
||||||
FindIterable<Document> cursor = Core.getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
FindIterable<Document> cursor = Core.getCommons().getDatabaseManager().getMongoDB().getDatabase().getCollection("plots").find(new Document("uuid", uuid));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
|
||||||
Document doc = cursor.first();
|
Document doc = cursor.first();
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.bukkit.Material;
|
||||||
/**
|
/**
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* created on 29.06.2016
|
|
||||||
*/
|
*/
|
||||||
public enum ResourcePack {
|
public enum ResourcePack {
|
||||||
|
|
||||||
|
@ -17,11 +16,11 @@ public enum ResourcePack {
|
||||||
SOARTEX_FANVER("§eSoartex Fanver", Material.MOSSY_COBBLESTONE, "http://mods.curse.com/texture-packs/minecraft/soartex-fanver-vanilla/2311293#"),
|
SOARTEX_FANVER("§eSoartex Fanver", Material.MOSSY_COBBLESTONE, "http://mods.curse.com/texture-packs/minecraft/soartex-fanver-vanilla/2311293#"),
|
||||||
DANDELION("§eDandelion", Material.YELLOW_FLOWER, "http://www.mediafire.com/download/7mmk531lf41f7ex/Dandelion+v1.8.1.zip");
|
DANDELION("§eDandelion", Material.YELLOW_FLOWER, "http://www.mediafire.com/download/7mmk531lf41f7ex/Dandelion+v1.8.1.zip");
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
private Material material;
|
private final Material material;
|
||||||
private String url;
|
private final String url;
|
||||||
|
|
||||||
private ResourcePack(String name, Material material, String url) {
|
ResourcePack(String name, Material material, String url) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
|
|
@ -11,8 +11,8 @@ import java.util.HashMap;
|
||||||
*/
|
*/
|
||||||
public class WorldEdit {
|
public class WorldEdit {
|
||||||
|
|
||||||
private static HashMap<CustomPlayer, Block> pos1 = new HashMap<>();
|
private static final HashMap<CustomPlayer, Block> pos1 = new HashMap<>();
|
||||||
private static HashMap<CustomPlayer, Block> pos2 = new HashMap<>();
|
private static final HashMap<CustomPlayer, Block> pos2 = new HashMap<>();
|
||||||
|
|
||||||
public static Block getPos1(CustomPlayer p) {
|
public static Block getPos1(CustomPlayer p) {
|
||||||
return pos1.containsKey(p) ? pos1.get(p) : null;
|
return pos1.containsKey(p) ? pos1.get(p) : null;
|
||||||
|
|
Loading…
Reference in New Issue