clean up particles
This commit is contained in:
parent
874e118d9d
commit
baa3f501b6
22 changed files with 75 additions and 154 deletions
|
@ -276,5 +276,6 @@ public class CommandEnvironment {
|
|||
this.registerExecutable(new CommandDelwarp());
|
||||
this.registerExecutable(new CommandShowwarp());
|
||||
this.registerExecutable(new CommandTphere());
|
||||
this.registerExecutable(new CommandEffect());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package server.command.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.model.ParticleType;
|
||||
import common.packet.SPacketParticles;
|
||||
import common.util.Vec3;
|
||||
import server.command.Command;
|
||||
import server.command.CommandEnvironment;
|
||||
import server.command.Executor;
|
||||
import server.command.UserPolicy;
|
||||
import server.network.Player;
|
||||
|
||||
public class CommandEffect extends Command {
|
||||
public CommandEffect() {
|
||||
super("effect");
|
||||
|
||||
this.addPlayerList("player", false, UserPolicy.NON_ADMINS_OR_SELF);
|
||||
this.addEnum("particle", ParticleType.class, ParticleType.values());
|
||||
this.addVector("position", true, false);
|
||||
this.setParamsOptional();
|
||||
this.addVector("offset", false, false);
|
||||
this.addDouble("speed", 0.0f, 100.0f, 0.0f);
|
||||
this.addInt("count", 0, 1000, 0);
|
||||
}
|
||||
|
||||
public void exec(CommandEnvironment env, Executor exec, List<Player> players, ParticleType type, Vec3 pos, Vec3 offset, double speed, int count) {
|
||||
offset = offset == null ? new Vec3(0.0, 0.0, 0.0) : offset;
|
||||
for(Player player : players) {
|
||||
player.sendPacket(new SPacketParticles(type, true, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, (float)offset.xCoord, (float)offset.yCoord, (float)offset.zCoord, (float)speed, count, 0));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,12 +20,10 @@ public class CommandPotion extends Command {
|
|||
this.addInt("duration", 0, 1000000, 1000000);
|
||||
this.addInt("strength", 1, 256, 1);
|
||||
|
||||
this.addFlag("particles", 'p');
|
||||
this.addFlag("ambient", 'a');
|
||||
this.addFlag("keep", 'k');
|
||||
}
|
||||
|
||||
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, int duration, int strength, boolean particles, boolean ambient, boolean keep) {
|
||||
public Object exec(CommandEnvironment env, Executor exec, List<EntityLiving> entities, Potion type, int duration, int strength, boolean keep) {
|
||||
int done = 0;
|
||||
for(EntityLiving entity : entities) {
|
||||
if(entity.isPotionApplicable(type, strength - 1)) {
|
||||
|
@ -33,7 +31,7 @@ public class CommandPotion extends Command {
|
|||
type.onImpact(null, null, entity, strength - 1, 1.0);
|
||||
}
|
||||
else {
|
||||
PotionEffect effect = new PotionEffect(type, duration == 0 ? Integer.MAX_VALUE : (duration * 20), strength - 1, ambient, particles);
|
||||
PotionEffect effect = new PotionEffect(type, duration == 0 ? Integer.MAX_VALUE : (duration * 20), strength - 1);
|
||||
if(!keep && entity.hasEffect(type))
|
||||
entity.removeEffect(type);
|
||||
entity.addEffect(effect);
|
||||
|
|
|
@ -2687,7 +2687,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
if(this.entity.hasEffect(Potion.SPEED))
|
||||
this.entity.removeEffect(Potion.SPEED);
|
||||
else
|
||||
this.entity.addEffect(new PotionEffect(Potion.SPEED, Integer.MAX_VALUE, 19, false, false));
|
||||
this.entity.addEffect(new PotionEffect(Potion.SPEED, Integer.MAX_VALUE, 19));
|
||||
this.addFeed(TextColor.GREEN + "Deine Geschwindigkeit wurde auf %dx geändert", (int)(this.entity.getAIMoveSpeed() * 10.0f));
|
||||
// int speed = this.playerEntity.speed != 1.0f ? 1 : 5;
|
||||
// this.playerEntity.speed = (float)speed;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue