This commit is contained in:
Driftay 2018-07-30 12:05:56 -04:00
commit 8deb02f29f
3 changed files with 23 additions and 6 deletions

View File

@ -55,6 +55,7 @@ public class P extends MPlugin {
public CmdAutoHelp cmdAutoHelp; public CmdAutoHelp cmdAutoHelp;
public boolean mc17 = false; public boolean mc17 = false;
public boolean mc18 = false; public boolean mc18 = false;
public boolean useNonPacketParticles = false;
public boolean factionsFlight = false; public boolean factionsFlight = false;
ItemStack item = new ItemStack(Material.CAKE); ItemStack item = new ItemStack(Material.CAKE);
// Persistence related // Persistence related
@ -150,6 +151,7 @@ public class P extends MPlugin {
//massive stats //massive stats
MassiveStats massive = new MassiveStats(this); MassiveStats massive = new MassiveStats(this);
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]); int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) { if (version == 7) {
P.p.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles."); 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) { } else if (version == 8) {
P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable."); P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
mc18 = true; 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")) { 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 com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Particle;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -57,8 +58,16 @@ public class CmdFly extends FCommand {
continue; continue;
} }
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); 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) { if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id); Bukkit.getScheduler().cancelTask(id);
id = -1; id = -1;

View File

@ -7,10 +7,7 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.Particles.ParticleEffect; import com.massivecraft.factions.util.Particles.ParticleEffect;
import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays; import java.util.Arrays;
@ -126,7 +123,13 @@ public class CmdSeeChunk extends FCommand {
continue; continue;
} }
if (useParticles) { if (useParticles) {
if (P.p.useNonPacketParticles) {
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
} else {
this.effect.display(0, 0, 0, 0, 1, loc, player); this.effect.display(0, 0, 0, 0, 1, loc, player);
}
} else { } else {
Material type = blockY % 5 == 0 ? Material.LEGACY_REDSTONE_LAMP_ON : Material.LEGACY_STAINED_GLASS; Material type = blockY % 5 == 0 ? Material.LEGACY_REDSTONE_LAMP_ON : Material.LEGACY_STAINED_GLASS;
VisualizeUtil.addLocation(player, loc, type); VisualizeUtil.addLocation(player, loc, type);