chat.txt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. event.load("chat");
  2. event.load("player_login");
  3. event.load("player_logout");
  4. event.load("living_death");
  5. cookie_time = 0;
  6. cookie = read.item("minecraft:cookie");
  7. serverspawn = world.getServerSpawn();
  8. joinmessages = list.new();
  9. list.add(joinmessages, concat("joined Mundus Crassus."));
  10. list.add(joinmessages, concat("entered the sick world."));
  11. list.add(joinmessages, concat("is ready to discover new ores."));
  12. list.add(joinmessages, concat("turns everything upside down."));
  13. leavemeassages = list.new();
  14. list.add(leavemeassages, concat("has left Mundus Crassus."));
  15. list.add(leavemeassages, concat("has left the sick world."));
  16. list.add(leavemeassages, concat("came, saw and won."));
  17. list.add(leavemeassages, concat("faded in the face of copper."));
  18. nomessageworlds = list.new();
  19. list.add(nomessageworlds, world.get("games"));
  20. colorcodedeath = "§9";
  21. death_prefix = "§0§lx §r";
  22. defaultdeaths = list.new();
  23. list.add(defaultdeaths, concat(colorcodedeath, " bled out."));
  24. list.add(defaultdeaths, concat(colorcodedeath, " wanted to die."));
  25. list.add(defaultdeaths, concat(colorcodedeath, " isn't hungry anymore."));
  26. list.add(defaultdeaths, concat(colorcodedeath, " f***ing died."));
  27. list.add(defaultdeaths, concat(colorcodedeath, " now dines with ghosts."));
  28. list.add(defaultdeaths, concat(colorcodedeath, " visits kajetan in his heaven."));
  29. list.add(defaultdeaths, concat(colorcodedeath, " is judged by kajetan (god)."));
  30. drowndeaths = list.new();
  31. list.add(drowndeaths, concat(colorcodedeath, " drowned."));
  32. list.add(drowndeaths, concat(colorcodedeath, " drank too much water."));
  33. list.add(drowndeaths, concat(colorcodedeath, " didn't grow gills fast enough."));
  34. list.add(drowndeaths, concat(colorcodedeath, " wanted to visit cthulhu."));
  35. list.add(drowndeaths, concat(colorcodedeath, " forgot he was in survival."));
  36. list.add(drowndeaths, concat(colorcodedeath, " believed he can fly."));
  37. falldeaths = list.new();
  38. list.add(falldeaths, concat(colorcodedeath, " fell victim to gravitation."));
  39. list.add(falldeaths, concat(colorcodedeath, " tripped on a banana peal."));
  40. list.add(falldeaths, concat(colorcodedeath, " jumped into the depths."));
  41. list.add(falldeaths, concat(colorcodedeath, " jumped into death."));
  42. list.add(falldeaths, concat(colorcodedeath, " forgot their wings."));
  43. list.add(falldeaths, concat(colorcodedeath, " forgot their RedBull."));
  44. firedeaths = list.new();
  45. list.add(firedeaths, concat(colorcodedeath, " looks hot today."));
  46. //andere damagecauses: fall, outOfWorld, arrow, drown (ertrinken), player, inWall, mob, magic, starve
  47. causetolist = map.new();
  48. map.add(causetolist, "fall", falldeaths);
  49. map.add(causetolist, "drown", drowndeaths);
  50. map.add(causetolist, "inFire", firedeaths);
  51. map.add(causetolist, "onFire", firedeaths);
  52. map.add(causetolist, "lava", firedeaths);
  53. map.add(causetolist, "player", list.new());
  54. setScriptVar("rank_playtime_list", list.new());
  55. online_list = players.toList();
  56. iter = list.iterator(online_list);
  57. while(hasNext(iter)) {
  58. rank.offerTimeScheduled(next(iter));
  59. }
  60. msg("dev", "§bChat §rloaded");
  61. @wait
  62. wait();
  63. if(event == "living_death") {
  64. if(!isPlayer(living_entity)) {
  65. goto("wait");
  66. }
  67. player = living_entity;
  68. }
  69. player_name = player.getName(player);
  70. nickname = player.getNickname(player);
  71. player_id = player.getId(player);
  72. //Wenn der Spieler keinen Nicknamen hat, werden die personalisierten Nachrichten geschickt, falls solche vorhanden sind
  73. if(removeFormat(nickname) == player_name) {
  74. send_personally_messages = true;
  75. } else {
  76. send_personally_messages = false;
  77. }
  78. fullname = player.getFullName(player);
  79. ignoreGoto(event);
  80. goto("wait");
  81. @player_login
  82. first_join = player.hasFirstJoin(player_id);
  83. if(first_join) {
  84. entity.teleport(player, serverspawn);
  85. msg("online", concat("§bWelcome to our sick world §e", player_name, " §b!!!"));
  86. player.setFirstJoin(player_id, true);
  87. }
  88. player.setHeadName(player);
  89. silentjoin = player.getSilentJoin(player);
  90. if(!silentjoin) {
  91. message = text.convert(player.getJoinMessage(player));
  92. if(message == null || !send_personally_messages) {
  93. message = concat("§a§l> §r", fullname, " §9", list.getIndex(joinmessages, math.random(0, list.getSize(joinmessages) - 1)));
  94. } else {
  95. message = concat("§a§l> §r", fullname, " §9", message);
  96. }
  97. msg("online", message);
  98. }
  99. player_loc = entity.getLocation(player);
  100. //Inventory
  101. inv.loadFromPlayer(player, player, loc.getWorld(player_loc));
  102. //Keks geben, wenn man als einziger Spieler auf den Server joint und im Survival-Mode ist und der letzte Keks seit 5 Minuten vergeben wurde
  103. if(players.getAmount() == 1) {
  104. if(!loc.isInGamesWorld(player_loc)) {
  105. if(player.isSurvival(player)) {
  106. now_time = time.getMillis();
  107. if(now_time - cookie_time > 300000) {
  108. cookie_time = now_time;
  109. msg(player, "§dHere is a cookie for you :D");
  110. safeGiveItemPlayer(player, cookie);
  111. }
  112. }
  113. }
  114. }
  115. player.setTabName(player);
  116. player.greet(player);
  117. player.showDefaultStacks(player);
  118. stacks.setActive(player, true);
  119. rank.offerTimeScheduled(player);
  120. //send marvinius amount of errors
  121. if(player_id == 2) {
  122. error_size = error.getSize();
  123. if(error_size > 0) {
  124. msg.prefix(player, "§cError", concat("There are ", text.number(error_size), " errors."));
  125. }
  126. }
  127. goto("wait");
  128. @player_logout
  129. message = text.convert(player.getLeaveMessage(player));
  130. if(message == null || !send_personally_messages) {
  131. message = concat("§c§l> §r", fullname, " §9", list.getIndex(leavemeassages, math.random(0, list.getSize(leavemeassages) - 1)));
  132. } else {
  133. message = concat("§c§l> §r", fullname, " §9", message);
  134. }
  135. msg("online", message);
  136. inv.saveForPlayer(player, player, loc.getWorld(entity.getLocation(player)));
  137. player.clearBackPos(player);
  138. rank.removeTimeOffert(player);
  139. goto("wait");
  140. @chat
  141. if(text.startsWith(message, "7", 0)) {
  142. length = text.length(message);
  143. space_index = read.number(text.indexOf(message, " ", 1));
  144. if(length > 1 && space_index == -1 || length > 1 && space_index > 1) {
  145. cancel = true;
  146. if(space_index == -1) {
  147. word = text.subString(message, 1, length);
  148. } else {
  149. word = text.subString(message, 1, space_index);
  150. }
  151. msg.prefix(player, "§6Commands", concat("You meant /", word, "?"));
  152. goto("wait");
  153. }
  154. }
  155. cancel = true;
  156. if(player.isMuted(player)) {
  157. if(!player.hasMinigame(player)) {
  158. msg.prefix(player, "§6Commands", "You are muted.");
  159. }
  160. goto("wait");
  161. }
  162. if(perm.has(player, "color")) {
  163. message = text.replace(message, "&", "§");
  164. }
  165. if(text.startsWith(message, "https://", 0)) {
  166. message = text.link(message, message);
  167. }
  168. sendOnlineMessage(player, message);
  169. goto("wait");
  170. @living_death
  171. world = loc.getWorld(entity.getLocation(player));
  172. if(list.contains(nomessageworlds, world)) {
  173. goto("wait");
  174. }
  175. damage_type = damage.getType(damage_source);
  176. list = map.getOrDefault(causetolist, damage_type, defaultdeaths);
  177. if(damage_type == "player") {
  178. killer = player.getFromDamageSource(damage_source);
  179. killer_name = player.getName(killer);
  180. item = entity.getEquip(killer, "hand");
  181. if(item.hasName(item)) {
  182. message1 = concat(death_prefix, fullname, colorcodedeath, " killed by ", killer_name, " with ");
  183. message2 = item.getFullText(item);
  184. sendMessageToWorld2(world, message1, message2);
  185. goto("wait");
  186. }
  187. list.clear(list);
  188. list.add(list, concat(death_prefix, fullname, colorcodedeath, " got their last honour from ", killer_name, "."));
  189. list.add(list, concat(death_prefix, fullname, colorcodedeath, " died by ", killer_name, "'s hand."));
  190. list.add(list, concat(death_prefix, fullname, colorcodedeath, " was killed by ", killer_name, "."));
  191. list.add(list, concat(death_prefix, fullname, colorcodedeath, " lost a bet to ", killer_name, "."));
  192. message = list.getIndex(list, math.random(0, list.getSize(list) - 1));
  193. } else {
  194. message = concat(death_prefix, fullname, list.getIndex(list, math.random(0, list.getSize(list) - 1)));
  195. }
  196. sendMessageToWorld(world, message);
  197. goto("wait");
  198. function player.greet(player) {
  199. player_name = player.getName(player);
  200. title.setSub(player, concat("§cNice to see you §6", player_name));
  201. title.send(player, "");
  202. }
  203. function rank.removeTimeOffert(player) {
  204. player_uuid = player.getUuid(player);
  205. list = getScriptVar("rank_playtime_list");
  206. for(i = 0; i < list.getSize(list); i++) {
  207. a = list.getIndex(list, i);
  208. if(player_uuid == a[0]) {
  209. list.removeIndex(list, i);
  210. return;
  211. }
  212. }
  213. }
  214. function rank.offerTimeScheduled(player) {
  215. list = getScriptVar("rank_playtime_list");
  216. a = array.new(2);
  217. a[0] = player.getUuid(player);
  218. playtime = playtime.getPlayerTotal(player);
  219. if(playtime < 1200) {
  220. diff = 1200 - playtime;
  221. a[1] = "rank.newcomer";
  222. } elseif(playtime < 6000) {
  223. diff = 6000 - playtime;
  224. a[1] = "rank.frequenter";
  225. } elseif(playtime < 42000) {
  226. diff = 42000 - playtime;
  227. a[1] = "rank.legend";
  228. } else {
  229. return;
  230. }
  231. if(diff > 1440) {
  232. return;
  233. }
  234. list.add(list, a);
  235. sgoto(diff * 60 * 20, "offerTimeRank");
  236. }
  237. @offerTimeRank
  238. list = getScriptVar("rank_playtime_list");
  239. if(list.getSize(list) == 0) {
  240. goto("wait");
  241. }
  242. a = list.getIndex(list, 0);
  243. list.removeIndex(list, 0);
  244. player_uuid = a[0];
  245. tech_name = a[1];
  246. player = player.get(player_uuid);
  247. if(player != null) {
  248. offerRank(player, tech_name);
  249. }
  250. goto("wait");