コード例 #1
0
 private int getMaxPageInternal() {
   int biggestSlot = 0;
   for (ParticleStorage particle : this.particles) {
     if (particle.getPosition() > biggestSlot) biggestSlot = particle.getPosition();
   }
   return biggestSlot / 44;
 }
コード例 #2
0
 public CustomItem getNoPermissionItem(ParticleStorage particle) {
   if ("%cosmeticsname%".equals(this.noPermissionItem.getItemMeta().getDisplayName())) {
     CustomItem item = new CustomItem(this.noPermissionItem.clone());
     item.setName(
         item.getItemMeta()
             .getDisplayName()
             .replace("%cosmeticsname%", particle.getItem().getItemMeta().getDisplayName()));
     return item;
   }
   return this.noPermissionItem;
 }
コード例 #3
0
  @SuppressWarnings("deprecation")
  @Override
  public void run() {
    for (Particle particle : this.plugin.getApi().getParticles()) {
      ParticleStorage particleStorage = particle.getParticleStorage();
      if (particleStorage.getShape() == ParticleShape.SPHERE) {
        Location l = particle.getPlayer().getLocation();
        new BukkitRunnable() {
          double phi = 0;

          @Override
          public void run() {
            this.phi += Math.PI / 10;
            for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / 32) {
              double x = Math.cos(theta) * Math.sin(this.phi);
              double y = Math.cos(this.phi) + 1;
              double z = Math.sin(theta) * Math.sin(this.phi);
              l.getWorld()
                  .spigot()
                  .playEffect(
                      new Location(l.getWorld(), l.getX() + x, l.getY() + y, l.getZ() + z),
                      Effect.valueOf(particleStorage.getParticle()),
                      particleStorage.getId(),
                      particleStorage.getData(),
                      0,
                      0,
                      0,
                      particleStorage.getSpeed(),
                      1,
                      Sphere.this.plugin.getParticles().getViewDistance());
            }
            if (this.phi > Math.PI) this.cancel();
          }
        }.runTaskTimer(this.plugin, 0, 1);
      }
    }
  }