Add SpeedCommand.java
Dieser Commit ist enthalten in:
Ursprung
8548edcebe
Commit
a7fbefbef4
@ -0,0 +1,37 @@
|
|||||||
|
package de.steamwar.bausystem.features.util;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Linked(LinkageType.COMMAND)
|
||||||
|
public class SpeedCommand extends SWCommand {
|
||||||
|
|
||||||
|
public SpeedCommand() {
|
||||||
|
super("speed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register(help = true)
|
||||||
|
public void genericHelp(Player p, String[] args) {
|
||||||
|
p.sendMessage("§8/§espeed §8[§e1§8-§e10§8] §8- §7Setzte deine Flug- und Laufgeschindigkeit.");
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: §e" + p.getFlySpeed() * 10F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register
|
||||||
|
public void speedCommand(Player p, float speed) {
|
||||||
|
speed = speed / 10F;
|
||||||
|
if(speed < -1F) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§c" + speed + " ist zu klein");
|
||||||
|
return;
|
||||||
|
} else if(speed > 1F) {
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "§c" + speed + " ist zu hoch");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
p.setFlySpeed(speed);
|
||||||
|
p.setWalkSpeed(speed);
|
||||||
|
p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: §e" + p.getFlySpeed() * 10F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren