From 79f210e2422768c442957a954a6ff62684e18a98 Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Wed, 27 Apr 2016 00:01:30 +0200 Subject: [PATCH] Schematic and WinEffect update +Added better schematic support +Fixed schematics not sending block updates to nearby players +Added win room schematics *Tweaked some of the win rooms +Added sounds to the Lava Trap win effect. --- .../common/block/MultiBlockUpdaterAgent.java | 110 ++++++++++++++++++ .../common/block/schematic/Schematic.java | 6 + .../mineplex/core/common/util/UtilBlock.java | 42 ++++++- .../wineffect/WinEffectBabyChicken.java | 6 +- .../gadgets/wineffect/WinEffectFireworks.java | 2 +- .../gadgets/wineffect/WinEffectFlames.java | 6 +- .../gadgets/wineffect/WinEffectLavaTrap.java | 47 ++++++-- .../wineffect/WinEffectLightningStrike.java | 2 +- .../wineffect/WinEffectMrPunchMan.java | 2 +- .../gadgets/wineffect/WinEffectPodium.java | 18 +-- .../WinEffectRiseOfTheElderGuardian.java | 4 +- .../wineffect/WinEffectSnowTrails.java | 6 +- .../core/gadget/types/WinEffectGadget.java | 50 ++++---- .../arcade/wineffect/WinEffectManager.java | 2 +- 14 files changed, 248 insertions(+), 55 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/MultiBlockUpdaterAgent.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/MultiBlockUpdaterAgent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/MultiBlockUpdaterAgent.java new file mode 100644 index 000000000..79547d745 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/MultiBlockUpdaterAgent.java @@ -0,0 +1,110 @@ +package mineplex.core.common.block; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Bukkit; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; +import org.bukkit.entity.Player; +import org.bukkit.util.BlockVector; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; +import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange; +import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange.MultiBlockChangeInfo; + +public class MultiBlockUpdaterAgent +{ + + private Map> _chunks = new HashMap>(); + + public MultiBlockUpdaterAgent() + { + } + + public void addBlock(Block block) + { + Chunk c = ((CraftChunk)block.getChunk()).getHandle(); + List list = _chunks.get(c); + + if(list == null) + { + list = new ArrayList(); + _chunks.put(c, list); + } + + if(list.size() >= 64) return; + + list.add(block.getLocation().toVector().toBlockVector()); + } + + public void send() + { + send(UtilServer.getPlayersCollection()); + } + + public void reset() + { + _chunks.clear(); + } + + public void send(Collection players) + { + for(Player p : players) + { + for(Chunk c : _chunks.keySet()) + { + if(!p.getWorld().equals(c.bukkitChunk.getWorld())) continue; + + int x = p.getLocation().getChunk().getX(); + int z = p.getLocation().getChunk().getZ(); + + int chunkDist = Math.max(Math.abs(c.locX-x), Math.abs(c.locZ-z)); + + if(chunkDist > Bukkit.getViewDistance()) continue; + + sendPacket(c, players); + } + } + } + + private void sendPacket(Chunk c, Collection players) + { + List list = _chunks.get(c); + + if(list == null) return; + + if(list.size() >= 64) + { + for(Player p : players) + { + MapUtil.SendChunkForPlayer(c, p); + } + } + else + { + PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(); + packet.a = new ChunkCoordIntPair(c.locX, c.locZ); + packet.b = new MultiBlockChangeInfo[list.size()]; + for(int i = 0; i < list.size(); i++) + { + BlockVector bv = list.get(i); + short xyz = (short)((bv.getBlockX() & 0xF) << 12 | (bv.getBlockZ() & 0xF) << 8 | bv.getBlockY()); + packet.b[i] = packet.new MultiBlockChangeInfo(xyz, c); + } + + for(Player p : players) + { + UtilPlayer.sendPacket(p, packet); + } + } + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java index 2d597029e..4545425ec 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java @@ -5,6 +5,8 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.util.Vector; +import com.mysql.jdbc.Util; + import mineplex.core.common.block.DataLocationMap; import mineplex.core.common.util.UtilBlock; @@ -53,6 +55,8 @@ public class Schematic int startX = originLocation.getBlockX(); int startY = originLocation.getBlockY(); int startZ = originLocation.getBlockZ(); + + UtilBlock.startQuickRecording(); for (int x = 0; x < _width; x++) { @@ -108,6 +112,8 @@ public class Schematic } } } + + UtilBlock.stopQuickRecording(); return locationMap; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 67ff2737f..c693d36d6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -3,7 +3,6 @@ package mineplex.core.common.util; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Queue; import org.bukkit.Location; import org.bukkit.Material; @@ -28,6 +27,7 @@ import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.material.Bed; +import mineplex.core.common.block.MultiBlockUpdaterAgent; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.IBlockData; @@ -91,6 +91,8 @@ public class UtilBlock */ public static HashSet horizontals = new HashSet<>(); + private static MultiBlockUpdaterAgent _quickChangeRecorder; + static { @@ -1512,6 +1514,39 @@ public class UtilBlock return state.update(false, false); } + /** + * See {@link #setQuick(World, int, int, int, int, byte)} + */ + public static void startQuickRecording() + { + if(_quickChangeRecorder != null) + { + _quickChangeRecorder.send(); + _quickChangeRecorder.reset(); + } + else + { + _quickChangeRecorder = new MultiBlockUpdaterAgent(); + } + } + + /** + * See {@link #setQuick(World, int, int, int, int, byte)} + */ + public static void stopQuickRecording() + { + if(_quickChangeRecorder == null) return; + _quickChangeRecorder.send(); + _quickChangeRecorder.reset(); + _quickChangeRecorder = null; + + } + + /** + * This doesn't send the block changes to the client. If you want to change lots of blocks and then send it to the player + * then do startQuickRecording() first. Change all the blocks you want. Then to send it do + * stopQuickRecording(). This will automatically send all the block changes to all relevant players. + */ public static void setQuick(World world, int x, int y, int z, int type, byte data) { int cx = x >> 4; @@ -1525,6 +1560,11 @@ public class UtilBlock BlockPosition pos = new BlockPosition(x, y, z); IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type).fromLegacyData(data); chunk.a(pos, ibd); + + if(_quickChangeRecorder != null) + { + _quickChangeRecorder.addBlock(world.getBlockAt(x, y, z)); + } } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java index f0e9472e4..5ed096c80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java @@ -53,7 +53,7 @@ public class WinEffectBabyChicken extends WinEffectGadget @Override public void play() { - _chicken = spawnChicken(player, _baseLocation); + _chicken = spawnChicken(_player, _baseLocation); UtilEnt.addGoalSelector(_chicken, 0, new PathfinderRandomRun(((CraftChicken)_chicken).getHandle(), getBaseLocation(), 4, 2.8)); @@ -103,7 +103,7 @@ public class WinEffectBabyChicken extends WinEffectGadget { // Flap Chicken Wings PacketPlayOutRelEntityMove packet = new PacketPlayOutRelEntityMove(_chicken.getEntityId(), (byte) 0, (byte) 0, (byte) 0, false); - UtilPlayer.getNearby(_chicken.getLocation(), 64).stream().forEach(p -> UtilPlayer.sendPacket(player, packet)); + UtilPlayer.getNearby(_chicken.getLocation(), 64).stream().forEach(p -> UtilPlayer.sendPacket(_player, packet)); ((CraftChicken) _chicken).getHandle().lastDamager = ((CraftChicken) _chicken).getHandle(); @@ -138,7 +138,7 @@ public class WinEffectBabyChicken extends WinEffectGadget @Override public void finish() { - UtilPlayer.showForAll(player); + UtilPlayer.showForAll(_player); _text.keySet().forEach(h -> h.stop()); _text.clear(); _chicken.remove(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFireworks.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFireworks.java index e983268f2..8effadf14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFireworks.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFireworks.java @@ -42,7 +42,7 @@ public class WinEffectFireworks extends WinEffectGadget start.add(0, 0, r); start.setDirection(new Vector(1, 0, 0)); - _npc = getNPC(player, start); + _npc = getNPC(_player, start); AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.GetEntity().getBukkitEntity()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFlames.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFlames.java index 055feb121..93ae6fe8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFlames.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectFlames.java @@ -28,6 +28,8 @@ public class WinEffectFlames extends WinEffectGadget { super(manager, "Flames", UtilText.splitLineToArray(C.cGray + "Oh shit, my feets are on fire!", LineFormat.LORE), 1, Material.BLAZE_POWDER, (byte) 0); + + _schematicName = "FlamesPodium"; } @Override @@ -36,13 +38,13 @@ public class WinEffectFlames extends WinEffectGadget int i = 0; int points = 12; - double r = 3; + double r = 4; Location start = getBaseLocation(); start.add(0, 0, r); start.setDirection(new Vector(1, 0, 0)); - _npc = getNPC(player, start); + _npc = getNPC(_player, start); AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.GetEntity().getBukkitEntity()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java index 4be1798be..49c0a02c3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java @@ -46,7 +46,9 @@ public class WinEffectLavaTrap extends WinEffectGadget public WinEffectLavaTrap(GadgetManager manager) { super(manager, "Lava Trap", UtilText.splitLineToArray(C.cGray + "FINALLY! A movie where the villain's master plan succeeds!", LineFormat.LORE), - 1, Material.LAVA_BUCKET, (byte) 0); + 1, Material.LAVA_BUCKET, (byte) 0); + + _schematicName = "LavaTrapPodium"; } @Override @@ -57,11 +59,11 @@ public class WinEffectLavaTrap extends WinEffectGadget _lever = getBaseLocation().add(_baseLocation.getDirection().normalize()).getBlock(); _lever.setTypeIdAndData(Material.LEVER.getId(), (byte) 5, false); - playerNPC = getNPC(player, getBaseLocation()); + playerNPC = getNPC(_player, getBaseLocation()); { Vector forward = getBaseLocation().getDirection().normalize().multiply(1.3); - Vector right = UtilAlg.getRight(forward.clone()).multiply(2); + Vector right = UtilAlg.getRight(forward.clone()).multiply(1); int maxPerRow = 6; @@ -71,7 +73,7 @@ public class WinEffectLavaTrap extends WinEffectGadget int inRow = index%maxPerRow; int rowSize = Math.min(nonTeam.size()-(row*maxPerRow), maxPerRow); - Vector f = forward.clone().multiply(3 + row); + Vector f = forward.clone().multiply(2.5 + row); Vector r = right.clone().multiply((-rowSize/2.0) + 0.5); r.add(right.clone().multiply(inRow)); @@ -94,7 +96,7 @@ public class WinEffectLavaTrap extends WinEffectGadget Location loc = getBaseLocation().add(f).add(r); loc.setDirection(getBaseLocation().subtract(loc).toVector()); - getNPC(team.get(index), loc); + ((ArmorStand)getNPC(nonTeam.get(index), loc).GetEntity().getBukkitEntity()).setGravity(true); } } @@ -128,23 +130,40 @@ public class WinEffectLavaTrap extends WinEffectGadget _lever.getWorld().playSound(_lever.getLocation(), Sound.CLICK, 0.3f, 0.6f); } + if(_tick == 20*3 + 1) + { + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.IRONGOLEM_HIT, 0.2f, 1.6f); + } + + if(_tick == 20*3 + 10) { - UtilBlock.getInBoundingBox(a, b.clone().add(0, -1, 0), false).forEach(block -> - { - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); - - block.setType(Material.AIR); - }); +// UtilBlock.getInBoundingBox(a, b.clone().add(0, -1, 0), false).forEach(block -> +// { +// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); +// +// block.setType(Material.AIR); +// }); + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.IRONGOLEM_DEATH, 0.2f, 0.5f); + + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.DIG_STONE, 1, 1f); + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.DIG_STONE, 1, 1.2f); + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.DIG_STONE, 1, 1.8f); + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.DIG_STONE, 1, 1.5f); + getBaseLocation().getWorld().playSound(getBaseLocation(), Sound.DIG_STONE, 1, 0.5f); + + pasteScematic("LavaTrapPodium-part-2"); } } @EventHandler public void onPhysics(BlockFromToEvent event) { + /* if(!isRunning()) return; if(_webs.contains(event.getToBlock())) event.setCancelled(true); + */ } @Override @@ -160,6 +179,8 @@ public class WinEffectLavaTrap extends WinEffectGadget public void buildWinnerRoom(Location loc) { + super.buildWinnerRoom(loc); + /* loc = loc.getBlock().getLocation(); Location floorCenter = loc.clone().add(0, -1, 0); Location floorA = floorCenter.clone().subtract(8, 0, 8); @@ -216,12 +237,14 @@ public class WinEffectLavaTrap extends WinEffectGadget ((CraftChunk)loc.getWorld().getChunkAt(x, z)).getHandle().initLighting(); } } + */ } @Override public void teleport(Player player, List team, List other, Location loc) { - loc = getBaseLocation().add(loc.getDirection().normalize().multiply(4)).add(-0.5, 3, -0.5); + Vector dir = loc.getDirection().normalize(); + loc = getBaseLocation().add(UtilAlg.getRight(dir).multiply(5)).add(0, 2, 0).subtract(dir); super.teleport(player, team, other, loc); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLightningStrike.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLightningStrike.java index 96fb2993b..86c4ec6bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLightningStrike.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLightningStrike.java @@ -28,7 +28,7 @@ public class WinEffectLightningStrike extends WinEffectGadget @Override public void play() { - final DisguisePlayer player = getNPC(this.player, getBaseLocation()); + final DisguisePlayer player = getNPC(this._player, getBaseLocation()); Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectMrPunchMan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectMrPunchMan.java index 9bf5f7844..54ae47a19 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectMrPunchMan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectMrPunchMan.java @@ -40,7 +40,7 @@ public class WinEffectMrPunchMan extends WinEffectGadget @Override public void play() { - _npc = getNPC(player, getBaseLocation()); + _npc = getNPC(_player, getBaseLocation()); List players = new ArrayList<>(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java index e2d49ccc2..b00afab5c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java @@ -35,19 +35,19 @@ public class WinEffectPodium extends WinEffectGadget @Override public void play() { - _baseLocation = _baseLocation.getBlock().getLocation(); +// _baseLocation = _baseLocation.getBlock().getLocation(); - Location a = getBaseLocation().add(1, 0, 1); - Location b = getBaseLocation().add(-2, 0, -2); +// Location a = getBaseLocation().add(1, 0, 1); +// Location b = getBaseLocation().add(-2, 0, -2); - UtilBlock.getInBoundingBox(a, b, false).forEach(block -> block.setTypeIdAndData(Material.STAINED_CLAY.getId(), (byte) 4, false)); +// UtilBlock.getInBoundingBox(a, b, false).forEach(block -> block.setTypeIdAndData(Material.STAINED_CLAY.getId(), (byte) 4, false)); - a = getBaseLocation().add(0, 1, 0); - b = getBaseLocation().add(-1, 0, -1); +// a = getBaseLocation().add(0, 1, 0); +// b = getBaseLocation().add(-1, 0, -1); +// +// UtilBlock.getInBoundingBox(a, b, false).forEach(block -> block.setTypeIdAndData(Material.STAINED_CLAY.getId(), (byte) 5, false)); - UtilBlock.getInBoundingBox(a, b, false).forEach(block -> block.setTypeIdAndData(Material.STAINED_CLAY.getId(), (byte) 5, false)); - - _npc = getNPC(this.player, getBaseLocation().add(0, 2, 0)); + _npc = getNPC(this._player, getBaseLocation()); AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.GetEntity().getBukkitEntity()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java index 5f3e4f545..5c5e923f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectRiseOfTheElderGuardian.java @@ -51,8 +51,8 @@ public class WinEffectRiseOfTheElderGuardian extends WinEffectGadget UtilEnt.setAI(_guardian, false); Location loc = getBaseLocation(); - loc.setDirection(player.getLocation().subtract(loc).toVector()); - _npc = getNPC(player, loc); + loc.setDirection(_player.getLocation().subtract(loc).toVector()); + _npc = getNPC(_player, loc); _npc.setHeldItem(new ItemStack(Material.DIAMOND_SWORD)); _npc.sendPacket(_npc.getEquipmentPackets().toArray(new Packet[5])); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectSnowTrails.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectSnowTrails.java index 2069bbad7..6b9ddf581 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectSnowTrails.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectSnowTrails.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.wineffect; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.event.EventHandler; @@ -28,12 +29,13 @@ public class WinEffectSnowTrails extends WinEffectGadget { super(manager, "Snow Trail", UtilText.splitLinesToArray(new String[] {C.cGray + "Oh the weather outside is frightful.", C.cGray + "But the fire is so delightful.", C.cGray + "And since we've no place to go.", C.cGray + "Let It Snow! Let It Snow! Let It Snow!"}, LineFormat.LORE), 1, Material.SNOW_BALL, (byte) 0); + + _schematicName = "SnowPodium"; } @Override public void play() { - _loc = getBaseLocation().add(0, 6, 0); int i = 0; @@ -44,7 +46,7 @@ public class WinEffectSnowTrails extends WinEffectGadget start.add(0, 0, r); start.setDirection(new Vector(1, 0, 0)); - _npc = getNPC(player, start); + _npc = getNPC(_player, start); AnimatorEntity animator = new AnimatorEntity(Manager.getPlugin(), _npc.GetEntity().getBukkitEntity()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 3fb335901..d54c7b6c3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -17,6 +17,7 @@ import org.bukkit.potion.PotionEffectType; import com.mojang.authlib.GameProfile; +import mineplex.core.common.block.schematic.Schematic; import mineplex.core.common.block.schematic.UtilSchematic; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -27,11 +28,13 @@ import mineplex.core.gadget.GadgetManager; public abstract class WinEffectGadget extends Gadget { - protected Player player; - protected long start; - protected long finish; + protected Player _player; + protected long _start; + protected long _finish; protected Location _baseLocation; + protected String _schematicName = "WinRoomPodium"; + /** All the players on the winners team. Empty if solo game. */ protected List team; /** All the other players on the other teams that didn't win. */ @@ -65,7 +68,7 @@ public abstract class WinEffectGadget extends Gadget public void runPlay() { - this.finish = start + 1000*12; + this._finish = _start + 1000*12; play(); } @@ -87,7 +90,7 @@ public abstract class WinEffectGadget extends Gadget { finish(); UtilServer.getPlayersCollection().forEach(p -> {unlockPlayer(p); UtilPlayer.showForAll(p); }); - player = null; + _player = null; _baseLocation = null; team.clear(); team = null; @@ -103,15 +106,15 @@ public abstract class WinEffectGadget extends Gadget public boolean isRunning() { - if(player == null) return false; + if(_player == null) return false; if(_baseLocation == null) return false; - if(System.currentTimeMillis() >= finish) return false; + if(System.currentTimeMillis() >= _finish) return false; return true; } public Player getPlayer() { - return player; + return _player; } public Location getBaseLocation() @@ -121,24 +124,24 @@ public abstract class WinEffectGadget extends Gadget public long getStart() { - return start; + return _start; } public long getFinish() { - return finish; + return _finish; } public void activate(Player player, List team, List nonTeam, Location loc) { - this.player = player; + this._player = player; this.team = team; this.nonTeam = nonTeam; this.other = new ArrayList<>(); other.addAll(UtilServer.getPlayersCollection()); other.remove(player); other.removeAll(team); - this.start = System.currentTimeMillis(); + this._start = System.currentTimeMillis(); this._baseLocation = loc.clone(); } @@ -221,14 +224,7 @@ public abstract class WinEffectGadget extends Gadget // ((CraftChunk)loc.getChunk()).getHandle().initLighting(); */ - try - { - UtilSchematic.loadSchematic(new File("schematic" + File.separator + "WinRoom.schematic")).paste(getBaseLocation(), true); - } - catch (IOException e) - { - e.printStackTrace(); - } + pasteScematic(_schematicName); } @@ -247,5 +243,19 @@ public abstract class WinEffectGadget extends Gadget Manager.getDisguiseManager().disguise(disguise); return disguise; } + + public Schematic pasteScematic(String schematicName) { + try + { + Schematic schematic = UtilSchematic.loadSchematic(new File("schematic" + File.separator + schematicName + ".schematic")); + schematic.paste(getBaseLocation(), false, true); + return schematic; + } + catch(IOException e) + { + e.printStackTrace(); + return null; + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index 75e63ed04..7fde82783 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -63,7 +63,7 @@ public class WinEffectManager protected void playEffect() { WinEffectGadget effect = getWinEffect(winner); - effect.teleport(winner, team, other, loc.clone().add(loc.getDirection().normalize().multiply(10)).add(0, 5, 0)); + effect.teleport(winner, team, other, loc.clone().add(loc.getDirection().normalize().multiply(10)).add(0, 3, 0)); new BukkitRunnable() { public void run() { game.CreatureAllowOverride = true;