replaced useless looping with just checking the rotation of the bed.
This commit is contained in:
parent
1ea87b8354
commit
cd0ce57691
@ -27,7 +27,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.blockrestore.BlockRestoreData;
|
||||
@ -45,6 +44,7 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
public class ClansGame extends MiniPlugin
|
||||
{
|
||||
@ -687,16 +687,47 @@ public class ClansGame extends MiniPlugin
|
||||
{
|
||||
clanHome.getBlock().setType(Material.AIR);
|
||||
|
||||
for (int x2 = -1; x2 < 1; x2++)
|
||||
byte data = clanHome.getBlock().getData();
|
||||
|
||||
EnumDirection dir = null;
|
||||
int xModif = 0;
|
||||
int zModif = 0;
|
||||
|
||||
if ((data & (1 << 0x2)) != 0)
|
||||
{
|
||||
for (int z2 = -1; z2 < 1; z2++)
|
||||
{
|
||||
Block block = clanHome.clone().add(x2, 0, z2).getBlock();
|
||||
if (block.getType().equals(Material.BED_BLOCK))
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
zModif = -1;
|
||||
dir = EnumDirection.NORTH;
|
||||
}
|
||||
else if ((data & (1 << 0x0)) != 0)
|
||||
{
|
||||
zModif = 1;
|
||||
dir = EnumDirection.SOUTH;
|
||||
}
|
||||
else if ((data & (1 << 0x1)) != 0)
|
||||
{
|
||||
xModif = -1;
|
||||
dir = EnumDirection.WEST;
|
||||
}
|
||||
else if ((data & (1 << 0x3)) != 0)
|
||||
{
|
||||
xModif = 1;
|
||||
dir = EnumDirection.EAST;
|
||||
}
|
||||
|
||||
if (dir == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block footBlock = clanHome.clone().add(xModif, 0, zModif).getBlock();
|
||||
if (footBlock.getType().equals(Material.BED_BLOCK))
|
||||
{
|
||||
footBlock.setType(Material.AIR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Shoudln't happen, but just in case:
|
||||
System.out.println("Second block of " + clan.getName() + "'s Clan Home should be a bed, but isn't. [STRANGE!!!]");
|
||||
}
|
||||
|
||||
clan.setHome(null);
|
||||
|
Loading…
Reference in New Issue
Block a user