Added Explosion instead of firework on hit.

This commit is contained in:
Bl4ckSkull666 2019-10-12 16:03:55 +02:00
parent fe10a2e697
commit 15deac3207
10 changed files with 307 additions and 579 deletions

View File

@ -7,8 +7,8 @@
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Quake_1.9" default="default" basedir=".">
<description>Builds, tests, and runs the project Quake_1.9.</description>
<project name="Quake" default="default" basedir=".">
<description>Builds, tests, and runs the project Quake.</description>
<import file="nbproject/build-impl.xml"/>
<!--
@ -58,7 +58,7 @@
An example of overriding the target for project execution could look like this:
<target name="run" depends="Quake_1.9-impl.jar">
<target name="run" depends="Quake-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
build.xml.data.CRC32=2936ce4c
build.xml.script.CRC32=bd6b80d1
build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
build.xml.data.CRC32=477a4906
build.xml.script.CRC32=fbf2856b
build.xml.stylesheet.CRC32=8064a381@1.79.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2936ce4c
nbproject/build-impl.xml.script.CRC32=cad2c6b6
nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
nbproject/build-impl.xml.data.CRC32=477a4906
nbproject/build-impl.xml.script.CRC32=5f55f531
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48

View File

@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Quake_1.9
application.title=Quake
application.vendor=Bl4ckSkull666
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
@ -30,15 +30,16 @@ debug.test.modulepath=\
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Quake_1.9.jar
dist.jar=${dist.dir}/Quake.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.spigot-1.12.1.jar=Z:\\Projekte\\AMC-Server.de\\JARs\\spigot-1.12.1.jar
file.reference.spigot-1.14.4.jar=Z:\\Projekte\\Minecraft\\Jars\\Spigot\\spigot-1.14.4.jar
file.reference.Vault_v1.7.2.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\Vault_v1.7.2.jar
file.reference.WorldEdit_v7.1.0-b4675.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\WorldEdit_v7.1.0-b4675.jar
file.reference.WorldGuard_v7.0.1-b1983.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\WorldGuard_v7.0.1-b1983.jar
file.reference.Quake.jar=dist\\Quake.jar
file.reference.spigot-1.12.1.jar=../../../AMC-Server.de/JARs/spigot-1.12.1.jar
file.reference.spigot-1.14.4.jar=../../../Minecraft/Jars/Spigot/spigot-1.14.4.jar
file.reference.Vault_v1.7.2.jar=../../../Minecraft/Jars/1.14/Vault_v1.7.2.jar
file.reference.WorldEdit_v7.1.0-b4675.jar=../../../Minecraft/Jars/1.14/WorldEdit_v7.1.0-b4675.jar
file.reference.WorldGuard_v7.0.1-b1983.jar=../../../Minecraft/Jars/1.14/WorldGuard_v7.0.1-b1983.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
@ -48,7 +49,8 @@ javac.classpath=\
${file.reference.spigot-1.14.4.jar}:\
${file.reference.Vault_v1.7.2.jar}:\
${file.reference.WorldEdit_v7.1.0-b4675.jar}:\
${file.reference.WorldGuard_v7.0.1-b1983.jar}
${file.reference.WorldGuard_v7.0.1-b1983.jar}:\
${file.reference.Quake.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -3,7 +3,7 @@
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Quake_1.9</name>
<name>Quake</name>
<source-roots>
<root id="src.dir"/>
</source-roots>

View File

@ -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()));

View File

@ -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);

View File

@ -379,6 +379,5 @@ public class PlayerListener implements Listener {
arena.leaveArena(event.getPlayer());
}
}
}

View File

@ -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;
}
}

View File

@ -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();