Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (args.length > 0 && args[0].equalsIgnoreCase("menu")) {
- if(!player.hasPermission("simpleinventorypets.create")) {
- msg(player, permission);
- }
- if (args[1].equalsIgnoreCase("add")) {
- Block targetedBlock = player.getTargetBlock(null, 10);
- Location location = targetedBlock.getLocation();
- if(targetedBlock.getType() == Material.TURTLE_EGG) {
- List<String> list = plugin.getLocationsConfig().getStringList("locations");
- String testString = location.getX() + ", " + location.getY() + ", " + location.getZ();
- for (int i = 0; i < list.size(); i++) {
- String test = list.get(i);
- if (testString.equals(test)) {
- msg(player, sameLocation);
- return false;
- }
- }
- msg(player, successfulAdd);
- list.add(location.getX() + ", " + location.getY() + ", " + location.getZ());
- plugin.getLocationsConfig().set("locations", list);
- plugin.saveCustomYml(plugin.locationsConf, plugin.locationsYml);
- plugin.reloadCustomYml(plugin.locationsConf, plugin.locationsYml);
- location.getWorld().spawnEntity(location.add(0.5, 0, 0.5), EntityType.ARMOR_STAND);
- }
- else {
- msg(player, turtleEgg);
- }
- }
- else if (args.length > 0 && args[1].equalsIgnoreCase("remove")) {
- Block targetBlock = player.getTargetBlock(null, 10);
- Location location = targetBlock.getLocation();
- if (targetBlock.getType() == Material.TURTLE_EGG) {
- List<String> list = plugin.getLocationsConfig().getStringList("locations");
- String testString = location.getX() + ", " + location.getY() + ", " + location.getZ();
- for (int i = 0; i < list.size(); i++) {
- String test = list.get(i);
- if (testString.equals(test)) {
- msg(player, successfulRemove);
- list.remove(test);
- plugin.getLocationsConfig().set("locations", list);
- plugin.saveCustomYml(plugin.locationsConf, plugin.locationsYml);
- plugin.reloadCustomYml(plugin.locationsConf, plugin.locationsYml);
- return true;
- }
- }
- }
- else {
- msg(player, turtleEgg);
- }
- }
- else {
- msg(player, invalidArgs);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement