Final touches
This commit is contained in:
parent
ecb42d91fe
commit
01e83f0646
@ -94,7 +94,7 @@ public class BlockForm
|
||||
_disguiseBlockBase.setInvisible(true);
|
||||
_host.Manager.getDisguiseManager().disguise(_disguiseBlockBase);
|
||||
|
||||
Apply();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void createFallingBlock()
|
||||
@ -118,12 +118,9 @@ public class BlockForm
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply()
|
||||
private void reset()
|
||||
{
|
||||
if (_block != null)
|
||||
{
|
||||
SolidifyRemove(false);
|
||||
}
|
||||
removeSolidBlock();
|
||||
createFallingBlock();
|
||||
// Inform
|
||||
|
||||
@ -140,9 +137,9 @@ public class BlockForm
|
||||
_player.playSound(_player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
public void remove()
|
||||
{
|
||||
SolidifyRemove(false);
|
||||
removeSolidBlock();
|
||||
removeFallingBlock();
|
||||
|
||||
_host.Manager.getDisguiseManager().undisguise(_hiddenDisguise);
|
||||
@ -234,12 +231,13 @@ public class BlockForm
|
||||
// Moved
|
||||
if (!_loc.getBlock().equals(_player.getLocation().getBlock()))
|
||||
{
|
||||
SolidifyRemove(true);
|
||||
removeSolidBlock();
|
||||
createFallingBlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SolidifyRemove(boolean create)
|
||||
private void removeSolidBlock()
|
||||
{
|
||||
if (_block != null)
|
||||
{
|
||||
@ -255,13 +253,10 @@ public class BlockForm
|
||||
|
||||
// Inform
|
||||
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
|
||||
|
||||
if (create)
|
||||
createFallingBlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void reset(Block block)
|
||||
public void setType(Block block)
|
||||
{
|
||||
if (block == null)
|
||||
return;
|
||||
@ -275,7 +270,7 @@ public class BlockForm
|
||||
_blockMat = block.getType();
|
||||
_blockData = block.getData();
|
||||
|
||||
Apply();
|
||||
reset();
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
|
@ -6,12 +6,9 @@ import java.util.Map;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInBlockDig;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockChange;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
@ -22,7 +19,6 @@ import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
@ -71,7 +67,7 @@ public class MorphBlock extends MorphGadget implements IPacketHandler
|
||||
BlockForm form = _active.remove(player);
|
||||
if (form != null)
|
||||
{
|
||||
form.Remove();
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +88,7 @@ public class MorphBlock extends MorphGadget implements IPacketHandler
|
||||
if (form == null)
|
||||
return;
|
||||
|
||||
form.reset(event.getClickedBlock());
|
||||
form.setType(event.getClickedBlock());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -134,6 +130,9 @@ public class MorphBlock extends MorphGadget implements IPacketHandler
|
||||
{
|
||||
PacketPlayInBlockDig packet = (PacketPlayInBlockDig) packetInfo.getPacket();
|
||||
|
||||
if (packet.c != PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK)
|
||||
return;
|
||||
|
||||
for (BlockForm form : _active.values())
|
||||
{
|
||||
if (form.getBlock() == null)
|
||||
|
Loading…
Reference in New Issue
Block a user