Compare commits
No commits in common. "b7bf79ee31830ade43f1fe0eaf07e9f980756849" and "b26b8a1ded2cf513f6d23fd2fca113699ff0a2ed" have entirely different histories.
b7bf79ee31
...
b26b8a1ded
3 changed files with 73 additions and 5 deletions
|
@ -56,11 +56,20 @@ public class Configuration {
|
||||||
chance = config.getDouble("chance");
|
chance = config.getDouble("chance");
|
||||||
attackDamage = config.getDouble("attackDamage");
|
attackDamage = config.getDouble("attackDamage");
|
||||||
attackDelay = config.getInt("attackDelay");
|
attackDelay = config.getInt("attackDelay");
|
||||||
|
|
||||||
jumpMode = config.getInt("jumpMode");
|
jumpMode = config.getInt("jumpMode");
|
||||||
jumpCondition = config.getInt("jumpCondition");
|
jumpCondition = config.getInt("jumpCondition");
|
||||||
jumpDelay = config.getInt("jumpDelay");
|
jumpDelay = config.getInt("jumpDelay");
|
||||||
jumpHeight = config.getDouble("jumpHeight", defaultJumpHeight());
|
|
||||||
|
if (jumpMode != 0) {
|
||||||
|
jumpHeight = config.getDouble("jumpHeight", -1);
|
||||||
|
if (jumpHeight == -1) {
|
||||||
|
jumpHeight = defaultJumpHeight();
|
||||||
|
}
|
||||||
|
logger.info("Jumping is experimental.");
|
||||||
|
logger.info("Jump mode: " + jumpMode);
|
||||||
|
logger.info("Jump condition: " + jumpCondition);
|
||||||
|
logger.info("Jump height: " + jumpHeight);
|
||||||
|
}
|
||||||
|
|
||||||
double _attackReach = config.getDouble("attackReach");
|
double _attackReach = config.getDouble("attackReach");
|
||||||
double _attackVerticalReach = config.getDouble("attackVerticalReach");
|
double _attackVerticalReach = config.getDouble("attackVerticalReach");
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -19,11 +20,13 @@ import java.util.Map;
|
||||||
|
|
||||||
public class GiantsCommand implements CommandExecutor {
|
public class GiantsCommand implements CommandExecutor {
|
||||||
private final GiantsPlugin plugin;
|
private final GiantsPlugin plugin;
|
||||||
|
private final Configuration configuration;
|
||||||
|
|
||||||
private final UpdateCommand updateCommand;
|
private final UpdateCommand updateCommand;
|
||||||
|
|
||||||
public GiantsCommand(GiantsPlugin plugin, UpdateCommand updateCommand) {
|
public GiantsCommand(GiantsPlugin plugin, Configuration configuration, UpdateCommand updateCommand) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.configuration = configuration;
|
||||||
this.updateCommand = updateCommand;
|
this.updateCommand = updateCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +46,19 @@ public class GiantsCommand implements CommandExecutor {
|
||||||
|
|
||||||
Player player = sender instanceof Player ? (Player) sender : null;
|
Player player = sender instanceof Player ? (Player) sender : null;
|
||||||
|
|
||||||
if (action.equals("serialize")) {
|
if (action.equals("spawn")) {
|
||||||
|
sender.sendMessage("This command is deprecated. Use /summon giant instead");
|
||||||
|
if (player != null) {
|
||||||
|
if (plugin.isSpawnableAt(player.getLocation())) {
|
||||||
|
sender.sendMessage("Spawned a Giant");
|
||||||
|
player.getWorld().spawnEntity(player.getLocation(), EntityType.GIANT);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("No space here for a Giant");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Only players can use this command.");
|
||||||
|
}
|
||||||
|
} else if (action.equals("serialize")) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
@ -81,6 +96,48 @@ public class GiantsCommand implements CommandExecutor {
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("Only players can use this command.");
|
sender.sendMessage("Only players can use this command.");
|
||||||
}
|
}
|
||||||
|
} else if (action.equals("jm")) { // TODO remove
|
||||||
|
if (args.length > 1) {
|
||||||
|
int mode = Integer.parseInt(args[1]);
|
||||||
|
configuration.jumpMode = mode;
|
||||||
|
|
||||||
|
sender.sendMessage("Jump mode set to " + mode);
|
||||||
|
sender.sendMessage("This command doesn't check if it's valid, an invalid value turns off jumping.");
|
||||||
|
|
||||||
|
if (configuration.jumpHeight == -1) {
|
||||||
|
configuration.jumpHeight = configuration.defaultJumpHeight();
|
||||||
|
sender.sendMessage("Jump height set to " + configuration.jumpHeight + ". Modify it with /giants jumpheight");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Jump mode: " + configuration.jumpMode);
|
||||||
|
}
|
||||||
|
} else if (action.equals("jh")) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
double height = Double.parseDouble(args[1]);
|
||||||
|
configuration.jumpHeight = height;
|
||||||
|
|
||||||
|
sender.sendMessage("Jump height set to " + height);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Jump height: " + configuration.jumpHeight);
|
||||||
|
}
|
||||||
|
} else if (action.equals("jc")) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
int condition = Integer.parseInt(args[1]);
|
||||||
|
configuration.jumpCondition = condition;
|
||||||
|
|
||||||
|
sender.sendMessage("Jump condition set to " + condition);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Jump condition: " + configuration.jumpCondition);
|
||||||
|
}
|
||||||
|
} else if (action.equals("jd")) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
int delay = Integer.parseInt(args[1]);
|
||||||
|
configuration.jumpDelay = delay;
|
||||||
|
|
||||||
|
sender.sendMessage("Jump delay set to " + delay);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("Jump delay: " + configuration.jumpDelay);
|
||||||
|
}
|
||||||
} else if (action.equals("update")) {
|
} else if (action.equals("update")) {
|
||||||
if (updateCommand != null)
|
if (updateCommand != null)
|
||||||
updateCommand.onCommand(sender, command, label, args);
|
updateCommand.onCommand(sender, command, label, args);
|
||||||
|
|
|
@ -9,8 +9,10 @@ load: STARTUP
|
||||||
commands:
|
commands:
|
||||||
giants:
|
giants:
|
||||||
description: Utility command for Giants
|
description: Utility command for Giants
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
giants.command.spawn:
|
||||||
|
description: Permits /giants spawn
|
||||||
|
default: op
|
||||||
giants.command.serialize:
|
giants.command.serialize:
|
||||||
description: Permits /giants serialize
|
description: Permits /giants serialize
|
||||||
default: op
|
default: op
|
||||||
|
|
Loading…
Reference in a new issue