Added Explosion instead of firework on hit.
This commit is contained in:
@@ -311,11 +311,12 @@ public abstract class Arena {
|
||||
}
|
||||
}, 2);
|
||||
|
||||
try {
|
||||
FireworkEffectPlayer.playFirework(victim.getLocation());
|
||||
/*try {
|
||||
_fw.playFirework(victim.getWorld(), victim.getLocation(), effect);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
kill(victim);
|
||||
broadcast(_plugin._trad.get("Game.Arena.Message.Shot").replace("[SHOOTER]", shooter.getName()).replace("[KILLED]", victim.getName()));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.Geekpower14.Quake.Arena;
|
||||
|
||||
import com.Geekpower14.Quake.Quake;
|
||||
import com.Geekpower14.Quake.Utils.FireworkEffectPlayer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -320,35 +321,7 @@ public class SArena extends Arena {
|
||||
if(_compteur >= nb)
|
||||
return;
|
||||
|
||||
Firework fw = (Firework)player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK);
|
||||
FireworkMeta fwm = fw.getFireworkMeta();
|
||||
Random r = new Random();
|
||||
int rt = r.nextInt(4) + 1;
|
||||
FireworkEffect.Type type = FireworkEffect.Type.BALL;
|
||||
if (rt == 1) {
|
||||
type = FireworkEffect.Type.BALL;
|
||||
}
|
||||
if (rt == 2) {
|
||||
type = FireworkEffect.Type.BALL_LARGE;
|
||||
}
|
||||
if (rt == 3) {
|
||||
type = FireworkEffect.Type.BURST;
|
||||
}
|
||||
if (rt == 4) {
|
||||
type = FireworkEffect.Type.CREEPER;
|
||||
}
|
||||
if (rt == 5) {
|
||||
type = FireworkEffect.Type.STAR;
|
||||
}
|
||||
int r1i = r.nextInt(17) + 1;
|
||||
int r2i = r.nextInt(17) + 1;
|
||||
Color c1 = getColor(r1i);
|
||||
Color c2 = getColor(r2i);
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
|
||||
fwm.addEffect(effect);
|
||||
int rp = r.nextInt(2) + 1;
|
||||
fwm.setPower(rp);
|
||||
fw.setFireworkMeta(fwm);
|
||||
FireworkEffectPlayer.playFirework(player);
|
||||
_compteur++;
|
||||
}
|
||||
}, 5, 5);
|
||||
|
||||
@@ -379,6 +379,5 @@ public class PlayerListener implements Listener {
|
||||
arena.leaveArena(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -264,5 +265,60 @@ public class Config {
|
||||
}
|
||||
}
|
||||
|
||||
public static Color getColor(int i) {
|
||||
Color c = null;
|
||||
if (i == 1) {
|
||||
c = Color.AQUA;
|
||||
}
|
||||
if (i == 2) {
|
||||
c = Color.BLACK;
|
||||
}
|
||||
if (i == 3) {
|
||||
c = Color.BLUE;
|
||||
}
|
||||
if (i == 4) {
|
||||
c = Color.FUCHSIA;
|
||||
}
|
||||
if (i == 5) {
|
||||
c = Color.GRAY;
|
||||
}
|
||||
if (i == 6) {
|
||||
c = Color.GREEN;
|
||||
}
|
||||
if (i == 7) {
|
||||
c = Color.LIME;
|
||||
}
|
||||
if (i == 8) {
|
||||
c = Color.MAROON;
|
||||
}
|
||||
if (i == 9) {
|
||||
c = Color.NAVY;
|
||||
}
|
||||
if (i == 10) {
|
||||
c = Color.OLIVE;
|
||||
}
|
||||
if (i == 11) {
|
||||
c = Color.ORANGE;
|
||||
}
|
||||
if (i == 12) {
|
||||
c = Color.PURPLE;
|
||||
}
|
||||
if (i == 13) {
|
||||
c = Color.RED;
|
||||
}
|
||||
if (i == 14) {
|
||||
c = Color.SILVER;
|
||||
}
|
||||
if (i == 15) {
|
||||
c = Color.TEAL;
|
||||
}
|
||||
if (i == 16) {
|
||||
c = Color.WHITE;
|
||||
}
|
||||
if (i == 17) {
|
||||
c = Color.YELLOW;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.Geekpower14.Quake.Utils;
|
||||
import com.Geekpower14.Quake.Quake;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Random;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Builder;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Particle.DustOptions;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class FireworkEffectPlayer {
|
||||
@@ -66,6 +73,45 @@ public class FireworkEffectPlayer {
|
||||
}
|
||||
fw.remove();
|
||||
}
|
||||
|
||||
public static void playFirework(Location loc) {
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, loc, 1);
|
||||
}
|
||||
|
||||
public static void playFirework(Player p) {
|
||||
Location loc = p.getLocation();
|
||||
Random r = new Random();
|
||||
Builder fweBuilder = FireworkEffect.builder();
|
||||
switch(r.nextInt(5)) {
|
||||
case 0:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.BALL);
|
||||
break;
|
||||
case 1:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.BALL_LARGE);
|
||||
break;
|
||||
case 2:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.BURST);
|
||||
break;
|
||||
case 3:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.CREEPER);
|
||||
break;
|
||||
case 4:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.STAR);
|
||||
break;
|
||||
default:
|
||||
fweBuilder = fweBuilder.with(FireworkEffect.Type.STAR);
|
||||
}
|
||||
fweBuilder = fweBuilder.flicker(r.nextBoolean());
|
||||
fweBuilder = fweBuilder.withColor(Config.getColor(r.nextInt(17) + 1));
|
||||
fweBuilder = fweBuilder.withFade(Config.getColor(r.nextInt(17) + 1));
|
||||
fweBuilder = fweBuilder.trail(true);
|
||||
|
||||
Firework fw = (Firework)loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
|
||||
FireworkMeta fwm = fw.getFireworkMeta();
|
||||
fwm.addEffect(fweBuilder.build());
|
||||
fwm.setPower(r.nextInt(5) + 2);
|
||||
fw.setFireworkMeta(fwm);
|
||||
}
|
||||
|
||||
private static Method getMethod(Class<?> cl, String method) {
|
||||
Method[] arrmethod = cl.getMethods();
|
||||
|
||||
Reference in New Issue
Block a user