123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- event.load("custom_command");
- event.load("block_click");
- event.load("player_leave");
- event.load("player_giveup");
- command.add("pos1");
- command.add("pos2");
- command.add("use");
- command.add("rg");
- list.new("undotype");
- list.new("undodata");
- list.new("undoloc");
- areapermanent = false;
- if(player == null) {
- term();
- }
- if(!perm.has(player, "isMod") || !perm.has(player, "isBuilder")) {
- player.speak(player, "§dClone", "§rNo perms for that");
- term();
- }
- player.speak(player, "§dClone", "§rHave fun");
- @wait
- wait();
- if(event == "player_leave" || event == "player_giveup") {
- term();
- }
- if(event == "custom_command") {
- if(command == "use") {
- temp = item.getType(entity.getEquip(player, "hand"));
- if(temp != "minecraft:air") {
- tool = temp;
- player.speak(player, "§dClone", "§rTool gesetzt");
- } else {
- player.speak(player, "§dClone", "§rMit Luft kannst du nichts anklicken");
- }
- removeVar("temp");
- goto("wait");
- }
- if(command == "pos1") {
- temploc = entity.getLocation(player);
- wepos1 = temploc;
- player.speak(player, "§dClone", "§rPos1 gesetzt");
- removeVar("temploc");
- areapermanent = false;
- goto("wait");
- }
- if(command == "pos2") {
- temploc = entity.getLocation(player);
- wepos2 = temploc;
- player.speak(player, "§dClone", "§rPos2 gesetzt");
- removeVar("temploc");
- areapermanent = false;
- goto("wait");
- }
- if(command == "rg") {
- i = -1;
- while(++i < list.getSize(undotype)) {
- block.set(list.getIndex(undoloc, i), read.item(concat(list.getIndex(undotype, i), ":", text.number(list.getIndex(undodata, i)))));
- reset();
- }
- player.speak(player, "§dClone", "§rÄnderungen rückgängig gemacht");
- goto("wait");
- }
- }
- if(event == "block_click") {
- p = player;
- bloc = block_loc;
- if(tool == item.getType(entity.getEquip(player, "hand"))) {
- if(!areapermanent) {
- if(wepos1 == null || wepos2 == null) {
- player.speak(player, "§dClone", "§rWähle zuerst einen Bereich aus!");
- goto("wait");
- }
- world1 = loc.getCoord(wepos1, "w");
- world2 = loc.getCoord(wepos2, "w");
- if(world1 != world2) {
- player.speak(player, "§dClone", "§rDie Welten der Koordinaten stimmen nicht überein!");
- goto("wait");
- }
- x1 = loc.getCoord(wepos1, "bx");
- y1 = loc.getCoord(wepos1, "by");
- z1 = loc.getCoord(wepos1, "bz");
- x2 = loc.getCoord(wepos2, "bx");
- y2 = loc.getCoord(wepos2, "by");
- z2 = loc.getCoord(wepos2, "bz");
- if(x1 > x2) {
- helper = x2;
- x2 = x1;
- x1 = helper;
- }
- if(y1 > y2) {
- helper = y2;
- y2 = y1;
- y1 = helper;
- }
- if(z1 > z2) {
- helper = z2;
- z2 = z1;
- z1 = helper;
- }
- removeVar("helper");
- copystartloc = read.location(concat(world1, ":", x1, ":", y1, ":", z1));
- xcopyedgedistance = x2 - x1;
- ycopyedgedistance = y2 - y1;
- zcopyedgedistance = z2 - z1;
- areapermanent = true;
- }
- counter = 0;
- list.clear(undotype);
- list.clear(undodata);
- list.clear(undoloc);
- bloc = loc.mod(bloc, 0, 1, 0);
- x = -1;
- while(inc("x") <= xcopyedgedistance) {
- y = -1;
- while(inc("y") <= ycopyedgedistance) {
- z = -1;
- while(inc("z") <= zcopyedgedistance) {
- relloc1 = loc.mod(copystartloc, x, y, z);
- relloc2 = loc.mod(bloc, x, y, z);
- list.add(undotype, block.getType(relloc2));
- list.add(undodata, block.getData(relloc2));
- list.add(undoloc, relloc2);
-
- if(block.getType(relloc1) != "minecraft:air") {
- block.clone(relloc1, relloc2);
- }
- if(inc("counter") == 1500) {
- waitfor(1);
- counter = 0;
- }
- reset();
- }
- }
- }
- player.speak(p, "§dClone", "§rBereich geklont");
- goto("wait");
- }
- }
- goto("wait");
|