This commit is contained in:
BuildTools 2018-01-15 12:32:49 +01:00
parent 491abc76e3
commit 12afb03856
6 changed files with 87 additions and 104 deletions

45
pom.xml
View File

@ -14,7 +14,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
@ -47,46 +46,20 @@
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version> <version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-async</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.36.Final</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency> <dependency>
<groupId>eu.univento</groupId> <groupId>eu.univento</groupId>
<artifactId>Core</artifactId> <artifactId>Core</artifactId>

View File

@ -1,46 +1,44 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.free4all; package eu.univento.free4all;
import eu.univento.core.Core; import eu.univento.commons.server.ServerType;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.free4all.commands.Setloc; import eu.univento.free4all.commands.Setloc;
import eu.univento.free4all.listeners.PlayerEvents; import eu.univento.free4all.listeners.PlayerEvents;
import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode;
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;
/** /**
* @author joethei * @author joethei
* @version 0.1 * @version 0.1
*/ */
public class Free4All extends JavaPlugin { public class Free4All extends JavaPlugin {
public static String prefix = " Free4All"; @Getter private static Free4All instance;
private static Free4All instance;
public static Free4All getInstance() {
return instance;
}
private static Logger logger;
public static void log(Level level, String msg) {
logger.log(level, msg);
}
@Override @Override
public void onEnable() { public void onEnable() {
Core.getInstance().registerPlugin(this);
instance = this; instance = this;
logger = Bukkit.getLogger();
PluginManager pm = Bukkit.getPluginManager(); PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerEvents(), this); pm.registerEvents(new PlayerEvents(), this);
new Setloc(this, "setloc", "sets locations"); new Setloc(this, "setloc", "sets locations");
ServerSettings.setServerType(ServerType.SECRET_GAME_FREE4ALL);
ServerSettings.setGameMode(GameMode.ADVENTURE);
ServerSettings.setGame(true);
ServerSettings.setGameState("Running");
} }
@Override @Override
public void onDisable() { public void onDisable() {
Core.getInstance().unregisterPlugin(this);
} }
} }

View File

@ -1,9 +1,13 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.free4all.commands; package eu.univento.free4all.commands;
import eu.univento.commons.player.Rank; import eu.univento.commons.player.rank.Rank;
import eu.univento.core.api.AutoCommand; import eu.univento.core.api.AutoCommand;
import eu.univento.core.api.Config; import eu.univento.core.api.Config;
import eu.univento.core.api.languages.Messages;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.free4all.Free4All; import eu.univento.free4all.Free4All;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -25,20 +29,19 @@ public class Setloc extends AutoCommand<Free4All>{
public boolean execute(CommandSender sender, String label, String[] args) { public boolean execute(CommandSender sender, String label, String[] args) {
if(sender instanceof Player) { if(sender instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer(sender.getName()); CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
Messages msgs = new Messages(p);
assert p != null; assert p != null;
if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) { if(p.getDatabasePlayer().isAllowed(Rank.SrDeveloper)) {
if(args.length == 1) { if(args.length == 1) {
Config.write("FFA.Spawn." + args[0], p.getLocation()); Config.write("FFA.Spawn." + args[0], p.getLocation());
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION()); p.sendMessage("§ePosition gesetzt");
}else { }else {
p.sendMessage(msgs.PREFIX() + msgs.Lobby_SET_LOCATION_USAGE()); p.sendMessage("§c/setloc <Zahl>");
} }
}else { }else {
p.sendMessage(msgs.NO_PERMS()); p.sendMessage("§cDazu hast du keine Rechte");
} }
}else { }else {
sender.sendMessage(Messages.Console.NOT_A_PLAYER); sender.sendMessage("");
} }
return false; return false;
} }

View File

@ -1,12 +1,16 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.free4all.listeners; package eu.univento.free4all.listeners;
import eu.univento.commons.player.currency.CurrencyType;
import eu.univento.core.Core; import eu.univento.core.Core;
import eu.univento.core.api.Hologram;
import eu.univento.core.api.effects.Effects;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.free4all.Free4All; import eu.univento.free4all.Free4All;
import eu.univento.free4all.utils.RespawnHelper; import eu.univento.free4all.utils.RespawnHelper;
import net.minecraft.server.v1_10_R1.EnumParticle; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -32,6 +36,7 @@ import java.util.Map;
*/ */
public class PlayerEvents implements Listener{ public class PlayerEvents implements Listener{
private Map<CustomPlayer, LinkedHashMap<CustomPlayer, BukkitTask>> lastDamage = new LinkedHashMap<>(); private Map<CustomPlayer, LinkedHashMap<CustomPlayer, BukkitTask>> lastDamage = new LinkedHashMap<>();
private Map<CustomPlayer, RespawnHelper> helpers = new LinkedHashMap<>();
@EventHandler @EventHandler
public void onPlayerDeath(PlayerDeathEvent e) { public void onPlayerDeath(PlayerDeathEvent e) {
@ -39,9 +44,7 @@ public class PlayerEvents implements Listener{
if(p.getKiller() != null) { if(p.getKiller() != null) {
CustomPlayer killer = CustomPlayer.getPlayer(p.getKiller()); CustomPlayer killer = CustomPlayer.getPlayer(p.getKiller());
e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §awurde von " + killer.getDatabasePlayer().getRank().getColor() + killer.getDisplayName() + " §agetötet."); e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §awurde von " + killer.getDatabasePlayer().getRank().getColor() + killer.getDisplayName() + " §agetötet.");
Hologram holo = new Hologram(new String[]{"§6+1 Coins"}, p.getEyeLocation()); killer.getDatabasePlayer().addCurrency(CurrencyType.Vents, 10);
killer.getDatabasePlayer().addCoins(1);
holo.showPlayerTemp(killer, 50);
for(CustomPlayer players : Core.getOnlinePlayers()) { for(CustomPlayer players : Core.getOnlinePlayers()) {
players.playEffect(killer.getLocation(), Effect.CHORUS_FLOWER_DEATH, 5, 2, 0.5F, 0.0F, 0.5F, 0.1F, 20, 5); players.playEffect(killer.getLocation(), Effect.CHORUS_FLOWER_DEATH, 5, 2, 0.5F, 0.0F, 0.5F, 0.1F, 20, 5);
} }
@ -49,8 +52,7 @@ public class PlayerEvents implements Listener{
for(Map.Entry<CustomPlayer, BukkitTask> entry : lastDamage.get(p).entrySet()) { for(Map.Entry<CustomPlayer, BukkitTask> entry : lastDamage.get(p).entrySet()) {
CustomPlayer killer = entry.getKey(); CustomPlayer killer = entry.getKey();
e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §a wurde von " + killer.getDatabasePlayer().getRank().getColor() + killer.getDisplayName() + " §cgetötet."); e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §a wurde von " + killer.getDatabasePlayer().getRank().getColor() + killer.getDisplayName() + " §cgetötet.");
Effects.playEffect(killer.getLocation(), EnumParticle.DRIP_LAVA, 10); killer.getDatabasePlayer().addCurrency(CurrencyType.Vents, 10);
killer.getDatabasePlayer().addCoins(1);
} }
}else { }else {
e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cist nun tot."); e.setDeathMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §cist nun tot.");
@ -60,10 +62,9 @@ public class PlayerEvents implements Listener{
@EventHandler @EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) { public void onPlayerRespawn(PlayerRespawnEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
RespawnHelper helper = new RespawnHelper(p); RespawnHelper helper = helpers.get(p);
e.setRespawnLocation(helper.getRespawnLocation()); e.setRespawnLocation(helper.getRespawnLocation());
helper.setRespawnInventory(); helper.setRespawnInventory();
Effects.playEffect(e.getRespawnLocation(), EnumParticle.HEART, 5);
} }
@EventHandler @EventHandler
@ -101,7 +102,9 @@ public class PlayerEvents implements Listener{
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent e) { public void onPlayerJoin(PlayerJoinEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer()); CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
e.setJoinMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §aist dem Spiel beigetreten."); helpers.put(p, new RespawnHelper(p));
e.setJoinMessage(null);
p.getDatabasePlayer().getRankAsync().whenComplete((rank, throwable) -> Bukkit.broadcastMessage(rank.getColor() + p.getDisplayName() + " §aist dem Spiel beigetreten."));
} }
@EventHandler @EventHandler
@ -113,13 +116,13 @@ public class PlayerEvents implements Listener{
if(lastDamage.containsKey(p)) { if(lastDamage.containsKey(p)) {
for(Map.Entry<CustomPlayer, BukkitTask> entry : lastDamage.get(p).entrySet()) { for(Map.Entry<CustomPlayer, BukkitTask> entry : lastDamage.get(p).entrySet()) {
CustomPlayer killer = entry.getKey(); CustomPlayer killer = entry.getKey();
killer.getDatabasePlayer().addCoins(1); killer.getDatabasePlayer().addCurrency(CurrencyType.Vents, 10);
Effects.playEffect(p.getLocation(), EnumParticle.FLAME, 10);
} }
e.setQuitMessage(Free4All.prefix + "§cDer Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §chat sich während eines Kampfes ausgeloggt."); e.setQuitMessage("§cDer Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §chat sich während eines Kampfes ausgeloggt.");
lastDamage.remove(p); lastDamage.remove(p);
} }
e.setQuitMessage(Free4All.prefix + "§cDer Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §c hat das Spiel verlassen."); e.setQuitMessage("§cDer Spieler " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §c hat das Spiel verlassen.");
} }
@EventHandler @EventHandler

View File

@ -1,8 +1,14 @@
/*
* Copyright (c) 2018 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.free4all.utils; package eu.univento.free4all.utils;
import eu.univento.core.api.Config; import eu.univento.core.api.Config;
import eu.univento.core.api.items.ItemBuilder; import eu.univento.core.api.items.ItemBuilder;
import eu.univento.core.api.player.CustomPlayer; import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.customitems.weapons.closecombat.ThiefsDagger;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -33,41 +39,41 @@ public class RespawnHelper {
inv.clear(); inv.clear();
if(inventory == 0) { if(inventory == 0) {
inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cEinfaches Schwert").make()); inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cEinfaches Schwert").build());
inv.setItem(1, new ItemBuilder(Material.BOW).name("§cEinfacher Bogen").make()); inv.setItem(1, new ItemBuilder(Material.BOW).name("§cEinfacher Bogen").build());
inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cEinfacher Pfeil").amount(10).make()); inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cEinfacher Pfeil").amount(10).build());
inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").make()); inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").build());
inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").make()); inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").build());
inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").enchantment(Enchantment.THORNS).make()); inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").enchantment(Enchantment.THORNS).build());
inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarker Helm").make()); inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarker Helm").build());
} }
if(inventory == 1) { if(inventory == 1) {
inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cFliegendes Schwert").enchantment(Enchantment.KNOCKBACK).make()); inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cFliegendes Schwert").enchantment(Enchantment.KNOCKBACK).build());
inv.setItem(1, new ItemBuilder(Material.BOW).name("§cFliegender Bogen").enchantment(Enchantment.ARROW_KNOCKBACK).make()); inv.setItem(1, new ItemBuilder(Material.BOW).name("§cFliegender Bogen").enchantment(Enchantment.ARROW_KNOCKBACK).build());
inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cFliegende Pfeil").amount(10).make()); inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cFliegende Pfeil").amount(10).build());
inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").make()); inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").build());
inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").make()); inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").build());
inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").make()); inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").build());
inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarke Helm").make()); inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarke Helm").build());
} }
if(inventory == 2) { if(inventory == 2) {
inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cFeuriges Schwert").enchantment(Enchantment.FIRE_ASPECT).make()); inv.setItem(0, new ItemBuilder(Material.WOOD_SWORD).name("§cFeuriges Schwert").enchantment(Enchantment.FIRE_ASPECT).build());
inv.setItem(1, new ItemBuilder(Material.BOW).name("§cFeuriger Bogen").enchantment(Enchantment.ARROW_FIRE).make()); inv.setItem(1, new ItemBuilder(Material.BOW).name("§cFeuriger Bogen").enchantment(Enchantment.ARROW_FIRE).build());
inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cFeuriger Pfeil").amount(10).make()); inv.setItem(8, new ItemBuilder(Material.ARROW).name("§cFeuriger Pfeil").amount(10).build());
inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").make()); inv.setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).name("§cStarke Schuhe").build());
inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").make()); inv.setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).name("§cStarke Hose").build());
inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").enchantment(Enchantment.PROTECTION_FIRE).make()); inv.setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).name("§cStarke Brustplatte").enchantment(Enchantment.PROTECTION_FIRE).build());
inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarke Helm").make()); inv.setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).name("§cStarke Helm").build());
} }
if(inventory == 3) { if(inventory == 3) {
inv.setItem(0, new ItemBuilder(Material.STONE_SWORD).name("§cEin Schwert").make()); new ThiefsDagger(player).addItem();
inv.setItem(1, new ItemBuilder(Material.BOW).name("§cEin Bogen").enchantment(Enchantment.ARROW_DAMAGE).make()); inv.setItem(1, new ItemBuilder(Material.BOW).name("§cEin Bogen").enchantment(Enchantment.ARROW_DAMAGE).build());
inv.setItem(8, new ItemBuilder(Material.ARROW).amount(20).make()); inv.setItem(8, new ItemBuilder(Material.ARROW).amount(20).build());
} }
if(inventory == 4) { if(inventory == 4) {
inv.setItem(0, new ItemBuilder(Material.STONE_SWORD).name("§cStarkes Schwert").enchantment(Enchantment.DAMAGE_ALL).make()); inv.setItem(0, new ItemBuilder(Material.STONE_SWORD).name("§cStarkes Schwert").enchantment(Enchantment.DAMAGE_ALL).build());
inv.setItem(1, new ItemBuilder(Material.BOW).name("§cUnendlicher Bogen").enchantment(Enchantment.ARROW_INFINITE).make()); inv.setItem(1, new ItemBuilder(Material.BOW).name("§cUnendlicher Bogen").enchantment(Enchantment.ARROW_INFINITE).build());
inv.setItem(8, new ItemBuilder(Material.SPECTRAL_ARROW).name("§cLeuchtender Pfeil").make()); inv.setItem(8, new ItemBuilder(Material.SPECTRAL_ARROW).name("§cLeuchtender Pfeil").build());
} }
} }
} }

View File

@ -1,5 +1,5 @@
name: Free4All name: Free4All
main: eu.univento.free4All.Free4All main: eu.univento.free4all.Free4All
author: joethei author: joethei
version: 0.1 version: 0.1
description: univento.eu Secret Minigame description: univento.eu Secret Minigame