mloeschenkohl hace 3 años
padre
commit
81d1e2ef6d

+ 96 - 0
JanTest4.txt

@@ -0,0 +1,96 @@
+event.load("player_toss");
+event.load("entity_click");
+event.load("living_death");
+randblock_x1 = -2987;
+randblock_x2 = -3000;
+randblock_z1 = -1000;
+randblock_z2 = -1004;
+middleloc = -2994;
+
+@checkgame
+wait();
+
+if(event == "living_death"){
+	if(entity.getType(living_entity) == "falling_block"){
+		p = "SirTerence7";
+	}else{
+		goto("checkgame");
+	}
+}else{
+	p = player.getName(player);
+}
+if(p == "SirTerence7" || p == "Mareeeen"){
+	ignoreGoto(event);
+}
+goto("checkgame");
+
+@player_toss
+cancel = true;
+item = entity.getEquip(player, "hand");
+item_type = item.getType(item);
+if(item_type == "minecraft:bedrock") {
+	location = entity.getLocation(player);
+	array = entity.getLook(player);
+	array2 = entity.getMotion(player);
+	x = array[0] + array2[0]*0.5;
+	y = array[1] + math.abs(array2[1])*0.5;
+	z = array[2] + array2[2]*0.5;
+	falling_block_entity = entity.spawn("falling_block", location, "{BlockState:{Name:\"minecraft:bedrock\"},Time:1,Motion:[0.0,1.0,0.0],DropItem:0,HurtEntities:1}");
+	entity.throw(falling_block_entity, x, y, z);
+	sgoto(5, "loop");
+}
+goto("checkgame");
+
+@entity_click
+entity_type = entity.getType(entity);
+if(entity_type == "falling_block"){
+	location = entity.getLocation(player);
+	array = entity.getLook(player);
+	array2 = entity.getMotion(player);
+	x = array[0]*0.5 + array2[0]*0.5;
+	y = array[1]*0.5 + math.abs(array2[1])*0.5;
+	z = array[2]*0.5 + array2[2]*0.5;
+	entity.throw(falling_block_entity, x, y, z);
+}
+goto("checkgame");
+
+@living_death
+x = loc.getX(entity.getLocation(living_entity));
+if(x > middleloc){
+	msg("dev", "Team 1 - Punkt");
+	//team = 0;
+	//team2 = 1;
+}else{
+	msg("dev", "Team 2 - Punkt");
+	//team = 1;
+	//team2 = 0;
+}
+//map.add(points, team, map.get(points, team) + 1);
+//updateDisplay();
+//minigame.speakAll(gamename,"§eThe ", map.get(teamcolortext2,team), "§eTeam scored a point.");
+//if(map.get(points, team) == maxpoints){
+//	winning_team = team;
+//	goto("win");
+//}
+//goto("Aufschlag");
+goto("checkgame");
+
+@loop
+ent_loc_x = loc.getX(entity.getLocation(falling_block_entity));
+ent_loc_z = loc.getZ(entity.getLocation(falling_block_entity));
+if(ent_loc_x >= randblock_x1 || ent_loc_x <= randblock_x2){
+		motion = entity.getMotion(falling_block_entity);
+		x = -motion[0];
+		y = motion[1];
+		z = motion[2];
+		entity.throw(falling_block_entity, x, y, z);
+}
+if(ent_loc_z >= randblock_z1 || ent_loc_z <= randblock_z2){
+		motion = entity.getMotion(falling_block_entity);
+		x = motion[0];
+		y = motion[1];
+		z = -motion[2];
+		entity.throw(falling_block_entity, x, y, z);
+}
+sgoto(5, "loop");
+goto("checkgame");

+ 43 - 0
JanTest5.txt

@@ -0,0 +1,43 @@
+event.load("player_toss");
+event.load("entity_click");
+event.load("block_click");
+Fun_Block = "minecraft:red_wool";
+tag = text.concat("{BlockState:{Name:\"", Fun_Block, "\"},Time:1,Motion:[0.0,0.5,0.0],DropItem:1,HurtEntities:0}");
+
+@checkgame
+wait();
+
+if(perm.has(player, "isVIP") || perm.has(player, "isTeam")){
+	ignoreGoto(event);
+}
+goto("checkgame");
+
+@player_toss
+if(item.getType(entity.getEquip(player, "hand")) == Fun_Block) {
+	cancel = true;
+	falling_block_entity = entity.spawn("falling_block", entity.getLocation(player), tag);
+	throw(player, falling_block_entity);
+}
+goto("checkgame");
+
+@entity_click
+if(entity.getType(entity) == "falling_block"){
+	throw(player, falling_block_entity);
+}
+goto("checkgame");
+
+@block_click
+if(block_type == Fun_Block){
+	block.set(block_loc, "minecraft:air");
+	falling_block_entity = entity.spawn("falling_block", block_loc, tag);
+}
+goto("checkgame");
+
+function throw(p, entity_to_throw){
+	array = entity.getLook(p);
+	array2 = entity.getMotion(p);
+	x = array[0]*0.225 + array2[0]*0.25;
+	y = math.abs(array[1]*0.75) + math.abs(array2[1])*0.5;
+	z = array[2]*0.225 + array2[2]*0.25;
+	entity.throw(entity_to_throw, x, y, z);
+}

+ 1 - 0
MarvWusi2.txt

@@ -0,0 +1 @@
+msg("dev", "wusi");

+ 352 - 0
minigames/Volleyball/Volleyball.txt

@@ -0,0 +1,352 @@
+rankingtable = "Volleyranks";
+game_short = "Volley";
+specific_lobby_handling = true;
+no_core_reset = true;
+gamename = "§6Volleyball";
+
+colorcodes = map.new();
+map.add(colorcodes, 0, "§1");
+map.add(colorcodes, 1, "§4");
+
+teamcolortext = map.new();
+map.add(teamcolortext, 0, "§1blue");
+map.add(teamcolortext, 1, "§4red");
+
+teamcolortext2 = map.new();
+map.add(teamcolortext2, 0, "§1Blue");
+map.add(teamcolortext2, 1, "§4Red");
+
+team_lists = map.new(); //Map mit Spielerlisten für jedes Team
+map.add(team_lists, 0, list.new());
+map.add(team_lists, 1, list.new());
+
+players = map.new(); //Alle Spieler (key) des Spiels und deren Teamzugehörigkeit (value)
+playersinteam = map.new(); //Anzahl der Spieler im Team
+allteams = list.new(); //Alle Teams, die noch im Spiel sind
+waiters = list.new(); //Spieler in der Lobby ohne Teamzugehörigkeit
+points = map.new(); //Punktestand der Teams
+
+gosub("setstart");
+goto("simplelobby");
+
+randblock_x1 = 5; //vorerst weil noch keine map vorhanden ist
+randblock_x2 = -5;
+
+randblock_z1 = 5;
+randblock_z2 = -5;
+
+@specificLobbyHandling
+player_name = player.getName(player);
+if(event == "player_join") {
+	list.add(waiters, player_name);
+	entity.setHealth(player, 20);
+	player.setHunger(player, 20);
+	player.setSaturation(player, 5);
+	player.clearInventory(player);
+	display.reset(player);
+	display.add(player, 1, gamename);
+	display.add(player, 2, mapname);
+	display.add(player, 3, "Spieler: 2x6");
+	return;
+}
+if(event == "player_logout" || event == "player_giveup") {
+	list.remove(waiters, player_name);
+	team = map.get(players, player_name);
+	if(team != null) {
+		teamlist = map.get(team_lists, team);
+		list.remove(teamlist, player_name);
+	}
+	map.remove(players, player_name);
+	return;
+}
+if(event == "block_click") {
+	if(hand == "OFF_HAND" || action == "left") {
+		return;
+	}
+	if(list.contains(joinblocks, block_loc)) {
+		newteam = list.getIndexOf(joinblocks, block_loc);
+		newteamlist = map.get(team_lists, newteam);
+		if(list.contains(newteamlist, player_name)) {
+			msg.prefix(player, gamename, "§eYou are already in this team.");
+			return;
+		}
+		if(list.getSize(newteamlist) >= teamsize) {
+			msg.prefix(player, gamename, "§eNo space for you in this team.");
+			return;
+		}
+		list.remove(waiters, player_name);
+		yetteam = map.get(players, player_name);
+		if(yetteam != null) {
+			yetteamlist = map.get(team_lists, yetteam);
+			list.remove(yetteamlist, player_name);
+		}
+		list.add(newteamlist, player_name);
+		map.add(players, player_name, newteam);
+		msg.prefix(player, gamename, concat("§eYou joined the ", map.get(teamcolortext, newteam), " §eteam."));;
+	}
+}
+return;
+
+@finalstart
+player_list = minigame.getPlayers(script_id);
+starttime = time.getMillis();
+event.load("player_toss");
+event.load("entity_click");
+event.load("living_pre_hurt");
+event.load("block_drop");
+
+while(list.getSize(waiters) != 0) {
+	team = getTeamWithLowestPeople(team_lists, numberofteams);
+	teamlist = map.get(team_lists, team);
+	p_name = list.getIndex(waiters, 0);
+	map.add(players, p_name, team);
+	list.add(teamlist, p_name);
+	list.remove(waiters, p_name);
+}
+
+minigame.displayAll(1, gamename);
+for(i = 0; i < numberofteams; i++) {
+	teamlist = map.get(team_lists, i);
+	size = list.getSize(teamlist);
+	if(size != 0) {
+		list.add(allteams, i);
+		map.add(points, i);
+		minigame.displayAll(i + 2, concat(map.get(teamcolortext2, i), " Points: ", text.number(points)));
+	}
+}
+
+for(i = 0; i < list.getSize(player_list); i++) {
+	p = player.get(list.getIndex(player_list, i));
+	p_name = player.getName(p);
+	msg.prefix(p, gamename, "The game has started.");
+	team = map.get(players, p_name);
+	player.setHunger(p, 20);
+	player.setSaturation(p, 5);
+	player.setGamemode(p, "survival");
+	player.setFly(p, false);
+	player.action(p, concat(map.get(colorcodes, team), "Team ", map.get(teamcolortext2, team)));
+	stacks.clear(p);
+}
+
+for(team = 0; team < numberofteams; team++) {
+	teamsize = map.get(playersinteam, team);
+	if(teamsize != 0) {
+		list.add(allteams, team);
+		map.add(points, team, 0);
+	}
+}
+				//*Volleyball wäre möglich, Aufschlag ist droppen der rest ist klicken
+
+				block_place/break wird verhindert, block_drop würde einen Punkt geben (Feld ist aus halfslabs 
+				-> immer blockdrop wenn block den boden berührt) location ist wichtig
+				2 Teams
+				bei aufschlag player_move verhindern
+				entity_click wird gezählt bei >3 für ein team bekommt das andere einen punkt und Aufschlag
+				*//
+sgoto(20, "loop");
+
+@checkgame
+wait();
+
+if(player.hasMinigameId(player, script_id)) {
+	ignoreGoto(event);
+}
+goto("checkgame");
+
+@Aufschlag
+teamlist = map.get(team_lists, team);
+p_uuid = list.getIndex(teamlist, math.random(0, list.getSize(teamlist) - 1));
+p = player.get(p_uuid);
+player.setInvSlot(p, 5, "minecraft:bedrock");
+goto("checkgame");
+
+@player_toss
+cancel = true;
+player = player;//*?*//
+//*player = living_entity; ist schon player?*//
+item = entity.getEquip(player, "hand");
+item_type = item.getType(item);
+//*isblock(item_type) wäre benötigt um nicht einzelne Blöcke zu werfen?*//
+if(item_type == "minecraft:bedrock") {
+	location = entity.getLocation(player);
+	array = entity.getLook(player);
+	array2 = entity.getMotion(player);
+	x = array[0] * 1.5 + array2[0];
+	y = array[1] * 1.5 + math.abs(array2[1]);
+	z = array[2] * 1.5 + array2[2];
+	block = entity.spawn(falling_block, location,  {BlockState:{Name:"minecraft:bedrock"},Time:1,Motion:[0.0,1.0,0.0],DropItem:0,HurtEntities:1});
+	entity.throw(block, x, y, z);
+	player.removeItem(player, bedrock)
+}
+goto("checkgame");
+
+@entity_click
+block = entity.getType(entity);
+player = player;//*?*//
+if(block == falling_block){
+	location = entity.getLocation(player);
+	array = entity.getLook(player);
+	array2 = entity.getMotion(player);
+	x = array[0] * 1.5 + array2[0];
+	y = array[1] * 1.5 + math.abs(array2[1]);
+	z = array[2] * 1.5 + array2[2];
+	entity.throw(block, x, y, z);
+}
+goto("checkgame");
+
+@living_pre_hurt
+block = damage_source;
+player = living_entity;
+cancel = true;
+if(block == falling_block){
+	location_player = entity.getLocation(player);
+	location_block = entity.getLocation(block);
+	motion_player = entity.getMotion(block);
+	motion_block = entity.getMotion(block);
+	if(location_block[1]-location_player[1] < 1){
+		x = motion_block[0] + motion_player[0]*0.5;
+		y = math.abs(motion_block[1]) + math.abs(motion_player[1]*0.5);
+		z = motion_block[2] + motion_player[2]*0.5;
+		entity.throw(block, x, y, z);
+	}else{
+		x = -motion_block[0] + motion_player[0]*0.5;
+		y = math.abs(motion_block[1]) + math.abs(motion_player[1]*0.5);
+		z = -motion_block[2] + motion_player[2]*0.5;
+		entity.throw(block, x, y, z);
+	}
+}
+goto("checkgame");
+
+@block_drop
+loc = location;
+x = loc[0]
+if(x > middleloc){
+	team = 0;
+	team2 = 1;
+}else{
+	team = 1;
+	team2 = 0;
+}
+map.add(points, team, map.get(points, team) + 1);
+updateDisplay();
+minigame.speakAll(gamename,"§eThe ", map.get(teamcolortext2,team), "§eTeam scored a point.");
+if(map.get(points, team) == maxpoints){
+	winning_team = team;
+	goto("win");
+}
+goto("Aufschlag");
+
+@block_break
+@block_place
+cancel = true;
+goto("checkgame");
+
+@loop
+ent_loc = entity.getLocation(block);
+motion = entity.getMotion(block);
+if(ent_loc[0] >= randblock_x1 || ent_loc[0] <= randblock_x2){
+		x = -motion[0];
+		y = motion[1];
+		z = motion[2];
+		entity.throw(block, x, y, z);
+}
+if(ent_loc[2] >= randblock_z1 || ent_loc[2] <= randblock_z2){
+		x = motion[0];
+		y = motion[1];
+		z = -motion[2];
+		entity.throw(block, x, y, z);
+}
+
+sgoto(20, "loop");
+goto("checkgame");
+
+@player_giveup
+@player_logout
+player_name = player.getName(player);
+team = map.get(players, player_name);
+color = map.get(colorcodes, team);
+minigame.speakAll(gamename, concat(color, player_name, " §ehas left the game."));
+teamlist = map.get(team_lists, team);
+list.remove(teamlist, player_name);
+map.remove(players, player_name);
+script = script.getFromId(script_id);
+minigame.kickplayer(script, player);
+if(list.getSize(teamlist) == 0) {
+	kickteam(team, true, false);
+	winning_team = list.getIndex($allteams, 0);
+	goto("win");
+}
+goto("checkgame");
+
+@win 
+tempcolortext = map.get($teamcolortext, winning_team);
+minigame.speakAll($gamename, concat("§cThe ", tempcolortext, " §cTeam has Won."));
+list.remove($allteams, team);
+$endtime = time.getMillis();
+
+for(i = 0; i < list.getSize(player_list); i++) {
+	player_uuid = list.getIndex(player_list, i);
+	p = player.get(player_uuid);
+	team = map.get(players, player_uuid);
+	if(team == winning_team) {
+		showstats(p, true, true);
+	} else {
+		showstats(p, true, false);
+	}
+	script = script.getFromId(script_id);
+	minigame.kickPlayer(script, p);
+}
+
+minigame.kickAllPlayers(script);
+minigame.term(script, gamesignloc);
+term();
+
+function showstats(player, show_time, won) { //Player player, Boolean show_time, Boolean won
+	player_name = player.getName(player);
+	player_id = player.getId(player);
+	last_record = ranking.getPoints($rankingtable, player_id);
+	playedgames = minigame.getPlayed(player_id, $game_short) + 1;
+	minigame.setPlayed(player_id, $game_short, playedgames);
+	kills = map.get($kills_map, player_name);
+	record = last_record + kills;
+	ranking.setPoints($rankingtable, player_id, record);
+	deaths = map.get($deaths_map, player_name);
+	wongames = minigame.getWon(player, "snow");
+	if(won) {
+		wongames++;
+		minigame.setWon(player, "snow", wongames);
+	}
+	
+	minigame.statsHeader(player, $gamename, "§e");
+	if(show_time) {
+		time = ($endtime - $starttime) / 1000;
+		minigame.statsLine(player, "§e", "Time", concat(text.number(math.rounddown(time / 60)), " min ", text.number(math.round(time % 60)), " s"));
+	}
+	minigame.statsLine(player, "§e", "Kills", text.number(kills));
+	minigame.statsLine(player, "§e", "Deaths", text.number(deaths));
+	if(deaths != 0) {
+		kd = kills / deaths;
+		minigame.statsLine(player, "§e", "K/D",  text.number(math.roundcomma(kd, 2)));
+	}
+	minigame.statsLine(player, "§e", "Won games", text.number(wongames));
+	minigame.statsLine(player, "§e", "Played games", text.number(playedgames));
+	if(playedgames != 0) {
+		minigame.statsLine(player, "§e", "Win ratio", concat(text.number(math.roundComma((wongames / playedgames) * 100, 2)), "%"));
+	}
+}
+
+function canStartGame() {
+	if(list.getSize($waiters) > 0) {
+		return true;
+	}
+	player_list = minigame.getPlayers(script_id);
+	all_size = list.getSize(player_list);
+	for(i = 0; i < $numberofteams; i++) {
+		teamlist = map.get($team_lists, i);
+		team_size = list.getSize(teamlist);
+		if(team_size == all_size) {
+			return false;
+		}
+	}
+	return true;
+}

+ 4 - 4
minigames/mengerrun/menger_map1.txt

@@ -1,8 +1,8 @@
 jan_mr_skills = list.new();
-addMengerSkill("Skill1", "km:skill15", 3, 2,"jump_boost", null, null, null);
-addMengerSkill("Skill2", "km:skill15", 3, 8, "jump_boost", 3, 3, "speed");
-addMengerSkill("Skill3", "km:skill15", 3, 21, "jump_boost", 3, 5, "speed");
-addMengerSkill("Skill4", "km:skill15", 3, 25, "jump_boost", 3, 7, "speed");
+addMengerSkill("Normal", "km:skill15", 0);
+addMengerSkill("Medium", "km:skill15", 1.5);
+addMengerSkill("High", "km:skill15", 2.5);
+addMengerSkill("Extreme", "km:skill15", 4);
 
 gamesworld = world.getGames();
 edge_loc_1 = loc.new(gamesworld, -1242, 242, 3081);

+ 35 - 17
minigames/mengerrun/mengerrun.txt

@@ -2,6 +2,7 @@ rankingtable = "mrranks";
 game_short = "mr";
 
 times = map.new();
+jump_strength = map.new();
 tp_times = map.new();
 seekerlist = list.new();
 escaperlist = list.new();
@@ -27,6 +28,8 @@ return;
 player_list = minigame.getPlayers(script_id);
 
 event.load("function_key");
+event.load("living_jump");
+strength = 0;
 
 //Temp-Kopie von player_list erstellen
 templist = list.new();
@@ -37,6 +40,7 @@ for(i = 0; i < amount_players; i++) {
 	msg.prefix(p, gamename, "The game has started.");
 	list.add(templist, p_uuid);
 	map.add(times, p_uuid, start_life_time);
+	map.add(jump_strength, p_uuid, 0);
 	player.setGamemode(p, "adventure");
 	player.setFly(p, false);
 	menger.tpPlayer(p);
@@ -64,7 +68,7 @@ sgoto(20, "loop");
 
 @checkgame
 wait();
-if(event == "living_pre_hurt") {
+if(event == "living_pre_hurt" || event == "living_jump") {
 	if(!isPlayer(living_entity)) {
 		goto("checkgame");
 	}
@@ -79,17 +83,29 @@ goto("checkgame");
 if(key > list.getSize(jan_mr_skills)) {
 	goto("checkgame");
 }
+p_f = player.getUuid(player);
 skill = list.getIndex(jan_mr_skills, key - 1);
 skill_name = skill[0];
-effecttime1 = skill[2]; //s
-amplifier1 = skill[3];
-tech_name1 = skill[4];
-effecttime2 = skill[5]; //s
-amplifier2 = skill[6];
-tech_name2 = skill[7];
-entity.addEffect(player, tech_name1, effecttime1 * 20, amplifier1, false);
-if(tech_name2 != null) {
-	entity.addEffect(player, tech_name2, effecttime2 * 20, amplifier2, false);
+strength = skill[2];
+if(map.get(jump_strength, p_f) == strength){
+	message = text.concat("Your Jump Strength is already set to ", skill_name, ".");
+}else{
+	map.add(jump_strength, p_f, strength);
+	message = text.concat("Your Jump Strength is now set to ", skill_name, ".");
+}
+p = player.get(p_f);
+msg.prefix(p, gamename, message);
+goto("checkgame");
+
+@living_jump
+jump = map.get(jump_strength, player.getUuid(player));
+if(jump > 0){
+	array = entity.getLook(living_entity);
+	array2 = entity.getMotion(living_entity);
+	x = array[0] * strength + array2[0];
+	y = math.abs(array[1]) * strength + array2[1];
+	z = array[2] * strength + array2[2];
+	entity.throw(living_entity, x, y, z);
 }
 goto("checkgame");
 
@@ -127,17 +143,21 @@ if(!list.contains(player_list, defender_uuid)) {
 	goto("checkgame");
 }
 if(!player.hasMinigameId(attacker, script_id)) {
+	cancel = true;
 	goto("checkgame");
 }
 attacker_uuid = player.getUuid(attacker);
 if(defender_uuid == attacker_uuid) {
+	cancel = true;
 	goto("checkgame");
 }
 if(!list.contains(player_list, attacker_uuid)) {
 	msg.prefix(defender, gamename, "§eIllegal player in game.");
+	cancel = true;
 	goto("checkgame");
 }
 if(list.contains(seekerlist, attacker_uuid) && list.contains(escaperlist, defender_uuid)) {
+	cancel = true;
 	menger.tpPlayer(defender);
 	setSeeker(defender);
 	msg.prefix(defender, gamename, "Catch other players!");
@@ -149,6 +169,9 @@ if(list.contains(seekerlist, attacker_uuid) && list.contains(escaperlist, defend
 	}
 	map.add(times, attacker_uuid, new_time);
 }
+if(list.contains(escaperlist, attacker_uuid) && list.contains(seekerlist, defender_uuid)) {
+	cancel = true;
+}
 goto("checkgame");
 
 @block_break
@@ -231,16 +254,11 @@ function setStackIcons(player) {
 	stacks.setActive(player, true);
 }
 
-function addMengerSkill(skill_name, icon, effecttime1, amplifier1, tech_name1, effecttime2, amplifier2, tech_name2) {
+function addMengerSkill(skill_name, icon, menger_strength) {
 	skill = array.new(8);
 	skill[0] = skill_name;
 	skill[1] = icon;
-	skill[2] = effecttime1; //s
-	skill[3] = amplifier1;
-	skill[4] = tech_name1;
-	skill[5] = effecttime2; //s
-	skill[6] = amplifier2;
-	skill[7] = tech_name2;
+	skill[2] = menger_strength;
 	list.add($jan_mr_skills, skill);
 }
 

+ 3 - 2
startscript.txt

@@ -1,3 +1,4 @@
+debug.setConsolePrint(false);
 clearscriptvars();
 
 setMOTD("§eNews§7: §2Clans §f& §cCities! §f- [§d1.16.4§f]\n§cMod Download §f-> §eminecraft§7.§ehammerle§7.§eme");
@@ -13,6 +14,7 @@ script.startNamed("Copyisland", "system/copyisland");
 script.startNamed("Damage", "system/damage");
 script.startNamed("Doors", "system/doors", "utils/u_general");
 script.startNamed("Harvest", "system/harvest", "utils/u_general");
+script.startNamed("Hawkeye", "system/hawkeye", "utils/u_general");
 script.startNamed("Herobrine", "system/herobrine", "utils/u_general");
 script.startNamed("Playtime", "system/playtime");
 script.startNamed("Pumpkin", "system/pumpkin", "utils/u_general");
@@ -32,6 +34,5 @@ script.startNamed("Timber", "system/timber", "utils/u_general");
 script.startNamed("Gamerules", "system/gamerules");
 script.startNamed("Scheduler", "system/scheduler", "utils/u_general");
 
-error.setConsolePrint(true);
-debug.setConsolePrint(false);
+error.setConsolePrint(false);
 term();

+ 103 - 0
story/admont/albtraum.txt

@@ -0,0 +1,103 @@
+event.load("quest_start");
+event.load("quest_term");
+event.load("custom_command");
+event.load("living_death");
+event.load("living_pre_hurt");
+
+world = world.getStory();
+mob_loc_1 = loc.new(world, -1633.5, 70, -80.5);
+mob_loc_2 = loc.new(world, -1635.5, 70, -82.5);
+
+zombie_count = 0;
+stage = 0;
+all_stages = 1;
+quest_name = "Albtraum";
+
+@wait
+wait();
+if(event == "living_pre_hurt") {
+	player = player.getFromDamageSource(damage_source);
+	if(player == null) {
+		goto("wait");
+	}
+}
+if(event == "living_death") {
+	if(isPlayer(living_entity)) {
+		if(zombie == 0) {
+			entity.remove(zombie1);
+			entity.remove(zombie2);
+			entity.remove(zombie3);
+			entity.remove(zombie4);
+			entity.remove(zombie5);
+		}	
+		player = living_entity;
+		msg.prefix(player, "§dQuest", "Quest terminiert.");
+		quest.term(script, player);
+		goto("wait");
+	}
+	player = player.getFromDamageSource(damage_source);
+	if(player == null) {
+		goto("wait");
+	}
+}
+if(!player.isQuester(player, script)) {
+	goto("wait");
+}
+if(event == "quest_term") {
+	entity.remove(zombie1);
+	entity.remove(zombie2);
+	entity.remove(zombie3);
+	entity.remove(zombie4);
+	entity.remove(zombie5);
+	wait(); //Script wird von außen terminiert
+}
+if(event == "quest_start") {
+	quest.display(player, quest_name, stage, all_stages);
+	msg.prefix(player, "§dHerbert", "MONSTER! GANZ VIELE MONSTER");
+	scheduler.msgPrefix(30, player, "§dHerbert", "ICH HABE SIE MIT MEINEN EIGENEN AUGEN GESEHEN!");
+	scheduler.msg(60, player, "§dAntwortmöglichkeiten:");
+	scheduler.msg(60, player, text.click("[§dA§r] §eJetzt mal ruhig, was ist denn los?", "/questanswer A"));
+	scheduler.msg(60, player, text.click("[§dB§r] §eWie? Wo? Was?", "/questanswer B"));
+	goto("wait");
+}
+
+label = concat("stage", text.number(stage));
+goto(label);
+
+@stage0
+if(event == "custom_command" && command == "questanswer") {
+	option = list.getIndex(args, 0);
+	if(option == "A") {
+		stage.increase(player);
+		msg.prefix(player, "§dHerbert", "Oh `tschuldigung, ich wollte nicht schreien. Ich bin so schnell ich konnte weggerannt. Vor…vor den M…Monstern.");
+		scheduler.msgprefix(30, player, "§dHerbert", "Sie waren in der Windmühle, bitte unternimm etwas!");
+	}
+	if(option == "B") {
+		stage.increase(player);
+		msg.prefix(player, "§dHerbert", "GRUSELIG! IN DER WINDMÜHLE! MONSTER! HILFE!");
+	}
+	if(option == "A" || option == "B"){
+		player.giveSingleItem(player, read.item("minecraft:stone_sword"), false);
+		zombie1 = entity.spawn("zombie", mob_loc_1);
+		zombie2 = entity.spawn("zombie", mob_loc_1);
+		zombie3 = entity.spawn("zombie", mob_loc_2);
+		zombie4 = entity.spawn("zombie", mob_loc_2);
+		zombie5 = entity.spawn("zombie", mob_loc_2);
+	}
+}
+goto("wait");
+
+@stage1
+if(event == "living_death"){
+	entity_type = entity.getType(living_entity);
+	if(entity_type == "zombie") {
+		zombie_count++;
+		if(zombie_count == 5) {
+			msg.prefix(player, "§dHerbert", "Du bist meine Rettung.");
+			msg(player, "§dQuest abgeschlossen. Belohnung: 6 Snuvis!");
+			addMoney(player, 6);
+			quest.finish(script, player);
+		}
+	}
+}
+goto("wait");

+ 31 - 0
story/admont/core.txt

@@ -78,6 +78,7 @@ if(entity_name == "Merle") {
 if(entity_name == "Herbert") {
 	inv = inv.new("333333333");
 	inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fSchatz von Admont"));
+	inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fAlbtraum"));
 	inv.open(inv, player, "Quests: Herbert");
 	goto("wait");
 }
@@ -137,6 +138,18 @@ if(entity_name == "Rolf") {
 	inv.open(inv, player, "Quests: Rolf");
 	goto("wait");
 }
+if(entity_name == "Schmied") {
+	inv = inv.new("333333333");
+	inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDie Uhr tickt"));
+	inv.open(inv, player, "Quests: Schmied");
+	goto("wait");
+}
+if(entity_name == "Förster") {
+	inv = inv.new("333333333");
+	inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fIch und mein Holz"));
+	inv.open(inv, player, "Quests: Förster");
+	goto("wait");
+}
 goto("wait");
 
 @inv_click
@@ -193,6 +206,10 @@ if(inv_name == "Quests: Herbert") {
 		quest.start(player, "story/admont/schatz_von_admont");
 		goto("wait");
 	}
+	if(inv_slot == 1) {
+		quest.start(player, "story/admont/albtraum");
+		goto("wait");
+	}
 	goto("wait");
 }
 if(inv_name == "Quests: Gustav") {
@@ -266,6 +283,20 @@ if(inv_name == "Quests: Rolf") {
 	}
 	goto("wait");
 }
+if(inv_name == "Quests: Schmied") {
+	if(inv_slot == 0) {
+		quest.start(player, "story/admont/die_uhr_tickt");
+		goto("wait");
+	}
+	goto("wait");
+}
+if(inv_name == "Quests: Förster") {
+	if(inv_slot == 0) {
+		quest.start(player, "story/admont/ich_und_mein_holz");
+		goto("wait");
+	}
+	goto("wait");
+}
 if(inv_name == "Skillshop") {
 	if(item.getType(item) == "minecraft:air") {
 		goto("wait");

+ 113 - 0
story/admont/die_uhr_tickt.txt

@@ -0,0 +1,113 @@
+event.load("quest_start");
+event.load("quest_term");
+event.load("entity_click");
+event.load("block_break");
+
+stage = 0;
+all_stages = 4;
+quest_name = "Die Uhr tickt";
+
+gold = 0;
+orchids = 0;
+bluedye = 0;
+
+@wait
+wait();
+if(!player.isQuester(player, script)) {
+	goto("wait");
+}
+if(event == "quest_term") {
+	//Hier Code einfügen...
+	wait(); //Script wird von außen terminiert
+}
+if(event == "quest_start") {
+	quest.display(player, quest_name, stage, all_stages);
+	msg.prefix(player, "§dSchmied", "Guten Tag!");
+	scheduler.msgPrefix(30, player, "§dSchmied", "Der gute Herbert hat eine neue Uhr in Auftrag gegeben.");
+	scheduler.msgPrefix(60, player, "§dSchmied", "Ich wollte gerade anfangen, da habe ich bemerkt, dass er mir noch garnicht das Gold dafür geliefert hat.");
+	scheduler.msgPrefix(90, player, "§dSchmied", "Sei doch so lieb und schau' beim Herbert vorbei, hole 5 Goldstücke und richte ihm meine Grüße aus.");
+	goto("wait");
+}
+
+label = concat("stage", text.number(stage));
+goto(label);
+
+@stage0
+if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
+	entity_name = entity.getName(entity);
+	if(entity_name == "Herbert") {
+		stage.increase(player);
+		msg.prefix(player, "§dHerbert", "Naa, was führt dich hierher?");
+		scheduler.msgPrefix(30, player, concat("§5", player.getName(player)), "Ich soll Grüße von der Schmiede ausrichten, es werden 5 Goldstücke für deine Uhr benötigt.");
+		scheduler.msgPrefix(60, player, "§dHerbert", "Ooohh das habe ich ja glatt vergessen. Hier!");
+		scheduler.giveItem(80, player, read.item("minecraft:gold_ingot", 5));
+		scheduler.msgPrefix(90, player, "§dHerbert", "Bitte bring sie direkt zur Schmiede! Ich brauche diese Uhr.");
+	}
+}
+goto("wait");
+
+@stage1
+if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
+	entity_name = entity.getName(entity);
+	if(entity_name == "Schmied") {
+		item = entity.getEquip(player, "hand");
+		item_type = item.getType(item);
+		wusi = human.giveItem("Schmied", player, "minecraft:gold_ingot", 5);
+		if(wusi == 0) {
+			msg.prefix(player, "§dSchmied", "Perfekt, jetzt fehlt nurnoch hellblauer Farbstoff für das Detail.");
+			scheduler.msgPrefix(30, player, "§dSchmied", "Pflücke eine blaue Orchidee und verarbeite sie zu Farbstoff.");
+			stage.increase(player);
+		}
+	}
+}	
+goto("wait");
+
+@stage2
+if(event == "block_break") {
+	if(block_type == "minecraft:blue_orchid") {
+		cancel = false;
+		scheduler.setBlock(5, block_loc, "minecraft:blue_orchid", false);
+		orchids++;
+		if(orchids == 1) {
+			stage.increase(player);
+			msg.prefix(player, "§dSchmied", "Gut, nun mache Farbstoff daraus.");
+		}
+	}
+}
+goto("wait");
+
+@stage3
+if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
+	entity_name = entity.getName(entity);
+	if(entity_name == "Schmied") {
+		item = entity.getEquip(player, "hand");
+		item_type = item.getType(item);
+		wusi = human.giveItem("Schmied", player, "minecraft:light_blue_dye", 1);
+		if(wusi == 0) {
+			stage.increase(player);
+			player.removeItem(player, read.item(item_type));
+			msg.prefix(player, "§dSchmied", "Jetzt kann ich loslegen!");
+			scheduler.msgPrefix(60, player, "§dSchmied", "Einen Moment noch.");
+			scheduler.msgPrefix(120, player, "§dSchmied", "Tadaaaa. Das Werk ist vollbracht. Du kannst sie ihm gleich vorbeibringen.");
+			scheduler.giveSingleItem(120, player, read.item("minecraft:clock"), false);
+		}
+	}
+}
+goto("wait");
+
+@stage4
+if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
+	entity_name = entity.getName(entity);
+	if(entity_name == "Herbert") {
+		item = entity.getEquip(player, "hand");
+		item_type = item.getType(item);
+		if(item_type == "minecraft:clock") {
+			player.removeItem(player, read.item(item_type));
+			msg.prefix(player, "§dHerbert", "Das ging aber flott!");
+			msg(player, "§dQuest abgeschlossen. Belohnung: 6 Snuvis!");
+			addMoney(player, 6);
+			quest.finish(script, player);
+		}
+	}
+}
+goto("wait");

+ 60 - 0
story/admont/ich_und_mein_holz.txt

@@ -0,0 +1,60 @@
+event.load("quest_start");
+event.load("quest_term");
+event.load("block_break");
+event.load("entity_click");
+
+stage = 0;
+all_stages = 2;
+quest_name = "Ich und mein Holz";
+
+wood_given = 0;
+spruce_log = 0;
+
+@wait
+wait();
+if(!player.isQuester(player, script)) {
+	goto("wait");
+}
+if(event == "quest_term") {
+	//Hier Code einfügen...
+	wait(); //Script wird von außen terminiert
+}
+if(event == "quest_start") {
+	quest.display(player, quest_name, stage, all_stages);
+	msg.prefix(player, "§dFörster", "Die neue Holzlieferung ist schon lange fällig...");
+	scheduler.msgPrefix(30, player, "§dFörster", "Ich hänge also ziemlich hinterher");
+	scheduler.msgPrefix(60, player, "§dFörster", "Ich brauche 32 Holz aus dem Wald nebenan, um dem Handwerker seine nötigen Ressourcen zu geben.");
+	player.giveSingleItem(player, read.item("minecraft:stone_axe"), false);
+	goto("wait");
+}
+
+label = concat("stage", text.number(stage));
+goto(label);
+
+@stage0
+if(event == "block_break") {
+	if(block_type == "minecraft:spruce_log" && loc.getx(block_loc)<= -1692) {
+		cancel = false;
+		scheduler.setBlock(25, block_loc, "minecraft:spruce_log", false);
+		spruce_log++;
+		if(spruce_log == 32) {
+			stage.increase(player);
+		}
+	}
+}
+goto("wait");
+
+@stage1
+if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
+	entity_name = entity.getName(entity);
+	if(entity_name == "Förster") {
+		wusi = human.giveItem("Förster", player, "minecraft:spruce_log", 32);
+		if(wusi == 0) {
+			msg.prefix(player, "§dFörster", "Danke, ich werde es zur Verarbeitung weiterreichen");
+			addMoney(player, 8);
+			msg(player, "§dQuest abgeschlossen. Belohnung: 8 Snuvis!");
+			quest.finish(script, player);
+		}
+	}
+}
+goto("wait");

+ 309 - 58
system/commands.txt

@@ -58,6 +58,7 @@ command.register("games", "Teleports to games-spawn");
 command.register("giveup", "Giveup a quest");
 command.register("grow", "Grow seeds");
 command.register("hat", "Be fame with a new hat");
+command.register("hawkeye", "Rollback griefings");
 command.register("head", "Gives you a player's head");
 command.register("heal", "Heals, fills hunger bar and remove effects");
 command.register("home", "Manage your homes");
@@ -137,6 +138,7 @@ command.register("world", "World-Commands");
 
 command.registerAlias("afklo", "afk");
 command.registerAlias("itemdb", "iteminfo");
+command.registerAlias("ha", "hawkeye");
 command.registerAlias("skull", "head");
 command.registerAlias("skick", "silentkick");
 command.registerAlias("sban", "silentban");
@@ -171,6 +173,7 @@ serverspawn = world.getServerSpawn();
 prefix_clan = "§2Clan";
 prefix_tips = "§eTips";
 prefix_lock = "§eLock";
+prefix_hawkeye = "§cHawkeye";
 prefix_commands = "§6Commands";
 prefix_friends = "§5Friends";
 prefix_world = "§bWorld";
@@ -246,6 +249,8 @@ if(afk_map == null) {
 	}
 }
 
+setScriptVar("hawkeye_lists", map.new());
+
 sgoto(10, "coordsloop");
 
 clan_invitations = list.new();
@@ -422,6 +427,8 @@ inv.setItem(skip_night_inv, 1, read.item("km:gem_stone", 1, "§fI don't care"));
 inv.setItem(skip_night_inv, 2, read.item("km:cross_red", 1, "§fNo"));
 skip_night_inv_id = inv.getId(skip_night_inv);
 
+ha_tool = read.item("km:guild_block", 1, "§cHawkeye Tool", "Hawkeye Tool");
+
 consoleCommands = set.new();
 set.add(consoleCommands, "ban");
 set.add(consoleCommands, "tempfly");
@@ -464,8 +471,6 @@ event.load("function_key");
 event.load("missing_perm");
 event.load("missing_command");
 event.load("custom_command");
-event.load("block_place");
-event.load("block_break");
 event.load("block_click");
 event.load("player_logout");
 event.load("player_data_tick");
@@ -1750,6 +1755,98 @@ entity.setEquip(player, "head", item);
 entity.setEquip(player, "hand", read.item("minecraft:air"));
 goto("wait");
 
+@hawkeye
+if(size == 0) {
+	@partyhelp
+	msg.prefix(player, prefix_party, "§r/hawkeye ...");
+	msg(player, "§5 - search <parameters> §rSearch for griefs");
+	msg(player, "§5 - rollback §rRollback last search");
+	msg(player, "§5 - tool §rGives you the Hawkeye Tool");
+	msg(player, "");
+	msg(player, "§5 - Parameters:");
+	msg(player, "§5 - e:<event>");
+	msg(player, "§5 - p:<player>");
+	msg(player, "§5 - r:<radius>");
+	msg(player, "§5 - t:<timespan> e.g. \"5d,4h,20m\"");
+	goto("wait");
+}
+arg0 = text.toLowerCase(list.getIndex(args, 0));
+if(arg0 == "tool") {
+	player.giveItem(player, ha_tool);
+	goto("wait");
+}
+if(arg0 == "print") {
+	side = list.getIndex(args, 1);
+	if(!isDouble(side)) {
+		msg.prefix(player, prefix_commands, "Zahl erwartet.");
+		goto("wait");
+	}
+	if(side < 1) {
+		msg.prefix(player, prefix_commands, "Zahl größer 0 erwartet.");
+		goto("wait");
+	}
+	list = hawkeye.getPlayerList(player);
+	if(list == null) {
+		goto("wait");
+	}
+	if(side > list.getSize(list)) {
+		msg.prefix(player, prefix_commands, "Ungültige Zahl.");
+		goto("wait");
+	}
+	hawkeye.print(player, list, side);
+	goto("wait");
+}
+if(arg0 == "search") {
+	if(size < 2) {
+		msg.prefix(player, prefix_commands, "/hawkeye search <parameters>");
+		goto("wait");
+	}
+	a = hawkeye.processInput(args, player);
+	if(text.class(a) == "String") {
+		msg.prefix(player, prefix_hawkeye, a);
+		goto("wait");
+	}
+	timeFrom = a[0];
+	timeTo = a[1];
+	player_loc = a[2];
+	radius = a[3];
+	events = a[4];
+	players = a[5];
+	l = hawkeye.getData(timeFrom, timeTo, player_loc, radius, events, players, "DESC");
+	if(text.class(l) == "String") {
+		msg.prefix(player, prefix_hawkeye, l);
+		hawkeye.setPlayerList(player, list.new());
+		goto("wait");
+	}
+	if(list.getSize(l) == 0) {
+		msg.prefix(player, prefix_hawkeye, "No results found.");
+		hawkeye.setPlayerList(player, list.new());
+		goto("wait");
+	}
+	hawkeye.setPlayerList(player, l);
+	hawkeye.print(player, l, 1);
+	goto("wait");
+}
+if(arg0 == "rollback") {
+	l = hawkeye.getPlayerList(player);
+	if(l == null) {
+		msg.prefix(player, prefix_hawkeye, "No results to rollback.");
+		goto("wait");
+	}
+	if(list.getSize(l) == 0) {
+		msg.prefix(player, prefix_hawkeye, "No results to rollback.");
+		goto("wait");
+	}
+	if(list.getSize(l) >= 1000) {
+		msg.prefix(player, prefix_hawkeye, "Limit (1000) reached. Edit search parameters.");
+		goto("wait");
+	}
+	counter = hawkeye.rollback(l);
+	msg.prefix(player, prefix_hawkeye, concat(text.number(counter), " blocks rollbacked."));
+	goto("wait");
+}
+goto("wait");
+
 @news
 if(size < 1) {
 	msg.prefix(player, prefix_commands, "/news <text>");
@@ -2689,6 +2786,7 @@ if(size != 1) {
 	msg(sender, " - friends");
 	msg(sender, " - games");
 	msg(sender, " - harvest");
+	msg(sender, " - hawkeye");
 	msg(sender, " - herobrine");
 	msg(sender, " - mails");
 	msg(sender, " - perms");
@@ -2762,6 +2860,13 @@ elseif(arg0 == "harvest") {
 	}
 	script.startNamed("Harvest", "system/harvest", "utils/u_general");
 }
+elseif(arg0 == "hawkeye") {
+	script = script.get("Hawkeye");
+	if(script != null) {
+		script.term(script);
+	}
+	script.startNamed("Hawkeye", "system/hawkeye", "utils/u_general");
+}
 elseif(arg0 == "herobrine") {
 	script = script.get("Herobrine");
 	if(script != null) {
@@ -7653,53 +7758,53 @@ function setCommandHelps() {
 	command.addIgnored("kill");
 	command.addIgnored("gamemode");
 	
-	addCommandHelp("silentjoin");
-	addCommandHelp("nowb");
-	addCommandHelp("coords");
-	addCommandHelp("ping");
-	addCommandHelp("rank");
-	addCommandHelp("back");
-	addCommandHelp("boost");
-	addCommandHelp("bug");
-	addCommandHelp("report");
-	addCommandHelp("skills");
-	addCommandHelp("startgame");
-	addCommandHelp("top");
-	addCommandHelp("ride");
-	addCommandHelp("repair");
-	addCommandHelp("live");
-	addCommandHelp("hack");
+	commandhelp.add("silentjoin");
+	commandhelp.add("nowb");
+	commandhelp.add("coords");
+	commandhelp.add("ping");
+	commandhelp.add("rank");
+	commandhelp.add("back");
+	commandhelp.add("boost");
+	commandhelp.add("bug");
+	commandhelp.add("report");
+	commandhelp.add("skills");
+	commandhelp.add("startgame");
+	commandhelp.add("top");
+	commandhelp.add("ride");
+	commandhelp.add("repair");
+	commandhelp.add("live");
+	commandhelp.add("hack");
 	
-	addCommandHelpChildPlayer("mute");
-	addCommandHelpChildPlayer("unmute");
-	addCommandHelpChildPlayer("tpa");
-	addCommandHelpChildPlayer("tpaccept");
-	addCommandHelpChildPlayer("tpahere");
-	addCommandHelpChildPlayer("tpaccepthere");
-	addCommandHelpChildPlayer("head");
-	addCommandHelpChildPlayer("seen");
-	addCommandHelpChildPlayer("heal");
-	addCommandHelpChildPlayer("feed");
+	commandhelp.addChildPlayer("mute");
+	commandhelp.addChildPlayer("unmute");
+	commandhelp.addChildPlayer("tpa");
+	commandhelp.addChildPlayer("tpaccept");
+	commandhelp.addChildPlayer("tpahere");
+	commandhelp.addChildPlayer("tpaccepthere");
+	commandhelp.addChildPlayer("head");
+	commandhelp.addChildPlayer("seen");
+	commandhelp.addChildPlayer("heal");
+	commandhelp.addChildPlayer("feed");
 	
-	help = addCommandHelp("lightning");
-	addCommandAlias(help, "thor", "lightning");
-	help = addCommandHelp("color");
-	addCommandAlias(help, "colour", "color");
-	help = addCommandHelp("iteminfo");
-	addCommandAlias(help, "itemdb", "iteminfo");
-	help = addCommandHelp("head");
-	addCommandAlias(help, "skull", "head");
-	help = addCommandHelp("memory");
-	addCommandAlias(help, "ram", "memory");
-	help = addCommandHelp("afk");
-	addCommandAlias(help, "afklo", "afk");
+	help = commandhelp.add("lightning");
+	commandhelp.addAlias(help, "thor", "lightning");
+	help = commandhelp.add("color");
+	commandhelp.addAlias(help, "colour", "color");
+	help = commandhelp.add("iteminfo");
+	commandhelp.addAlias(help, "itemdb", "iteminfo");
+	help = commandhelp.add("head");
+	commandhelp.addAlias(help, "skull", "head");
+	help = commandhelp.add("memory");
+	commandhelp.addAlias(help, "ram", "memory");
+	help = commandhelp.add("afk");
+	commandhelp.addAlias(help, "afklo", "afk");
 	
-	help = addCommandHelp("leave");
-	addCommandAlias(help, "l", "leave");
-	addCommandAlias(help, "hub", "leave");
+	help = commandhelp.add("leave");
+	commandhelp.addAlias(help, "l", "leave");
+	commandhelp.addAlias(help, "hub", "leave");
 	
-	help = addCommandHelp("giveup");
-	addCommandAlias(help, "fuckit", "giveup");
+	help = commandhelp.add("giveup");
+	commandhelp.addAlias(help, "fuckit", "giveup");
 	
 	help = command.newHelp("vanish", "vanish");
 	//vanish [on] [player]
@@ -7711,7 +7816,7 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "player"));
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "v", "vanish");
+	commandhelp.addAlias(help, "v", "vanish");
 	
 	help = command.newHelp("start", "start");
 	command.addHelpChild(help, command.newHelpLiteral("ai"));
@@ -7721,6 +7826,7 @@ function setCommandHelps() {
 	command.addHelpChild(help, command.newHelpLiteral("damage"));
 	command.addHelpChild(help, command.newHelpLiteral("doors"));
 	command.addHelpChild(help, command.newHelpLiteral("harvest"));
+	command.addHelpChild(help, command.newHelpLiteral("hawkeye"));
 	command.addHelpChild(help, command.newHelpLiteral("herobrine"));
 	command.addHelpChild(help, command.newHelpLiteral("games"));
 	command.addHelpChild(help, command.newHelpLiteral("mails"));
@@ -7754,7 +7860,7 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "player", "gamemode.other"));
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "gm", "gamemode");
+	commandhelp.addAlias(help, "gm", "gamemode");
 	
 	help = command.newHelp("databank", "databank");
 	//databank showtables
@@ -7907,7 +8013,22 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, helpArg1);
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "dt", "datatools");
+	commandhelp.addAlias(help, "dt", "datatools");
+	
+	help = command.newHelp("hawkeye", "hawkeye");
+	//hawkeye search <parameters>
+	helpArg0 = command.newHelpLiteral("search");
+	command.addHelpChild(helpArg0, command.newHelpString("name", true));
+	command.addHelpChild(help, helpArg0);
+	//hawkeye rollback
+	command.addHelpChild(help, command.newHelpLiteral("rollback"));
+	//hawkeye tool
+	command.addHelpChild(help, command.newHelpLiteral("tool"));
+	commandhelp.addAlias(help, "ha", "hawkeye");
+	
+	command.addHelpChild(help, command.newHelpInt("radius", 1, 5));
+	command.addHelpChild(help, command.newHelpLiteral("block"));
+	command.addHelp(help);
 	
 	help = command.newHelp("voxel", "voxel");
 	command.addHelpChild(help, command.newHelpInt("radius", 1, 5));
@@ -7917,7 +8038,7 @@ function setCommandHelps() {
 	help = command.newHelp("help", "help");
 	command.addHelpChild(help, command.newHelpInt("page", 1, 100));
 	command.addHelp(help);
-	addCommandAlias(help, "mimimi", "help");
+	commandhelp.addAlias(help, "mimimi", "help");
 	
 	help = command.newHelp("suicide", "suicide");
 	command.addHelpChild(help, command.newHelpSpecial("Player", "player", "kill.other"));
@@ -8056,7 +8177,7 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, command.newHelpInt("id", 0, 1000000));
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "s", "script");
+	commandhelp.addAlias(help, "s", "script");
 	
 	help = command.newHelp("home", "home");
 	//home set
@@ -8151,7 +8272,7 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, helpArg1);
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "p", "plot");
+	commandhelp.addAlias(help, "p", "plot");
 	
 	help = command.newHelp("warp", "warp");
 	//warp set [group] <name>
@@ -8187,7 +8308,7 @@ function setCommandHelps() {
 	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "to-player", "teleport.other"));
 	command.addHelpChild(help, helpArg0);
 	command.addHelp(help);
-	addCommandAlias(help, "tp", "teleport");
+	commandhelp.addAlias(help, "tp", "teleport");
 	
 	help = command.newHelp("lastseen", "lastseen");
 	command.addHelpChild(help, command.newHelpInt("amount", 1, 100));
@@ -8329,7 +8450,7 @@ function setCommandHelps() {
 	//friend list
 	command.addHelpChild(help, command.newHelpLiteral("list"));
 	command.addHelp(help);
-	addCommandAlias(help, "f", "friend");
+	commandhelp.addAlias(help, "f", "friend");
 	
 	help = command.newHelp("sign", "sign");
 	helpArg0 = command.newHelpInt("1-4", 1, 4);
@@ -8618,31 +8739,31 @@ function setCommandHelps() {
 	command.sendHelp();
 }
 
-function addCommandHelp(command) {
+function commandhelp.add(command) {
 	help = command.newHelp(command, command);
 	command.addHelp(help);
 	return help;
 }
 
-function addCommandHelpChildString(command, arg0, bool) {
+function commandhelp.addChildString(command, arg0, bool) {
 	help = command.newHelp(command, command);
 	command.addHelpChild(help, command.newHelpString(arg0, bool));
 	command.addHelp(help);
 }
 
-function addCommandHelpChildPlayer(command) {
+function commandhelp.addChildPlayer(command) {
 	help = command.newHelp(command, command);
 	command.addHelpChild(help, command.newHelpSpecial("Player", "player"));
 	command.addHelp(help);
 }
 
-function addCommandHelpChildBool(command, arg0) {
+function commandhelp.addChildBool(command, arg0) {
 	help = command.newHelp(command, command);
 	command.addHelpChild(help, command.newHelpBool(arg0));
 	command.addHelp(help);
 }
 
-function addCommandAlias(help, alias, command) {
+function commandhelp.addAlias(help, alias, command) {
 	helpAlias = command.newHelp(alias, command);
 	command.addHelpAlias(helpAlias, help);
 	command.addHelp(helpAlias);
@@ -9075,4 +9196,134 @@ function tpBottom(player) {
 	}					
 	loc.addY(player_loc, 1);
 	entity.teleport(player, player_loc);
+}
+
+function hawkeye.getStartIndices(string) {
+	a = array.new(5);
+	a[0] = text.indexOf(string, "e:", 0);
+	a[1] = text.indexOf(string, "p:", 0);
+	a[2] = text.indexOf(string, "r:", 0);
+	a[3] = text.indexOf(string, "t:", 0);
+	a[4] = text.length(string);
+	a = array.sort(a, true);
+	return a;
+}
+
+function hawkeye.getParStrings(string, indices) {
+	index = 0;
+	while(indices[index] == -1) {
+		index++;
+	}
+	start_index = indices[index];
+	if(start_index != 0) {
+		return null;
+	}
+	l = list.new();
+	while(++index < 5) {
+		next_index = indices[index];
+		if(index == 4) {
+			next_index++;
+		}
+		par_str = text.trim(text.subString(string, start_index, next_index - 1));
+		if(text.length(par_str) < 3) {
+			return null;
+		}
+		list.add(l, par_str);
+		start_index = next_index;
+	}
+	return l;
+}
+
+function hawkeye.processInput(args, player) {
+	string = text.concatList(args, " ", 1, list.getSize(args) - 1);
+	indices = hawkeye.getStartIndices(string);
+	par_strings = hawkeye.getParStrings(string, indices);
+	if(par_strings == null) {
+		return "False input parameters";
+	}
+	first_letters = set.new();
+	iter = list.iterator(par_strings);
+	while(hasNext(iter)) {
+		par_str = next(iter);
+		first_letter = text.subString(par_str, 0, 1);
+		if(set.contains(first_letters, first_letter)) {
+			return "Twice input parameters";
+		}
+		set.add(first_letters, first_letter);
+		par_str = text.subString(par_str, 2, text.length(par_str));
+		args_par_str = text.split(",", par_str);
+		
+		if(first_letter == "e") {
+			events = list.new();
+			iter_args = list.iterator(args_par_str);
+			while(hasNext(iter_args)) {
+				list.add(events, next(iter_args));
+			}
+		}
+		elseif(first_letter == "p") {
+			players = list.new();
+			iter_args = list.iterator(args_par_str);
+			while(hasNext(iter_args)) {
+				list.add(players, next(iter_args));
+			}
+		}
+		elseif(first_letter == "r") {
+			if(list.getSize(args_par_str) > 1) {
+				return "False input at r:";
+			}
+			radius = list.getIndex(args_par_str, 0);
+			if(!isDouble(radius)) {
+				return "False input at r:";
+			}
+		}
+		elseif(first_letter == "t") {
+			if(list.getSize(args_par_str) > 3) {
+				return "False input at t:";
+			}
+			if(text.contains(par_str, "d")) {
+				d = true;
+			} else {
+				d = false;
+			}
+			time_span = 0;
+			iter_args = list.iterator(args_par_str);
+			while(hasNext(iter_args)) {
+				arg = next(iter_args);
+				if(text.contains(arg, "m")) {
+					minutes = text.convert(text.replace(arg, "m", ""));
+					if(!isDouble(minutes)) {
+						return "False input at t:";
+					}
+					time_span += minutes * 60;
+				}
+				elseif(text.contains(arg, "h")) {
+					hours = text.convert(text.replace(arg, "h", ""));
+					if(!isDouble(hours)) {
+						return "False input at t:";
+					}
+					time_span += hours * 60 * 60;
+				} else {
+					if(d) {
+						days = arg;
+						if(!isDouble(days)) {
+							return "False input at t:";
+						}
+						time_span += days * 24 * 60 * 60;
+					} else {
+						return "False input at t:";
+					}
+				}
+			}
+			timeTo = time.getMillis();
+			timeFrom = timeTo - time_span * 1000;
+		}
+	}
+	a = array.new(6);
+	a[0] = timeFrom;
+	a[1] = timeTo;
+	a[2] = entity.getLocation(player);
+	a[3] = radius;
+	a[4] = events;
+	a[5] = players;
+	return a;
 }

+ 177 - 0
system/hawkeye.txt

@@ -0,0 +1,177 @@
+/*TODO:
+undo?
+*/
+
+/*
+/hawkeye search <parameters>
+Parameters Examples:
+	p:marvinius,MentorMentos
+	t:30d,4h,20m
+	r:10
+	e:block_break,block_place
+*/
+
+event.load("block_break");
+event.load("block_place");
+event.load("block_click");
+prefix_hawkeye = "§cHawkeye";
+
+chests_tag = block.getTag("forge:chests/wooden");
+wall_signs_tag = block.getTag("minecraft:wall_signs");
+standing_signs_tag = block.getTag("minecraft:standing_signs");
+stairs_tag = block.getTag("minecraft:stairs");
+slabs_tag = block.getTag("minecraft:slabs");
+buttons_tag = block.getTag("minecraft:buttons");
+face_prop = block.getProperty("face");
+facing_prop = block.getProperty("facing");
+facing_except_up_prop = block.getProperty("facing_except_up");
+horizontal_facing_prop = block.getProperty("horizontal_facing");
+half_prop = block.getProperty("half");
+stair_shape_prop = block.getProperty("stair_shape");
+slab_type_prop = block.getProperty("slab_type");
+rotation_prop = block.getProperty("rotation");
+chest_type_prop = block.getProperty("chest_type");
+extended_prop = block.getProperty("extended");
+
+databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS hawkeye(id INT NOT NULL PRIMARY KEY, player_id INT NOT NULL, event VARCHAR(25) NOT NULL, world VARCHAR(15) NOT NULL, x INT NOT NULL, y INT NOT NULL, z INT NOT NULL, time BIGINT NOT NULL);"));
+databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS hawkeye_data(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, hawkeye_id INT NOT NULL, name VARCHAR(20) NOT NULL, value VARCHAR(100) NOT NULL, FOREIGN KEY (hawkeye_id) REFERENCES hawkeye(id) ON DELETE RESTRICT);"));
+
+hawkeye.deleteOlderThanThreeWeeks();
+
+msg("dev", "§bHawkeye §rloaded.");
+@wait
+wait();
+if(event == "block_place") {
+	item = entity.getEquip(player, "hand");
+	if(hawkeye.isTool(item)) {
+		if(!perm.has(player, "hawkeye")) {
+			perm.no(player, "hawkeye");
+			goto("wait");
+		}
+		cancel = true;
+		list = hawkeye.getData(null, null, block_loc, 1, null, null, "DESC");
+		if(list.getSize(list) == 0) {
+			msg.prefix(player, prefix_hawkeye, "No results found.");
+			goto("wait");
+		}
+		hawkeye.setPlayerList(player, list);
+		hawkeye.print(player, list, 1);
+		goto("wait");
+	}
+}
+if(event == "block_click") {
+	item = entity.getEquip(player, "hand");
+	if(action == "left" && hawkeye.isTool(item)) {
+		if(!perm.has(player, "hawkeye")) {
+			perm.no(player, "hawkeye");
+			goto("wait");
+		}
+		cancel = true;
+		list = hawkeye.getData(null, null, block_loc, 1, null, null, "DESC");
+		if(list.getSize(list) == 0) {
+			msg.prefix(player, prefix_hawkeye, "No results found.");
+			goto("wait");
+		}
+		hawkeye.setPlayerList(player, list);
+		hawkeye.print(player, list, 1);
+	}
+	goto("wait");
+}
+world_name = world.getName(loc.getWorld(block_loc));
+if(isSurvWorldName(world_name)) {
+	if(event == "block_break" || event == "block_place") {
+		if(!cancel) {
+			id = hawkeye.getNextId();
+			hawkeye.addBlockEvent(id, event, player, block_loc);
+			hawkeye.addBlockDetail(id, "block_type", block_type);
+			if(block_type == "minecraft:piston" || block_type == "minecraft:sticky_piston") {
+				hawkeye.addBlockState(id, block_loc, "facing", facing_prop);
+				hawkeye.addBlockState(id, block_loc, "extended", extended_prop);
+			}
+			elseif(block.hasTag(chests_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "facing", horizontal_facing_prop);
+				hawkeye.addBlockState(id, block_loc, "chest", chest_type_prop);
+			}
+			elseif(block.hasTag(standing_signs_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "rotation", rotation_prop);
+			}
+			elseif(block.hasTag(buttons_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "facing", horizontal_facing_prop);
+				hawkeye.addBlockState(id, block_loc, "face", face_prop);
+			}
+			elseif(block_type == "minecraft:hopper") {
+				hawkeye.addBlockState(id, block_loc, "facing", facing_except_up_prop);
+			}
+			elseif(block.hasTag(wall_signs_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "facing", horizontal_facing_prop);
+			}
+			elseif(block.hasTag(slabs_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "type", slab_type_prop);
+			}
+			elseif(block.hasTag(stairs_tag, block)) {
+				hawkeye.addBlockState(id, block_loc, "facing", horizontal_facing_prop);
+				hawkeye.addBlockState(id, block_loc, "half", half_prop);
+				hawkeye.addBlockState(id, block_loc, "shape", stair_shape_prop);
+			}
+		}
+	}
+}
+goto("wait");
+
+function hawkeye.addBlockState(id, block_loc, state_name, state_prop) {
+	state = block.getState(block_loc, state_prop);
+	if(state != null) {
+		hawkeye.addBlockDetail(id, state_name, state);
+	}
+}
+
+function hawkeye.addBlockEvent(id, event, player, location) {
+	stmt = databank.prepare("INSERT INTO hawkeye (id, player_id, event, world, x, y, z, time) VALUES (?,?,?,?,?,?,?,?)");
+	databank.setInt(stmt, 1, id);
+	databank.setInt(stmt, 2, player.getId(player));
+	databank.setString(stmt, 3, event);
+	databank.setString(stmt, 4, world.getName(loc.getWorld(location)));
+	databank.setInt(stmt, 5, loc.getX(location));
+	databank.setInt(stmt, 6, loc.getY(location));
+	databank.setInt(stmt, 7, loc.getZ(location));
+	databank.setLong(stmt, 8, time.getMillis());
+	databank.workerExecute(stmt);
+}
+
+function hawkeye.addBlockDetail(hawkeye_id, name, value) {
+	stmt = databank.prepare("INSERT INTO hawkeye_data (hawkeye_id, name, value) VALUES (?,?,?)");
+	databank.setInt(stmt, 1, hawkeye_id);
+	databank.setString(stmt, 2, name);
+	databank.setString(stmt, 3, value);
+	databank.workerExecute(stmt);
+}
+
+function hawkeye.getNextId() {
+	id = 0;
+	stmt = databank.prepare("SELECT MAX(id) FROM hawkeye;");
+	result = databank.execute(stmt);
+	if(databank.next(result)) {
+		id = databank.getInt(result, 1);
+	}
+	databank.close(result);
+	databank.close(stmt);
+	return id + 1;
+}
+
+function hawkeye.deleteOlderThanThreeWeeks() {
+	three_weeks_before = time.getMillis() - 21 * 24 * 60 * 60 * 1000;
+	stmt = databank.prepare("DELETE FROM hawkeye_data WHERE hawkeye_id IN(SELECT id FROM hawkeye WHERE time < ?);");
+	databank.setLong(stmt, 1, three_weeks_before);
+	databank.workerExecute(stmt);
+	stmt2 = databank.prepare("DELETE FROM hawkeye WHERE time < ?;");
+	databank.setLong(stmt2, 1, three_weeks_before);
+	databank.workerExecute(stmt2);
+}
+
+function hawkeye.isTool(item) {
+	lore = item.getLore(item);
+	if(list.getSize(lore) > 0) {
+		return list.getIndex(lore, 0) == "Hawkeye Tool";
+	}
+	return false;
+}

+ 6 - 0
system/perms.txt

@@ -124,6 +124,7 @@ perm.registerGroup(2, "playtime.year");
 perm.registerGroup(2, "playtime.month");
 perm.registerGroup(2, "playtime.other");
 perm.registerGroup(2, "startgame.jump");
+perm.registerGroup(2, "hawkeye");
 perm.registerGroup(2, "hack");
 perm.registerGroup(2, "perm");
 perm.registerGroup(2, "perm.give");
@@ -320,6 +321,8 @@ perm.registerGroup(7, "stats.remove");
 perm.registerGroup(7, "removeinvstats");
 perm.registerGroup(7, "removesfstats");
 perm.registerGroup(7, "mail.reset");
+perm.registerGroup(7, "datapack");
+perm.registerGroup(7, "reload");
 
 //Perm-Group zur User-Simulation
 perm.registerGroup(8, "pseudoPerm");
@@ -335,6 +338,8 @@ perm.registerGroup(9, "setmessage");
 //Owner
 perm.registerGroup(10, "isOwner");
 perm.registerGroup(10, "isTeam");
+perm.registerGroup(10, "datapack");
+perm.registerGroup(10, "reload");
 
 //Streamer
 perm.registerGroup(11, "isStreamer");
@@ -391,6 +396,7 @@ perm.registerGroup(12, "startgame.jump");
 perm.registerGroup(12, "user.other");
 perm.registerGroup(12, "gamerule");
 perm.registerGroup(12, "tempfly");
+perm.registerGroup(12, "hawkeye");
 perm.registerGroup(12, "fly");
 perm.registerGroup(12, "fly.other");
 perm.registerGroup(12, "plot.other");

+ 7 - 0
system/scheduler.txt

@@ -65,6 +65,13 @@ while(hasNext(iter)) {
 			item = a[3];
 			player.safeGiveItem(player, item);
 		}
+		//giveSingleItem
+		if(action == 9) {
+			player = a[2];
+			item = a[3];
+			boolean = a[4];
+			player.giveSingleItem(player, item, boolean);
+		}
 		remove(iter);
 	}
 }

+ 12 - 12
system/survival.txt

@@ -14,18 +14,18 @@ event.load("mob_griefing");
 event.load("item_air_click");
 
 setScriptVar("skills", list.new());
-skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 40, false, false, true);
-skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 40, false, false, true);
-skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 400, true, false, false);
-skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 200, true, false, false);
-skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 300, false, true, false);
-skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 32, false, true, false);
-skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 32, false, true, false);
-skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 32, false, true, false);
-skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 32, false, true, false);
-skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 32, false, true, false);
-skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 32, false, true, false);
-skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 32, false, true, false);
+skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
+skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
+skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 1000, true, false, false);
+skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 500, true, false, false);
+skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false);
+skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
+skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
+skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
+skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
+skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
+skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
+skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
 skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
 
 clan.loadData();

+ 9 - 14
test.txt

@@ -1,16 +1,11 @@
-clan.delete(1);
+event.load("block_place");
 
-function clan.delete(clan_id) {
-	//Members
-	list = clan.getMembersList(clan_id);
-	iter = list.iterator(list);
-	while(hasNext(iter)) {
-		player_uuid = next(iter);
-		player_id = player.getId(player_uuid);
-		player.setClanId(player_id, -1);
-		player.setClanRole(player_id, "null");
-	}
-	//Clan
-	config.delete(clan.getData(clan_id));
-	map.remove(getScriptVar("clan_data"), clan_id);
+böser_spieler_name = "marvinius";
+
+@sprungmarke
+wait();
+if(player_name == böser_spieler_name) {
+	msg(player, "Böse!");
+	cancel = true;
 }
+goto("sprungmarke");

+ 4 - 0
test2.txt

@@ -0,0 +1,4 @@
+databank.workerExecute(databank.prepare("DROP table hawkeye_data"));
+databank.workerExecute(databank.prepare("DROP table hawkeye"));
+waitfor(10);
+term();

+ 0 - 0
test3.txt


+ 291 - 7
utils/u_general.txt

@@ -29,10 +29,36 @@ function list.copy(list) {
 	return list_new;
 }
 
+function array.sort(my_array, ascending) {
+	size = array.getSize(my_array);
+	if(ascending) {
+		for(i = 0; i < size - 1; i++) {
+			for(j = i + 1; j < size; j++) {
+				if(my_array[j] < my_array[i]) {
+					temp = my_array[i];
+					my_array[i] = my_array[j];
+					my_array[j] = temp;
+				}
+			}
+		}
+	} else {
+		for(i = 0; i < size - 1; i++) {
+			for(j = i + 1; j < size; j++) {
+				if(my_array[j] > my_array[i]) {
+					temp = my_array[i];
+					my_array[i] = my_array[j];
+					my_array[j] = temp;
+				}
+			}
+		}
+	}
+	return my_array;
+}
+
 function map.sort(map, ascending) {
-	map_size = map.getSize(map);
-	my_array = array.new(map_size, 2);
-	//Map in 2 Arrays verwandeln
+	size = map.getSize(map);
+	my_array = array.new(size, 2);
+	//Map in Array umwandeln
 	i = 0;
 	iter = map.iterator(map);
 	while(hasNext(iter)) {
@@ -45,8 +71,8 @@ function map.sort(map, ascending) {
 	}
 	//Array sortieren
 	if(ascending) {
-		for(i = 0; i < map_size - 1; i++) {
-			for(j = i + 1; j < map_size; j++) {
+		for(i = 0; i < size - 1; i++) {
+			for(j = i + 1; j < size; j++) {
 				if(my_array[j, 1] < my_array[i, 1]) {
 					g = my_array[i, 0];
 					h = my_array[i, 1];
@@ -58,8 +84,8 @@ function map.sort(map, ascending) {
 			}
 		}
 	} else {
-		for(i = 0; i < map_size - 1; i++) {
-			for(j = i + 1; j < map_size; j++) {
+		for(i = 0; i < size - 1; i++) {
+			for(j = i + 1; j < size; j++) {
 				if(my_array[j, 1] > my_array[i, 1]) {
 					g = my_array[i, 0];
 					h = my_array[i, 1];
@@ -2828,6 +2854,22 @@ function skill.showAll(player) {
 //Loc-Utils
 //--------------------------------------------------
 
+function loc.getStringColon(loc) {
+	world_name = world.getName(loc.getWorld(loc));
+	x = text.number(loc.getX(loc));
+	y = text.number(loc.getY(loc));
+	z = text.number(loc.getZ(loc));
+	return concat(world_name, ":", x, ":", y, ":", z);
+}
+
+function loc.getStringSpace(loc) {
+	world_name = world.getName(loc.getWorld(loc));
+	x = text.number(loc.getX(loc));
+	y = text.number(loc.getY(loc));
+	z = text.number(loc.getZ(loc));
+	return concat(world_name, " ", x, " ", y, " ", z);
+}
+
 function loc.isSameWorld(loc1, loc2) {
 	return world.getName(loc.getWorld(loc1)) == world.getName(loc.getWorld(loc2));
 }
@@ -3786,4 +3828,246 @@ function scheduler.giveItem(ticks, player, item) {
 	a[2] = player;
 	a[3] = item;
 	scheduler.add(a);
+}
+
+function scheduler.giveSingleItem(ticks, player, item, boolean) {
+	a = array.new(5);
+	a[0] = 9;
+	a[1] = ticks;
+	a[2] = player;
+	a[3] = item;
+	a[4] = boolean;
+	scheduler.add(a);
+}
+
+
+//--------------------------------------------------
+//Hawkeye-Utils
+//--------------------------------------------------
+
+function hawkeye.getData(timeFrom, timeTo, location, radius, events, players, order) {
+	base_query = "SELECT * FROM hawkeye WHERE ";
+	and_query = " AND ";
+	//Events
+	where_query = hawkeye.getEventQuery(events);
+	if(where_query == -1) {
+		return "False input at e:";
+	}
+	//Players
+	player_query = hawkeye.getPlayerQuery(players);
+	if(player_query == -1) {
+		return "False input at p:";
+	}
+	if(text.length(where_query) == 0) {
+		where_query = player_query;
+	} elseif(text.length(player_query) != 0) {
+		where_query = concat(where_query, and_query, player_query);
+	}
+	//Location
+	location_query = hawkeye.getLocationQuery(location, radius);
+	if(text.length(where_query) == 0) {
+		where_query = location_query;
+	} elseif(text.length(location_query) != 0) {
+		where_query = concat(where_query, and_query, location_query);
+	}
+	//Time
+	time_query = hawkeye.getTimeQuery(timeFrom, timeTo);
+	if(text.length(where_query) == 0) {
+		where_query = time_query;
+	} elseif(text.length(time_query) != 0) {
+		where_query = concat(where_query, and_query, time_query);
+	}
+	//Safety check
+	if(text.length(where_query) == 0) {
+		return "No parameters found";
+	}
+	//Final Statement
+	stmt = databank.prepare(concat(base_query, where_query, " ORDER BY time ", order, ";"));
+	index = 1;
+	if(events != null) {
+		iter = list.iterator(events);
+		while(hasNext(iter)) {
+			databank.setString(stmt, index, next(iter));
+			index++;
+		}
+	}
+	if(players != null) {
+		iter = list.iterator(players);
+		while(hasNext(iter)) {
+			databank.setInt(stmt, index, player.getId(player.getUuid(next(iter))));
+			index++;
+		}
+	}
+	if(location != null && radius != null) {
+		databank.setInt(stmt, index++, loc.getX(location));
+		databank.setInt(stmt, index++, loc.getY(location));
+		databank.setInt(stmt, index++, loc.getZ(location));
+		databank.setInt(stmt, index++, radius);
+	}
+	if(timeFrom != null && timeTo != null) {
+		databank.setLong(stmt, index++, timeFrom);
+		databank.setLong(stmt, index++, timeTo);
+	}
+	l = list.new();
+	result = databank.execute(stmt);
+	while(databank.next(result)) {
+		a = array.new(6);
+		id = databank.getInt(result, 1);
+		a[0] = id; //id
+		a[1] = databank.getInt(result, 2); //player_id
+		a[2] = databank.getString(result, 3); //event
+		a[3] = loc.new(world.get(databank.getString(result, 4)), databank.getInt(result, 5), databank.getInt(result, 6), databank.getInt(result, 7)); //location
+		a[4] = databank.getLong(result, 8); //time
+		a[5] = hawkeye.getDetailData(id);
+		list.add(l, a);
+	}
+	databank.close(result);
+	databank.close(stmt);
+	return l;
+}
+
+function hawkeye.getEventQuery(events) {
+	if(events == null) {
+		return "";
+	}
+	query = "event IN(";
+	c = 0;
+	iter = list.iterator(events);
+	while(hasNext(iter)) {
+		event = next(iter);
+		if(event != "block_break" && event != "block_place") {
+			return -1;
+		}
+		if(c == 0) {
+			query = concat(query, "?");
+		} else {
+			query = concat(query, ",?");
+		}
+		c++;
+	}
+	return concat(query, ")");
+}
+
+function hawkeye.getPlayerQuery(players) {
+	if(players == null) {
+		return "";
+	}
+	query = "player_id IN(";
+	c = 0;
+	iter = list.iterator(players);
+	while(hasNext(iter)) {
+		player_name = next(iter);
+		player_uuid = player.getUuid(player_name);
+		if(player_uuid == null) {
+			return -1;
+		}
+		if(c == 0) {
+			query = concat(query, "?");
+		} else {
+			query = concat(query, ",?");
+		}
+		c++;
+	}
+	return concat(query, ")");
+}
+
+function hawkeye.getLocationQuery(player_loc, radius) {	
+	if(player_loc == null || radius == null) {
+		return "";
+	}
+	return "POWER(x - ?, 2) + POWER(y - ?, 2) + POWER(z - ?, 2) < POWER(?, 2)";
+}
+
+function hawkeye.getTimeQuery(timeFrom, timeTo) {
+	if(timeFrom == null || timeTo == null) {
+		return "";
+	}
+	return "time > ? AND time < ?";
+}
+
+function hawkeye.getDetailData(hawkeye_id) {
+	stmt = databank.prepare("SELECT name,value FROM hawkeye_data WHERE hawkeye_id = ?;");
+	databank.setInt(stmt, 1, hawkeye_id);
+	l = list.new();
+	result = databank.execute(stmt);
+	while(databank.next(result)) {
+		a = array.new(2);
+		a[0] = databank.getString(result, 1); //name
+		a[1] = databank.getString(result, 2); //value
+		list.add(l, a);
+	}
+	databank.close(result);
+	databank.close(stmt);
+	return l;
+}
+
+function hawkeye.print(player, list, side) {
+	amount = list.getSize(list);
+	a = list.getIndex(list, side - 1);
+	msg.prefix(player, "§cHawkeye", concat("§7----- Page (§c", text.number(side), "§7/§c", text.number(amount), "§7) -----"));
+	msg(player, concat("§7| ID:", text.number(a[0]), " ", getTimeString(a[4])));
+	msg(player, concat("§7| §c", a[2], " ", player.getNameFromId(a[1])));
+	msg(player, concat("§7| ", loc.getStringSpace(a[3])));
+	detail_l = a[5];
+	detail_iter = list.iterator(detail_l);
+	while(hasNext(detail_iter)) {
+		detail_a = next(detail_iter);
+		msg(player, concat("§7| - ", detail_a[0], ": ", detail_a[1]));
+	}
+	if(side == 1) {
+		backward = "§7<<<<";
+		if(amount == 1) {
+			forward = "§7>>>>";
+		} else {
+			forward = text.click("§c>>>>", concat("/hawkeye print ", side + 1));
+		}
+	} elseif(side >= amount) {
+		backward = text.click("§c<<<<", concat("/hawkeye print ", side - 1));
+		forward = "§7>>>>";
+	} else {
+		backward = text.click("§c<<<<", concat("/hawkeye print ", side - 1));
+		forward = text.click("§c>>>>", concat("/hawkeye print ", side + 1));
+	}
+	msg(player, backward, " ", forward);
+	msg(player, "§7-----------------------------");
+}
+
+function hawkeye.setPlayerList(player, list) {
+	map.add(getScriptVar("hawkeye_lists"), player.getUuid(player), list);
+}
+
+function hawkeye.getPlayerList(player) {
+	return map.get(getScriptVar("hawkeye_lists"), player.getUuid(player));
+}
+
+function hawkeye.rollback(list) {
+	counter = 0;
+	for(i = 0; i < list.getSize(list); i++) {
+		a = list.getIndex(list, i);
+		player_id = a[1];
+		event = a[2];
+		loc = a[3];
+		time = a[4];
+		detail_l = a[5];
+		str = "";
+		detail_iter = list.iterator(detail_l);
+		while(hasNext(detail_iter)) {
+			detail_a = next(detail_iter);
+			name = detail_a[0];
+			value = detail_a[1];
+			if(name == "block_type") {
+				block_type = value;
+			} else {
+				str = concat(str, name, "=", value,",");
+			}
+		}
+		if(event == "block_place") {
+			block.set(loc, "minecraft:air");
+			counter++;
+		} elseif(event == "block_break") {
+			block.set(loc, concat(block_type, "[", str, "]"));
+			counter++;
+		}
+	}
+	return counter;
 }

+ 18 - 0
utils/u_quest.txt

@@ -31,4 +31,22 @@ function player.setShipProgress(player_or_id, progress) {
 		config.set(config, "ship.progress", progress);
 		config.saveAsync(config);
 	}
+}
+
+function human.giveItem(human_name, player, needed_type, needed_amount) {
+	item = entity.getEquip(player, "hand");
+	item_type = item.getType(item);
+	if(item_type == "minecraft:air") {
+		return null;
+	}
+	if(item_type == needed_type) {
+		rest_item = player.removeItem(player, read.item(item_type, needed_amount));
+		rest_item_amount = item.getAmount(rest_item);
+		if(rest_item_amount > 0) {
+			msg.prefix(player, human_name, concat("Ich brauche bitte noch ", text.number(rest_item_amount), " Stück davon."));
+		}
+		return rest_item_amount;
+	}
+	msg.prefix(player, human_name, "Das kann ich nicht gebrauchen.");
+	return null;
 }