improving animations again.

This commit is contained in:
Sarah 2015-08-10 15:33:00 +02:00
parent aea081c292
commit 65fc81a2aa
2 changed files with 48 additions and 17 deletions

View File

@ -42,17 +42,20 @@ import mineplex.database.tables.records.BonusRecord;
import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.poll.PollManager;
import mineplex.serverdata.commands.ServerCommandManager;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.block.Dropper;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.DataWatcher;
@ -444,6 +447,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
}
catch (Exception e)
{
new SpinGui(getPlugin(), player, _rewardManager, manager).openInventory();
UtilPlayer.message(player, F.main("Carl", "There was an error processing your request"));
}
}
@ -925,4 +929,25 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
return _pollManager;
}
@EventHandler
public void ItemDecay(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK)
return;
for(Entity entity : _carlNpc.getEntity().getNearbyEntities(3, -0.5, 3))
{
if(!(entity instanceof Item))
continue;
if(!((Item) entity).getItemStack().hasItemMeta())
continue;
if(!((Item) entity).getItemStack().getItemMeta().getDisplayName().startsWith(" "))
continue;
entity.remove();
}
}
}

View File

@ -11,6 +11,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@ -35,22 +36,22 @@ public class AnimationCarl extends Animation
{
if(((String) _type).contentEquals("DAILY"))
{
for (int i = 1; i < 60; i++)
for (int i = 1; i < 40; i++)
{
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, "" + i));
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, "" + i));
Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 7/3000d))*0.6, 1, false);
UtilAction.velocity(coin, vel, Math.abs(Math.sin(i * 8/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 8/3000d))*0.6, 1, false);
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i));
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 9/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 9/3000d))*0.6, 1, false);
UtilAction.velocity(coin, vel, Math.abs(Math.sin(i * 9/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 9/3000d))*0.6, 1, false);
coin.setTicksLived(1160);
gem.setTicksLived(1160);
}
}
if(((String) _type).contentEquals("RANK"))
{
for (int i = 1; i < 100; i++)
for (int i = 1; i < 50; i++)
{
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, "" + i));
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d));
UtilAction.velocity(coin, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 7/3000d))*0.6, 1, false);
coin.setTicksLived(1160);
@ -58,13 +59,13 @@ public class AnimationCarl extends Animation
}
if(!((String) _type).contentEquals("DAILY")&& !((String) _type).contentEquals("RANK"))
{
for (int i = 1; i < 60; i++)
for (int i = 1; i < 40; i++)
{
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, "" + i));
Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, "" + i));
Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 7/3000d))*0.6, 1, false);
UtilAction.velocity(paper, vel, Math.abs(Math.sin(i * 8/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 8/3000d))*0.6, 1, false);
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i));
Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, " " + i));
Vector vel = new Vector(Math.sin(i * 8/5d), 0, Math.cos(i * 8/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 8/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 8/3000d))*0.6, 1, false);
UtilAction.velocity(paper, vel, Math.abs(Math.sin(i * 9/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 9/3000d))*0.6, 1, false);
paper.setTicksLived(1160);
gem.setTicksLived(1160);
}
@ -79,13 +80,18 @@ public class AnimationCarl extends Animation
{
itemStack = new ItemStack(Material.NETHER_STAR);
}
Item item = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), itemStack);
Item item = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.7, 0.5), itemStack);
Vector vel = new Vector(_player.getLocation().getX() - _creeper.getLocation().getX(), 0, _player.getLocation().getZ() - _creeper.getLocation().getZ());
UtilAction.velocity(item, vel, 0.1, false, 0, 0.2 + 1*0.4, 1, false);
item.setTicksLived(1170);
item.setTicksLived(1160);
finish();
}
}