+ 1.11 Update

+ testing ArmorStand modeling
master
Johannes Theiner 6 years ago
parent 79d0dfd757
commit 50da4db042

@ -48,36 +48,49 @@
</plugins>
</build>
<!--TODO: add maven repo for univento code-->
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<id>univentoEU</id>
<url>http://dev.joethei.de:8081/repository/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Core</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Commons</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

@ -1,8 +1,8 @@
package eu.univento.trashgames;
import eu.univento.commons.server.ServerType;
import eu.univento.core.Core;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.core.api.server.ServerType;
import eu.univento.trashgames.commands.Setloc;
import eu.univento.trashgames.game.GameState;
import eu.univento.trashgames.listeners.JoinQuit;
@ -42,7 +42,7 @@ public class TrashGames extends JavaPlugin {
Core.getInstance().registerPlugin(this);
ServerSettings.setGame(true);
ServerSettings.setServerType(ServerType.GAME_TRASHGAMES);
ServerSettings.setServerType(ServerType.SECRET_GAME_TRASHGAMES);
ServerSettings.setGameMode(GameMode.ADVENTURE);
PluginManager pm = Bukkit.getPluginManager();

@ -0,0 +1,81 @@
package eu.univento.trashgames.game;
import eu.univento.core.api.items.ItemBuilder;
import eu.univento.trashgames.TrashGames;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.EulerAngle;
import java.util.HashMap;
/**
* @author joethei
* @version 0.1
*/
public class Duck {
private HashMap<String, ArmorStand> parts = new HashMap<>();
public Duck(Location location) {
ArmorStand body = getNewArmorStand(location, false, true);
ArmorStand head = getNewArmorStand(location.clone().add(0, 0.2, 0.2), false, true);
ArmorStand leftFeather = getNewArmorStand(location.clone().add(0.43, 0.2, 0.5), false, true);
ArmorStand rightFeather = getNewArmorStand(location.clone().add(-0.04, 0.2, 0.5), false, true);
ArmorStand leftFeet = getNewArmorStand(location.clone().add(0.4, 0.15, 0.2), false, true);
ArmorStand rightFeet = getNewArmorStand(location.clone().add(0, 0.15, 0.2), false, true);
body.setHelmet(new ItemStack(Material.GOLD_BLOCK));
head.setHelmet(new ItemBuilder(Material.SKULL).data(3).skullOwner("duck").make());
leftFeather.setHeadPose(new EulerAngle(4.7123889804, 0, 1.5707963268));
leftFeather.setHelmet(new ItemStack(Material.INK_SACK, 1, (short) 11));
rightFeather.setHeadPose(new EulerAngle(4.7123889804, 0, 1.5707963268));
rightFeather.setHelmet(new ItemStack(Material.INK_SACK, 1, (short) 11));
leftFeet.setRightArmPose(new EulerAngle(0.2617993878, 0, 0));
leftFeet.setItemInHand(new ItemStack(Material.RED_SANDSTONE));
rightFeet.setRightArmPose(new EulerAngle(0.2617993878, 0, 0));
rightFeet.setItemInHand(new ItemStack(Material.RED_SANDSTONE));
parts.put("body", body);
parts.put("head", head);
parts.put("leftfeather", leftFeather);
parts.put("rightfeather", rightFeather);
parts.put("leftfeet", leftFeet);
parts.put("rightfeet", rightFeet);
}
private ArmorStand getNewArmorStand(Location location, boolean visible, boolean mini) {
ArmorStand as = location.getWorld().spawn(location, ArmorStand.class);
as.setBasePlate(false);
as.setArms(true);
as.setVisible(visible);
as.setInvulnerable(true);
as.setCanPickupItems(false);
as.setGravity(false);
as.setSmall(mini);
return as;
}
public void fly() {
new BukkitRunnable() {
public void run() {
for(String part : parts.keySet()) {
parts.get(part).teleport(parts.get(part).getLocation().add(0,0.1,0));
}
}
}.runTaskTimer(TrashGames.getInstance(), 0L, 1L);
}
}

@ -7,6 +7,7 @@ import eu.univento.core.api.player.SpectateManager;
import eu.univento.core.api.player.Spectator;
import eu.univento.trashgames.TrashGames;
import eu.univento.trashgames.game.GameState;
import org.bukkit.Particle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
@ -29,6 +30,7 @@ public class JoinQuit implements Listener{
//new GameCountdown();
}
}
p.spawnParticle(Particle.TOTEM, p.getLocation(), 1);
}
@EventHandler
@ -37,6 +39,7 @@ public class JoinQuit implements Listener{
if(PlayerManager.contains(p)) {
PlayerManager.remove(p);
if(TrashGames.getState() == GameState.GAME) {
p.damage(99999D);
e.setQuitMessage(p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " hat uns verlassen");
PlayerManager.getPlayers().get(0).getDatabasePlayer().addCoins(50);
Utils.restart();

@ -6,20 +6,17 @@ import eu.univento.core.api.player.CustomPlayer;
import eu.univento.trashgames.TrashGames;
import eu.univento.trashgames.game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.entity.SpectralArrow;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import java.util.Random;
/**
* @author joethei
* @version 0.1
@ -32,7 +29,7 @@ public class PlayerEvents implements Listener{
if(PlayerManager.contains(p)) {
PlayerManager.remove(p);
TrashGames.setState(GameState.RESTART);
Bukkit.broadcastMessage(PlayerManager.getPlayers().get(0) + " hat gewonnen");
Bukkit.broadcastMessage(PlayerManager.getPlayers().get(0).getDisplayName() + " hat gewonnen");
PlayerManager.getPlayers().get(0).getDatabasePlayer().addCoins(50);
}
}
@ -52,17 +49,31 @@ public class PlayerEvents implements Listener{
}
}
@EventHandler
public void onShoot(ProjectileLaunchEvent e) {
Projectile projectile = e.getEntity();
projectile.setGravity(false);
projectile.setCustomName("Hallo du");
projectile.setCustomNameVisible(true);
}
@EventHandler
public void onDamageByEntity(EntityDamageByEntityEvent e) {
if(e.getEntity() instanceof Player) {
CustomPlayer p = CustomPlayer.getPlayer((Player) e.getEntity());
if(e.getDamager() instanceof Player) {
CustomPlayer t = CustomPlayer.getPlayer((Player) e.getDamager());
if(e.getDamager().getLocation().getY() - t.getLocation().getY() > 1.35D) {
e.setDamage(e.getDamage() * 5D);
p.sendMessage("§4Head§6Shoot");
}
p.sendMessage("Du hast was abgekriegt von " + t.getDatabasePlayer().getRank().getColor() + t.getDisplayName());
p.setArrowsInBody(new Random().nextInt(50));
}
if(e.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow) e.getDamager();
CustomPlayer shooter = CustomPlayer.getPlayer((Player) arrow.getShooter());
arrow.setBounce(true);
p.sendMessage("Der Pfeil kam von " + shooter.getDatabasePlayer().getRank().getColor() + shooter.getDisplayName());
}
if(e.getDamager() instanceof SpectralArrow) {
@ -78,14 +89,4 @@ public class PlayerEvents implements Listener{
}
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(e.getClickedBlock() == null) return;
if(e.getClickedBlock().getType() == Material.CHEST) {
e.setCancelled(true);
p.playEffect(e.getClickedBlock().getLocation(), Effect.CLOUD, 200);
}
}
}

@ -6,9 +6,10 @@ import eu.univento.core.api.Utils;
import eu.univento.core.api.blocks.banners.BannerString;
import eu.univento.core.api.blocks.banners.FloatingText;
import eu.univento.core.api.game.PlayerManager;
import eu.univento.core.api.map.Cuboid;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.schematic.Cuboid;
import eu.univento.trashgames.TrashGames;
import eu.univento.trashgames.game.Duck;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -17,8 +18,6 @@ import org.bukkit.block.Banner;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
@ -33,7 +32,7 @@ import java.util.stream.Collectors;
*/
public class GameCountdown extends BukkitRunnable {
private int time = 3611;
private int time = 611;
private Cuboid blocks;
public GameCountdown() {
@ -42,25 +41,21 @@ public class GameCountdown extends BukkitRunnable {
@Override
public void run() {
Core.getCommons().getLoggingHandler().getTrashGames().info("GameCountdown running: " + time);
time--;
if(time == 3610) {
Bukkit.broadcastMessage("Teleport");
if(time == 610) {
blocks = new Cuboid(Config.readLocation("TrashGames.Locs.Corner.1"), Config.readLocation("TrashGames.Locs.Corner.2"));
Bukkit.broadcastMessage("Blocks: " + blocks.getBlocks().size());
int i = 0;
for(CustomPlayer player : PlayerManager.getPlayers()) {
i++;
player.teleport(Config.readLocation("TrashGames.Locs.Spawn." + i));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10, 10000, false));
}
ArrayList<Banner> wallBanners = blocks.getBlocks().stream().filter(block -> block.getType() == Material.WALL_BANNER).map(block -> (Banner) block.getState()).collect(Collectors.toCollection(ArrayList::new));
ArrayList<Banner> banners = blocks.getBlocks().stream().filter(block -> block.getType() == Material.STANDING_BANNER).map(block -> (Banner) block.getState()).collect(Collectors.toCollection(ArrayList::new));
BannerString string = new BannerString(wallBanners);
FloatingText text = new FloatingText("§FeuniventoEU", 4);
FloatingText text = new FloatingText("univentoEU", 4);
new BukkitRunnable() {
@Override
public void run() {
@ -69,7 +64,7 @@ public class GameCountdown extends BukkitRunnable {
}.runTaskTimer(TrashGames.getInstance(), 2, 3);
BannerString string1 = new BannerString(banners);
FloatingText text1 = new FloatingText("§F3TrashGames", 4);
FloatingText text1 = new FloatingText("TrashGames", 4);
new BukkitRunnable() {
@Override
public void run() {
@ -78,12 +73,11 @@ public class GameCountdown extends BukkitRunnable {
}.runTaskTimer(TrashGames.getInstance(), 2, 3);
}
if (time == 3600) {
if (time == 600) {
for(CustomPlayer player : PlayerManager.getPlayers()) {
dropItems(player.getLocation().add(0.0D, 3.0D, 0.0D));
player.sendTitle(1, 5, 1, "§5Los", "§egehts");
dropItems(player.getLocation().add(0.0D, 2.0D, 0.0D));
player.sendTitle("§5Los", "§egehts");
}
Bukkit.broadcastMessage("Jetzt aber schnell");
new BukkitRunnable() {
@Override
public void run() {
@ -92,8 +86,11 @@ public class GameCountdown extends BukkitRunnable {
}.runTaskLater(TrashGames.getInstance(), 10 * 20L);
}
if (time == 3400) {
Bukkit.broadcastMessage("Die Hälfte ist geschaft");
if (time == 300) {
Bukkit.broadcastMessage("§aDie Hälfte ist geschaft");
new Duck(PlayerManager.getPlayers().get(0).getLocation()).fly();
blocks.getBlocks().stream().filter(block -> block.getType() == Material.CHEST).forEach(block -> {
for (CustomPlayer players : PlayerManager.getPlayers()) {
players.changeChestState(block.getLocation(), true);
@ -102,12 +99,11 @@ public class GameCountdown extends BukkitRunnable {
new BukkitRunnable() {
@Override
public void run() {
List<Material> materials = Arrays.asList(Material.DIAMOND_SWORD, Material.IRON_SWORD, Material.DIAMOND_AXE, Material.DIAMOND_CHESTPLATE);
List<Material> materials = Arrays.asList(Material.DIAMOND_SWORD, Material.IRON_SWORD, Material.DIAMOND_AXE, Material.DIAMOND_CHESTPLATE,
Material.DEAD_BUSH, Material.DEAD_BUSH, Material.DEAD_BUSH, Material.DEAD_BUSH, Material.DEAD_BUSH, Material.DEAD_BUSH, Material.DEAD_BUSH);
int random = new Random().nextInt(materials.size());
Item item = block.getWorld().dropItem(block.getLocation().add(0.0D, 1.0D, 0.0D), new ItemStack(materials.get(random)));
item.setPickupDelay(5);
item.setGlowing(true);
item.setVelocity(item.getLocation().getDirection().multiply(0D).setY(0.5D));
for (CustomPlayer player : PlayerManager.getPlayers())
player.playSound(block.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1.0F, 1.0F);
}
@ -127,7 +123,11 @@ public class GameCountdown extends BukkitRunnable {
}
if (time == 0) {
Bukkit.broadcastMessage("Die Zeit ist um");
for(CustomPlayer player : PlayerManager.getPlayers()) {
player.setVelocity(player.getLocation().getDirection().multiply(0.0D).setY(10.0D));
player.setGliding(true);
player.setInvulnerable(true);
}
this.cancel();
Utils.restart();
for(CustomPlayer players : Core.getOnlinePlayers())
@ -140,20 +140,17 @@ public class GameCountdown extends BukkitRunnable {
}
}.runTaskLater(TrashGames.getInstance(), 5 * 20L);
}
for (CustomPlayer player : Core.getOnlinePlayers()) {
for (CustomPlayer player : Core.getOnlinePlayers())
player.setLevel(time);
}
}
private void dropItems(Location loc) {
List<ItemStack> items = Arrays.asList(new ItemStack(Material.APPLE, 64), new ItemStack(Material.WORKBENCH),
new ItemStack(Material.COBBLESTONE, 2), new ItemStack(Material.STICK, 4), new ItemStack(Material.ROTTEN_FLESH, 64),
new ItemStack(Material.APPLE, 20));
new ItemStack(Material.APPLE, 20), new ItemStack(Material.BOW), new ItemStack(Material.ARROW, 20));
for (ItemStack itemStack : items) {
Item item = loc.getWorld().dropItemNaturally(loc, itemStack);
item.setPickupDelay(3);
item.setGlowing(true);
item.setVelocity(item.getLocation().getDirection().multiply(0D).setY(0.5D));
for (CustomPlayer player : PlayerManager.getPlayers())
player.playSound(item.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1.0F, 1.0F);
}

Loading…
Cancel
Save