mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
test command rtp type + multi particle support
This commit is contained in:
parent
231ab44da4
commit
713ce65db6
@ -72,8 +72,12 @@ public class AddonFlashback implements Addon, Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onTeleport(RTP_TeleportPostEvent e) { //Create a timer to teleport player back
|
void onTeleport(RTP_TeleportPostEvent e) { //Create a timer to teleport player back
|
||||||
if (e.getType() != RTP_TYPE.ADDON_PORTAL)
|
if (e.getType() != RTP_TYPE.ADDON_PORTAL &&
|
||||||
|
e.getType() != RTP_TYPE.JOIN &&
|
||||||
|
e.getType() != RTP_TYPE.TEST) {
|
||||||
|
cancelPlayer(e.getPlayer());
|
||||||
players.add(new FlashbackPlayer(this, e.getPlayer(), e.getOldLocation(), time, warnings));
|
players.add(new FlashbackPlayer(this, e.getPlayer(), e.getOldLocation(), time, warnings));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -83,8 +87,12 @@ public class AddonFlashback implements Addon, Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onLeave(PlayerQuitEvent e) {
|
void onLeave(PlayerQuitEvent e) {
|
||||||
|
cancelPlayer(e.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelPlayer(Player p) {
|
||||||
for (FlashbackPlayer fbp : players)
|
for (FlashbackPlayer fbp : players)
|
||||||
if (fbp.p == e.getPlayer())
|
if (fbp.p == p)
|
||||||
fbp.cancel();
|
fbp.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class CmdTest implements RTPCommand, RTPCommandHelpable {
|
|||||||
public void execute(CommandSender sendi, String label, String[] args) {
|
public void execute(CommandSender sendi, String label, String[] args) {
|
||||||
if (sendi instanceof Player) {
|
if (sendi instanceof Player) {
|
||||||
Player p = (Player) sendi;
|
Player p = (Player) sendi;
|
||||||
BetterRTP.getInstance().getRTP().getTeleport().afterTeleport(p, p.getLocation(), 0, 0, p.getLocation(), RTP_TYPE.COMMAND);
|
BetterRTP.getInstance().getRTP().getTeleport().afterTeleport(p, p.getLocation(), 0, 0, p.getLocation(), RTP_TYPE.TEST);
|
||||||
} else
|
} else
|
||||||
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
|
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,9 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import xyz.xenondevs.particle.ParticleEffect;
|
import xyz.xenondevs.particle.ParticleEffect;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
//---
|
//---
|
||||||
@ -19,7 +21,7 @@ import java.util.Random;
|
|||||||
public class RTPParticles {
|
public class RTPParticles {
|
||||||
|
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private ParticleEffect effect;
|
private List<ParticleEffect> effects = new ArrayList<>();
|
||||||
private String shape;
|
private String shape;
|
||||||
private final int
|
private final int
|
||||||
radius = 30,
|
radius = 30,
|
||||||
@ -38,12 +40,23 @@ public class RTPParticles {
|
|||||||
enabled = config.getBoolean("Particles.Enabled");
|
enabled = config.getBoolean("Particles.Enabled");
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
//Enabled? Load all this junk
|
//Enabled? Load all this junk
|
||||||
String type = config.getString("Particles.Type");
|
List<String> types;
|
||||||
|
if (config.isList("Particles.Type"))
|
||||||
|
types = config.getStringList("Particles.Type");
|
||||||
|
else {
|
||||||
|
types = new ArrayList<>();
|
||||||
|
types.add(config.getString("Particles.Type"));
|
||||||
|
}
|
||||||
|
String typeTrying = null;
|
||||||
try {
|
try {
|
||||||
effect = ParticleEffect.valueOf(type.toUpperCase());
|
for (String type : types) {
|
||||||
|
typeTrying = type;
|
||||||
|
effects.add(ParticleEffect.valueOf(type.toUpperCase()));
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException | NullPointerException e) {
|
} catch (IllegalArgumentException | NullPointerException e) {
|
||||||
effect = ParticleEffect.ASH;
|
effects.clear();
|
||||||
getPl().getLogger().severe("The particle '" + type + "' doesn't exist! Default particle enabled... " +
|
effects.add(ParticleEffect.ASH);
|
||||||
|
getPl().getLogger().severe("The particle '" + typeTrying + "' doesn't exist! Default particle enabled... " +
|
||||||
"Try using '/rtp info particles' to get a list of available particles");
|
"Try using '/rtp info particles' to get a list of available particles");
|
||||||
}
|
}
|
||||||
shape = config.getString("Particles.Shape").toUpperCase();
|
shape = config.getString("Particles.Shape").toUpperCase();
|
||||||
@ -72,7 +85,9 @@ public class RTPParticles {
|
|||||||
Location loc = p.getLocation().add(new Vector(0, pHeight, 0));
|
Location loc = p.getLocation().add(new Vector(0, pHeight, 0));
|
||||||
for (int index = 1; index < precision; index++) {
|
for (int index = 1; index < precision; index++) {
|
||||||
Vector vec = getVecCircle(index, precision, radius);
|
Vector vec = getVecCircle(index, precision, radius);
|
||||||
effect.display(loc.clone().add(vec), new Vector(0, -0.125, 0), 1f, 0, null);
|
for (ParticleEffect effect : effects) {
|
||||||
|
effect.display(loc.clone().add(vec), new Vector(0, -0.125, 0), 1f, 0, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +97,9 @@ public class RTPParticles {
|
|||||||
for (int index = 1; index < precision; index++) {
|
for (int index = 1; index < precision; index++) {
|
||||||
double yran = ran.nextGaussian() * pHeight;
|
double yran = ran.nextGaussian() * pHeight;
|
||||||
Vector vec = getVecCircle(index, precision, radius).add(new Vector(0, yran, 0));
|
Vector vec = getVecCircle(index, precision, radius).add(new Vector(0, yran, 0));
|
||||||
effect.display(loc.clone().add(vec));
|
for (ParticleEffect effect : effects) {
|
||||||
|
effect.display(loc.clone().add(vec));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +107,9 @@ public class RTPParticles {
|
|||||||
Location loc = p.getLocation().add(new Vector(0, 1, 0));
|
Location loc = p.getLocation().add(new Vector(0, 1, 0));
|
||||||
for (int index = 1; index < precision; index++) {
|
for (int index = 1; index < precision; index++) {
|
||||||
Vector vec = getVecCircle(index, precision, radius);
|
Vector vec = getVecCircle(index, precision, radius);
|
||||||
effect.display(loc.clone().add(vec), vec, 1.5f, 0, null);
|
for (ParticleEffect effect : effects) {
|
||||||
|
effect.display(loc.clone().add(vec), vec, 1.5f, 0, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ public enum RTP_TYPE {
|
|||||||
COMMAND, //Player executed command
|
COMMAND, //Player executed command
|
||||||
FORCED, //Player was forced to rtp (/rtp player <player>)
|
FORCED, //Player was forced to rtp (/rtp player <player>)
|
||||||
JOIN, //Player joined and was rtp'd automatically
|
JOIN, //Player joined and was rtp'd automatically
|
||||||
|
TEST, //Player was just testing out effects
|
||||||
ADDON, //Player RTP'd from the external addons plugin
|
ADDON, //Player RTP'd from the external addons plugin
|
||||||
ADDON_PORTAL, //Player RTP'd from the external addons (Portals)
|
ADDON_PORTAL, //Player RTP'd from the external addons (Portals)
|
||||||
ADDON_MAGICSTICK, //Player RTP'd from the external addons (MagicStick)
|
ADDON_MAGICSTICK, //Player RTP'd from the external addons (MagicStick)
|
||||||
|
@ -32,7 +32,9 @@ Titles:
|
|||||||
SendMessage: true
|
SendMessage: true
|
||||||
Particles: #Use `rtp info particles` for a list of particles
|
Particles: #Use `rtp info particles` for a list of particles
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Type: 'EXPLOSION_NORMAL' #list of particle types at https://github.com/ByteZ1337/ParticleLib/blob/master/src/main/java/xyz/xenondevs/particle/ParticleEffect.java
|
Type: #list of particle types at https://github.com/ByteZ1337/ParticleLib/blob/master/src/main/java/xyz/xenondevs/particle/ParticleEffect.java
|
||||||
|
- 'EXPLOSION_NORMAL'
|
||||||
|
- 'CRIT'
|
||||||
Shape: 'EXPLODE' #Types available are "Scan, Teleport and Explode", or use `/rtp info shapes` for a list of shapes
|
Shape: 'EXPLODE' #Types available are "Scan, Teleport and Explode", or use `/rtp info shapes` for a list of shapes
|
||||||
Invincible: #Amount of time a player should not take damage for
|
Invincible: #Amount of time a player should not take damage for
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user