* Fixed unable to die when not moving. You'll become unsolid faster.

This commit is contained in:
Steffion 2013-08-26 15:23:43 +02:00
parent 4c23fbc263
commit f5ae383366
3 changed files with 76 additions and 69 deletions

View File

@ -93,7 +93,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
MessageM.broadcastFMessage(ConfigC.error_disguiseCraftNotInstalled,
true);
}
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
MessageM.broadcastFMessage(ConfigC.error_protocolLibNotInstalled,
true);
@ -129,8 +129,8 @@ public class BlockHunt extends JavaPlugin implements Listener {
if ((Boolean) W.config.get(ConfigC.autoUpdateCheck)) {
if ((Boolean) W.config.get(ConfigC.autoDownloadUpdate)) {
new Updater(this, W.pluginName,
this.getFile(), Updater.UpdateType.DEFAULT, true);
new Updater(this, W.pluginName, this.getFile(),
Updater.UpdateType.DEFAULT, true);
} else {
new Updater(this, W.pluginName, this.getFile(),
Updater.UpdateType.NO_DOWNLOAD, true);
@ -479,69 +479,10 @@ public class BlockHunt extends JavaPlugin implements Listener {
}
}
} else {
Block pBlock = player.getLocation()
.getBlock();
block.setAmount(5);
if (W.hiddenLoc.get(player) != null) {
pBlock = W.hiddenLoc.get(player)
.getBlock();
}
if (!W.dcAPI.isDisguised(player)) {
for (Player pl : Bukkit
.getOnlinePlayers()) {
if (!pl.equals(player)) {
if (W.hiddenLocWater
.get(player) != null) {
if (W.hiddenLocWater
.get(player)) {
pl.sendBlockChange(
pBlock.getLocation(),
Material.STATIONARY_WATER,
(byte) 0);
} else {
pl.sendBlockChange(
pBlock.getLocation(),
Material.AIR,
(byte) 0);
}
} else {
pl.sendBlockChange(
pBlock.getLocation(),
Material.AIR,
(byte) 0);
}
W.hiddenLocWater
.remove(player);
}
}
player.playSound(pLoc,
Sound.BAT_HURT, 1, 1);
block.removeEnchantment(Enchantment.DURABILITY);
LinkedList<String> data = new LinkedList<String>();
data.add("blockID:"
+ block.getTypeId());
data.add("blockData:"
+ block.getDurability());
Disguise disguise = new Disguise(
W.dcAPI.newEntityID(),
data,
DisguiseType.FallingBlock);
if (W.dcAPI.isDisguised(player)) {
W.dcAPI.changePlayerDisguise(
player, disguise);
} else {
W.dcAPI.disguisePlayer(player,
disguise);
}
MessageM.sendFMessage(
player,
ConfigC.normal_ingameNoMoreSolid,
true);
SolidBlockHandler
.makePlayerUnsolid(player,
block);
}
}
}

View File

@ -3,6 +3,7 @@ package nl.Steffion.BlockHunt.Listeners;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.SignsHandler;
import nl.Steffion.BlockHunt.SolidBlockHandler;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
@ -10,6 +11,7 @@ import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -124,10 +126,12 @@ public class OnPlayerInteractEvent implements Listener {
if (moveLocBlock.getX() == pLoc.getX()
&& moveLocBlock.getY() == pLoc.getY()
&& moveLocBlock.getZ() == pLoc.getZ()) {
W.moveLoc.put(pl, player.getLocation());
player.getWorld().playSound(
player.getLocation(), Sound.HURT_FLESH,
1, 1);
W.moveLoc.put(pl, new Location(pl.getWorld(),
0, 0, 0));
pl.getWorld().playSound(player.getLocation(),
Sound.HURT_FLESH, 1, 1);
ItemStack block = pl.getInventory().getItem(8);
SolidBlockHandler.makePlayerUnsolid(pl, block);
}
}
}

View File

@ -0,0 +1,62 @@
package nl.Steffion.BlockHunt;
import java.util.LinkedList;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
public class SolidBlockHandler {
public static void makePlayerUnsolid(Player player, ItemStack block) {
Block pBlock = player.getLocation().getBlock();
if (W.hiddenLoc.get(player) != null) {
pBlock = W.hiddenLoc.get(player).getBlock();
}
block.setAmount(5);
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
if (W.hiddenLocWater.get(player) != null) {
if (W.hiddenLocWater.get(player)) {
pl.sendBlockChange(pBlock.getLocation(),
Material.STATIONARY_WATER, (byte) 0);
} else {
pl.sendBlockChange(pBlock.getLocation(), Material.AIR,
(byte) 0);
}
} else {
pl.sendBlockChange(pBlock.getLocation(), Material.AIR,
(byte) 0);
}
W.hiddenLocWater.remove(player);
}
}
player.playSound(player.getLocation(), Sound.BAT_HURT, 1, 1);
block.removeEnchantment(Enchantment.DURABILITY);
LinkedList<String> data = new LinkedList<String>();
data.add("blockID:" + block.getTypeId());
data.add("blockData:" + block.getDurability());
Disguise disguise = new Disguise(W.dcAPI.newEntityID(), data,
DisguiseType.FallingBlock);
if (W.dcAPI.isDisguised(player)) {
W.dcAPI.changePlayerDisguise(player, disguise);
} else {
W.dcAPI.disguisePlayer(player, disguise);
}
MessageM.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid, true);
}
}