From fb7fcccf24a024dc0c03b5df0406d9b4e9fa8b36 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sun, 8 Nov 2015 01:01:18 -0500 Subject: [PATCH] - Reverting back to banners --- .../game/games/common/CaptureTheFlag.java | 9 ++++++ .../game/games/common/ctf_data/Flag.java | 29 ++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index 88458ba5c..c837b5a06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -49,6 +49,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -768,4 +769,12 @@ public class CaptureTheFlag extends TeamGame } } } + + @EventHandler + public void debug(BlockPlaceEvent event) + { + Bukkit.broadcastMessage(event.getBlock().toString()); + Bukkit.broadcastMessage("SPLIT"); + Bukkit.broadcastMessage(event.getBlockReplacedState().getRawData() + ""); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java index e25eff6f8..95d129d34 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java @@ -20,13 +20,17 @@ import nautilus.game.arcade.game.games.common.CaptureTheFlag; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Banner; import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.block.CraftBanner; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -46,6 +50,7 @@ public class Flag private ChatColor _enemy; private ItemStack _representation; + private DyeColor _dyeData; private Player _holding = null; @@ -69,16 +74,19 @@ public class Flag ItemStack i; if (team.GetColor() == ChatColor.RED) { - i = new ItemStack(Material.REDSTONE_BLOCK); + i = new ItemStack(Material.BANNER); + _dyeData = DyeColor.RED; _enemy = ChatColor.BLUE; } else { - i = new ItemStack(Material.LAPIS_BLOCK); + i = new ItemStack(Material.BANNER); + _dyeData = DyeColor.BLUE; _enemy = ChatColor.RED; } - ItemMeta im = i.getItemMeta(); + BannerMeta im = (BannerMeta) i.getItemMeta(); + im.setBaseColor(_dyeData); im.setDisplayName(_displayName); i.setItemMeta(im); @@ -226,8 +234,7 @@ public class Flag { _flagBlocks = new Block[] { - loc.getBlock(), - loc.clone().add(0, 1, 0).getBlock() + loc.getBlock() }; for (Block block : _flagBlocks) @@ -237,19 +244,21 @@ public class Flag _priorBlocks = new Material[] { - loc.getBlock().getType(), - loc.clone().add(0, 1, 0).getBlock().getType() + loc.getBlock().getType() }; _priorData = new Byte[] { - loc.getBlock().getData(), - loc.clone().add(0, 1, 0).getBlock().getData() + loc.getBlock().getData() }; for (Block block : _flagBlocks) { - block.setType(_representation.getType()); + block.setType(Material.STANDING_BANNER); + block.setData((byte) 0); + //Banner banner = (Banner) block.getState(); + //banner.setBaseColor(_dyeData); + //banner.update(); } if (!_moved)