+ 1.11 Update

This commit is contained in:
Johannes Theiner 2016-11-24 19:55:51 +01:00
parent d256ecf6e0
commit 5b0abbcfca
25 changed files with 266 additions and 410 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module com.demonwav.mcdev.MinecraftModuleTypes="PAPER_MODULE_TYPE" org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
@ -11,42 +11,34 @@
</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.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: 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: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.15" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.10-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" name="Maven: org.bukkit:craftbukkit:1.10.2-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="Core" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="CloudCommons" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.11-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module-library"> <orderEntry type="module" module-name="Core" scope="PROVIDED" />
<library name="Maven: eu.the5zig.mod:mod:1.0"> <orderEntry type="module" module-name="Commons" scope="PROVIDED" />
<CLASSES> <orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
<root url="jar://$MODULE_DIR$/../Core/local-maven-repo/The5zigMod.jar!/" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
</CLASSES> <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
<JAVADOC /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<SOURCES /> <orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.5" level="project" />
</library> <orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.9.4" level="project" />
</orderEntry> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TheHolyWaffle:TeamSpeak-3-Java-API:v1.0.13" level="project" />
<orderEntry type="module" module-name="Commons" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.8" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.10" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
<orderEntry type="library" name="Maven: com.github.theholywaffle:teamspeak3-api:1.0.14-SNAPSHOT" 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: net.gpedro.integrations.slack:slack-webhook:1.2.1" level="project" />
</component> </component>
</module> </module>

23
pom.xml
View File

@ -50,38 +50,41 @@
<repositories> <repositories>
<repository> <repository>
<id>spigot-repo</id> <id>univentoEU</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>http://dev.joethei.de:8081/repository/public/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>eu.univento</groupId> <groupId>eu.univento</groupId>
<artifactId>Core</artifactId> <artifactId>Core</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> <scope>provided</scope>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -15,9 +15,6 @@ import org.bukkit.World;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* main class... * main class...
* @author joethei * @author joethei
@ -25,32 +22,12 @@ import java.util.logging.Logger;
*/ */
public class Lobby extends JavaPlugin{ public class Lobby extends JavaPlugin{
/**
* plugin instance
*/
public static Lobby instance; public static Lobby instance;
/**
* @return instance of plugin
*/
public static Lobby getInstance() { public static Lobby getInstance() {
return instance; return instance;
} }
/**
* Logger to log to
*/
private static Logger logger = Bukkit.getLogger();
/**
* @param level Log level
* @param string String
*/
public static void log(Level level, String string) {
if(ServerSettings.isDebug()) {
logger.log(level, "[" + Lobby.getInstance().getDescription().getName() + "] " + string);
}
}
@Override @Override
public void onEnable() { public void onEnable() {
@ -69,13 +46,13 @@ public class Lobby extends JavaPlugin{
pm.registerEvents(new StatusSigns(), this); pm.registerEvents(new StatusSigns(), this);
pm.registerEvents(new PlayerInteract(), this); pm.registerEvents(new PlayerInteract(), this);
if(ServerSettings.isDebug()) log(Level.INFO, "Events registriert"); if(ServerSettings.isDebug()) Core.getCommons().getLoggingHandler().getLobby().info("Events registriert");
new Setloc(this, "setloc", "Setzt Teleport Punkte"); new Setloc(this, "setloc", "Setzt Teleport Punkte");
new DropItem(this, "dropitem", "Setzt EasterEggs"); new DropItem(this, "dropitem", "Setzt EasterEggs");
if(ServerSettings.isDebug()) log(Level.INFO, "Befehle registriert"); if(ServerSettings.isDebug()) Core.getCommons().getLoggingHandler().getLobby().info("Befehle registriert");
for(World w : Bukkit.getWorlds()) { for(World w : Bukkit.getWorlds()) {
w.setDifficulty(Difficulty.PEACEFUL); w.setDifficulty(Difficulty.PEACEFUL);
@ -86,7 +63,7 @@ public class Lobby extends JavaPlugin{
StatusSignManager.updateSigns(); StatusSignManager.updateSigns();
NMSHandler.registerEnties(); NMSHandler.registerEnties();
Core.getInstance().registerPlugin(this); Core.getInstance().registerPlugin(this);
log(Level.INFO, " Plugin ver." + getDescription().getVersion() + " gestartet"); Core.getCommons().getLoggingHandler().getLobby().info(" Plugin ver." + getDescription().getVersion() + " gestartet");
} }
@ -94,7 +71,7 @@ public class Lobby extends JavaPlugin{
public void onDisable() { public void onDisable() {
StatusSignManager.saveSigns(); StatusSignManager.saveSigns();
PetManager.clearPets(); PetManager.clearPets();
log(Level.INFO, "Plugin beendet"); Core.getCommons().getLoggingHandler().getLobby().info("Plugin beendet");
} }
} }

View File

@ -1,17 +1,16 @@
package eu.univento.lobby.commands; package eu.univento.lobby.commands;
import java.util.List; 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.lobby.Lobby;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import eu.univento.core.api.AutoCommand; import java.util.List;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.Rank;
import eu.univento.lobby.Lobby;
/** /**
* drops items for easter eggs * drops items for easter eggs
@ -36,7 +35,7 @@ public class DropItem extends AutoCommand<Lobby>{
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.Admin)) { if(p.getDatabasePlayer().isAllowed(Rank.Admin)) {
if(args.length == 1) { if(args.length == 1) {
if(args[0].equalsIgnoreCase("music_3")) { if(args[0].equalsIgnoreCase("music_3")) {
ItemStack music_3 = new ItemStack(Material.RECORD_3); ItemStack music_3 = new ItemStack(Material.RECORD_3);

View File

@ -1,17 +1,16 @@
package eu.univento.lobby.commands; package eu.univento.lobby.commands;
import java.util.ArrayList; import eu.univento.commons.player.Rank;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
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.lobby.Lobby; import eu.univento.lobby.Lobby;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
/** /**
* sets teleport locations * sets teleport locations
@ -35,7 +34,7 @@ public class Setloc extends AutoCommand<Lobby>{
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("Lobby.Locs." + args[0], p.getLocation()); Config.write("Lobby.Locs." + args[0], p.getLocation());
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION()); p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION());

View File

@ -8,7 +8,7 @@ import eu.univento.lobby.utils.CustomMapRenderer;
import eu.univento.lobby.utils.PetManager; import eu.univento.lobby.utils.PetManager;
import eu.univento.lobby.utils.Pets; import eu.univento.lobby.utils.Pets;
import eu.univento.lobby.utils.Scoreboards; import eu.univento.lobby.utils.Scoreboards;
import net.minecraft.server.v1_10_R1.EnumParticle; import net.minecraft.server.v1_11_R1.EnumParticle;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
@ -37,7 +37,6 @@ import org.bukkit.util.Vector;
/** /**
* some short events * some short events
*
* @author joethei * @author joethei
* @version 1.0 * @version 1.0
*/ */
@ -50,41 +49,21 @@ public class Events implements Listener {
map.addRenderer(new CustomMapRenderer()); map.addRenderer(new CustomMapRenderer());
} }
/**
* cancels food level changes
*
* @param e FoodLevelChangeEvent
*/
@EventHandler @EventHandler
public void onFoodLevelChange(FoodLevelChangeEvent e) { public void onFoodLevelChange(FoodLevelChangeEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels weather changes
*
* @param e WeatherChangeEvent
*/
@EventHandler @EventHandler
public void onWeatherChange(WeatherChangeEvent e) { public void onWeatherChange(WeatherChangeEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels item consume
*
* @param e PlayerItemConsumeEvent
*/
@EventHandler @EventHandler
public void onConsume(PlayerItemConsumeEvent e) { public void onConsume(PlayerItemConsumeEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels death message and drops
*
* @param e PlayerDeathEvent
*/
@EventHandler @EventHandler
public void onDeath(PlayerDeathEvent e) { public void onDeath(PlayerDeathEvent e) {
e.setDeathMessage(null); e.setDeathMessage(null);
@ -102,80 +81,42 @@ public class Events implements Listener {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* sets respawn location
*
* @param e PlayerRespawnEvent
*/
@EventHandler @EventHandler
public void onRespawn(PlayerRespawnEvent e) { public void onRespawn(PlayerRespawnEvent e) {
e.setRespawnLocation(Config.readLocation("Lobby.Locs.Spawn")); e.setRespawnLocation(Config.readLocation("Lobby.Locs.Spawn"));
} }
/**
* cancels inventory dropping in creative
*
* @param e InventoryCreativeEvent
*/
@EventHandler @EventHandler
public void onInventoryCreative(InventoryCreativeEvent e) { public void onInventoryCreative(InventoryCreativeEvent e) {
e.setCancelled(false); e.setCancelled(false);
} }
/**
* cancels item drop
*
* @param e PlayerDropItemEvent
*/
@EventHandler @EventHandler
public void onDrop(PlayerDropItemEvent e) { public void onDrop(PlayerDropItemEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels player damage
*
* @param e EntityDamageEvent
*/
@EventHandler @EventHandler
public void onDamage(EntityDamageEvent e) { public void onDamage(EntityDamageEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels explosions
*
* @param e EntityExplodeEvent
*/
@EventHandler @EventHandler
public void onExplode(EntityExplodeEvent e) { public void onExplode(EntityExplodeEvent e) {
e.blockList().clear(); e.blockList().clear();
} }
/**
* cancels block destroying when block burns
*
* @param e BlockBurnEvent
*/
@EventHandler @EventHandler
public void onBurn(BlockBurnEvent e) { public void onBurn(BlockBurnEvent e) {
e.setCancelled(true); e.setCancelled(true);
} }
/**
* @param e BlockIgniteEvent
*/
@EventHandler @EventHandler
public void onBlockIgnite(BlockIgniteEvent e) { public void onBlockIgnite(BlockIgniteEvent e) {
if (e.getCause() == IgniteCause.SPREAD) if (e.getCause() == IgniteCause.SPREAD)
e.setCancelled(true); e.setCancelled(true);
} }
/**
* cancels chest opening and stuff + some easter egg
*
* @param e PlayerInteract
*/
@EventHandler @EventHandler
public void onInteract(PlayerInteractEvent e) { public void onInteract(PlayerInteractEvent e) {
if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL) if (e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.SOIL)
@ -203,7 +144,7 @@ public class Events implements Listener {
p.playParticle(skull.getLocation().add(0.5D, 1.5D, 0.5D), EnumParticle.ENCHANTMENT_TABLE, 0.3F, 500); p.playParticle(skull.getLocation().add(0.5D, 1.5D, 0.5D), EnumParticle.ENCHANTMENT_TABLE, 0.3F, 500);
Bukkit.getScheduler().scheduleAsyncDelayedTask(Lobby.getInstance(), () -> { Bukkit.getScheduler().scheduleAsyncDelayedTask(Lobby.getInstance(), () -> {
p.playParticle(skull.getLocation().add(0.5D, 0.0D, 0.5D), EnumParticle.SPELL_WITCH, 0.4F, 500); p.playParticle(skull.getLocation().add(0.5D, 0.0D, 0.5D), EnumParticle.SPELL_WITCH, 0.4F, 500);
p.sendTitle(10, 50, 10, "§eDu hast ein Versteck gefunden", "§6Name hier einfügen"); p.sendTitle(10, 50, 10, "Versteck", "§eDu hast ein Versteck gefunden");
p.getDatabasePlayer().addCoins(100); p.getDatabasePlayer().addCoins(100);
Scoreboards.updateScoreboard(p); Scoreboards.updateScoreboard(p);
}, 3 * 20L); }, 3 * 20L);
@ -215,11 +156,7 @@ public class Events implements Listener {
} }
} }
} }
/**
* prevents item despawning
*
* @param e ItemDespawnEvent
*/
@EventHandler @EventHandler
public void onItemDespawn(ItemDespawnEvent e) { public void onItemDespawn(ItemDespawnEvent e) {
e.setCancelled(true); e.setCancelled(true);

View File

@ -1,19 +1,17 @@
package eu.univento.lobby.listeners; package eu.univento.lobby.listeners;
import java.sql.PreparedStatement; import eu.univento.commons.database.MySQL;
import java.sql.ResultSet; import eu.univento.core.Core;
import java.sql.SQLException;
import eu.univento.core.api.languages.Messages; import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import eu.univento.core.Core; import java.sql.PreparedStatement;
import eu.univento.core.api.database.MySQL; import java.sql.ResultSet;
import eu.univento.core.api.Title; import java.sql.SQLException;
import eu.univento.core.api.player.CustomPlayer;
/** /**
* handels all posible easter eggs * handels all posible easter eggs
@ -22,85 +20,61 @@ import eu.univento.core.api.player.CustomPlayer;
*/ */
public class FoundItems implements Listener{ public class FoundItems implements Listener{
/**
* handels item pickup
* @param e PlayerPickupItemEvent
*/
@EventHandler @EventHandler
public void onItemPickup(PlayerPickupItemEvent e) { public void onItemPickup(PlayerPickupItemEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
Messages msgs = new Messages(p); Messages msgs = new Messages(p);
if(e.getItem().getItemStack().getType() == Material.RECORD_3) { if(e.getItem().getItemStack().getType() == Material.RECORD_3) {
if(!hasFound("music_3", p)) { if(!hasFound("music_3")) {
setFound("music_3", p); setFound("music_3");
Title.sendTitle(p, 5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Music_3"); p.sendTitle(5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Music_3");
p.addExperience(5); p.addExperience(5);
} }
} }
if(e.getItem().getItemStack().getType() == Material.SUGAR) { if(e.getItem().getItemStack().getType() == Material.SUGAR) {
if(!hasFound("sugar", p)) { if(!hasFound("sugar")) {
setFound("sugar", p); setFound("su1gar");
Title.sendTitle(p, 5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Sugar"); p.sendTitle(5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Sugar");
p.addExperience(5); p.addExperience(5);
} }
} }
if(e.getItem().getItemStack().getType() == Material.RED_ROSE) { if(e.getItem().getItemStack().getType() == Material.RED_ROSE) {
if(!hasFound("hearts", p)) { if(!hasFound("hearts")) {
setFound("hearts", p); setFound("hearts");
Title.sendTitle(p, 5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Hearts"); p.sendTitle(5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Hearts");
p.addExperience(3); p.addExperience(3);
} }
} }
if(e.getItem().getItemStack().getType() == Material.FEATHER) { if(e.getItem().getItemStack().getType() == Material.FEATHER) {
if(!hasFound("feather", p)) { if(!hasFound("feather")) {
setFound("feather", p); setFound("feather");
Title.sendTitle(p, 5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Feather"); p.sendTitle(5, 5, 5, msgs.Lobby_FOUND_ITEM_PREFIX(), "Feather");
} }
} }
e.setCancelled(true); e.setCancelled(true);
} }
/** public static boolean hasFound(String item) {
* checks if player has found item int id = 8;
* @param item name of item MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
* @param p CustomPlayer
* @return boolean
*/
public static boolean hasFound(String item, CustomPlayer p) {
int id = 8;
MySQL sql = Core.getMySQL();
try { try {
sql.openConnection(); PreparedStatement st = sql.getConnection().prepareStatement("SELECT * FROM FoundItems WHERE ID='" + id + "';");
PreparedStatement st = sql.getConnection().prepareStatement("SELECT * FROM FoundItems WHERE ID='" + id + "';"); ResultSet rs = st.executeQuery();
ResultSet rs = st.executeQuery(); return rs.next() && rs.getInt(item) == 1;
if(rs.next()) { } catch (SQLException e) {
boolean has = rs.getInt(item) == 1;
sql.closeConnection();
return has;
}else{
return false;
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
} }
/** private void setFound(String item) {
* sets item to found
* @param item name of item
* @param p CustomPlayer
*/
void setFound(String item, CustomPlayer p) {
int id = 8; int id = 8;
MySQL sql = Core.getMySQL(); MySQL sql = Core.getCommons().getDatabaseManager().getMySQL();
try { try {
sql.openConnection();
PreparedStatement st = sql.getConnection().prepareStatement("UPDATE FoundItems SET " + item + "='1' WHERE ID='" + id + "';"); PreparedStatement st = sql.getConnection().prepareStatement("UPDATE FoundItems SET " + item + "='1' WHERE ID='" + id + "';");
st.execute(); st.execute();
sql.closeConnection(); } catch (SQLException e) {
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -1,27 +1,21 @@
package eu.univento.lobby.listeners; package eu.univento.lobby.listeners;
import java.util.HashMap; import eu.univento.commons.player.Rank;
import eu.univento.core.Core; import eu.univento.core.Core;
import eu.univento.core.api.player.Rank; import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Bukkit; import eu.univento.lobby.Lobby;
import org.bukkit.Effect; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
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;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.HashMap;
/** /**
* some item events * some item events
*
* @author joethei * @author joethei
* @version 1.0 * @version 1.0
*/ */
@ -35,18 +29,18 @@ public class ItemEvents implements Listener {
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = p.getItemInHand(); ItemStack item = p.getItemInHand();
if (item.getType() == Material.NAME_TAG) { if (item.getType() == Material.NAME_TAG) {
if (p.isAllowed(Rank.Partner)) { if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if (p.isNicked()) { if (p.getDatabasePlayer().getSettings().isNicked()) {
p.setNicked(false); p.getDatabasePlayer().getSettings().setNickStatus(false);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_OFF()); p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_OFF());
} else { } else {
p.setNicked(true); p.getDatabasePlayer().getSettings().setNickStatus(true);
p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_ON()); p.sendMessage(p.getMessages().PREFIX() + p.getMessages().Lobby_AUTONICK_ON());
} }
} }
} }
if (item.getType() == Material.EYE_OF_ENDER) { if (item.getType() == Material.EYE_OF_ENDER) {
if (p.isAllowed(Rank.Partner)) { if (p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if (forcefield.containsKey(p)) { if (forcefield.containsKey(p)) {
Bukkit.getScheduler().cancelTask(forcefield.get(p)); Bukkit.getScheduler().cancelTask(forcefield.get(p));
forcefield.remove(p); forcefield.remove(p);
@ -98,6 +92,6 @@ public class ItemEvents implements Listener {
private void playEffect(Location loc, Effect effect, boolean v) { private void playEffect(Location loc, Effect effect, boolean v) {
for (int i = 0; i <= 8; i += ((!v) && (i == 3) ? 2 : 1)) for (int i = 0; i <= 8; i += ((!v) && (i == 3) ? 2 : 1))
Core.getOnlinePlayers().stream().filter(p -> p.hasEffects()).forEach(p -> p.playEffect(loc, effect, 1.0F)); Core.getOnlinePlayers().stream().filter(p -> p.getDatabasePlayer().getSettings().hasEffectsEnabled()).forEach(p -> p.playEffect(loc, effect, 1.0F));
} }
} }

View File

@ -4,7 +4,7 @@ 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.lobby.utils.Inventorys; import eu.univento.lobby.utils.InventoryManager;
import eu.univento.lobby.utils.PetManager; import eu.univento.lobby.utils.PetManager;
import eu.univento.lobby.utils.Scoreboards; import eu.univento.lobby.utils.Scoreboards;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -44,7 +44,7 @@ public class JoinQuit implements Listener {
p.teleport(Config.readLocation("Lobby.Locs.Spawn")); p.teleport(Config.readLocation("Lobby.Locs.Spawn"));
} }
Inventorys invs = new Inventorys(p); InventoryManager invs = new InventoryManager(p);
p.giveExp(p.getDatabasePlayer().getExperience()); p.giveExp(p.getDatabasePlayer().getExperience());
p.sendTitle(10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2()); p.sendTitle(10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2());

View File

@ -26,20 +26,9 @@ import java.util.ArrayList;
*/ */
public class Jumppads implements Listener{ public class Jumppads implements Listener{
/**
* contains players flying from premium lobby to spawn
*/
private ArrayList<CustomPlayer> flySpawn = new ArrayList<>(); private ArrayList<CustomPlayer> flySpawn = new ArrayList<>();
/**
* contains players flying from spawn to premium lobby
*/
private ArrayList<CustomPlayer> flyPremium = new ArrayList<>(); private ArrayList<CustomPlayer> flyPremium = new ArrayList<>();
/**
* lets players jump over pads
* @param e PlayerMoveEvent
* @throws InterruptedException thread closed
*/
@EventHandler @EventHandler
public void onMove(PlayerMoveEvent e) throws InterruptedException { public void onMove(PlayerMoveEvent e) throws InterruptedException {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
@ -140,10 +129,6 @@ public class Jumppads implements Listener{
} }
} }
/**
* cancels fall damage
* @param e EntityDamageEvent
*/
@EventHandler @EventHandler
public void onDamage(EntityDamageEvent e) { public void onDamage(EntityDamageEvent e) {
if(e.getEntity() instanceof Player) { if(e.getEntity() instanceof Player) {
@ -153,11 +138,6 @@ public class Jumppads implements Listener{
} }
} }
/**
* teleports player to location
* @param loc name of location
* @param p CustomPlayer
*/
private void teleport(String loc, CustomPlayer p) { private void teleport(String loc, CustomPlayer p) {
p.teleport(Config.readLocation("Lobby.Locs." + loc)); p.teleport(Config.readLocation("Lobby.Locs." + loc));
p.playSound(p.getEyeLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 5.0F, 1.0F); p.playSound(p.getEyeLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 5.0F, 1.0F);
@ -166,10 +146,6 @@ public class Jumppads implements Listener{
p.setHealth(10.0); p.setHealth(10.0);
} }
/**
* runs cancel timer
* @param p CustomPlayer
*/
private void runTimer(CustomPlayer p) { private void runTimer(CustomPlayer p) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), () -> { Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), () -> {
if(flyPremium.contains(p)) { if(flyPremium.contains(p)) {

View File

@ -1,7 +1,7 @@
package eu.univento.lobby.listeners; package eu.univento.lobby.listeners;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.Inventorys; import eu.univento.lobby.utils.InventoryManager;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -17,17 +17,13 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class Menu implements Listener{ public class Menu implements Listener{
/**
* opens and creates menus
* @param e PlayerInteract
*/
@EventHandler @EventHandler
public void onInteract(PlayerInteractEvent e) { public void onInteract(PlayerInteractEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = p.getItemInHand(); ItemStack item = p.getItemInHand();
if(!p.hasOpenInventory()) { if(!p.hasOpenInventory()) {
Inventorys invs = new Inventorys(p); InventoryManager invs = new InventoryManager(p);
if(item.getType() == Material.WORKBENCH) { if(item.getType() == Material.WORKBENCH) {
p.setOpenInventory(true); p.setOpenInventory(true);
p.openInventory(invs.getNavigatorInventory()); p.openInventory(invs.getNavigatorInventory());

View File

@ -1,19 +1,15 @@
package eu.univento.lobby.listeners; package eu.univento.lobby.listeners;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import eu.univento.core.Core; import eu.univento.core.Core;
import eu.univento.core.api.Config;
import eu.univento.core.api.effects.Effects; import eu.univento.core.api.effects.Effects;
import eu.univento.core.api.languages.Messages; import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.utils.InventoryManager;
import eu.univento.lobby.utils.PetManager; import eu.univento.lobby.utils.PetManager;
import net.minecraft.server.v1_10_R1.EnumParticle; import net.minecraft.server.v1_11_R1.EnumParticle;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -25,10 +21,8 @@ import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import eu.univento.core.api.Config; import java.util.ArrayList;
import eu.univento.core.api.player.CustomPlayer; import java.util.List;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.utils.Inventorys;
/** /**
* handles teleport menus * handles teleport menus
@ -40,16 +34,11 @@ public class MenuEvents implements Listener {
private ArrayList<CustomPlayer> heartPlayers = new ArrayList<>(); private ArrayList<CustomPlayer> heartPlayers = new ArrayList<>();
private ArrayList<CustomPlayer> lavaPlayers = new ArrayList<>(); private ArrayList<CustomPlayer> lavaPlayers = new ArrayList<>();
/**
* clicking items
* @param e InventoryClickEvent
*/
@EventHandler @EventHandler
public void onClick(InventoryClickEvent e) { public void onClick(InventoryClickEvent e) {
if (e.getWhoClicked() instanceof Player) { if (e.getWhoClicked() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName()); CustomPlayer p = CustomPlayer.getPlayer(e.getWhoClicked().getName());
Inventorys invs = new Inventorys(p); InventoryManager invs = new InventoryManager(p);
Messages msgs = new Messages(p); Messages msgs = new Messages(p);
if(!e.getSlotType().equals(SlotType.OUTSIDE)) { if(!e.getSlotType().equals(SlotType.OUTSIDE)) {
if (e.getInventory().getName().equals(invs.getNavigatorInventory().getName())) { if (e.getInventory().getName().equals(invs.getNavigatorInventory().getName())) {
@ -107,7 +96,7 @@ public class MenuEvents implements Listener {
if (e.getInventory().getName().equals(invs.getSettingsInventory().getName())) { if (e.getInventory().getName().equals(invs.getSettingsInventory().getName())) {
if(e.getSlot() == 0) { if(e.getSlot() == 0) {
p.setPartyRequests(!p.hasPartyRequests()); p.getDatabasePlayer().getSettings().setPartyRequests(!p.getDatabasePlayer().getSettings().hasPartyRequestsEnabled());
p.closeInventory(); p.closeInventory();
p.openInventory(invs.getSettingsInventory()); p.openInventory(invs.getSettingsInventory());
} }
@ -115,19 +104,19 @@ public class MenuEvents implements Listener {
if(e.getInventory().getName().equals(invs.getLanguagesInventory().getName())) { if(e.getInventory().getName().equals(invs.getLanguagesInventory().getName())) {
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eDeutsch")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eDeutsch")) {
p.setLanguage("DE"); p.getDatabasePlayer().getSettings().setLanguage("DE");
p.closeInventory(); p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Sprache auf §eDeutsch §7geändert"); p.sendMessage(msgs.PREFIX() + "§7Sprache auf §eDeutsch §7geändert");
invs.setMainInventory(true); invs.setMainInventory(true);
} }
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eEnglish")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eEnglish")) {
p.setLanguage("EN"); p.getDatabasePlayer().getSettings().setLanguage("EN");
p.closeInventory(); p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Language changed to §eenglish"); p.sendMessage(msgs.PREFIX() + "§7Language changed to §eenglish");
invs.setMainInventory(true); invs.setMainInventory(true);
} }
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eitaliano")) { if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§eitaliano")) {
p.setLanguage("IT"); p.getDatabasePlayer().getSettings().setLanguage("IT");
p.closeInventory(); p.closeInventory();
p.sendMessage(msgs.PREFIX() + "§7Da fehlt doch noch was"); p.sendMessage(msgs.PREFIX() + "§7Da fehlt doch noch was");
invs.setMainInventory(true); invs.setMainInventory(true);
@ -256,26 +245,18 @@ public class MenuEvents implements Listener {
} }
} }
/**
* plays effects on player move
* @param e PlayerMoveEvent
*/
@EventHandler @EventHandler
public void onMove(PlayerMoveEvent e) { public void onMove(PlayerMoveEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
List<Player> players = Core.getOnlinePlayers().stream().map(CustomPlayer::getPLAYER).collect(Collectors.toList()); List<Player> players = new ArrayList<>();
players.addAll(Core.getOnlinePlayers());
if(heartPlayers.contains(p)) if(heartPlayers.contains(p))
Effects.playEffect(p.getLocation(), EnumParticle.HEART, 5, 5); Effects.playEffect(p.getLocation(), EnumParticle.HEART, 5);
if(lavaPlayers.contains(p)) if(lavaPlayers.contains(p))
Effects.playEffect(p.getLocation(), EnumParticle.DRIP_LAVA, 5, 5); Effects.playEffect(p.getLocation(), EnumParticle.DRIP_LAVA, 5);
} }
/**
* teleports player with effects to location
* @param p CustomPlayer
* @param location String
*/
private void teleport(CustomPlayer p, String location) { private void teleport(CustomPlayer p, String location) {
Vector v = p.getLocation().getDirection().multiply(0D).setY(2D); Vector v = p.getLocation().getDirection().multiply(0D).setY(2D);
p.setVelocity(v); p.setVelocity(v);

View File

@ -17,11 +17,11 @@ import java.util.Random;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class Parkour implements Listener{ public class Parkour implements Listener{
static ArrayList<CustomPlayer> players = new ArrayList<>(); private static ArrayList<CustomPlayer> players = new ArrayList<>();
public static ArrayList<CustomPlayer> getPlayers() { public static ArrayList<CustomPlayer> getPlayers() {
return players; return players;
} }

View File

@ -19,7 +19,7 @@ import org.bukkit.inventory.meta.ItemMeta;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class PetInteract implements Listener { public class PetInteract implements Listener {
@ -78,7 +78,7 @@ public class PetInteract implements Listener {
if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) { if(event.getSlot() == AnvilGUI.AnvilSlot.OUTPUT) {
event.setWillClose(true); event.setWillClose(true);
event.setWillDestroy(true); event.setWillDestroy(true);
PetManager.setName(p, p.getColor() + event.getName()); PetManager.setName(p, p.getDatabasePlayer().getRank().getColor() + event.getName());
p.refreshExperience(); p.refreshExperience();
}else{ }else{
event.setWillDestroy(true); event.setWillDestroy(true);

View File

@ -1,8 +1,9 @@
package eu.univento.lobby.listeners; package eu.univento.lobby.listeners;
import java.util.ArrayList; import eu.univento.commons.player.Rank;
import eu.univento.core.api.languages.Messages;
import eu.univento.lobby.utils.Inventorys; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.lobby.utils.InventoryManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -14,9 +15,7 @@ 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 eu.univento.core.api.languages.Messages; import java.util.ArrayList;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.Rank;
/** /**
* lets players show/hide other players * lets players show/hide other players
@ -35,10 +34,7 @@ public class PlayerHider implements Listener{
public static ArrayList<CustomPlayer> getSilentlobby() { public static ArrayList<CustomPlayer> getSilentlobby() {
return silentlobby; return silentlobby;
} }
/**
* item to hide
* @return ItemStack
*/
private ItemStack getHide(CustomPlayer p) { private ItemStack getHide(CustomPlayer p) {
Messages msgs = new Messages(p); Messages msgs = new Messages(p);
ItemStack hide = new ItemStack(Material.GLOWSTONE_DUST); ItemStack hide = new ItemStack(Material.GLOWSTONE_DUST);
@ -49,10 +45,6 @@ public class PlayerHider implements Listener{
return hide; return hide;
} }
/**
* item to show
* @return ItemStack
*/
private ItemStack getShow(CustomPlayer p) { private ItemStack getShow(CustomPlayer p) {
Messages msgs = new Messages(p); Messages msgs = new Messages(p);
ItemStack show = new ItemStack(Material.SUGAR); ItemStack show = new ItemStack(Material.SUGAR);
@ -63,11 +55,6 @@ public class PlayerHider implements Listener{
return show; return show;
} }
/**
* player interacts with item
* @param e PlayerInteract
* @throws InterruptedException threads closed
*/
@EventHandler @EventHandler
public void onInteract(PlayerInteractEvent e) throws InterruptedException { public void onInteract(PlayerInteractEvent e) throws InterruptedException {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer().getName());
@ -90,7 +77,7 @@ public class PlayerHider implements Listener{
for(Player players : Bukkit.getOnlinePlayers()) { for(Player players : Bukkit.getOnlinePlayers()) {
CustomPlayer player = CustomPlayer.getPlayer(players.getName()); CustomPlayer player = CustomPlayer.getPlayer(players.getName());
if(!player.isAllowed(Rank.Supporter)) { if(!player.getDatabasePlayer().isAllowed(Rank.Supporter)) {
p.hidePlayer(players); p.hidePlayer(players);
} }
} }
@ -103,10 +90,10 @@ public class PlayerHider implements Listener{
} }
if(item.getType() == Material.TNT) { if(item.getType() == Material.TNT) {
if(p.isAllowed(Rank.Partner)) { if(p.getDatabasePlayer().isAllowed(Rank.Partner)) {
if(silentlobby.contains(p)) { if(silentlobby.contains(p)) {
silentlobby.remove(p); silentlobby.remove(p);
Inventorys invs = new Inventorys(p); InventoryManager invs = new InventoryManager(p);
p.getInventory().clear(); p.getInventory().clear();
invs.setMainInventory(true); invs.setMainInventory(true);
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_OFF()); p.sendMessage(msgs.PREFIX() + msgs.Lobby_SILENT_LOBBY_OFF());
@ -128,5 +115,4 @@ public class PlayerHider implements Listener{
} }
} }
} }
} }

View File

@ -16,7 +16,7 @@ import org.bukkit.inventory.meta.SkullMeta;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class PlayerInteract implements Listener{ public class PlayerInteract implements Listener{
@ -31,7 +31,7 @@ public class PlayerInteract implements Listener{
} }
private void openInventory(CustomPlayer p, CustomPlayer clicked) { private void openInventory(CustomPlayer p, CustomPlayer clicked) {
Inventory inv = Bukkit.createInventory(p, 9, clicked.getColor() + clicked.getName() + "'s " + p.getMessages().LobbyItems_PLAYER_MENU()); Inventory inv = Bukkit.createInventory(p, 9, clicked.getDatabasePlayer().getRank().getColor() + clicked.getName() + "'s " + p.getMessages().LobbyItems_PLAYER_MENU());
ItemStack friend = new ItemStack(Material.PUMPKIN); ItemStack friend = new ItemStack(Material.PUMPKIN);
ItemMeta friendMeta = friend.getItemMeta(); ItemMeta friendMeta = friend.getItemMeta();

View File

@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class StatusSigns implements Listener{ public class StatusSigns implements Listener{
@ -37,6 +37,7 @@ public class StatusSigns implements Listener{
if(block.getType() == Material.WALL_SIGN) { if(block.getType() == Material.WALL_SIGN) {
if(StatusSignManager.isStatusSign(block.getLocation())) { if(StatusSignManager.isStatusSign(block.getLocation())) {
StatusSign sign = StatusSignManager.getSign(block.getLocation()); StatusSign sign = StatusSignManager.getSign(block.getLocation());
assert sign != null;
p.connectToServer(sign.getServerName()); p.connectToServer(sign.getServerName());
} }
} }

View File

@ -1,10 +1,14 @@
package eu.univento.lobby.story.events; package eu.univento.lobby.story.events;
import eu.univento.core.api.entity.EntityModifier; import eu.univento.core.api.entity.EntityModifier;
import eu.univento.core.api.entity.pathfinding.AStar;
import eu.univento.core.api.entity.pathfinding.PathingResult;
import eu.univento.core.api.entity.pathfinding.Tile;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.story.StoryMission; import eu.univento.core.api.story.StoryMission;
import eu.univento.lobby.Lobby; import eu.univento.lobby.Lobby;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
@ -16,6 +20,9 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.HashSet;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 0.1
@ -33,22 +40,24 @@ public class StartMissionEvents implements Listener{
public void onSneak(PlayerToggleSneakEvent e) { public void onSneak(PlayerToggleSneakEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(p == mission.getPlayer()) { if(p == mission.getPlayer()) {
p.sendMessage("Hallo du da"); if(p.isSneaking()) {
p.setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); p.sendMessage("Hallo du da");
EntityModifier.Builder crepper = new EntityModifier(p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER)).modify(); EntityModifier.Builder crepper = new EntityModifier(p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER)).modify();
crepper.setNoAI(true).followPlayer(p, 1.0F); crepper.setNoAI(true).followPlayer(p, 1.0F);
Giant giant = p.getWorld().spawn(p.getLocation(), Giant.class); Giant giant = p.getWorld().spawn(p.getLocation(), Giant.class);
giant.getEquipment().setItemInMainHand(p.getItemInHand()); giant.getEquipment().setItemInMainHand(new ItemStack(Material.DIAMOND_SWORD));
giant.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 999)); giant.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 999));
giant.setAI(false); giant.setAI(false);
giant.setGravity(false); giant.setGravity(false);
runPathing(p.getLocation(), p.getTargetBlock(new HashSet<Byte>(), 50).getLocation(), 50);
Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), () -> { Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), () -> {
crepper.die(); crepper.die();
giant.remove(); giant.remove();
}, 20 * 20L); }, 20 * 20L);
}
} }
} }
@ -56,4 +65,39 @@ public class StartMissionEvents implements Listener{
public void onDamage(EntityDamageEvent e) { public void onDamage(EntityDamageEvent e) {
if(e.getEntity() instanceof Giant) e.setCancelled(true); if(e.getEntity() instanceof Giant) e.setCancelled(true);
} }
private void runPathing(final Location start, final Location end, final int range){
try {
//create our pathfinder
AStar path = new AStar(start, end, range);
//get the list of nodes to walk to as a Tile object
ArrayList<Tile> route = path.iterate();
//get the result of the path trace
PathingResult result = path.getPathingResult();
switch(result){
case SUCCESS :
//Path was successful. Do something here.
changePathBlocksToDiamond(start, route);
break;
case NO_PATH :
//No path found, throw error.
System.out.println("No path found!");
break;
}
} catch (AStar.InvalidPathException e) {
//InvalidPathException will be thrown if start or end block is air
if(e.isStartNotSolid()){
System.out.println("End block is not walkable");
}
if(e.isStartNotSolid()){
System.out.println("Start block is not walkable");
}
}
}
private void changePathBlocksToDiamond(Location start, ArrayList<Tile> tiles){
for(Tile t : tiles)
t.getLocation(start).getBlock().setType(Material.DIAMOND_BLOCK);
}
} }

View File

@ -10,7 +10,6 @@ import org.bukkit.map.MinecraftFont;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 0.1
* created on 05.07.2016
*/ */
public class CustomMapRenderer extends MapRenderer{ public class CustomMapRenderer extends MapRenderer{

View File

@ -1,9 +1,10 @@
package eu.univento.lobby.utils; package eu.univento.lobby.utils;
import java.util.ArrayList; import eu.univento.commons.player.Rank;
import java.util.List; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.server.ServerInfo; import eu.univento.core.api.server.ServerInfo;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.listeners.FoundItems;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -14,26 +15,24 @@ import org.bukkit.inventory.ItemFlag;
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 eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.Rank;
import eu.univento.lobby.Lobby;
import eu.univento.lobby.listeners.FoundItems;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import java.util.ArrayList;
import java.util.List;
/** /**
* opens inventorys for players * opens inventorys for players
* *
* @author joethei * @author joethei
* @version 1.0 * @version 1.0
*/ */
public class Inventorys { public class InventoryManager {
private CustomPlayer player; private CustomPlayer player;
private ItemStack empty = new ItemStack(Material.AIR); private ItemStack empty = new ItemStack(Material.AIR);
public Inventorys(CustomPlayer player) { public InventoryManager(CustomPlayer player) {
this.player = player; this.player = player;
} }
@ -42,33 +41,33 @@ public class Inventorys {
ItemStack nav = new ItemStack(Material.WORKBENCH); ItemStack nav = new ItemStack(Material.WORKBENCH);
ItemMeta navMeta = nav.getItemMeta(); ItemMeta navMeta = nav.getItemMeta();
navMeta.setDisplayName(player.getMessage("Lobby.Item.Navigator")); navMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.Navigator"));
nav.setItemMeta(navMeta); nav.setItemMeta(navMeta);
ItemStack lobby = new ItemStack(Material.BLAZE_POWDER); ItemStack lobby = new ItemStack(Material.BLAZE_POWDER);
ItemMeta lobbyMeta = lobby.getItemMeta(); ItemMeta lobbyMeta = lobby.getItemMeta();
lobbyMeta.setDisplayName(player.getMessage("Lobby.Item.LobbySwitcher")); lobbyMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.LobbySwitcher"));
lobby.setItemMeta(lobbyMeta); lobby.setItemMeta(lobbyMeta);
ItemStack adventure = new ItemStack(Material.GLOWSTONE_DUST); ItemStack adventure = new ItemStack(Material.GLOWSTONE_DUST);
ItemMeta adventureMeta = adventure.getItemMeta(); ItemMeta adventureMeta = adventure.getItemMeta();
adventureMeta.setDisplayName(player.getMessage("Lobby.Item.Adventure")); adventureMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.Adventure"));
adventure.setItemMeta(adventureMeta); adventure.setItemMeta(adventureMeta);
ItemStack fun = new ItemStack(Material.CHEST); ItemStack fun = new ItemStack(Material.CHEST);
ItemMeta funMeta = fun.getItemMeta(); ItemMeta funMeta = fun.getItemMeta();
funMeta.setDisplayName(player.getMessage("Lobby.Item.FunChest")); funMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.FunChest"));
fun.setItemMeta(funMeta); fun.setItemMeta(funMeta);
ItemStack youtube = new ItemStack(Material.EXP_BOTTLE); ItemStack youtube = new ItemStack(Material.EXP_BOTTLE);
ItemMeta youtubeMeta = youtube.getItemMeta(); ItemMeta youtubeMeta = youtube.getItemMeta();
youtubeMeta.setDisplayName(player.getMessage("Lobby.Item.Youtuber")); youtubeMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.Youtuber"));
youtube.setItemMeta(youtubeMeta); youtube.setItemMeta(youtubeMeta);
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta meta = (SkullMeta) skull.getItemMeta(); SkullMeta meta = (SkullMeta) skull.getItemMeta();
meta.setOwner(player.getName()); meta.setOwner(player.getName());
meta.setDisplayName(player.getMessage("Lobby.Item.Profile")); meta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.Profile"));
skull.setItemMeta(meta); skull.setItemMeta(meta);
inv.setItem(2, empty); inv.setItem(2, empty);
@ -79,7 +78,7 @@ public class Inventorys {
timeItem(inv, 8, skull, Sound.ENTITY_CHICKEN_EGG, 40L, false, forcetime); timeItem(inv, 8, skull, Sound.ENTITY_CHICKEN_EGG, 40L, false, forcetime);
timeItem(inv, 1, lobby, Sound.ENTITY_CHICKEN_EGG, 60L, false, forcetime); timeItem(inv, 1, lobby, Sound.ENTITY_CHICKEN_EGG, 60L, false, forcetime);
timeItem(inv, 7, fun, Sound.ENTITY_CHICKEN_EGG, 80L, false, forcetime); timeItem(inv, 7, fun, Sound.ENTITY_CHICKEN_EGG, 80L, false, forcetime);
if (player.isAllowed(Rank.Partner)) { if (player.getDatabasePlayer().isAllowed(Rank.Partner)) {
timeItem(inv, 5, youtube, Sound.ENTITY_CHICKEN_EGG, 120L, false, forcetime); timeItem(inv, 5, youtube, Sound.ENTITY_CHICKEN_EGG, 120L, false, forcetime);
timeItem(inv, 3, adventure, Sound.ENTITY_CHICKEN_DEATH, 140L, false, forcetime); timeItem(inv, 3, adventure, Sound.ENTITY_CHICKEN_DEATH, 140L, false, forcetime);
} else { } else {
@ -98,25 +97,25 @@ public class Inventorys {
ItemStack spawn = new ItemStack(Material.FIREWORK_CHARGE); ItemStack spawn = new ItemStack(Material.FIREWORK_CHARGE);
ItemMeta spawnMeta = spawn.getItemMeta(); ItemMeta spawnMeta = spawn.getItemMeta();
spawnMeta.setDisplayName(player.getMessage("Lobby.Menu.Nav.Spawn")); spawnMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Spawn"));
spawnMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); spawnMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
spawn.setItemMeta(spawnMeta); spawn.setItemMeta(spawnMeta);
ItemStack strive = new ItemStack(Material.WOOL, 1, (byte) 11); ItemStack strive = new ItemStack(Material.WOOL, 1, (byte) 11);
ItemMeta striveMeta = strive.getItemMeta(); ItemMeta striveMeta = strive.getItemMeta();
striveMeta.setDisplayName(player.getMessage("Lobby.Menu.Nav.Strive")); striveMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Strive"));
strive.setItemMeta(striveMeta); strive.setItemMeta(striveMeta);
ItemStack hustle = new ItemStack(Material.CHAINMAIL_BOOTS); ItemStack hustle = new ItemStack(Material.CHAINMAIL_BOOTS);
ItemMeta hustleMeta = hustle.getItemMeta(); ItemMeta hustleMeta = hustle.getItemMeta();
hustleMeta.setDisplayName(player.getMessage("Lobby.Menu.Nav.Hustle")); hustleMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Hustle"));
hustleMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); hustleMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
hustle.setItemMeta(hustleMeta); hustle.setItemMeta(hustleMeta);
ItemStack build = new ItemStack(Material.FLOWER_POT_ITEM); ItemStack build = new ItemStack(Material.FLOWER_POT_ITEM);
ItemMeta buildMeta = build.getItemMeta(); ItemMeta buildMeta = build.getItemMeta();
buildMeta.setDisplayName(player.getMessage("Lobby.Menu.Nav.Build")); buildMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Menu.Nav.Build"));
ArrayList<String> buildLore = new ArrayList<>(); ArrayList<String> buildLore = new ArrayList<>();
ServerInfo buildInfo = new ServerInfo("build"); ServerInfo buildInfo = new ServerInfo("build");
buildLore.add(buildInfo.getOnlinePlayers() + player.getMessages().LobbyItems_PLAYERS_ONLINE()); buildLore.add(buildInfo.getOnlinePlayers() + player.getMessages().LobbyItems_PLAYERS_ONLINE());
@ -126,7 +125,7 @@ public class Inventorys {
inv.setItem(21, hustle); inv.setItem(21, hustle);
inv.setItem(23, strive); inv.setItem(23, strive);
inv.setItem(31, spawn); inv.setItem(31, spawn);
if (player.isAllowed(Rank.Supporter)) inv.setItem(26, build); if (player.getDatabasePlayer().isAllowed(Rank.Supporter)) inv.setItem(26, build);
return inv; return inv;
} }
@ -160,33 +159,33 @@ public class Inventorys {
Inventory inv = player.getInventory(); Inventory inv = player.getInventory();
String nickState; String nickState;
if(player.isNicked()) nickState = "on"; else nickState = "off"; if(player.getDatabasePlayer().getSettings().isNicked()) nickState = "on"; else nickState = "off";
ItemStack nick = new ItemStack(Material.NAME_TAG); ItemStack nick = new ItemStack(Material.NAME_TAG);
ItemMeta nickMeta = nick.getItemMeta(); ItemMeta nickMeta = nick.getItemMeta();
nickMeta.setDisplayName(player.getMessage("Lobby.Item.YT.Nick." + nickState)); nickMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.YT.Nick." + nickState));
nick.setItemMeta(nickMeta); nick.setItemMeta(nickMeta);
ItemStack silent = new ItemStack(Material.TNT); ItemStack silent = new ItemStack(Material.TNT);
ItemMeta silentMeta = silent.getItemMeta(); ItemMeta silentMeta = silent.getItemMeta();
silentMeta.setDisplayName(player.getMessage("Lobby.Item.YT.SilentLobby")); silentMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.YT.SilentLobby"));
silent.setItemMeta(silentMeta); silent.setItemMeta(silentMeta);
ItemStack force = new ItemStack(Material.EYE_OF_ENDER); ItemStack force = new ItemStack(Material.EYE_OF_ENDER);
ItemMeta forceMeta = force.getItemMeta(); ItemMeta forceMeta = force.getItemMeta();
forceMeta.setDisplayName(player.getMessage("Lobby.Item.YT.Forcefield")); forceMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.YT.Forcefield"));
force.setItemMeta(forceMeta); force.setItemMeta(forceMeta);
ItemStack extras = new ItemStack(Material.MILK_BUCKET); ItemStack extras = new ItemStack(Material.MILK_BUCKET);
ItemMeta extrasMeta = extras.getItemMeta(); ItemMeta extrasMeta = extras.getItemMeta();
extrasMeta.setDisplayName(player.getMessage("Lobby.Item.YT.Extras")); extrasMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.YT.Extras"));
extras.setItemMeta(extrasMeta); extras.setItemMeta(extrasMeta);
Dye dye = new Dye(); Dye dye = new Dye();
dye.setColor(DyeColor.RED); dye.setColor(DyeColor.RED);
ItemStack back = dye.toItemStack(); ItemStack back = dye.toItemStack();
ItemMeta backMeta = back.getItemMeta(); ItemMeta backMeta = back.getItemMeta();
backMeta.setDisplayName(player.getMessage("Lobby.Item.YT.Back")); backMeta.setDisplayName(player.getDatabasePlayer().getLanguage().getWord("Lobby.Item.YT.Back"));
back.setItemMeta(backMeta); back.setItemMeta(backMeta);
inv.setItem(0, force); inv.setItem(0, force);
@ -255,7 +254,7 @@ public class Inventorys {
music_3.setItemMeta(music_3Meta); music_3.setItemMeta(music_3Meta);
if (FoundItems.hasFound("music_3", player)) inv.setItem(2, music_3); if (FoundItems.hasFound("music_3")) inv.setItem(2, music_3);
return inv; return inv;
} }
@ -278,8 +277,8 @@ public class Inventorys {
featherMeta.setDisplayName("§6Federleicht"); featherMeta.setDisplayName("§6Federleicht");
feather.setItemMeta(featherMeta); feather.setItemMeta(featherMeta);
if (FoundItems.hasFound("sugar", player)) inv.setItem(0, sugar); if (FoundItems.hasFound("sugar")) inv.setItem(0, sugar);
if (FoundItems.hasFound("feather", player)) inv.setItem(1, feather); if (FoundItems.hasFound("feather")) inv.setItem(1, feather);
return inv; return inv;
} }
@ -302,7 +301,7 @@ public class Inventorys {
lavaMeta.setDisplayName("§6Lava"); lavaMeta.setDisplayName("§6Lava");
lava.setItemMeta(lavaMeta); lava.setItemMeta(lavaMeta);
if (FoundItems.hasFound("hearts", player)) inv.setItem(0, hearts); if (FoundItems.hasFound("hearts")) inv.setItem(0, hearts);
//if(FoundItems.hasFound("lava", player)) inv.setItem(1, lava); //if(FoundItems.hasFound("lava", player)) inv.setItem(1, lava);
return inv; return inv;
@ -416,64 +415,64 @@ public class Inventorys {
ItemStack fastMenu = new ItemStack(Material.ANVIL); ItemStack fastMenu = new ItemStack(Material.ANVIL);
ItemMeta fastMenuMeta = fastMenu.getItemMeta(); ItemMeta fastMenuMeta = fastMenu.getItemMeta();
fastMenuMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FASTMENU()); fastMenuMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FASTMENU());
if (player.hasInventoryAnimation()) fastMenuMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasInventoryAnimationEnabled()) fastMenuMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasInventoryAnimation()) fastMenuMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasInventoryAnimationEnabled()) fastMenuMeta.setLore(on);
else fastMenuMeta.setLore(off); else fastMenuMeta.setLore(off);
fastMenu.setItemMeta(fastMenuMeta); fastMenu.setItemMeta(fastMenuMeta);
ItemStack teleport = new ItemStack(Material.ENDER_PEARL); ItemStack teleport = new ItemStack(Material.ENDER_PEARL);
ItemMeta teleportMeta = teleport.getItemMeta(); ItemMeta teleportMeta = teleport.getItemMeta();
teleportMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_SERVER_TELEPORT()); teleportMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_SERVER_TELEPORT());
if (player.hasTeleportAnimation()) teleportMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasTeleportAnimationEnabled()) teleportMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasTeleportAnimation()) teleportMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasTeleportAnimationEnabled()) teleportMeta.setLore(on);
else fastMenuMeta.setLore(off); else fastMenuMeta.setLore(off);
teleport.setItemMeta(teleportMeta); teleport.setItemMeta(teleportMeta);
ItemStack requestsParty = new ItemStack(Material.FIREWORK); ItemStack requestsParty = new ItemStack(Material.FIREWORK);
ItemMeta requestsPartyMeta = requestsParty.getItemMeta(); ItemMeta requestsPartyMeta = requestsParty.getItemMeta();
requestsPartyMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_PARTY_REQUESTS()); requestsPartyMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_PARTY_REQUESTS());
if (player.hasPartyRequests()) requestsPartyMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasPartyRequestsEnabled()) requestsPartyMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasPartyRequests()) requestsPartyMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasPartyRequestsEnabled()) requestsPartyMeta.setLore(on);
else requestsPartyMeta.setLore(off); else requestsPartyMeta.setLore(off);
requestsParty.setItemMeta(requestsPartyMeta); requestsParty.setItemMeta(requestsPartyMeta);
ItemStack requestsFriends = new ItemStack(Material.PUMPKIN); ItemStack requestsFriends = new ItemStack(Material.PUMPKIN);
ItemMeta requestsFriendsMeta = requestsFriends.getItemMeta(); ItemMeta requestsFriendsMeta = requestsFriends.getItemMeta();
requestsFriendsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FRIEND_REQUESTS()); requestsFriendsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_FRIEND_REQUESTS());
if (player.hasFriendRequests()) requestsFriendsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasFriendRequestsEnabled()) requestsFriendsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasFriendRequests()) requestsFriendsMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasFriendRequestsEnabled()) requestsFriendsMeta.setLore(on);
else requestsFriendsMeta.setLore(off); else requestsFriendsMeta.setLore(off);
requestsFriends.setItemMeta(requestsFriendsMeta); requestsFriends.setItemMeta(requestsFriendsMeta);
ItemStack friendJump = new ItemStack(Material.ELYTRA); ItemStack friendJump = new ItemStack(Material.ELYTRA);
ItemMeta friendJumpMeta = friendJump.getItemMeta(); ItemMeta friendJumpMeta = friendJump.getItemMeta();
friendJumpMeta.setDisplayName("Freunde springen nicht gerne"); friendJumpMeta.setDisplayName("Freunde springen nicht gerne");
if (player.hasFriendJump()) friendJumpMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasFriendJumpEnabled()) friendJumpMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasFriendJump()) friendJumpMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasFriendJumpEnabled()) friendJumpMeta.setLore(on);
else friendJumpMeta.setLore(off); else friendJumpMeta.setLore(off);
friendJump.setItemMeta(friendJumpMeta); friendJump.setItemMeta(friendJumpMeta);
ItemStack chat = new ItemStack(Material.SIGN); ItemStack chat = new ItemStack(Material.SIGN);
ItemMeta chatMeta = chat.getItemMeta(); ItemMeta chatMeta = chat.getItemMeta();
chatMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_CHATSOUNDS()); chatMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_CHATSOUNDS());
if (player.hasChatSounds()) chatMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasChatSoundsEnabled()) chatMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasChatSounds()) chatMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasChatSoundsEnabled()) chatMeta.setLore(on);
else chatMeta.setLore(off); else chatMeta.setLore(off);
chat.setItemMeta(chatMeta); chat.setItemMeta(chatMeta);
ItemStack effects = new ItemStack(Material.BLAZE_POWDER); ItemStack effects = new ItemStack(Material.BLAZE_POWDER);
ItemMeta effectsMeta = effects.getItemMeta(); ItemMeta effectsMeta = effects.getItemMeta();
effectsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_EFFECTS()); effectsMeta.setDisplayName(player.getMessages().LobbyItems_SETTINGS_EFFECTS());
if (player.hasEffects()) effectsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasEffectsEnabled()) effectsMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasEffects()) effectsMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasEffectsEnabled()) effectsMeta.setLore(on);
else effectsMeta.setLore(off); else effectsMeta.setLore(off);
effects.setItemMeta(effectsMeta); effects.setItemMeta(effectsMeta);
ItemStack storyMode = new ItemStack(Material.BOOK_AND_QUILL); ItemStack storyMode = new ItemStack(Material.BOOK_AND_QUILL);
ItemMeta storyModeMeta = storyMode.getItemMeta(); ItemMeta storyModeMeta = storyMode.getItemMeta();
storyModeMeta.setDisplayName("Geschichtsmodus ist auch noch da"); storyModeMeta.setDisplayName("Geschichtsmodus ist auch noch da");
if (player.hasStoryMode()) storyModeMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().hasStoryModeEnabled()) storyModeMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
if (player.hasStoryMode()) storyModeMeta.setLore(on); if (player.getDatabasePlayer().getSettings().hasStoryModeEnabled()) storyModeMeta.setLore(on);
else storyModeMeta.setLore(off); else storyModeMeta.setLore(off);
storyMode.setItemMeta(storyModeMeta); storyMode.setItemMeta(storyModeMeta);
@ -502,19 +501,19 @@ public class Inventorys {
ItemStack de = new ItemStack(Material.PAPER); ItemStack de = new ItemStack(Material.PAPER);
ItemMeta deMeta = de.getItemMeta(); ItemMeta deMeta = de.getItemMeta();
deMeta.setDisplayName("§eDeutsch"); deMeta.setDisplayName("§eDeutsch");
if (player.getLanguage().equals("DE")) deMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().getLanguage().equals("DE")) deMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
de.setItemMeta(deMeta); de.setItemMeta(deMeta);
ItemStack en = new ItemStack(Material.PAPER); ItemStack en = new ItemStack(Material.PAPER);
ItemMeta enMeta = en.getItemMeta(); ItemMeta enMeta = en.getItemMeta();
enMeta.setDisplayName("§eEnglish"); enMeta.setDisplayName("§eEnglish");
if (player.getLanguage().equals("EN")) enMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().getLanguage().equals("EN")) enMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
en.setItemMeta(enMeta); en.setItemMeta(enMeta);
ItemStack it = new ItemStack(Material.PAPER); ItemStack it = new ItemStack(Material.PAPER);
ItemMeta itMeta = it.getItemMeta(); ItemMeta itMeta = it.getItemMeta();
itMeta.setDisplayName("§eitaliano"); itMeta.setDisplayName("§eitaliano");
if (player.getLanguage().equals("IT")) itMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false); if (player.getDatabasePlayer().getSettings().getLanguage().equals("IT")) itMeta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
it.setItemMeta(itMeta); it.setItemMeta(itMeta);
inv.setItem(0, de); inv.setItem(0, de);
@ -567,7 +566,7 @@ public class Inventorys {
* @param forcedtime if true settings will be ignored * @param forcedtime if true settings will be ignored
*/ */
private void timeItem(Inventory inv, int slot, ItemStack item, Sound sound, long time, boolean menu, boolean forcedtime) { private void timeItem(Inventory inv, int slot, ItemStack item, Sound sound, long time, boolean menu, boolean forcedtime) {
if (!player.hasInventoryAnimation() || forcedtime) { if (!player.getDatabasePlayer().getSettings().hasInventoryAnimationEnabled() || forcedtime) {
addItem(inv, slot, item, null, menu); addItem(inv, slot, item, null, menu);
} else { } else {
Bukkit.getScheduler().scheduleAsyncDelayedTask(Lobby.getInstance(), () -> addItem(inv, slot, item, sound, menu), time); Bukkit.getScheduler().scheduleAsyncDelayedTask(Lobby.getInstance(), () -> addItem(inv, slot, item, sound, menu), time);

View File

@ -8,7 +8,7 @@ import java.util.HashMap;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class PetManager { public class PetManager {

View File

@ -3,7 +3,7 @@ package eu.univento.lobby.utils;
import eu.univento.core.api.pet.NMSHandler; import eu.univento.core.api.pet.NMSHandler;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftCreature; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftCreature;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -13,7 +13,7 @@ import java.util.Random;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class Pets { public class Pets {
@ -23,7 +23,7 @@ public class Pets {
void createPet(CustomPlayer p, EntityType type){ void createPet(CustomPlayer p, EntityType type){
Entity entity = NMSHandler.spawn(type, p.getLocation()); Entity entity = NMSHandler.spawn(type, p.getLocation());
assert entity != null; assert entity != null;
entity.setCustomName(p.getColor() + p.getDisplayName() + "'s"); entity.setCustomName(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + "'s");
entity.setCustomNameVisible(true); entity.setCustomNameVisible(true);
PetManager.getPets().put(p, entity); PetManager.getPets().put(p, entity);
} }

View File

@ -9,7 +9,7 @@ import org.bukkit.scoreboard.Scoreboard;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class Scoreboards { public class Scoreboards {

View File

@ -9,7 +9,7 @@ import org.bukkit.block.Sign;
/** /**
* @author joethei * @author joethei
* @version 0.2 * @version 1.0
*/ */
public class StatusSign { public class StatusSign {

View File

@ -5,7 +5,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -13,7 +12,7 @@ import java.util.ArrayList;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 1.0
*/ */
public class StatusSignManager { public class StatusSignManager {