Skip to content

Commit

Permalink
Merge pull request #8 from GreWeMa/master
Browse files Browse the repository at this point in the history
Fixed issue when only player who writes command can see particles.
  • Loading branch information
runescapejon authored Aug 15, 2017
2 parents 26a9da1 + 85317b1 commit 1a22fba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.spongepowered.api.util.Color;

import me.runescapejon.CrazyFeet.CrazyFeet;
import org.spongepowered.api.world.World;

public class CrazyFeetListener {

Expand All @@ -28,42 +29,44 @@ public void onMove(MoveEntityEvent event, @First Player player) {
pearl = CrazyFeet.getInstance().getCrazyPearl().contains(player);
witch = CrazyFeet.getInstance().getCrazyWitch().contains(player);

World world = player.getWorld();

if (fire) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.MOBSPAWNER_FLAMES).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.MOBSPAWNER_FLAMES).build(),
player.getLocation().getPosition().add(0, -1, 0));
}
if (note) {
// Crap Sponge api doesn't support color Notes seem like it
// here is aqua notes <3
player.spawnParticles(
world.spawnParticles(
ParticleEffect.builder().type(ParticleTypes.NOTE)
.option(ParticleOptions.COLOR, Color.ofRgb(0, 255, 255)).build(),
player.getLocation().getPosition().add(0, 0.1, 0));

// here is red notes
player.spawnParticles(
world.spawnParticles(
ParticleEffect.builder().type(ParticleTypes.NOTE)
.option(ParticleOptions.COLOR, Color.ofRgb(255, 0, 0)).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
if (magic) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.INSTANT_SPELL).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.INSTANT_SPELL).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
if (smoke) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.SMOKE).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.SMOKE).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
if (heart) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.HEART).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.HEART).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
if (pearl) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.ENDER_TELEPORT).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.ENDER_TELEPORT).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
if (witch) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.WITCH_SPELL).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.WITCH_SPELL).build(),
player.getLocation().getPosition().add(0, 0.1, 0));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.spongepowered.api.util.Color;

import me.runescapejon.CrazyFeet.CrazyFeet;
import org.spongepowered.api.world.World;

public class CrazyHeadListener {
// It's seem getPosition().add(0, 3, 0,) seem the right location for the
Expand All @@ -30,42 +31,44 @@ public void onMoveHead(MoveEntityEvent event, @First Player player) {
pearlh = CrazyFeet.getInstance().getCrazyPearlHead().contains(player);
witchh = CrazyFeet.getInstance().getCrazyWitchHead().contains(player);

World world = player.getWorld();

if (fireh) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.MOBSPAWNER_FLAMES).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.MOBSPAWNER_FLAMES).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (noteh) {
// Crap Sponge api doesn't support color Notes seem like it
// here is aqua notes <3
player.spawnParticles(
world.spawnParticles(
ParticleEffect.builder().type(ParticleTypes.NOTE)
.option(ParticleOptions.COLOR, Color.ofRgb(0, 255, 255)).build(),
player.getLocation().getPosition().add(0, 2.5, 0));

// here is red notes
player.spawnParticles(
world.spawnParticles(
ParticleEffect.builder().type(ParticleTypes.NOTE)
.option(ParticleOptions.COLOR, Color.ofRgb(255, 0, 0)).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (magich) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.INSTANT_SPELL).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.INSTANT_SPELL).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (smokeh) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.SMOKE).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.SMOKE).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (hearth) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.HEART).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.HEART).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (pearlh) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.ENDER_TELEPORT).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.ENDER_TELEPORT).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
if (witchh) {
player.spawnParticles(ParticleEffect.builder().type(ParticleTypes.WITCH_SPELL).build(),
world.spawnParticles(ParticleEffect.builder().type(ParticleTypes.WITCH_SPELL).build(),
player.getLocation().getPosition().add(0, 2.5, 0));
}
}
Expand Down

0 comments on commit 1a22fba

Please sign in to comment.