more bug fixes

This commit is contained in:
NewGarbo 2015-11-18 19:32:20 +00:00
parent 924504ac9f
commit 6f3693f804
3 changed files with 50 additions and 16 deletions

View File

@ -699,16 +699,16 @@ public class UtilBlock
BlockState pillowBlock = location.clone().add(xModif, 0, zModif).getBlock().getState();
BlockState footBlock = location.getBlock().getState();
if (force && (!pillowBlock.getType().equals(Material.AIR) && !footBlock.getType().equals(Material.AIR)))
if (!force && (!pillowBlock.getType().equals(Material.AIR) || !footBlock.getType().equals(Material.AIR)))
{
return false;
}
pillowBlock.setType(Material.BED_BLOCK);
pillowBlock.setRawData(dirFlag);
pillowBlock.setRawData((byte) (0x8 | dirFlag));
footBlock.setType(Material.BED_BLOCK);
footBlock.setRawData((byte) (0x8 | dirFlag));
footBlock.setRawData(dirFlag);
return pillowBlock.update(true, false) && footBlock.update(true, false);
}

View File

@ -929,10 +929,10 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
Block footBlock = clan.getHome().clone().add(xModif, 0, zModif).getBlock();
if (footBlock.getType().equals(Material.BED_BLOCK))
Block headBlock = clan.getHome().clone().add(xModif, 0, zModif).getBlock();
if (clan.getHome().getBlock().getType().equals(Material.BED_BLOCK))
{
footBlock.setType(Material.AIR);
headBlock.setType(Material.AIR);
clan.getHome().getBlock().setType(Material.AIR);
}
else

View File

@ -6,7 +6,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -238,7 +240,7 @@ public class GoldManager extends MiniPlugin
{
double x = Math.random() * 2 * Math.PI;
Vector velocity = new Vector(Math.sin(x), 0, Math.cos(x));
dropGold(location, 1000, velocity, velMult);
dropGold(location, 1000, velocity, velMult, 100);
}
// Drop Extra
@ -246,19 +248,51 @@ public class GoldManager extends MiniPlugin
{
double x = Math.random() * 2 * Math.PI;
Vector velocity = new Vector(Math.sin(x), 0, Math.cos(x));
dropGold(location, extraGold, velocity, velMult);
dropGold(location, extraGold, velocity, velMult, 100);
}
}
private void dropGold(Location location, int amount, Vector velocity, double velMult)
private void dropGold(Location location, int amount, Vector velocity, double velMult, int goldPerEntity)
{
Item item = location.getWorld().dropItem(location, new ItemStack(Material.GOLD_NUGGET));
item.setPickupDelay(40);
item.setMetadata(META_STRING, new FixedMetadataValue(getPlugin(), amount));
_itemSet.add(item);
// Velocity
UtilAction.velocity(item, velocity, velMult, false, 0, 0.2, 0.2, false);
int count = amount / goldPerEntity;
int extraGold = amount % goldPerEntity;
for (int i = 0; i < count; i++)
{
Item item = location.getWorld().dropItem(location, new ItemStack(Material.GOLD_NUGGET));
item.setPickupDelay(40);
item.setMetadata(META_STRING, new FixedMetadataValue(getPlugin(), goldPerEntity));
_itemSet.add(item);
if (item.getItemStack().getItemMeta() == null)
{
item.getItemStack().setItemMeta(Bukkit.getItemFactory().getItemMeta(item.getItemStack().getType()));
}
item.getItemStack().getItemMeta().setDisplayName(UUID.randomUUID().toString());
// Velocity
UtilAction.velocity(item, velocity, velMult, false, 0, 0.2, 0.2, false);
}
if (extraGold > 0)
{
Item item = location.getWorld().dropItem(location, new ItemStack(Material.GOLD_NUGGET));
item.setPickupDelay(40);
item.setMetadata(META_STRING, new FixedMetadataValue(getPlugin(), extraGold));
if (item.getItemStack().getItemMeta() == null)
{
item.getItemStack().setItemMeta(Bukkit.getItemFactory().getItemMeta(item.getItemStack().getType()));
}
item.getItemStack().getItemMeta().setDisplayName(UUID.randomUUID().toString());
_itemSet.add(item);
// Velocity
UtilAction.velocity(item, velocity, velMult, false, 0, 0.2, 0.2, false);
}
}
public void purchaseToken(final Player player, final int tokenValue)