particles

This commit is contained in:
SuperRonanCraft 2020-08-07 11:52:45 -04:00
parent b8930a510d
commit 8f17178799
4 changed files with 41 additions and 9 deletions

17
pom.xml
View File

@ -78,20 +78,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Bukkit API-->
<!--dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency-->
<dependency> <!-- Spigot (this includes Spigot API, Bukkit API, Craftbukkit and NMS) -->
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -119,5 +112,11 @@
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<!-- Particles Library -->
<dependency>
<groupId>xyz.xenondevs</groupId>
<artifactId>particle</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
</project>

View File

@ -181,6 +181,7 @@ public class RTP {
getPl().getText().getOtherNotSafe(sendi, maxAttempts, p.getDisplayName());
getPl().getCmd().cooldowns.remove(p.getUniqueId());
getPl().getEco().unCharge(p, price);
getPl().getCmd().rtping.put(p.getUniqueId(), false);
}
//Get a random location depending the world type

View File

@ -2,12 +2,15 @@ package me.SuperRonanCraft.BetterRTP.player;
import io.papermc.lib.PaperLib;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import xyz.xenondevs.particle.ParticleEffect;
import java.util.ArrayList;
import java.util.List;
@ -35,6 +38,7 @@ public class RTPTeleport {
public void run() {
if (getPl().getText().getSoundsEnabled())
sounds(p);
particles(p);
}
});
} catch (Exception e) {
@ -106,6 +110,30 @@ public class RTPTeleport {
p.playSound(p.getLocation(), sound, 1F, 1F);
}
private void particles(Player p) {
if (getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getBoolean("Settings.Particles.Enabled"))
try {
String type = getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getString("Settings.Particles.Type");
ParticleEffect effect = ParticleEffect.valueOf(type.toUpperCase());
int radius = 30;
int precision = getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getInt("Settings.Particles.Amount");;
Location loc = p.getLocation().add(new Vector(0, 2, 0));
for (int i = 1; i < precision; i++) {
double p1 = (i * Math.PI) / (precision / 2);
double p2 = (i - 1) * Math.PI / (precision / 2);
double x1 = Math.cos(p1) * radius;
double x2 = Math.cos(p2) * radius;
double z1 = Math.sin(p1) * radius;
double z2 = Math.sin(p2) * radius;
Vector vec = new Vector(x2 - x1, 0, z2 - z1);
effect.display(loc.clone().add(vec), new Vector(0, -0.125, 0), 1f, 0, null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Main getPl() {
return Main.getInstance();
}

View File

@ -25,6 +25,10 @@ Settings:
Enabled: true
Time: 5
CancelOnMove: true
Particles:
Enabled: true
Type: 'PORTAL' #list of particle types at https://github.com/ByteZ1337/ParticleLib/blob/master/src/main/java/xyz/xenondevs/particle/ParticleEffect.java
Amount: 180
DisableUpdater: false
Default: