Fixed some bugs with the Editor kit
This commit is contained in:
parent
c5f7c4fe0e
commit
b239f0af28
@ -72,6 +72,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
@ -327,7 +328,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
//On Player interact with a placed block by Editor
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||
{
|
||||
if(!IsLive())
|
||||
{
|
||||
@ -337,18 +338,30 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(GetTeam(event.getPlayer()).GetColor() == ChatColor.RED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
|
||||
if(_locationsOfBlocks.contains(clickedBlock.getLocation()))
|
||||
{
|
||||
if(!(event.getPlayer().getInventory().getItem(event.getPlayer().getInventory().getHeldItemSlot()) instanceof Block))
|
||||
new BukkitRunnable()
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
|
||||
event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
|
||||
Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, event.getClickedBlock().getData(), 2000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(!(event.getPlayer().getItemInHand().getType().isBlock()) || event.getPlayer().getItemInHand().getType() == Material.AIR)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
|
||||
event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
|
||||
Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, event.getClickedBlock().getData(), 2000);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Manager.getPlugin(), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user