Browse Source

city system update and added gamerules per world

Marvin Löschenkohl 3 years ago
parent
commit
1da120a15e

+ 1 - 1
minigames/halma/halma.txt

@@ -297,7 +297,7 @@ function showstats(player, won) { //Player player, Boolean won
 	setRanking($rankingtable, player_id, last_record, playedgames);
 	
 	minigame.statsHeader(player, $gamename, "§e");
-	minigame.statsLine(player, "§e", "Won games", text.hover(text.number(last_record), "Relevant for ranking"));
+	minigame.statsLine(player, "§e", "Won games", text.number(last_record));
 	minigame.statsLine(player, "§e", "Played games", text.number(playedgames));
 	if(playedgames != 0) {
 		minigame.statsLine(player, "§e", "Win ratio", concat(text.number(math.roundComma((last_record / playedgames) * 100, 2)), "%"));

+ 1 - 0
minigames/parcour/parcour.txt

@@ -179,6 +179,7 @@ if(key == 1) {
 	seconds = 0;
 	jumpstage = 0;
 	entity.setHealth(player, 20);
+	entity.setBurning(player, 0);
 	display.add(player, 4, concat("Checkpoints: §e", text.number(jumpstage), "/", text.number(list.getSize(checkpoints) - 1)));
 	display.add(player, 5, concat("§rTime: §e0:00"));
 	starttime = time.getMillis();

+ 2 - 21
startscript.txt

@@ -23,27 +23,8 @@ script.startNamed("Survival", "survival/survival", "utils/u_general");
 script.startNamed("Gamecenter", "global/gamecenter", "utils/u_general", "utils/u_games", "utils/u_party");
 script.startNamed("Ranklist", "global/ranklist", "utils/u_general", "utils/u_games");
 script.startNamed("SpawnQuests", "storydorf/spawn/core", "utils/u_general");
-
-gamerule.set.bool("showDeathMessages", false);
-gamerule.set.bool("doImmediateRespawn", false);
-gamerule.set.bool("doFireTick", false);
-gamerule.set.bool("commandBlockOutput", false);
-gamerule.set.bool("doImmediateRespawn", true);
-gamerule.set.bool("keepInventory", true);
-gamerule.set.int("spawnRadius", 1);
+script.startNamed("Gamerules", "system/gamerules");
 
 error.setConsolePrint(true);
 debug.setConsolePrint(false);
-term();
-
-function gamerule.set.bool(gamerule_string, boolean) {
-	gamerule_key = gamerule.getKey(gamerule_string);
-	gamerule_value = gamerule.getValue(world.get("overworld"), gamerule_key);
-	gamerule.setBool(gamerule_value, boolean);
-}
-
-function gamerule.set.int(gamerule_string, int) {
-	gamerule_key = gamerule.getKey(gamerule_string);
-	gamerule_value = gamerule.getValue(world.get("overworld"), gamerule_key);
-	gamerule.setInt(gamerule_value, int);
-}
+term();

+ 1 - 1
storydorf/spawn/findmentos.txt

@@ -55,7 +55,7 @@ if(entity_name == "Marvin") {
 if(entity_name == "Mentos") {
 	if(stage == 3) {
 		msg(player, "§dQuest completed. Reward: 5 Coins!");
-		addMoney(player, 5);
+		addMoney(player, 4);
 		quest.finish(script, player);
 	}
 }

+ 1 - 1
storydorf/spawn/stonemage.txt

@@ -179,7 +179,7 @@ if(entity_name == "Stone Mage") {
 		map = script.getVar(spawn_script, "timestamp");
 		map.add(map, player.getUuid(player), time.getMillis());
 		msg(player, "§dQuest completed. Reward: 50 Coins!");
-		addMoney(player, 50);
+		addMoney(player, 20);
 		quest.finish(script, player);
 	}
 }

+ 1 - 1
survival/survival.txt

@@ -233,7 +233,7 @@ if(entity.getType(entity) == "human") {
 			offerRank(player, "§2Pionier");
 		}
 		removeAdventureDisplay(player);
-		safeGiveItemPlayer(player, coin_gold);
+		safeGiveItemPlayer(player, coin_silver);
 		goto("wait");
 	}
 }

+ 413 - 88
system/commands.txt

@@ -332,6 +332,7 @@ event.load("missing_command");
 event.load("custom_command");
 event.load("block_place");
 event.load("block_break");
+event.load("block_click");
 event.load("player_login");
 event.load("player_logout");
 
@@ -371,6 +372,51 @@ if(event == "custom_command") {
 	ignoreGoto(command);
 	goto("wait");
 }
+if(event == "block_click") {
+	if(action == "left") {
+		goto("wait");
+	}
+	block = block.get(block_loc);
+	if(!block.hasTag(sign_tag, block)) {
+		goto("wait");
+	}
+	line0 = block.getSign(block_loc, 0);
+	if(line0 != "§3[§bFree Plot§3]") {
+		goto("wait");
+	}
+	price = read.number(removeFormat(block.getSign(block_loc, 1)));
+	if(!isDouble(price) || price < 0) {
+		msg.prefix(player, prefix_clan, "Positive number expected.");
+		goto("wait");
+	}
+	p_id = read.number(block.getSign(block_loc, 3));
+	if(!hasEnoughMoney(player, price)) {
+		msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(price), "§r snuvis for this."));
+		goto("wait");
+	}
+	plot_list = plot.get(block_loc);
+	iter = list.iterator(plot_list);
+	while(hasNext(iter)) {
+		plot = next(iter);
+		if(plot.isFree(plot)) {
+			break;
+		}
+	}
+	if(!plot.isFree(plot)) {
+		msg.prefix(player, prefix_plot, "You aren't on a free plot.");
+		goto("wait");
+	}
+	//Plot claimen
+	subMoney(player, price);
+	addMoney(p_id, price);
+	plot.setSub(plot, true);
+	plot.setLeader(plot, player.getId(player));
+	player_name = player.getName(player);
+	plot.addPlayer(plot, player_name);
+	plot.setName(plot, concat(player_name, "'s plot"));
+	msg.prefix(player, prefix_plot, concat("Plot claimed. Spent §6", text.number(price), "§r snuvis."));
+	goto("wait");
+}
 if(event == "block_place") {
 	//Hopper unter gesichertern Kisten sind verboten
 	if(block_type == "minecraft:hopper") {
@@ -494,7 +540,7 @@ if(event == "inv_click") {
 	//inv see
 	if(set.contains(invseeids, inv_id)) {
 		//On inv_click in an invsee inventory
-		text.split(split_list, " ", inv_name);
+		split_list = text.split(" ", inv_name);
 		p_name = list.getIndex(split_list, 2);
 		p = read.player(p_name);
 		if(p == null) {
@@ -1882,7 +1928,11 @@ if(size == 2) {
 		msg.prefix(player, prefix_commands, "Unknown gamerule type.");
 		goto("wait");
 	}
-	msg.prefix(player, prefix_commands, concat(gamerule_string, " set to ", value, "."));
+	if(world.getName(world) == "overworld") {
+		msg.prefix(player, prefix_commands, concat(gamerule_string, " set to ", value, "."));
+	} else {
+		msg.prefix(player, prefix_commands, concat(gamerule_string, " set to ", value, " (not persistent)."));
+	}
 	goto("wait");
 }
 goto("wait");
@@ -3368,14 +3418,16 @@ if(size == 0) {
 	msg.prefix(player, prefix_plot, "/plot ...");
 	msg(player, "§d - info §rReturns info about current location");
 	msg(player, "§d - pos1/pos2 §rSet corner points");
-	msg(player, "§d - create §rCreates a  plot (y: 0 - 255)");
+	msg(player, "§d - create §rCreates a plot (Y: 0 - 255)");
 	msg(player, "§d - create3D §rCreates a 3D plot");
 	msg(player, "§d - remove §rRemoves a plot");
-	msg(player, "§d - expand <anzahl> §rExpands a plot to looking direction");
+	msg(player, "§d - expand <anzahl> §rExpands a plot");
 	msg(player, "§d - name <name> §rRenames a plot");
-	msg(player, "§d - share <player> §rAdds a player to a plot");
-	msg(player, "§d - kick <player> §rRemoves a player from a plot");
-	msg(player, "§d - leader <player> §rSets a new plot-leader");
+	msg(player, "§d - share <player> §rAdd a player to a plot");
+	msg(player, "§d - kick <player> §rRemove a player from a plot");
+	msg(player, "§d - leader <player> §rPromote to plot-leader");
+	msg(player, "§d - mod <player> §rPromote to plot-mod");
+	msg(player, "§d - degrade <player> §rDemote a plot-mod");
 	msg(player, "§d - raise <player> §rRaises a plot to a city");
 	if(perm.has(player, "plot.moreinfo")) {
 		msg(player, "§d - moreinfo §rReturns more detailed infos");
@@ -3385,9 +3437,80 @@ if(size == 0) {
 	goto("wait");
 }
 arg0 = text.toLowerCase(list.getIndex(args, 0));
+if(arg0 == "sell") {
+	if(size != 2) {
+		msg.prefix(player, prefix_commands, "/plot sell <price>");
+		goto("wait");
+	}
+	sign_loc = player.getTarget(player, 5, false, false);
+	block = block.get(sign_loc);
+	if(!block.hasTag(sign_tag, block)) {
+		msg.prefix(player, prefix_plot, "You need to look at an empty sign.");
+		goto("wait");
+	}
+	if(block.getSign(sign_loc, 0) != "" || block.getSign(sign_loc, 1) != "" || block.getSign(sign_loc, 2) != "" || block.getSign(sign_loc, 3) != "") {
+		msg.prefix(player, prefix_plot, "You need to look at an empty sign.");
+		goto("wait");
+	}
+	plot_list = plot.get(sign_loc);
+	amount = list.getSize(plot_list);
+	if(amount == 0 || amount == 1) {
+		msg.prefix(player, prefix_plot, "You aren't on a sub plot.");
+		goto("wait");
+	}
+	if(amount > 2) {
+		msg.prefix(player, prefix_plot, "Multiple plots present. Not possible.");
+		goto("wait");
+	}
+	plot_1 = list.getIndex(plot_list, 0);
+	plot_2 = list.getIndex(plot_list, 1);
+	if(plot.isCity(plot_1)) {
+		city_plot = plot_1;
+		sell_plot = plot_2;
+	} elseif(plot.isCity(plot_2)) {
+		sell_plot = plot_1;
+		city_plot = plot_2;
+	} else {
+		msg.prefix(player, prefix_plot, "No city found.");
+		goto("wait");
+	}
+	if(!plot.isLeader(city_plot, player) && !plot.isMod(city_plot, player)) {
+		msg.prefix(player, prefix_plot, "You aren't a city plot leader or mod.");
+		goto("wait");
+	}
+	snuvis = list.getIndex(args, 1);
+	if(!isDouble(snuvis) || snuvis < 0) {
+		msg.prefix(player, prefix_plot, "Positive number expected.");
+		goto("wait");
+	}
+	//Sell Plot
+	x1 = plot.getMinX(sell_plot);
+	y1 = plot.getMinY(sell_plot);
+	z1 = plot.getMinZ(sell_plot);
+	x2 = plot.getMaxX(sell_plot);
+	y2 = plot.getMaxY(sell_plot);
+	z2 = plot.getMaxZ(sell_plot);
+	length = math.abs(x1 - x2) + 1;
+	width = math.abs(z1 - z2) + 1;
+	high = math.abs(y1 - y2) + 1;
+	//Change plot settings
+	plot.setFree(sell_plot, true);
+	plot.setName(sell_plot, "Free Plot");
+	plot.removePlayer(sell_plot, player.getName(player));
+	//Label Sign
+	block.setSign(sign_loc, 0, "§3[§bFree Plot§3]");
+	block.setSign(sign_loc, 1, concat("§2", text.number(snuvis)));
+	if(high == 256) {
+		block.setSign(sign_loc, 2, concat(text.number(length), "x", text.number(width)));
+	} else {
+		block.setSign(sign_loc, 2, concat(text.number(length), "x", text.number(width), " (Y:", text.number(high), ")"));
+	}
+	block.setSign(sign_loc, 3, text.number(player.getId(player)));
+	msg.prefix(player, prefix_plot, "Free plot for selling created.");
+	goto("wait");
+}
 if(arg0 == "raise") {
 	location = entity.getLocation(player);
-	world = loc.getWorld(location);
 	plot_list = plot.get(location);
 	amount = list.getSize(plot_list);
 	if(amount == 0) {
@@ -3444,7 +3567,7 @@ if(arg0 == "leader") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cSetLeader§r] ", concat("/plot leader ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cSetLeader§r] ", concat("/plot leader ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3483,14 +3606,143 @@ if(arg0 == "leader") {
 	}
 	old_leader = plot.getLeader(plot);
 	if(old_leader != null) {
-		plot.removeRank(plot, old_leader);
+		plot.setMod(plot, old_leader);
 	}
-	plot.setRank(plot, p_id, "leader");
+	plot.setLeader(plot, p_id);
 	plot.addPlayer(plot, p_name);
 	msg.prefix(player, prefix_plot, concat(p_name, " promoted to plot leader."));
 	goto("wait");
 }
-if(arg0 == "remove" || arg0 == "r" || arg0 == "delete") {
+if(arg0 == "mod") {
+	if(size < 2) {
+		msg.prefix(player, prefix_commands, "/plot mod <player> [plot_id]");
+		goto("wait");
+	}
+	p_name = list.getIndex(args, 1);
+	p_uuid = player.getUuid(p_name);
+	if(p_uuid == null) {
+		msg.prefix(player, prefix_plot, "This player has never been online.");
+		goto("wait");
+	}
+	p_name = player.getName(p_uuid);
+	location = entity.getLocation(player);
+	world = loc.getWorld(location);
+	if(size == 2) {
+		plot_list = plot.get(location);
+		amount = list.getSize(plot_list);
+		if(amount == 0) {
+			msg.prefix(player, prefix_plot, "You aren't on a plot.");
+			goto("wait");
+		}
+		plot = list.getIndex(plot_list, 0);
+		if(amount > 1) {
+			msg.prefix(player, prefix_plot, "Multiple plots present:");
+			for(i = 0; i < amount; i++) {
+				plot = list.getIndex(plot_list, i);
+				plot_id = plot.getId(plot);
+				msg(player, text.click(" [§cSetMod§r] ", concat("/plot mod ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+			}
+			goto("wait");
+		}
+	} else {
+		if(size != 3) {
+			msg.prefix(player, prefix_commands, "/plot mod <player> [plot_id]");
+			goto("wait");
+		}
+		plot_id = list.getIndex(args, 2);
+		plot = plot.getFromId(plot_id, world);
+		if(plot == null) {
+			msg.prefix(player, prefix_plot, "Unknown plot or not in this world.");
+			goto("wait");
+		}
+	}
+	player_id = player.getId(player);
+	if(!perm.has(player, "plot.other")) {
+		world_name = world.getName(world);
+		if(!isSurvWorldName(world_name)) {
+			msg.prefix(player, prefix_perms, "You have no permission for this in this world.");
+			goto("wait");
+		}
+		if(!plot.isLeader(plot, player_id)) {
+			msg.prefix(player, prefix_plot, "You aren't the plot leader.");
+			goto("wait");
+		}
+	}
+	p_id = player.getId(p_uuid);
+	if(plot.isMod(plot, p_id)) {
+		msg.prefix(player, prefix_plot, "This player is already a plot mod.");
+		goto("wait");
+	}
+	plot.setMod(plot, p_id);
+	plot.addPlayer(plot, p_name);
+	msg.prefix(player, prefix_plot, concat(p_name, " promoted to plot mod."));
+	goto("wait");
+}
+if(arg0 == "degrade") {
+	if(size < 2) {
+		msg.prefix(player, prefix_commands, "/plot degrade <player> [plot_id]");
+		goto("wait");
+	}
+	p_name = list.getIndex(args, 1);
+	p_uuid = player.getUuid(p_name);
+	if(p_uuid == null) {
+		msg.prefix(player, prefix_plot, "This player has never been online.");
+		goto("wait");
+	}
+	p_name = player.getName(p_uuid);
+	location = entity.getLocation(player);
+	world = loc.getWorld(location);
+	if(size == 2) {
+		plot_list = plot.get(location);
+		amount = list.getSize(plot_list);
+		if(amount == 0) {
+			msg.prefix(player, prefix_plot, "You aren't on a plot.");
+			goto("wait");
+		}
+		plot = list.getIndex(plot_list, 0);
+		if(amount > 1) {
+			msg.prefix(player, prefix_plot, "Multiple plots present:");
+			for(i = 0; i < amount; i++) {
+				plot = list.getIndex(plot_list, i);
+				plot_id = plot.getId(plot);
+				msg(player, text.click(" [§cDegradeMod§r] ", concat("/plot degrade ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+			}
+			goto("wait");
+		}
+	} else {
+		if(size != 3) {
+			msg.prefix(player, prefix_commands, "/plot degrade <player> [plot_id]");
+			goto("wait");
+		}
+		plot_id = list.getIndex(args, 2);
+		plot = plot.getFromId(plot_id, world);
+		if(plot == null) {
+			msg.prefix(player, prefix_plot, "Unknown plot or not in this world.");
+			goto("wait");
+		}
+	}
+	player_id = player.getId(player);
+	if(!perm.has(player, "plot.other")) {
+		world_name = world.getName(world);
+		if(!isSurvWorldName(world_name)) {
+			msg.prefix(player, prefix_perms, "You have no permission for this in this world.");
+			goto("wait");
+		}
+		if(!plot.isLeader(plot, player_id)) {
+			msg.prefix(player, prefix_plot, "You aren't the plot leader.");
+			goto("wait");
+		}
+	}
+	p_id = player.getId(p_uuid);
+	if(!plot.isMod(plot, p_id)) {
+		msg.prefix(player, prefix_plot, "This player is not a plot mod.");
+		goto("wait");
+	}
+	plot.removeRank(plot, p_id);
+	msg.prefix(player, prefix_plot, concat(p_name, " is no longer a plot mod."));
+	goto("wait");
+}
+if(arg0 == "remove") {
 	location = entity.getLocation(player);
 	world = loc.getWorld(location);
 	if(size == 1) {
@@ -3506,7 +3758,7 @@ if(arg0 == "remove" || arg0 == "r" || arg0 == "delete") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cRemove§r] ", concat("/plot remove ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cRemove§r] ", concat("/plot remove ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3579,7 +3831,7 @@ if(arg0 == "expand") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cExpand§r] ", concat("/plot expand ", anzahl, " ", direction, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cExpand§r] ", concat("/plot expand ", anzahl, " ", direction, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3596,6 +3848,10 @@ if(arg0 == "expand") {
 			goto("wait");
 		}
 	}
+	if(plot.isSub(plot)) {
+		msg.prefix(player, prefix_plot, "Sub plots can't be expanded.");
+		goto("wait");
+	}
 	x1 = plot.getMinX(plot);
 	y1 = plot.getMinY(plot);
 	z1 = plot.getMinZ(plot);
@@ -3638,8 +3894,8 @@ if(arg0 == "expand") {
 			goto("wait");
 		}
 		//Calc costs
-		length = math.abs(x1 - x2);
-		width = math.abs(z1 - z2);
+		length = math.abs(x1 - x2) + 1;
+		width = math.abs(z1 - z2) + 1;
 		snuvis = plot.calcCost(length, width);
 		if(!hasEnoughMoney(player, snuvis)) {
 			msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(snuvis), "§r snuvis for this."));
@@ -3684,7 +3940,7 @@ if(arg0 == "share") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cShare§r] ", concat("/plot share ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cShare§r] ", concat("/plot share ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3707,8 +3963,8 @@ if(arg0 == "share") {
 			goto("wait");
 		}
 		player_id = player.getId(player);
-		if(!plot.isLeader(plot, player_id)) {
-			msg.prefix(player, prefix_plot, "You aren't the plot leader.");
+		if(!plot.isLeader(plot, player_id) && !plot.isMod(plot, player_id)) {
+			msg.prefix(player, prefix_plot, "You aren't a plot leader or mod.");
 			goto("wait");
 		}
 	}
@@ -3743,7 +3999,7 @@ if(arg0 == "kick") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cKick§r] ", concat("/plot kick ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cKick§r] ", concat("/plot kick ", p_name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3766,8 +4022,8 @@ if(arg0 == "kick") {
 			goto("wait");
 		}
 		player_id = player.getId(player);
-		if(!plot.isLeader(plot, player_id)) {
-			msg.prefix(player, prefix_plot, "You aren't the plot leader.");
+		if(!plot.isLeader(plot, player_id) && !plot.isMod(plot, player_id)) {
+			msg.prefix(player, prefix_plot, "You aren't a plot leader or mod.");
 			goto("wait");
 		}
 		if(player_name == p_name) {
@@ -3800,7 +4056,7 @@ if(arg0 == "name") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cRename§r] ", concat("/plot name ", name, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cRename§r] ", concat("/plot name ", name, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -3823,8 +4079,8 @@ if(arg0 == "name") {
 			goto("wait");
 		}
 		player_id = player.getId(player);
-		if(!plot.isLeader(plot, player_id)) {
-			msg.prefix(player, prefix_plot, "You aren't the plot leader.");
+		if(!plot.isLeader(plot, player_id) && !plot.isMod(plot, player_id)) {
+			msg.prefix(player, prefix_plot, "You aren't a plot leader or mod.");
 			goto("wait");
 		}
 	}
@@ -3851,6 +4107,7 @@ if(arg0 == "create" || arg0 == "c") {
 	x2 = loc.getX(loc2);
 	y2 = loc.getY(loc2);
 	z2 = loc.getZ(loc2);
+	create_message = "Plot created.";
 	if(!perm.has(player, "plot.other")) {
 		world_name = world.getName(world1);
 		if(!isSurvWorldName(world_name)) {
@@ -3858,34 +4115,49 @@ if(arg0 == "create" || arg0 == "c") {
 			goto("wait");
 		}
 		list = plot.intersecting(world1, x1, y1, z1, x2, y2, z2);
+		sub_plot = false;
 		if(list.getSize(list) > 0) {
-			msg.prefix(player, prefix_plot, "Intersecting plots are not allowed.");
-			goto("wait");
-		}
-		//Calc costs
-		length = math.abs(x1 - x2);
-		width = math.abs(z1 - z2);
-		snuvis = plot.calcCost(length, width);
-		free_plot_used = player.usedHisFreePlot(player_id);
-		if(!free_plot_used) {
-			snuvis -= plot.calcCost(16, 16);
-			if(snuvis < 0) {
-				snuvis = 0;
+			city_plot = list.getIndex(list, 0);
+			if(plot.isCity(city_plot)) {
+				city_id = plot.getId(city_plot);
+				if(!loc.hasPlotId(loc1, city_id)) {
+					msg.prefix(player, prefix_plot, "The sub plot needs to be surrounded by the city.");
+					goto("wait");
+				}
+				if(!loc.hasPlotId(loc2, city_id)) {
+					msg.prefix(player, prefix_plot, "The sub plot needs to be surrounded by the city.");
+					goto("wait");
+				}
+				sub_plot = true;
+			} else {
+				msg.prefix(player, prefix_plot, "Intersecting plots are not allowed.");
+				goto("wait");
 			}
-			msg.prefix(player, prefix_plot, "Free plot (16 x 16) to calculation included.");
-		}
-		if(!hasEnoughMoney(player, snuvis)) {
-			msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(snuvis), "§r snuvis for this."));
-			goto("wait");
 		}
-		create_message = concat("Plot created. Spent §6", text.number(snuvis), "§r snuvis.");
-		subMoney(player, snuvis);
-		if(!free_plot_used) {
-			player.setUsedFreePlot(player_id, true);
-			offerRank(player, "§eSiedler");
+		if(!sub_plot) {
+			//Calc costs
+			length = math.abs(x1 - x2) + 1;
+			width = math.abs(z1 - z2) + 1;
+			snuvis = plot.calcCost(length, width);
+			free_plot_used = player.usedHisFreePlot(player_id);
+			if(!free_plot_used) {
+				snuvis -= plot.calcCost(16, 16);
+				if(snuvis < 0) {
+					snuvis = 0;
+				}
+				msg.prefix(player, prefix_plot, "Free plot (16 x 16) to calculation included.");
+			}
+			if(!hasEnoughMoney(player, snuvis)) {
+				msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(snuvis), "§r snuvis for this."));
+				goto("wait");
+			}
+			create_message = concat("Plot created. Spent §6", text.number(snuvis), "§r snuvis.");
+			subMoney(player, snuvis);
+			if(!free_plot_used) {
+				player.setUsedFreePlot(player_id, true);
+				offerRank(player, "§eSiedler");
+			}
 		}
-	} else {
-		create_message = concat("Plot created.");
 	}
 	//Create plot
 	map.remove(plotpos1, player_id);
@@ -3896,7 +4168,7 @@ if(arg0 == "create" || arg0 == "c") {
 	plot = plot.add(loc1, loc2);
 	plot.setName(plot, concat(player_name, "'s plot"));
 	plot.addPlayer(plot, player_name);
-	plot.setRank(plot, player_id, "leader");
+	plot.setLeader(plot, player_id);
 	msg.prefix(player, prefix_plot, create_message);
 	goto("wait");
 }
@@ -3919,6 +4191,7 @@ if(arg0 == "create3d" || arg0 == "add3d") {
 	x2 = loc.getX(loc2);
 	y2 = loc.getY(loc2);
 	z2 = loc.getZ(loc2);
+	create_message = "3DPlot created.";
 	if(!perm.has(player, "plot.other")) {
 		world_name = world.getName(world1);
 		if(!isSurvWorldName(world_name)) {
@@ -3926,34 +4199,49 @@ if(arg0 == "create3d" || arg0 == "add3d") {
 			goto("wait");
 		}
 		list = plot.intersecting(world1, x1, y1, z1, x2, y2, z2);
+		sub_plot = false;
 		if(list.getSize(list) > 0) {
-			msg.prefix(player, prefix_plot, "Intersecting plots are not allowed.");
-			goto("wait");
-		}
-		//Calc costs
-		length = math.abs(x1 - x2);
-		width = math.abs(z1 - z2);
-		snuvis = plot.calcCost(length, width);
-		free_plot_used = player.usedHisFreePlot(player_id);
-		if(!free_plot_used) {
-			snuvis -= plot.calcCost(16, 16);
-			if(snuvis < 0) {
-				snuvis = 0;
+			city_plot = list.getIndex(list, 0);
+			if(plot.isCity(city_plot)) {
+				city_id = plot.getId(city_plot);
+				if(!loc.hasPlotId(loc1, city_id)) {
+					msg.prefix(player, prefix_plot, "The sub plot needs to be surrounded by the city.");
+					goto("wait");
+				}
+				if(!loc.hasPlotId(loc2, city_id)) {
+					msg.prefix(player, prefix_plot, "The sub plot needs to be surrounded by the city.");
+					goto("wait");
+				}
+				sub_plot = true;
+			} else {
+				msg.prefix(player, prefix_plot, "Intersecting plots are not allowed.");
+				goto("wait");
 			}
-			msg.prefix(player, prefix_plot, "Free plot (16 x 16) to calculation included.");
-		}
-		if(!hasEnoughMoney(player, snuvis)) {
-			msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(snuvis), "§r snuvis for this."));
-			goto("wait");
 		}
-		create_message = concat("3DPlot created. Spent §6", text.number(snuvis), "§r snuvis.");
-		subMoney(player, snuvis);
-		if(!free_plot_used) {
-			player.setUsedFreePlot(player_id, true);
-			offerRank(player, "§eSiedler");
+		if(!sub_plot) {
+			//Calc costs
+			length = math.abs(x1 - x2) + 1;
+			width = math.abs(z1 - z2) + 1;
+			snuvis = plot.calcCost(length, width);
+			free_plot_used = player.usedHisFreePlot(player_id);
+			if(!free_plot_used) {
+				snuvis -= plot.calcCost(16, 16);
+				if(snuvis < 0) {
+					snuvis = 0;
+				}
+				msg.prefix(player, prefix_plot, "Free plot (16 x 16) to calculation included.");
+			}
+			if(!hasEnoughMoney(player, snuvis)) {
+				msg.prefix(player, prefix_plot, concat("You'll need §6", text.number(snuvis), "§r snuvis for this."));
+				goto("wait");
+			}
+			create_message = concat("3DPlot created. Spent §6", text.number(snuvis), "§r snuvis.");
+			subMoney(player, snuvis);
+			if(!free_plot_used) {
+				player.setUsedFreePlot(player_id, true);
+				offerRank(player, "§eSiedler");
+			}
 		}
-	} else {
-		create_message = concat("3DPlot created.");
 	}
 	//Create plot
 	map.remove(plotpos1, player_id);
@@ -3961,7 +4249,7 @@ if(arg0 == "create3d" || arg0 == "add3d") {
 	plot = plot.add(loc1, loc2);
 	plot.setName(plot, concat(player_name, "'s plot"));
 	plot.addPlayer(plot, player_name);
-	plot.setRank(plot, player_id, "leader");
+	plot.setLeader(plot, player_id);
 	msg.prefix(player, prefix_plot, create_message);
 	goto("wait");
 }
@@ -3991,6 +4279,9 @@ if(arg0 == "pos1" || arg0 == "pos2") {
 			}
 			msg.prefix(player, prefix_plot, "Free plot (16 x 16) to calculation included.");
 		}
+		if(loc.isCity(loc1) && loc.isCity(loc2)) {
+			snuvis = 0;
+		}
 		msg.prefix(player, prefix_plot, concat("This plot will cost §6", text.number(snuvis), "§r snuvis."));
 	}
 	goto("wait");
@@ -4028,7 +4319,7 @@ if(arg0 == "flags") {
 				x = loc.getX(location);
 				y = loc.getY(location);
 				z = loc.getZ(location);
-				msg(player, text.click(" [§cFlags§r] ", concat("/plot flags ", flags, " ", boolean, " ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cFlags§r] ", concat("/plot flags ", flags, " ", boolean, " ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -4046,9 +4337,17 @@ if(arg0 == "flags") {
 	}
 	flags_list = list.new();
 	temp_flags = 0;
+	if(flags >= 512) {
+		list.add(flags_list, "SUB_PLOT_FLAG");
+		temp_flags += 512;
+	}
+	if(flags >= 256) {
+		list.add(flags_list, "FREE_FLAG");
+		temp_flags += 256;
+	}
 	if(flags >= 128) {
 		list.add(flags_list, "CITY_FLAG");
-		temp_flags += 64;
+		temp_flags += 128;
 	}
 	if(flags >= 64) {
 		list.add(flags_list, "EXPLOSION_FLAG");
@@ -4097,7 +4396,7 @@ if(arg0 == "listall") {
 	while(hasNext(iterator)) {
 		plot = next(iterator);
 		plot_id = plot.getId(plot);
-		msg(player, concat(" - #", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)), " ", plot);
+		msg(player, concat(" - #", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 	}
 	goto("wait");
 }
@@ -4121,7 +4420,7 @@ if(arg0 == "moreinfo" || arg0 == "mi") {
 			for(i = 0; i < amount; i++) {
 				plot = list.getIndex(plot_list, i);
 				plot_id = plot.getId(plot);
-				msg(player, text.click(" [§cInfo§r] ", concat("/plot moreinfo ", plot_id)), concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+				msg(player, text.click(" [§cInfo§r] ", concat("/plot moreinfo ", plot_id)), concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 			}
 			goto("wait");
 		}
@@ -4143,7 +4442,7 @@ if(arg0 == "moreinfo" || arg0 == "mi") {
 		owners = concat(owners, "/", player.getName(list.getIndex(owners_list, i)));
 	}
 	plot_id = plot.getId(plot);
-	msg.prefix(player, prefix_plot, concat("#", text.number(plot_id), " §6", plot.getName(plot), " §r", owners));
+	msg.prefix(player, prefix_plot, concat("#", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", owners));
 	msg(player, "   §dWorld: §r", world.getName(world));
 	msg(player, "   §dPos1: §r", plot.getMinX(plot), " / ", plot.getMinY(plot), " / ", plot.getMinZ(plot));
 	msg(player, "   §dPos2: §r", plot.getMaxX(plot), " / ", plot.getMaxY(plot), " / ", plot.getMaxZ(plot));
@@ -4151,6 +4450,24 @@ if(arg0 == "moreinfo" || arg0 == "mi") {
 	flags_true = list.new();
 	flags_false = list.new();
 	array = array.new(2);
+	array[0] = 512;
+	array[1] = "SUB_PLOT_FLAG";
+	if(flags >= 512) {
+		list.add(flags_true, array);
+		flags -= 512;
+	} else {
+		list.add(flags_false, array);
+	}
+	array = array.new(2);
+	array[0] = 256;
+	array[1] = "FREE_FLAG";
+	if(flags >= 256) {
+		list.add(flags_true, array);
+		flags -= 256;
+	} else {
+		list.add(flags_false, array);
+	}
+	array = array.new(2);
 	array[0] = 128;
 	array[1] = "CITY_FLAG";
 	if(flags >= 128) {
@@ -4230,7 +4547,7 @@ if(arg0 == "moreinfo" || arg0 == "mi") {
 		array = next(iter);
 		flag_number = array[0];
 		flag_name = array[1];
-		msg(player, "    ", text.click(concat(" §d[§r", flag_name, "§d] "), concat("/plot flags ", flag_number, " false ", plot_id, " ", x, " ", y, " ", z, " ", world.getName(world))));
+		msg(player, "    ", text.click(concat(" §d[§r", flag_name, "§d] "), concat("/plot flags ", flag_number, " false ", plot_id)));
 	}
 	msg(player, "   §dFlags false:");
 	iter = list.iterator(flags_false);
@@ -4238,7 +4555,7 @@ if(arg0 == "moreinfo" || arg0 == "mi") {
 		array = next(iter);
 		flag_number = array[0];
 		flag_name = array[1];
-		msg(player, "    ", text.click(concat(" §d[§r", flag_name, "§d] "), concat("/plot flags ", flag_number, " true ", plot_id, " ", x, " ", y, " ", z, " ", world.getName(world))));
+		msg(player, "    ", text.click(concat(" §d[§r", flag_name, "§d] "), concat("/plot flags ", flag_number, " true ", plot_id)));
 	}
 	goto("wait");
 }
@@ -4254,12 +4571,7 @@ if(arg0 == "info" || arg0 == "i") {
 	for(i = 0; i < size; i++) {
 		plot = list.getIndex(list, i);
 		plot_id = plot.getId(plot);
-		if(plot.isCity(plot)) {
-			type = "§4[§cCity§4]";
-		} else {
-			type = "§6[§ePlot§6]";
-		}
-		msg(player, concat(" - #", text.number(plot_id), " ", type, " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
+		msg(player, concat(" - #", text.number(plot_id), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
 	}
 	goto("wait");
 }
@@ -5819,6 +6131,7 @@ entity.heal(affectedplayer, 50);
 player.setHunger(affectedplayer, 20);
 player.setSaturation(affectedplayer, 5);
 entity.clearEffects(affectedplayer);
+entity.setBurning(affectedplayer, 0);
 msg.prefix(affectedplayer, prefix_commands, "You have been healed.");
 goto("wait");
 
@@ -6903,6 +7216,18 @@ function setCommandHelps() {
 	helpArg0 = command.newHelpLiteral("leader");
 	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "player"));
 	command.addHelpChild(help, helpArg0);
+	//plot mod <name>
+	helpArg0 = command.newHelpLiteral("mod");
+	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "player"));
+	command.addHelpChild(help, helpArg0);
+	//plot degrade <name>
+	helpArg0 = command.newHelpLiteral("degrade");
+	command.addHelpChild(helpArg0, command.newHelpSpecial("Player", "player"));
+	command.addHelpChild(help, helpArg0);
+	//plot sell <price>
+	helpArg0 = command.newHelpLiteral("sell");
+	command.addHelpChild(helpArg0, command.newHelpInt("price", 1, 10000));
+	command.addHelpChild(help, helpArg0);
 	//plot moreinfo
 	command.addHelpChild(help, command.newHelpLiteral("moreinfo", "plot.moreinfo"));
 	//plot listall

+ 50 - 0
system/gamerules.txt

@@ -0,0 +1,50 @@
+event.load("world_load");
+
+world.setGamerules(world.get("overworld"));
+world.setGamerules(world.get("the_nether"));
+world.setGamerules(world.get("the_end"));
+world.setGamerules(world.get("story"));
+world.setGamerules(world.get("games"));
+world.setGamerules(world.get("creative"));
+
+msg("dev", "§bGamerules §rloaded.");
+@wait
+wait();
+ignoreGoto(event);
+goto("wait");
+
+@world_load
+world.setGamerules(world);
+goto("wait");
+
+function world.setGamerules(world) {
+	if(world == null) {
+		return;
+	}
+	gamerule.set.bool("showDeathMessages", world, false);
+	gamerule.set.bool("doImmediateRespawn", world, false);
+	gamerule.set.bool("doFireTick", world, false);
+	gamerule.set.bool("commandBlockOutput", world, false);
+	gamerule.set.bool("keepInventory", world, true);
+	gamerule.set.int("spawnRadius", world, 1);
+	
+	world_name = world.getName(world);
+	if(world_name == "games") {
+		gamerule.set.bool("doDaylightCycle", world, false);
+	}
+	if(world_name == "creative") {
+		gamerule.set.bool("doDaylightCycle", world, false);
+	}
+}
+
+function gamerule.set.bool(gamerule_string, world, boolean) {
+	gamerule_key = gamerule.getKey(gamerule_string);
+	gamerule_value = gamerule.getValue(world, gamerule_key);
+	gamerule.setBool(gamerule_value, boolean);
+}
+
+function gamerule.set.int(gamerule_string, world, int) {
+	gamerule_key = gamerule.getKey(gamerule_string);
+	gamerule_value = gamerule.getValue(world, gamerule_key);
+	gamerule.setInt(gamerule_value, int);
+}

+ 0 - 2
system/perms.txt

@@ -146,7 +146,6 @@ perm.registerGroup(2, "enderchest");
 perm.registerGroup(2, "say");
 perm.registerGroup(2, "feed");
 perm.registerGroup(2, "tppos");
-perm.registerGroup(2, "plot.expand");
 perm.registerGroup(2, "plot.other");
 perm.registerGroup(2, "plot.moreinfo");
 perm.registerGroup(2, "boost");
@@ -365,7 +364,6 @@ perm.registerGroup(12, "gamerule");
 perm.registerGroup(12, "fly");
 perm.registerGroup(12, "fly.other");
 perm.registerGroup(12, "plot.other");
-perm.registerGroup(12, "plot.expand");
 
 //YTer
 perm.registerGroup(13, "isYT");

+ 124 - 12
utils/u_general.txt

@@ -262,15 +262,15 @@ function getGamesWorld() { //Deprecated
 }
 
 function world.getServerSpawn() {
-	return read.location(config.getString(getScriptVar("server_config"), "serverspawn", "games:0:0:0"));
+	return read.location(config.getString(getScriptVar("server_config"), "serverspawn", "games:0:100:0"));
 }
 
 function world.getGamesSpawn() {
-	return read.location(config.getString(getScriptVar("server_config"), "gamesspawn", "games:0:0:0"));
+	return read.location(config.getString(getScriptVar("server_config"), "gamesspawn", "games:0:100:0"));
 }
 
 function world.getCreativeSpawn() {
-	return read.location(config.getString(getScriptVar("server_config"), "creativespawn", "games:0:0:0"));
+	return read.location(config.getString(getScriptVar("server_config"), "creativespawn", "games:0:100:0"));
 }
 
 function world.getOverWorld() {
@@ -1316,8 +1316,8 @@ function player.showDefaultStacks(player) {
 }
 
 function player.setSpeed(player, speed) {
-	living.setMovementSpeed(player, speed / 10);
-	living.setFlyingSpeed(player, speed / 10 * 4);
+	living.setPersistentMovementSpeed(player, speed / 10);
+	living.setPersistentFlyingSpeed(player, speed / 10 * 4);
 }
 
 function player.usedHisFreePlot(player_or_id) {
@@ -1852,8 +1852,8 @@ function plot.getOwnersString(plot) {
 	return text.concatList(owners_list, " / ", 0, list.getSize(owners_list) - 1);
 }
 
-function plot.isLeader(plot, player_id) {
-	return plot.getRank(plot, player_id) == "leader";
+function plot.isLeader(plot, player_or_id) {
+	return plot.getRank(plot, player_or_id) == "leader";
 }
 
 function plot.getLeader(plot) {
@@ -1870,7 +1870,39 @@ function plot.getLeader(plot) {
 	return player_id;
 }
 
-function plot.getRank(plot, player_id) {
+function plot.setLeader(plot, player_or_id) {
+	plot.setRank(plot, player_or_id, "leader");
+}
+
+function plot.isMod(plot, player_or_id) {
+	return plot.getRank(plot, player_or_id) == "mod";
+}
+
+function plot.getMods(plot) {
+	list = list.new();
+	plot_id = plot.getId(plot);
+	stmt = databank.prepare("SELECT player_id FROM plotranks WHERE plot_id = ? AND rank = ?;");
+	databank.setInt(stmt, 1, plot_id);
+	databank.setString(stmt, 2, "mod");
+	result = databank.execute(stmt);
+	while(databank.next(result)) {
+		list.add(list, databank.getInt(result, 1));
+	}
+	databank.close(result);
+	databank.close(stmt);
+	return list;
+}
+
+function plot.setMod(plot, player_or_id) {
+	plot.setRank(plot, player_or_id, "mod");
+}
+
+function plot.getRank(plot, player_or_id) {
+	if(isPlayer(player_or_id)) {
+		player_id = player.getId(player_or_id);
+	} else {
+		player_id = player_or_id;
+	}
 	plot_id = plot.getId(plot);
 	stmt = databank.prepare("SELECT rank FROM plotranks WHERE player_id = ? AND plot_id = ?;");
 	databank.setInt(stmt, 1, player_id);
@@ -1881,10 +1913,16 @@ function plot.getRank(plot, player_id) {
 	}
 	databank.close(result);
 	databank.close(stmt);
+	msg("dev", rank);
 	return rank;
 }
 
-function plot.setRank(plot, player_id, rank) {
+function plot.setRank(plot, player_or_id, rank) {
+	if(isPlayer(player_or_id)) {
+		player_id = player.getId(player_or_id);
+	} else {
+		player_id = player_or_id;
+	}
 	plot_id = plot.getId(plot);
 	stmt = databank.prepare("INSERT INTO plotranks (plot_id, player_id, rank) VALUES (?,?,?)");
 	databank.setInt(stmt, 1, plot_id);
@@ -1893,7 +1931,12 @@ function plot.setRank(plot, player_id, rank) {
 	databank.workerExecute(stmt);
 }
 
-function plot.removeRank(plot, player_id) {
+function plot.removeRank(plot, player_or_id) {
+	if(isPlayer(player_or_id)) {
+		player_id = player.getId(player_or_id);
+	} else {
+		player_id = player_or_id;
+	}
 	plot_id = plot.getId(plot);
 	stmt = databank.prepare("DELETE FROM plotranks WHERE player_id = ? AND plot_id = ?;");
 	databank.setInt(stmt, 1, player_id);
@@ -1901,6 +1944,13 @@ function plot.removeRank(plot, player_id) {
 	databank.workerExecute(stmt);
 }
 
+function plot.transferRanks(old_plot_id, new_plot_id) {
+	stmt = databank.prepare("UPDATE plotranks SET plot_id = ? WHERE plot_id = ?;");
+	databank.setInt(stmt, 1, new_plot_id);
+	databank.setInt(stmt, 2, old_plot_id);
+	databank.workerExecute(stmt);
+}
+
 function plot.removeAllPlayers(plot) {
 	list = plot.getOwners(plot);
 	iter = list.iterator(list);
@@ -1919,6 +1969,7 @@ function plot.setEdges(plot, location1, location2) {
 	world = loc.getWorld(location1);
 	plot.remove(plot, world);
 	//Alte Daten auf neuem Plot setzen
+	plot.transferRanks(plot.getId(plot), plot.getId(new_plot));
 	plot.setName(new_plot, plot_name);
 	new_list = plot.getOwners(new_plot);
 	for(i = 0; i < list.getSize(list); i++) {
@@ -1932,6 +1983,24 @@ function getFlags(plot, getActive) { //getActive = true means getActiveFlags
 	flags_true = list.new();
 	flags_false = list.new();
 	array = array.new(2);
+	array[0] = 512;
+	array[1] = "SUB_PLOT_FLAG";
+	if(flags >= 512) {
+		list.add(flags_true, array);
+		flags -= 512;
+	} else {
+		list.add(flags_false, array);
+	}
+	array = array.new(2);
+	array[0] = 256;
+	array[1] = "FREE_FLAG";
+	if(flags >= 256) {
+		list.add(flags_true, array);
+		flags -= 256;
+	} else {
+		list.add(flags_false, array);
+	}
+	array = array.new(2);
 	array[0] = 128;
 	array[1] = "CITY_FLAG";
 	if(flags >= 128) {
@@ -2009,18 +2078,49 @@ function getFlags(plot, getActive) { //getActive = true means getActiveFlags
 	}
 }
 
-function plot.isCity(plot) {
-	return plot.hasFlags(plot, 128);
+function plot.getType(plot) {
+	if(plot.isCity(plot)) {
+		type = "§4[§cCity§4]";
+	} elseif(plot.isFree(plot)) {
+		type = "§3[§bFree§3]";
+	} elseif(plot.isSub(plot)) {
+		type = "§6[§eSubPlot§6]";
+	} else {
+		type = "§6[§ePlot§6]";
+	}
+	return type;
 }
 
 function plot.isExplosive(plot) {
 	return plot.hasFlags(plot, 64);
 }
 
+function plot.isCity(plot) {
+	return plot.hasFlags(plot, 128);
+}
+
+function plot.isFree(plot) {
+	return plot.hasFlags(plot, 256);
+}
+
+function plot.isSub(plot) {
+	return plot.hasFlags(plot, 512);
+}
+
 function plot.setCity(plot, boolean) {
 	plot.setFlags(plot, 128, boolean);
 }
 
+function plot.setFree(plot, boolean) {
+	plot.setFlags(plot, 256, boolean);
+	plot.setFlags(plot, 512, !boolean); //Sub-Plot entfernen
+}
+
+function plot.setSub(plot, boolean) {
+	plot.setFlags(plot, 512, boolean);
+	plot.setFlags(plot, 256, !boolean); //Free-Plot entfernen
+}
+
 //--------------------------------------------------
 //Skill-Utils
 //--------------------------------------------------
@@ -2159,6 +2259,18 @@ function skill.showShop(player, skill_name1, skill_name2, skill_name3, skill_nam
 //Loc-Utils
 //--------------------------------------------------
 
+function loc.isCity(location) {
+	list = plot.get(location);
+	iter = list.iterator(list);
+	while(hasNext(iter)) {
+		plot = next(iter);
+		if(plot.isCity(plot)) {
+			return true;
+		}
+	}
+	return false;
+}
+
 function loc.hasPlotId(location, plot_id) {
 	return list.contains(plot.getIdListFromLocation(location), plot_id);
 }