Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- //Block Break Listener
- //
- public class BlockBreakListener implements Listener{
- Main pl = Main.getPlugin();
- @EventHandler
- public void onBreak(BlockBreakEvent e) {
- if(e.getBlock() == null) {
- return;
- }
- Material type = e.getBlock().getType();
- if((type == Material.IRON_PLATE) || type == Material.STONE_PLATE || type == Material.WOOD_PLATE || type == Material.GOLD_PLATE){
- List<String> locations = pl.getLocations().getStringList("boosterplates");
- String string = e.getBlock().getWorld().getName()+":"+e.getBlock().getLocation().getX()+
- ":"+e.getBlock().getLocation().getY()+":"+e.getBlock().getLocation().getBlockZ();
- locations.remove(string);
- pl.getLocations().set("boosterplates", locations);
- pl.saveLocations();
- boosterplates.locs.remove(string);
- }
- }
- }
- //
- //Block Place Listener
- //
- public class BlockPlaceListener implements Listener{
- Main pl = Main.pl;
- @EventHandler
- public void onPlace(BlockPlaceEvent e) {
- Material type = e.getBlock().getType();
- if((type == Material.IRON_PLATE) || type == Material.STONE_PLATE || type == Material.WOOD_PLATE || type ==
- Material.GOLD_PLATE){
- List<String> locations = pl.getLocations().getStringList("boosterplates");
- String string = e.getBlock().getWorld().getName()+":"+e.getBlock().getLocation().getX()+
- ":"+e.getBlock().getLocation().getY()+":"+e.getBlock().getLocation().getBlockZ();
- locations.add(string);
- pl.getLocations().set("boosterplates", locations);
- pl.saveLocations();
- boosterplates.locs.add(string);
- }
- }
- }
- }
- //
- // boosterplates.java
- //
- public class boosterplates {
- static int count;
- static Main pl = Main.pl;
- public static List<String> locs = pl.getLocations().getStringList("boosterplates");
- public static void start() {
- count = 16;
- Bukkit.getScheduler().scheduleSyncRepeatingTask(pl, new Runnable() {
- @Override
- public void run() {
- for(String loc : locs) {
- String[] location = loc.split(":");
- String world = location[0];
- double x = Double.parseDouble(location[1]);
- double y = Double.parseDouble(location[2]);
- double z = Double.parseDouble(location[3]);
- Location loc2 = new Location(Bukkit.getWorld(world), x, y, z);
- loc2.add(0.5,0.7,0.5);
- if(count == 15) ParticleEffects.boosterplate(loc2.add(0.8, 0, 0), true, 0, 0, 0, 0, 1);
- if(count == 14) ParticleEffects.boosterplate(loc2.add(0.75, 0, 0.43), true, 0, 0, 0, 0, 1);
- if(count == 13) ParticleEffects.boosterplate(loc2.add(0.65, 0, 0.65), true, 0, 0, 0, 0, 1);
- if(count == 12) ParticleEffects.boosterplate(loc2.add(0.43, 0, 0.75), true, 0, 0, 0, 0, 1);
- if(count == 11) ParticleEffects.boosterplate(loc2.add(0, 0, 0.8), true, 0, 0, 0, 0, 1);
- if(count == 10) ParticleEffects.boosterplate(loc2.add(-0.43, 0, 0.75), true, 0, 0, 0, 0, 1);
- if(count == 9) ParticleEffects.boosterplate(loc2.add(-0.65, 0, 0.65), true, 0, 0, 0, 0, 1);
- if(count == 8) ParticleEffects.boosterplate(loc2.add(-0.75, 0, 0.43), true, 0, 0, 0, 0, 1);
- if(count == 7) ParticleEffects.boosterplate(loc2.add(-0.8, 0, 0), true, 0, 0, 0, 0, 1);
- if(count == 6) ParticleEffects.boosterplate(loc2.add(-0.75, 0, -0.43), true, 0, 0, 0, 0, 1);
- if(count == 5) ParticleEffects.boosterplate(loc2.add(-0.65, 0, -0.65), true, 0, 0, 0, 0, 1);
- if(count == 4) ParticleEffects.boosterplate(loc2.add(-0.43, 0, -0.75), true, 0, 0, 0, 0, 1);
- if(count == 3) ParticleEffects.boosterplate(loc2.add(0, 0, -0.8), true, 0, 0, 0, 0, 1);
- if(count == 2) ParticleEffects.boosterplate(loc2.add(0.43, 0, -0.75), true, 0, 0, 0, 0, 1);
- if(count == 1) ParticleEffects.boosterplate(loc2.add(0.65, 0, -0.65), true, 0, 0, 0, 0, 1);
- if(count == 0) {
- ParticleEffects.boosterplate(loc2.add(0.75, 0, -0.43), true, 0, 0, 0, 0, 1);
- }
- }
- if(count == 0)count = 16;
- count--;
- }
- }, 0, 2);
- }
- }
- //
- // ParticleEffects.java
- //
- public class ParticleEffects {
- public static void send(Location location,boolean longdistance,float offsetx,float offsety,float offsetz,float speed,int amount) throws Exception {
- ArrayList<EnumParticle> particles = new ArrayList<EnumParticle>();
- particles.add(EnumParticle.VILLAGER_HAPPY);
- for(EnumParticle name : particles) {
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(name, longdistance, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetx, offsety, offsetz, speed, amount, 0);
- for(Player all : Bukkit.getOnlinePlayers()) {
- ((CraftPlayer) all).getHandle().playerConnection.sendPacket(packet);
- }
- }
- }
- public static void boosterplate(Location location,boolean longdistance,float offsetx,float offsety,float offsetz,float speed,int amount){
- try {
- PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(EnumParticle.FIREWORKS_SPARK, longdistance, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetx, offsety, offsetz, 0, amount, 0);
- for(Player all : Bukkit.getOnlinePlayers()) {
- ((CraftPlayer) all).getHandle().playerConnection.sendPacket(packet);
- }
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment