1.13 now has working particles.

This commit is contained in:
ProSavage 2018-07-29 14:34:40 -05:00
parent 51f157931f
commit e7e3e14825
2 changed files with 15 additions and 1 deletions

View File

@ -55,6 +55,7 @@ public class P extends MPlugin {
public CmdAutoHelp cmdAutoHelp;
public boolean mc17 = false;
public boolean mc18 = false;
public boolean useNonPacketParticles = false;
public boolean factionsFlight = false;
ItemStack item = new ItemStack(Material.CAKE);
// Persistence related
@ -150,6 +151,7 @@ public class P extends MPlugin {
//massive stats
MassiveStats massive = new MassiveStats(this);
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) {
P.p.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
@ -157,6 +159,9 @@ public class P extends MPlugin {
} else if (version == 8) {
P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
mc18 = true;
} else if (version > 8) {
useNonPacketParticles = true;
P.p.log("Minecraft Version 1.9 or higher found, using non packet based particle API");
}
if (P.p.getConfig().getBoolean("enable-faction-flight")) {

View File

@ -11,6 +11,7 @@ import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -57,7 +58,15 @@ public class CmdFly extends FCommand {
continue;
}
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
if (P.p.useNonPacketParticles) {
// 1.9+ based servers will use the built in particleAPI instead of packet based.
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
// So setting the amount to 0 spawns 1 in the precise location
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
} else {
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
}
}
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id);