diff --git a/TeamVento.iml b/TeamVento.iml
index 9d89429..28eb5f3 100644
--- a/TeamVento.iml
+++ b/TeamVento.iml
@@ -6,31 +6,29 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fb13dc3..b8bbcf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,52 +51,7 @@
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
-
-
-
- org.bukkit
- craftbukkit
- 1.10-R0.1-SNAPSHOT
- provided
-
-
- org.bukkit
- bukkit
- 1.10-R0.1-SNAPSHOT
- provided
-
-
- org.mongodb
- mongo-java-driver
- 3.2.2
-
-
- org.mongodb
- mongodb-driver-async
- 3.2.2
-
-
- io.netty
- netty-all
- 4.0.36.Final
-
-
- org.spigotmc
- spigot-api
- 1.10-R0.1-SNAPSHOT
- provided
-
-
- com.google.code.gson
- gson
- 2.3.1
-
eu.univento
Core
diff --git a/src/main/java/eu/univento/teamvento/TeamVento.java b/src/main/java/eu/univento/teamvento/TeamVento.java
index 1fbb53f..37d5a62 100644
--- a/src/main/java/eu/univento/teamvento/TeamVento.java
+++ b/src/main/java/eu/univento/teamvento/TeamVento.java
@@ -1,5 +1,6 @@
package eu.univento.teamvento;
+import eu.univento.core.Core;
import eu.univento.core.api.Config;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.teamvento.commands.*;
@@ -14,8 +15,6 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
/**
* @author joethei
@@ -23,8 +22,8 @@ import java.util.logging.Logger;
*/
public class TeamVento extends JavaPlugin {
- private static File file = new File("plugins/Core", "worlds.yml");
- private static FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
+ private static final File file = new File("plugins/Core", "worlds.yml");
+ private static final FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
public static File getConfigFile() {
return file;
@@ -39,14 +38,9 @@ public class TeamVento extends JavaPlugin {
return instance;
}
- private static Logger logger = Bukkit.getLogger();
-
- private static void log(Level level, String string) {
- logger.log(level, "[" + getInstance().getDescription().getName() + "] " + string);
- }
-
@Override
public void onEnable() {
+ Core.getInstance().registerPlugin(this);
instance = this;
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new JoinQuit(), this);
@@ -56,13 +50,13 @@ public class TeamVento extends JavaPlugin {
pm.registerEvents(new MenuEvents(), this);
new Setloc(this, "setloc" , "sets locations");
- new WorldTP(this, "worldtp", "teleports players to other worlds", "wtp");
- new WorldCreate(this, "worldcreate", "creates new worlds", "wc");
- new WorldImport(this, "worldimport", "imports worlds", "wi");
+ new WorldTP(this, "teleports players to other worlds", "wtp");
+ new WorldCreate(this, "creates new worlds", "wc");
+ new WorldImport(this, "worldimport", "imports worlds");
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");
+ new WorldList(this, "lists all worlds", "wl");
+ new PlotInfo(this, "info about a plot", "pi");
new Pack(this, "pack", "sets resource pack");
for(String world : getCfg().getKeys(true)) {
@@ -92,18 +86,19 @@ public class TeamVento extends JavaPlugin {
ServerSettings.setGameMode(GameMode.CREATIVE);
- ServerSettings.setBuild(true);
+ ServerSettings.setBuild(false);
PlotManager.update();
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, () -> Events.redstone = 0, 1L, 10 * 20L);
}
@Override
public void onDisable() {
- Config.write("lastPlot", PlotManager.getLastPlot().getOwner().toString());
+ Config.write(PlotManager.getLastPlot().getOwner().toString());
Bukkit.getWorld("plots").getLivingEntities().forEach(Entity::remove);
- log(Level.INFO, "Plugin beendet");
+ Core.getInstance().unregisterPlugin(this);
+ Core.getCommons().getLoggingHandler().getTrashGames().info("Plugin beendet");
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/commands/Pack.java b/src/main/java/eu/univento/teamvento/commands/Pack.java
index 1b45931..a2f4daa 100644
--- a/src/main/java/eu/univento/teamvento/commands/Pack.java
+++ b/src/main/java/eu/univento/teamvento/commands/Pack.java
@@ -14,7 +14,6 @@ import java.util.List;
/**
* @author joethei
* @version 0.1
- * created on 01.07.2016
*/
public class Pack extends AutoCommand{
@@ -27,9 +26,7 @@ public class Pack extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
if(args.length == 1) {
- if(ResourcePack.valueOf(args[0]) != null) {
- p.setResourcePack(ResourcePack.valueOf(args[0]).getUrl());
- }else p.sendMessage("§cDieses Pack ist nicht erhätlich");
+ p.setResourcePack(ResourcePack.valueOf(args[0]).getUrl());
}else{
p.sendMessage("§cDa stimmt was mit den Argumenten nicht");
}
diff --git a/src/main/java/eu/univento/teamvento/commands/PlotInfo.java b/src/main/java/eu/univento/teamvento/commands/PlotInfo.java
index 9b3c1cf..91cc082 100644
--- a/src/main/java/eu/univento/teamvento/commands/PlotInfo.java
+++ b/src/main/java/eu/univento/teamvento/commands/PlotInfo.java
@@ -1,15 +1,13 @@
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.core.api.player.Rank;
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 net.md_5.bungee.api.chat.ClickEvent;
-import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -26,15 +24,13 @@ public class PlotInfo extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) sender);
- if(p.isAllowed(Rank.SrBuilder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
if(PlotManager.getPlotByLocation(p.getLocation()) != null) {
Plot plot = PlotManager.getPlotByLocation(p.getLocation());
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
p.sendMessage("§eErsteller: " + UUIDFetcher.getName(plot.getOwner()));
p.sendMessage("§eErstellt am: " + PlotManager.getCreatedDate(plot.getOwner().toString()));
- TextComponent pack = new TextComponent("§eResourcePack " + plot.getResourcePack().getName());
- pack.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pack " + plot.getResourcePack().name()));
- //p.spigot().sendMessage(pack);
+ p.sendMessage("§eResourcePack " + plot.getResourcePack().getName());
});
}else{
p.sendMessage("§cHier ist leider kein Plot");
diff --git a/src/main/java/eu/univento/teamvento/commands/Sel.java b/src/main/java/eu/univento/teamvento/commands/Sel.java
index 1576dde..94a520f 100644
--- a/src/main/java/eu/univento/teamvento/commands/Sel.java
+++ b/src/main/java/eu/univento/teamvento/commands/Sel.java
@@ -1,9 +1,9 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.WorldEdit;
import org.bukkit.command.CommandSender;
@@ -21,7 +21,7 @@ public class Sel extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.Builder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
WorldEdit.setPos1(p, null);
WorldEdit.setPos2(p, null);
p.sendMessage(p.getMessages().PREFIX() + "selection cleared");
diff --git a/src/main/java/eu/univento/teamvento/commands/Set.java b/src/main/java/eu/univento/teamvento/commands/Set.java
index 811b60c..4e61e88 100644
--- a/src/main/java/eu/univento/teamvento/commands/Set.java
+++ b/src/main/java/eu/univento/teamvento/commands/Set.java
@@ -1,10 +1,10 @@
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.map.Cuboid;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.WorldEdit;
import org.bukkit.Bukkit;
@@ -29,7 +29,7 @@ public class Set extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.Builder)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Builder)) {
Material material;
if(args.length == 0) {
material = p.getInventory().getItemInMainHand().getType();
@@ -62,7 +62,7 @@ public class Set extends AutoCommand{
return null;
}
- void setBlocks(Material material, CustomPlayer p) {
+ 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");
diff --git a/src/main/java/eu/univento/teamvento/commands/Setloc.java b/src/main/java/eu/univento/teamvento/commands/Setloc.java
index 81ae1dd..194cbb4 100644
--- a/src/main/java/eu/univento/teamvento/commands/Setloc.java
+++ b/src/main/java/eu/univento/teamvento/commands/Setloc.java
@@ -1,10 +1,10 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -20,9 +20,9 @@ public class Setloc extends AutoCommand{
/**
* @param plugin main class
- * @param command command to execute
- * @param description describes the command
- * @param aliases aliases of command
+ * @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);
@@ -33,7 +33,7 @@ public class Setloc extends AutoCommand{
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
- if(p.isAllowed(Rank.SrDeveloper)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
if(args.length == 1) {
Config.write("Build.Locs." + args[0], p.getLocation());
p.sendMessage("§aLocation gesetzt");
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldCreate.java b/src/main/java/eu/univento/teamvento/commands/WorldCreate.java
index a48f804..77d2e06 100644
--- a/src/main/java/eu/univento/teamvento/commands/WorldCreate.java
+++ b/src/main/java/eu/univento/teamvento/commands/WorldCreate.java
@@ -1,9 +1,9 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.VoidGenerator;
import org.bukkit.Bukkit;
@@ -30,7 +30,7 @@ public class WorldCreate extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.SrBuilder)) {
+ 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]);
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldImport.java b/src/main/java/eu/univento/teamvento/commands/WorldImport.java
index 1449fe6..3e314a9 100644
--- a/src/main/java/eu/univento/teamvento/commands/WorldImport.java
+++ b/src/main/java/eu/univento/teamvento/commands/WorldImport.java
@@ -1,9 +1,9 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import org.bukkit.Bukkit;
import org.bukkit.WorldCreator;
@@ -27,7 +27,7 @@ public class WorldImport extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if (p.isAllowed(Rank.SrBuilder)) {
+ if (p.getDatabasePlayer().isAllowed(Rank.SrBuilder)) {
if(args.length == 1) {
if(Bukkit.getWorld(args[0]) == null) {
Bukkit.createWorld(new WorldCreator(args[0]));
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldList.java b/src/main/java/eu/univento/teamvento/commands/WorldList.java
index fd828ce..f43f300 100644
--- a/src/main/java/eu/univento/teamvento/commands/WorldList.java
+++ b/src/main/java/eu/univento/teamvento/commands/WorldList.java
@@ -1,9 +1,9 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,7 +24,7 @@ public class WorldList extends AutoCommand {
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.Supporter)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
p.sendMessage("§cAll worlds");
for(String world : TeamVento.getCfg().getKeys(true)) {
p.sendMessage("§a- " + world);
diff --git a/src/main/java/eu/univento/teamvento/commands/WorldTP.java b/src/main/java/eu/univento/teamvento/commands/WorldTP.java
index 93a58ca..065c913 100644
--- a/src/main/java/eu/univento/teamvento/commands/WorldTP.java
+++ b/src/main/java/eu/univento/teamvento/commands/WorldTP.java
@@ -1,9 +1,9 @@
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.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import org.bukkit.Bukkit;
import org.bukkit.World;
@@ -28,7 +28,7 @@ public class WorldTP extends AutoCommand{
public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
- if(p.isAllowed(Rank.Supporter)) {
+ if(p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
if(args.length == 1) {
if(Bukkit.getWorld(args[0]) != null) {
p.teleport(Bukkit.getWorld(args[0]).getSpawnLocation());
diff --git a/src/main/java/eu/univento/teamvento/listener/Events.java b/src/main/java/eu/univento/teamvento/listener/Events.java
index cd59e22..447f3df 100644
--- a/src/main/java/eu/univento/teamvento/listener/Events.java
+++ b/src/main/java/eu/univento/teamvento/listener/Events.java
@@ -1,10 +1,10 @@
package eu.univento.teamvento.listener;
+import eu.univento.commons.player.Rank;
import eu.univento.core.Core;
import eu.univento.core.api.Config;
import eu.univento.core.api.events.MoveEventFilter;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.Plot;
import eu.univento.teamvento.utils.PlotManager;
@@ -23,6 +23,8 @@ 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.InventoryAction;
+import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.player.*;
@@ -35,29 +37,22 @@ import org.bukkit.scheduler.BukkitTask;
import java.util.HashMap;
import java.util.Random;
import java.util.UUID;
-import java.util.logging.Level;
/**
* @author joethei
- * @version 0.2
+ * @version 0.3
*/
public class Events implements Listener{
public static int redstone;
- private HashMap lightningTasks = new HashMap<>();
+ private final HashMap lightningTasks = new HashMap<>();
@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
e.setCancelled(true);
}
- @EventHandler
- public void onTramp(PlayerInteractEvent e) {
- if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL)
- e.setCancelled(true);
- }
-
@EventHandler
public void onEntityExplode(EntityExplodeEvent e) {
e.setCancelled(true);
@@ -66,25 +61,12 @@ public class Events implements Listener{
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
- if (p.isAllowed(Rank.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
- 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);
+ if(PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) e.setCancelled(true);
+ if(!PlotManager.getPlotByLocation(e.getBlock().getLocation()).isOwner(p)) e.setCancelled(true);
+ if(!e.getBlock().getWorld().getName().equals("plots")) e.setCancelled(false);
+ if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) e.setCancelled(false);
/**
- CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
- if (p.isAllowed(Ranks.SrDeveloper)) return;
+ if (p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
if (!e.getBlock().getWorld().getName().equalsIgnoreCase("plots")) return;
if (PlotManager.getPlotByLocation(e.getBlock().getLocation()) == null) {
e.setCancelled(true);
@@ -95,15 +77,29 @@ public class Events implements Listener{
}
@EventHandler
- public void onBlockCanBuild(BlockCanBuildEvent e) {
- e.setBuildable(true);
+ 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.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
public void onHangingPlace(HangingPlaceEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
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()).isOwner(p)) e.setCancelled(true);
}
@@ -113,14 +109,14 @@ public class Events implements Listener{
if(e.getRemover() instanceof Projectile) {
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getRemover()).getShooter());
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()).isOwner(p)) e.setCancelled(true);
}
if(e.getRemover() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getRemover());
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()).isOwner(p)) e.setCancelled(true);
}else{
@@ -133,7 +129,7 @@ public class Events implements Listener{
if (e.getDamager() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getDamager());
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) {
e.setCancelled(true);
return;
@@ -143,7 +139,7 @@ public class Events implements Listener{
if(e.getDamager() instanceof Projectile) {
CustomPlayer p = CustomPlayer.getPlayer((Player) ((Projectile) e.getDamager()).getShooter());
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) {
e.setCancelled(true);
return;
@@ -166,7 +162,7 @@ public class Events implements Listener{
}
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
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()).isOwner(p)) e.setCancelled(true);
}
@@ -209,12 +205,14 @@ public class Events implements Listener{
@EventHandler
public void onInteract(PlayerInteractEvent e) {
+ if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL)
+ e.setCancelled(true);
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots")) return;
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()).isOwner(p)) e.setCancelled(true);
}
@@ -232,7 +230,7 @@ public class Events implements Listener{
if (!e.getRightClicked().getWorld().getName().equalsIgnoreCase("plots"))
return;
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()).isOwner(p)) e.setCancelled(true);
}
@@ -242,7 +240,7 @@ public class Events implements Listener{
public void onArmorStandManipulate(PlayerArmorStandManipulateEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
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()).isOwner(p)) e.setCancelled(true);
}
@@ -250,21 +248,21 @@ public class Events implements Listener{
@EventHandler
public void onDrop(PlayerDropItemEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
- if(!p.isAllowed(Rank.SrDeveloper))
+ if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
e.setCancelled(true);
}
@EventHandler
public void onPickup(PlayerPickupItemEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
- if(!p.isAllowed(Rank.SrDeveloper))
+ if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
e.setCancelled(true);
}
@EventHandler
public void onArrowPickup(PlayerPickupArrowEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
- if(!p.isAllowed(Rank.SrDeveloper))
+ if(!p.getDatabasePlayer().isAllowed(Rank.SrDeveloper))
e.setCancelled(true);
}
@@ -286,6 +284,13 @@ public class Events implements Listener{
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
public void onConsume(PlayerItemConsumeEvent e) {
e.setCancelled(true);
@@ -296,7 +301,7 @@ public class Events implements Listener{
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
return;
- if(p.isAllowed(Rank.SrDeveloper)) return;
+ if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) return;
if(PlotManager.getPlotByLocation(e.getPlayer().getLocation()) == null) {
e.setCancelled(true);
return;
@@ -309,7 +314,7 @@ public class Events implements Listener{
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if (!e.getPlayer().getWorld().getName().equalsIgnoreCase("plots"))
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()).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 down = p.getLocation().subtract(0.0D, 2.0D, 0.0D).getBlock();
if(p.getLocation().getBlock().getType() == Material.GOLD_PLATE && up.getType() == Material.COAL_BLOCK) {
- Core.log(Level.INFO, "Platte und Coal");
- if(down.getType() == Material.COMMAND_CHAIN && p.isAllowed(Rank.Supporter)){
- p.teleport(Config.readLocation("Build.Locs.Planning"));
+ Core.getCommons().getLoggingHandler().getTeamVento().info("Platte und Coal");
+ if(down.getType() == Material.COMMAND_CHAIN && p.getDatabasePlayer().isAllowed(Rank.Supporter)){
+ p.teleport(Bukkit.getWorld("EinfachAFK").getSpawnLocation());
p.setGameMode(GameMode.ADVENTURE);
}
}
if(up.getType() == Material.COAL_BLOCK && down.getType() == Material.COMMAND_CHAIN) {
- Core.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) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
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()).isOwner(p)) e.setCancelled(true);
}
diff --git a/src/main/java/eu/univento/teamvento/listener/JoinQuit.java b/src/main/java/eu/univento/teamvento/listener/JoinQuit.java
index 11ef90a..4398aa8 100644
--- a/src/main/java/eu/univento/teamvento/listener/JoinQuit.java
+++ b/src/main/java/eu/univento/teamvento/listener/JoinQuit.java
@@ -1,9 +1,9 @@
package eu.univento.teamvento.listener;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.Config;
import eu.univento.core.api.Hologram;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.teamvento.TeamVento;
import eu.univento.teamvento.utils.PlotManager;
import net.minecraft.server.v1_10_R1.EnumParticle;
@@ -24,7 +24,7 @@ import java.util.HashMap;
*/
public class JoinQuit implements Listener {
- static HashMap holograms = new HashMap<>();
+ static final HashMap holograms = new HashMap<>();
@EventHandler
public void onJoin(PlayerJoinEvent e) {
@@ -38,8 +38,8 @@ public class JoinQuit implements Listener {
menu.setItemMeta(menuMeta);
p.getInventory().setItem(8, menu);
}
- if(p.getRank() == Rank.Builder || p.getRank() == Rank.SrBuilder)
- Bukkit.broadcastMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
+ if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
+ Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §bbetreten");
else
p.teleport(Config.readLocation("Build.Locs.Spawn"));
@@ -61,7 +61,7 @@ public class JoinQuit implements Listener {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
e.setQuitMessage(null);
holograms.remove(p);
- if(p.getRank() == Rank.Builder || p.getRank() == Rank.SrBuilder)
- Bukkit.broadcastMessage(p.getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
+ if(p.getDatabasePlayer().getRank() == Rank.Builder || p.getDatabasePlayer().getRank() == Rank.SrBuilder)
+ Bukkit.broadcastMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §8hat den Server §cverlassen");
}
}
\ No newline at end of file
diff --git a/src/main/java/eu/univento/teamvento/listener/MenuEvents.java b/src/main/java/eu/univento/teamvento/listener/MenuEvents.java
index 52e8cbe..bce4af1 100644
--- a/src/main/java/eu/univento/teamvento/listener/MenuEvents.java
+++ b/src/main/java/eu/univento/teamvento/listener/MenuEvents.java
@@ -26,10 +26,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
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{
@@ -89,11 +85,11 @@ public class MenuEvents implements Listener{
if(e.getCurrentItem().getType() == Material.MINECART) {
p.closeInventory();
Bukkit.getScheduler().runTaskAsynchronously(TeamVento.getInstance(), () -> {
- ScrollingInventory inventory = new ScrollingInventory(p, "§eTeleport", 27);
+ ScrollingInventory inventory = new ScrollingInventory(p, "§eTeleport");
for(Plot plots : PlotManager.getPlots()) {
String name = UUIDFetcher.getName(plots.getOwner());
inventory.addItem(new ItemBuilder(Material.SKULL_ITEM)
- .durability(3).skullOwner(name)
+ .durability().skullOwner(name)
.name(plot.getName().equals("") ? "§cunbenanntes Plot" : "§e" + plots.getName())
.lore("§eby " + name)
.make());
@@ -183,45 +179,45 @@ public class MenuEvents implements Listener{
if(e.getCurrentItem().getType() == Material.SIGN) {
AnvilGUI gui = new AnvilGUI(p, event -> {
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
- event.setWillClose(true);
- event.setWillDestroy(true);
+ event.setWillClose();
+ event.setWillDestroy();
plot.setName(event.getName());
p.refreshExperience();
}else{
- event.setWillDestroy(true);
- event.setWillClose(true);
+ event.setWillDestroy();
+ event.setWillClose();
}
});
ItemStack name = new ItemStack(Material.SIGN);
ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName(plot.getName() == null ? "§cunbennantes Plot" : plot.getName());
name.setItemMeta(nameMeta);
- gui.setSlot(AnvilGUI.AnvilSlot.INPUT_LEFT, name);
+ gui.setSlot(name);
gui.open();
}
if(e.getCurrentItem().getType() == Material.NAME_TAG) {
AnvilGUI gui = new AnvilGUI(p, event -> {
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
- event.setWillClose(true);
- event.setWillDestroy(true);
+ event.setWillClose();
+ event.setWillDestroy();
plot.setContact(event.getName());
p.refreshExperience();
}else{
- event.setWillDestroy(true);
- event.setWillClose(true);
+ event.setWillDestroy();
+ event.setWillClose();
}
});
ItemStack name = new ItemStack(Material.NAME_TAG);
ItemMeta nameMeta = name.getItemMeta();
nameMeta.setDisplayName(plot.getContact() == null ? "§cKontaktdaten hier angeben" : plot.getContact());
name.setItemMeta(nameMeta);
- gui.setSlot(AnvilGUI.AnvilSlot.INPUT_LEFT, name);
+ gui.setSlot(name);
gui.open();
}
if(e.getCurrentItem().getType() == Material.DIRT) {
- ScrollingInventory inventory = new ScrollingInventory(p, "§eResourcePack", 27);
+ ScrollingInventory inventory = new ScrollingInventory(p, "§eResourcePack");
for(ResourcePack pack : ResourcePack.values()) {
inventory.addItem(new ItemBuilder(pack.getMaterial()).name(pack.getName())
.enchantment(pack.name().equals(plot.getResourcePack().name()) ? Enchantment.ARROW_DAMAGE : null).make());
diff --git a/src/main/java/eu/univento/teamvento/listener/PositionSetter.java b/src/main/java/eu/univento/teamvento/listener/PositionSetter.java
index e75c742..7897647 100644
--- a/src/main/java/eu/univento/teamvento/listener/PositionSetter.java
+++ b/src/main/java/eu/univento/teamvento/listener/PositionSetter.java
@@ -1,7 +1,7 @@
package eu.univento.teamvento.listener;
+import eu.univento.commons.player.Rank;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.core.api.player.Rank;
import eu.univento.teamvento.utils.WorldEdit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -22,7 +22,7 @@ public class PositionSetter implements Listener{
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
Block b = e.getClickedBlock();
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) {
WorldEdit.setPos1(p, b);
p.sendMessage(p.getMessages().PREFIX() + "§aset pos1");
diff --git a/src/main/java/eu/univento/teamvento/listener/SignInteract.java b/src/main/java/eu/univento/teamvento/listener/SignInteract.java
index 6dd9f4d..ec8b426 100644
--- a/src/main/java/eu/univento/teamvento/listener/SignInteract.java
+++ b/src/main/java/eu/univento/teamvento/listener/SignInteract.java
@@ -3,13 +3,11 @@ package eu.univento.teamvento.listener;
import eu.univento.core.api.Config;
import eu.univento.core.api.Hologram;
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 org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
diff --git a/src/main/java/eu/univento/teamvento/utils/Inventorys.java b/src/main/java/eu/univento/teamvento/utils/Inventorys.java
index 7bc8605..ef5fd8b 100644
--- a/src/main/java/eu/univento/teamvento/utils/Inventorys.java
+++ b/src/main/java/eu/univento/teamvento/utils/Inventorys.java
@@ -12,7 +12,7 @@ import org.bukkit.material.Dye;
public class Inventorys {
- private CustomPlayer player;
+ private final CustomPlayer player;
public Inventorys(CustomPlayer player) {
this.player = player;
diff --git a/src/main/java/eu/univento/teamvento/utils/Plot.java b/src/main/java/eu/univento/teamvento/utils/Plot.java
index 24634ce..4b2cfe2 100644
--- a/src/main/java/eu/univento/teamvento/utils/Plot.java
+++ b/src/main/java/eu/univento/teamvento/utils/Plot.java
@@ -5,7 +5,6 @@ import com.mongodb.client.FindIterable;
import eu.univento.core.Core;
import eu.univento.core.api.map.Cuboid;
import eu.univento.core.api.player.CustomPlayer;
-import eu.univento.teamvento.TeamVento;
import org.bson.Document;
import org.bukkit.*;
import org.bukkit.block.Biome;
@@ -19,9 +18,9 @@ import java.util.stream.Collectors;
public class Plot {
- private Cuboid area;
- private UUID owner;
- private Location spawn;
+ private final Cuboid area;
+ private final UUID owner;
+ private final Location spawn;
public Plot(Cuboid area, UUID owner, Location spawn) {
this.area = area;
@@ -119,7 +118,7 @@ public class Plot {
map.put("Z", String.valueOf(animal.getLocation().getZ()));
ArrayList