
    StartupEvents.registry('palladium:abilities', (event) => {
        event.create('heroes:nearby_geo')
            .icon(palladium.createItemIcon('palladium:vibranium_circuit'))
			.addProperty("armor_type", "string", "Chest", "Helmet / Chest / Gauntlets / Boots / Orbit")
			.addProperty("custom_command_1", "string", " ", "Custom Command")
			.addProperty("custom_command_2", "string", " ", "Custom Command")
			.addProperty("form_all_armor", "boolean", false, "true/false")
			.firstTick((entity, entry, holder, enabled) => {
                if (enabled) {
					const form_all_armor = entry.getPropertyByName('form_all_armor');
					const armor_type = entry.getPropertyByName('armor_type');
					const custom_command_1 = entry.getPropertyByName('custom_command_1');
					const custom_command_2 = entry.getPropertyByName('custom_command_2');
                    let username = entity.getGameProfile().getName();
					let username_true = username.toLowerCase();
							
						let geo_max = global.geo_types;
						for (let geo_list = 0; geo_list <= geo_max; geo_list++) {
							let geo_type = global['geo_type_' + geo_list].toString();
								entity.persistentData['geo_type_' + geo_list] = 0

								}
								
					let scoreboard = Utils.server.scoreboard;
					let scoreboard_obj_temp = scoreboard.getObjective('Heroes.Geo_Armor.' + armor_type + '.Toggle');
					let value_temp = 0
					
					if (scoreboard_obj_temp != null || armor_type == "Orbit") {
					if (scoreboard_obj_temp != null) {
					let score = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_temp);
					let value = score.getScore();
					value_temp = value
					}
					
					if (value_temp != 1 || armor_type == "Orbit") {
						entity.server.runCommandSilent("execute as " + entity.uuid + " at @s run " + custom_command_1);
						entity.server.runCommandSilent("execute as " + entity.uuid + " at @s run " + custom_command_2);
					
						for (let pos of BlockPos.betweenClosed(new BlockPos(entity.x + 5, entity.y + 5, entity.z + 5), [entity.x - 5, entity.y - 5, entity.z - 5])) {
							
						let geo_max = global.geo_types;
						for (let geo_list = 0; geo_list <= geo_max; geo_list++) {
							let geo_type = global['geo_type_' + geo_list].toString();
							if(entity.getLevel().getBlock(pos).id === geo_type) {
								entity.persistentData['geo_type_' + geo_list] = entity.persistentData['geo_type_' + geo_list] + 1
								}
							}
						}
					// select rock type
						let geo_check = -1	
						let geo_max = global.geo_types;
						for (let geo_list = 0; geo_list <= geo_max; geo_list++) {
							let geo_amount = entity.persistentData['geo_type_' + geo_list]
								if (geo_amount >= 8) {
									if (geo_list > geo_check) {
										geo_check = geo_list
								}
							}
						}
						if (geo_check >= 0) {
							if (form_all_armor != true) {
						entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor." + armor_type + " " + geo_check + "");
						if (armor_type != "Orbit") {
						entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor." + armor_type + ".Toggle 1");
						} else {
						entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor." + armor_type + ".Amount 4");
								}
							} else {
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Helmet " + geo_check + "");
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Helmet.Toggle 1");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Chest " + geo_check + "");
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Chest.Toggle 1");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Boots " + geo_check + "");
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Boots.Toggle 1");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Gauntlets " + geo_check + "");
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Gauntlets.Toggle 1");
							}
						} else {
							entity.server.runCommandSilent('execute as ${entity.uuid} run /title @s actionbar ["",{"text":"You are unable to attract any material","bold":true,"color":"dark_red"}]');
						}
							} else {
								if (form_all_armor != true) {
								entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor." + armor_type + ".Toggle 0");
								} else {
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Helmet.Toggle 0");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Chest.Toggle 0");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Boots.Toggle 0");
							
							entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Geo_Armor.Gauntlets.Toggle 0");
								}
								
							}
						}
					}
            });
    });
