|
@@ -130,6 +130,7 @@ command.register("unmute", "Unmutes a player");
|
|
|
command.register("user", "Returns infos about a user");
|
|
|
command.register("vanish", "Vanishes a player");
|
|
|
command.register("var", "Reads variables from a scripts");
|
|
|
+command.register("vote", "Show vote rewars");
|
|
|
command.register("voxel", "Set radius for voxel");
|
|
|
command.register("warn", "Warns a player");
|
|
|
command.register("warp", "Warp-Commands");
|
|
@@ -233,6 +234,7 @@ if(live_set == null) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+afk_loop_active = false;
|
|
|
afk_map = getScriptVar("afk_map");
|
|
|
if(afk_map == null) {
|
|
|
afk_map = map.new();
|
|
@@ -245,13 +247,21 @@ if(afk_map == null) {
|
|
|
player = player.get(map.getKey(element));
|
|
|
if(player != null) {
|
|
|
player.setAfk(player, true);
|
|
|
+ afk_loop_active = true;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+if(afk_loop_active) {
|
|
|
+ sgoto(30, "afk_loop");
|
|
|
+}
|
|
|
|
|
|
-setScriptVar("hawkeye_lists", map.new());
|
|
|
+setScriptVar("ha_data_lists", map.new());
|
|
|
+setScriptVar("ha_undo_lists", map.new());
|
|
|
+money.setBoostFactor(1);
|
|
|
|
|
|
sgoto(10, "coordsloop");
|
|
|
+sgoto(1200, "afk_checker_loop");
|
|
|
|
|
|
clan_invitations = list.new();
|
|
|
friend_requests = map.new();
|
|
@@ -267,6 +277,7 @@ ride_set = set.new();
|
|
|
fields = set.new();
|
|
|
vanish_set = set.new();
|
|
|
skip_night_set = set.new();
|
|
|
+afk_checker_map = map.new();
|
|
|
|
|
|
butcher_set = set.new();
|
|
|
set.add(butcher_set, "zombie");
|
|
@@ -427,6 +438,10 @@ 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);
|
|
|
|
|
|
+vote_inv = inv.new("222222222");
|
|
|
+inv.setItem(vote_inv, 0, read.item("km:coin_gold", 1, "§fMoneyBooster", "Doubles incoming money for 5 minutes.", "Cost: 30 VP"));
|
|
|
+vote_inv_id = inv.getId(vote_inv);
|
|
|
+
|
|
|
ha_tool = read.item("km:guild_block", 1, "§cHawkeye Tool", "Hawkeye Tool");
|
|
|
|
|
|
consoleCommands = set.new();
|
|
@@ -453,7 +468,6 @@ databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS homes (playe
|
|
|
last_skip_night = 0;
|
|
|
skip_night_started = false;
|
|
|
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
|
|
@@ -640,6 +654,7 @@ if(event == "missing_command") {
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(event == "player_logout") {
|
|
|
+ map.remove(afk_checker_map, uuid);
|
|
|
player.setAfk(player, false);
|
|
|
list.remove(jailed_list, player.getUuid(player));
|
|
|
if(player.hasQuest2(player)) {
|
|
@@ -695,6 +710,24 @@ if(event == "inv_click") {
|
|
|
inv.update(player);
|
|
|
goto("wait");
|
|
|
}
|
|
|
+ if(inv_id == vote_inv_id) {
|
|
|
+ if(inv_slot == 0) {
|
|
|
+ if(money.getBoostFactor() > 1) {
|
|
|
+ msg.prefix(player, prefix_commands, "Boost already active.");
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ vp = player.getVotePoints(player);
|
|
|
+ if(vp < 30) {
|
|
|
+ msg.prefix(player, prefix_commands, "Not enough vote points.");
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ player.setVotePoints(player, vp - 30);
|
|
|
+ msg("online", "§6§k#§rMoneyBooster activated!!!§6§k#");
|
|
|
+ money.setBoostFactor(2);
|
|
|
+ sgoto(6000, "resetMoneyBoost");
|
|
|
+ }
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
if(inv_id == skip_night_inv_id) {
|
|
|
world = world.getOverWorld();
|
|
|
world_time = world.getTime(world);
|
|
@@ -987,6 +1020,10 @@ goto("wait");
|
|
|
msg.prefix(player, prefix_commands, "Your pc got hacked now.");
|
|
|
goto("wait");
|
|
|
|
|
|
+@resetMoneyBoost
|
|
|
+money.setBoostFactor(1);
|
|
|
+goto("wait");
|
|
|
+
|
|
|
@skip_night_loop
|
|
|
skip_night_counter--;
|
|
|
if(skip_night_counter == 0) {
|
|
@@ -1631,6 +1668,10 @@ var = script.getVar(script, var_name);
|
|
|
msg.prefix(player, "§dScript", concat(var_name, " = ", var));
|
|
|
goto("wait");
|
|
|
|
|
|
+@vote
|
|
|
+inv.open(vote_inv, player, concat("Your vote points: §6", text.number(player.getVotePoints(player))));
|
|
|
+goto("wait");
|
|
|
+
|
|
|
@voxel
|
|
|
if(size < 1) {
|
|
|
@voxelhelp
|
|
@@ -1761,6 +1802,7 @@ if(size == 0) {
|
|
|
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 - undo §rUndos your last rollback");
|
|
|
msg(player, "§5 - tool §rGives you the Hawkeye Tool");
|
|
|
msg(player, "");
|
|
|
msg(player, "§5 - Parameters:");
|
|
@@ -1778,19 +1820,19 @@ if(arg0 == "tool") {
|
|
|
if(arg0 == "print") {
|
|
|
side = list.getIndex(args, 1);
|
|
|
if(!isDouble(side)) {
|
|
|
- msg.prefix(player, prefix_commands, "Zahl erwartet.");
|
|
|
+ msg.prefix(player, prefix_commands, "Number expected.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(side < 1) {
|
|
|
- msg.prefix(player, prefix_commands, "Zahl größer 0 erwartet.");
|
|
|
+ msg.prefix(player, prefix_commands, "Positive number expected.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
- list = hawkeye.getPlayerList(player);
|
|
|
+ list = hawkeye.getDataList(player);
|
|
|
if(list == null) {
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(side > list.getSize(list)) {
|
|
|
- msg.prefix(player, prefix_commands, "Ungültige Zahl.");
|
|
|
+ msg.prefix(player, prefix_commands, "Invalid number.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
hawkeye.print(player, list, side);
|
|
@@ -1815,20 +1857,20 @@ if(arg0 == "search") {
|
|
|
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());
|
|
|
+ hawkeye.setDataList(player, list.new());
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(list.getSize(l) == 0) {
|
|
|
msg.prefix(player, prefix_hawkeye, "No results found.");
|
|
|
- hawkeye.setPlayerList(player, list.new());
|
|
|
+ hawkeye.setDataList(player, list.new());
|
|
|
goto("wait");
|
|
|
}
|
|
|
- hawkeye.setPlayerList(player, l);
|
|
|
+ hawkeye.setDataList(player, l);
|
|
|
hawkeye.print(player, l, 1);
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(arg0 == "rollback") {
|
|
|
- l = hawkeye.getPlayerList(player);
|
|
|
+ l = hawkeye.getDataList(player);
|
|
|
if(l == null) {
|
|
|
msg.prefix(player, prefix_hawkeye, "No results to rollback.");
|
|
|
goto("wait");
|
|
@@ -1842,9 +1884,25 @@ if(arg0 == "rollback") {
|
|
|
goto("wait");
|
|
|
}
|
|
|
counter = hawkeye.rollback(l);
|
|
|
+ hawkeye.setUndoList(player, l);
|
|
|
msg.prefix(player, prefix_hawkeye, concat(text.number(counter), " blocks rollbacked."));
|
|
|
goto("wait");
|
|
|
}
|
|
|
+if(arg0 == "undo") {
|
|
|
+ l = hawkeye.getUndoList(player);
|
|
|
+ if(l == null) {
|
|
|
+ msg.prefix(player, prefix_hawkeye, "No rollback to undo.");
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ if(list.getSize(l) == 0) {
|
|
|
+ msg.prefix(player, prefix_hawkeye, "No rollback to undo.");
|
|
|
+ goto("wait");
|
|
|
+ }
|
|
|
+ hawkeye.undo(l);
|
|
|
+ hawkeye.setUndoList(player, list.new());
|
|
|
+ msg.prefix(player, prefix_hawkeye, "Undo done.");
|
|
|
+ goto("wait");
|
|
|
+}
|
|
|
goto("wait");
|
|
|
|
|
|
@news
|
|
@@ -2040,6 +2098,48 @@ if(size > 0) {
|
|
|
}
|
|
|
goto("wait");
|
|
|
|
|
|
+@afk_checker_loop
|
|
|
+online_list = players.toList();
|
|
|
+iter = list.iterator(online_list);
|
|
|
+while(hasNext(iter)) {
|
|
|
+ uuid = next(iter);
|
|
|
+ p = player.get(uuid);
|
|
|
+ yaw = loc.getYaw(entity.getLocation(p));
|
|
|
+ a = map.get(afk_checker_map, uuid);
|
|
|
+ if(a == null) {
|
|
|
+ a = array.new(2);
|
|
|
+ a[0] = yaw;
|
|
|
+ a[1] = 0;
|
|
|
+ map.add(afk_checker_map, uuid, a);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ last_yaw = a[0];
|
|
|
+ counter = a[1];
|
|
|
+ if(last_yaw == yaw) {
|
|
|
+ counter++;
|
|
|
+ } else {
|
|
|
+ counter = 0;
|
|
|
+ }
|
|
|
+ a[0] = yaw;
|
|
|
+ a[1] = counter;
|
|
|
+ map.add(afk_checker_map, uuid, a);
|
|
|
+ if(counter == 3) {
|
|
|
+ nickname = player.getNickname(p);
|
|
|
+ if(player.isAfk(p)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ msg.prefix("online", prefix_commands, concat(nickname, "§7 is now afk."));
|
|
|
+ player.setAfk(p, true);
|
|
|
+ player.setTabName(p);
|
|
|
+ if(!afk_loop_active) {
|
|
|
+ sgoto(30, "afk_loop");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+sgoto(1200, "afk_checker_loop");
|
|
|
+goto("wait");
|
|
|
+
|
|
|
+
|
|
|
@pvp
|
|
|
if(size == 0) {
|
|
|
if(hasPvpOn(player)) {
|
|
@@ -2166,7 +2266,7 @@ if(size == 0) {
|
|
|
msg(player, "§6 - list <player>");
|
|
|
}
|
|
|
if(perm.has(player, "perm.toggle")) {
|
|
|
- msg(player, "§6 - toggle <player>");
|
|
|
+ msg(player, "§6 - toggle");
|
|
|
}
|
|
|
goto("wait");
|
|
|
}
|
|
@@ -2576,7 +2676,7 @@ if(arg0 == "list") {
|
|
|
databank.close(result);
|
|
|
databank.close(getTippsListStatement);
|
|
|
if(counter == 0) {
|
|
|
- msg.prefix(player, prefix_tips, "§rIm Moment stehen keine Tipps zur Verfügung.");
|
|
|
+ msg.prefix(player, prefix_tips, "No tips available.");
|
|
|
}
|
|
|
goto("wait");
|
|
|
}
|
|
@@ -2587,8 +2687,9 @@ if(arg0 == "add") {
|
|
|
}
|
|
|
tipp_key = list.getIndex(args, 1);
|
|
|
tipp_value = concatList(args, " ", 2, size - 1);
|
|
|
+ tipp_value = text.replace(tipp_value, "&", "§");
|
|
|
tipp.register(tipp_key, tipp_value);
|
|
|
- msg.prefix(player, prefix_tips, "§rDer Tipp wurde hinzugefügt.");
|
|
|
+ msg.prefix(player, prefix_tips, "Tip added.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
if(arg0 == "remove") {
|
|
@@ -2598,28 +2699,52 @@ if(arg0 == "remove") {
|
|
|
}
|
|
|
tipp_key = list.getIndex(args, 1);
|
|
|
removeTippStatement = databank.prepare("DELETE FROM tipps WHERE tipp_key = ?;");
|
|
|
- databank.setInt(removeTippStatement, 1, tipp_key);
|
|
|
+ databank.setString(removeTippStatement, 1, tipp_key);
|
|
|
databank.workerExecute(removeTippStatement);
|
|
|
- msg.prefix(player, prefix_tips, "§rDer Tipp wurde entfernt.");
|
|
|
+ msg.prefix(player, prefix_tips, "Tip removed.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
tipp_key = arg0;
|
|
|
tipp_value = tipp.get(tipp_key);
|
|
|
if(tipp_value == null) {
|
|
|
- msg.prefix(player, prefix_tips, "§rDer Tipp existiert nicht.");
|
|
|
+ msg.prefix(player, prefix_tips, "This tip does not exist.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
+link = false;
|
|
|
+if(text.contains(tipp_value, "https://")) {
|
|
|
+ link = true;
|
|
|
+ https_index = text.indexOf(tipp_value, "https://", 0);
|
|
|
+ space_index = text.indexOf(tipp_value, " ", https_index);
|
|
|
+ length = text.length(tipp_value);
|
|
|
+ if(https_index == 0) {
|
|
|
+ msg_before = "";
|
|
|
+ } else {
|
|
|
+ msg_before = text.subString(tipp_value, 0, https_index);
|
|
|
+ }
|
|
|
+ if(space_index == -1) {
|
|
|
+ msg_link = text.subString(tipp_value, https_index, length);
|
|
|
+ msg_after = "";
|
|
|
+ } else {
|
|
|
+ msg_link = text.subString(tipp_value, https_index, space_index);
|
|
|
+ msg_after = text.subString(tipp_value, space_index, length);
|
|
|
+ }
|
|
|
+ msg_link = text.link(msg_link, msg_link);
|
|
|
+}
|
|
|
if(size == 1) {
|
|
|
- msg.prefix("online", prefix_tips, tipp_value);
|
|
|
+ p = "online";
|
|
|
} else {
|
|
|
p_name = list.getIndex(args, 1);
|
|
|
if(!isOnline(p_name)) {
|
|
|
- msg.prefix(player, prefix_tips, "§rDieser Spieler ist nicht online");
|
|
|
+ msg.prefix(player, prefix_tips, "This player is not online.");
|
|
|
goto("wait");
|
|
|
}
|
|
|
p = read.player(p_name);
|
|
|
- msg.prefix(p, prefix_tips, tipp_value);
|
|
|
- msg.prefix(player, prefix_tips, concat("§rDer Tipp wurde §7", p_name, "§r gesendet."));
|
|
|
+ msg.prefix(player, prefix_tips, concat("Tip sent to §7", p_name, "§r."));
|
|
|
+}
|
|
|
+if(link) {
|
|
|
+ msg(p, concat("§r[", prefix_tips, "§r] "), msg_before, msg_link, msg_after);
|
|
|
+} else {
|
|
|
+ msg(p, concat("§r[", prefix_tips, "§r] ", tipp_value));
|
|
|
}
|
|
|
goto("wait");
|
|
|
|
|
@@ -3954,9 +4079,9 @@ p = read.player(p_name);
|
|
|
p_name = player.getName(p);
|
|
|
if(p_name == "marvinius") {
|
|
|
msg(player, "§cSorry §b¯\\_(ツ)_/¯");
|
|
|
- goto("wait");
|
|
|
+ //goto("wait");
|
|
|
}
|
|
|
-head.add(p, 0, sender_name, 160, 50, 20);
|
|
|
+head.add(p, 0, sender_name, 0.4, 0.05, 0.2, 0.35);
|
|
|
title.setSub(p, "is watching you");
|
|
|
title.send(p, concat("§c", sender_name));
|
|
|
list.add(warninglist, p_name);
|
|
@@ -8020,14 +8145,13 @@ function setCommandHelps() {
|
|
|
helpArg0 = command.newHelpLiteral("search");
|
|
|
command.addHelpChild(helpArg0, command.newHelpString("name", true));
|
|
|
command.addHelpChild(help, helpArg0);
|
|
|
+ //hawkeye undo
|
|
|
+ command.addHelpChild(help, command.newHelpLiteral("undo"));
|
|
|
//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");
|