|
@@ -148,6 +148,7 @@ command.registerAlias("fuckit", "giveup");
|
|
|
command.registerAlias("ram", "memory");
|
|
|
command.registerAlias("thor", "lightning");
|
|
|
|
|
|
+beds_tag = block.getTag("minecraft:beds");
|
|
|
chest_tag = block.getTag("forge:chests");
|
|
|
sign_tag = block.getTag("minecraft:signs");
|
|
|
crops_tag = block.getTag("minecraft:crops");
|
|
@@ -424,7 +425,16 @@ databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS homes (playe
|
|
|
jail_loop_active = false;
|
|
|
afk_loop_active = false;
|
|
|
|
|
|
+actual_move_id = map.new(); //Key: player_uuid, Value: move_id. Diese Map speichert das aktuell betretene Plot eines Spielers.
|
|
|
+plot_move_ids_list = list.new(); //Speichert Array mit plot_id und move_id
|
|
|
+check_for_plot_list = list.new();
|
|
|
+plot.registerMoveEvents(world.get("overworld"));
|
|
|
+plot.registerMoveEvents(world.get("the_nether"));
|
|
|
+plot.registerMoveEvents(world.get("the_end"));
|
|
|
+plot.registerMoveEvents(world.get("games"));
|
|
|
+
|
|
|
event.load("entity_click");
|
|
|
+event.load("player_move");
|
|
|
event.load("inv_click");
|
|
|
event.load("inv_close");
|
|
|
event.load("function_key");
|
|
@@ -473,8 +483,37 @@ if(event == "custom_command") {
|
|
|
ignoreGoto(command);
|
|
|
goto("wait");
|
|
|
}
|
|
|
+if(event == "player_move") {
|
|
|
+ player_uuid = player.getUuid(player);
|
|
|
+ last_move_id = map.getOrDefault(actual_move_id, player_uuid, null);
|
|
|
+ if(last_move_id == id) {
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ world = loc.getWorld(entity.getLocation(player));
|
|
|
+ plot_id = plot.getPlotIdFromMoveId(id);
|
|
|
+ plot = plot.getFromId(plot_id, world);
|
|
|
+ if(plot == null) {
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ if(plot.isCity(plot)) {
|
|
|
+ color_code = "§c";
|
|
|
+ } else {
|
|
|
+ color_code = "§e";
|
|
|
+ }
|
|
|
+ title.reset(player);
|
|
|
+ title.setSub(player, concat("You entered ", color_code, plot.getName(plot), "."));
|
|
|
+ title.send(player, "");
|
|
|
+ map.add(actual_move_id, player_uuid, id);
|
|
|
+ list.add(check_for_plot_list, player_uuid);
|
|
|
+ sgoto(100, "checkForPlot");
|
|
|
+ goto("wait");
|
|
|
+}
|
|
|
if(event == "block_click") {
|
|
|
- block = block.get(block_loc);
|
|
|
+ world_name = world.getName(loc.getWorld(entity.getLocation(player)));
|
|
|
+ if(!isSurvWorldName(world_name) && block.hasTag(beds_tag, block)) {
|
|
|
+ cancel = true;
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
if(block.hasTag(chest_tag, block)) {
|
|
|
sub_plot = loc.getSubPlot(block_loc);
|
|
|
if(sub_plot == null) {
|
|
@@ -3295,7 +3334,7 @@ if(size < 1) {
|
|
|
player_uuid = player.getUuid(sender);
|
|
|
p_uuid = map.get(answer_map, player_uuid);
|
|
|
if(p_uuid == null) {
|
|
|
- msg.prefix(sender, prefix_commands, "There ist no one you could answer.");
|
|
|
+ msg.prefix(sender, prefix_commands, "There is no one you could answer.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
nachricht = text.replace(text.concatList(args, " ", 0, size - 1), "&", "§");
|
|
@@ -3759,9 +3798,12 @@ if(size == 0) {
|
|
|
msg(player, "§d - raise §rRaises a plot to a city");
|
|
|
msg(player, "§d - sell <price> §rSells a sub-plot");
|
|
|
if(perm.has(player, "plot.moreinfo")) {
|
|
|
+ msg(player, "§d - list [player] §rLists all plots from a player");
|
|
|
msg(player, "§d - moreinfo [id] §rReturns more detailed infos");
|
|
|
msg(player, "§d - listall §rLists all plots");
|
|
|
msg(player, "§d - flags <flags> <boolean> §rSet all flags to the boolean");
|
|
|
+ } else {
|
|
|
+ msg(player, "§d - list §rLists your plots");
|
|
|
}
|
|
|
goto("wait");
|
|
|
}
|
|
@@ -4151,6 +4193,7 @@ if(arg0 == "remove") {
|
|
|
}
|
|
|
}
|
|
|
plot.removeAllPlayers(plot);
|
|
|
+ plot.delMoveEvent(plot);
|
|
|
plot.remove(plot, world);
|
|
|
msg.prefix(player, prefix_plot, concat("Plot removed. #", text.number(plot.getId(plot)), " §6", plot.getName(plot)));
|
|
|
goto("wait");
|
|
@@ -4418,6 +4461,7 @@ if(arg0 == "name") {
|
|
|
goto("wait");
|
|
|
}
|
|
|
plot = list.getIndex(plot_list, 0);
|
|
|
+ name = list.getIndex(args, 1);
|
|
|
if(amount > 1) {
|
|
|
msg.prefix(player, prefix_plot, "Multiple plots present:");
|
|
|
for(i = 0; i < amount; i++) {
|
|
@@ -4563,6 +4607,7 @@ if(arg0 == "create" || arg0 == "c") {
|
|
|
if(sub_plot) {
|
|
|
plot.setSub(plot, true);
|
|
|
}
|
|
|
+ plot.setMoveEvent(plot, world1);
|
|
|
plot.setName(plot, concat(player_name, "'s plot"));
|
|
|
plot.addPlayer(plot, player_name);
|
|
|
plot.setLeader(plot, player_id);
|
|
@@ -4654,6 +4699,7 @@ if(arg0 == "create3d" || arg0 == "add3d") {
|
|
|
if(sub_plot) {
|
|
|
plot.setSub(plot, true);
|
|
|
}
|
|
|
+ plot.setMoveEvent(plot, world1);
|
|
|
plot.setName(plot, concat(player_name, "'s plot"));
|
|
|
plot.addPlayer(plot, player_name);
|
|
|
plot.setLeader(plot, player_id);
|
|
@@ -4788,6 +4834,31 @@ if(arg0 == "flags") {
|
|
|
msg.prefix(player, prefix_plot, "Flags gesetzt.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
+if(arg0 == "list") {
|
|
|
+ if(size == 1) {
|
|
|
+ p_name = player.getName(player);
|
|
|
+ } else {
|
|
|
+ if(!perm.has(player, "plot.moreinfo")) {
|
|
|
+ perm.no(player, "plot.moreinfo");
|
|
|
+ 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);
|
|
|
+ msg.prefix(player, prefix_commands, concat(p_name, "'s plots:"));
|
|
|
+ world = loc.getWorld(entity.getLocation(player));
|
|
|
+ iter = plot.iterator(world, p_uuid);
|
|
|
+ while(hasNext(iter)) {
|
|
|
+ plot = next(iter);
|
|
|
+ msg(player, concat(" - #", text.number(plot.getId(plot)), " ", plot.getType(plot), " §6", plot.getName(plot), " §r", plot.getOwnersString(plot)));
|
|
|
+ }
|
|
|
+ goto("wait");
|
|
|
+}
|
|
|
if(arg0 == "listall") {
|
|
|
if(!perm.has(player, "plot.moreinfo")) {
|
|
|
perm.no(player, "plot.moreinfo");
|
|
@@ -8722,4 +8793,83 @@ if(list != null) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+goto("wait");
|
|
|
+
|
|
|
+//--------------------------------------------------
|
|
|
+//Plot-Utils
|
|
|
+//--------------------------------------------------
|
|
|
+
|
|
|
+function plot.registerMoveEvents(world) {
|
|
|
+ iter = plot.iterator(world);
|
|
|
+ while(hasNext(iter)) {
|
|
|
+ plot = next(iter);
|
|
|
+ if(plot.isCity(plot) || plot.isPlot(plot)) {
|
|
|
+ plot.setMoveEvent(plot, world);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function plot.delMoveEvent(plot) {
|
|
|
+ plot_id = plot.getId(plot);
|
|
|
+ for(i = 0; i < list.getSize($plot_move_ids_list); i++) {
|
|
|
+ a = list.getIndex($plot_move_ids_list, i);
|
|
|
+ if(a[1] == plot_id) {
|
|
|
+ event.removeMoveData(a[0]);
|
|
|
+ list.removeIndex($plot_move_ids_list, i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function plot.setMoveEvent(plot, world) {
|
|
|
+ x1 = plot.getMinX(plot);
|
|
|
+ y1 = plot.getMinY(plot);
|
|
|
+ z1 = plot.getMinZ(plot);
|
|
|
+ x2 = plot.getMaxX(plot);
|
|
|
+ y2 = plot.getMaxY(plot);
|
|
|
+ z2 = plot.getMaxZ(plot);
|
|
|
+ loc1 = loc.new(world, x1, y1, z1);
|
|
|
+ loc2 = loc.new(world, x2, y2, z2);
|
|
|
+ move_id = event.addMoveData(loc1, loc2, 100, -1);
|
|
|
+ plot_id = plot.getId(plot);
|
|
|
+ a = array.new(2);
|
|
|
+ a[0] = move_id;
|
|
|
+ a[1] = plot_id;
|
|
|
+ list.add($plot_move_ids_list, a);
|
|
|
+}
|
|
|
+
|
|
|
+function plot.getPlotIdFromMoveId(move_id) {
|
|
|
+ iter = list.iterator($plot_move_ids_list);
|
|
|
+ while(hasNext(iter)) {
|
|
|
+ a = next(iter);
|
|
|
+ if(a[0] == move_id) {
|
|
|
+ return a[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+}
|
|
|
+
|
|
|
+function plot.getMoveIdFromPlotId(plot_id) {
|
|
|
+ iter = list.iterator($plot_move_ids_list);
|
|
|
+ while(hasNext(iter)) {
|
|
|
+ a = next(iter);
|
|
|
+ if(a[1] == plot_id) {
|
|
|
+ return a[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+}
|
|
|
+
|
|
|
+@checkForPlot
|
|
|
+player_uuid = list.getIndex(check_for_plot_list, 0);
|
|
|
+list.removeIndex(check_for_plot_list, 0);
|
|
|
+player = player.get(player_uuid);
|
|
|
+player_loc = entity.getLocation(player);
|
|
|
+plot_list = plot.get(player_loc);
|
|
|
+if(list.getSize(plot_list) == 0) {
|
|
|
+ map.remove(actual_move_id, player_uuid);
|
|
|
+} else {
|
|
|
+ list.add(check_for_plot_list, player_uuid);
|
|
|
+ sgoto(100, "checkForPlot");
|
|
|
+}
|
|
|
goto("wait");
|