123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- event.load("chat");
- event.load("player_login");
- event.load("player_logout");
- event.load("living_death");
- cookie_time = 0;
- cookie = read.item("minecraft:cookie");
- serverspawn = world.getServerSpawn();
- joinmessages = list.new();
- list.add(joinmessages, concat("joined Mundus Crassus."));
- list.add(joinmessages, concat("entered the sick world."));
- list.add(joinmessages, concat("is ready to discover new ores."));
- list.add(joinmessages, concat("turns everything upside down."));
- leavemeassages = list.new();
- list.add(leavemeassages, concat("has left Mundus Crassus."));
- list.add(leavemeassages, concat("has left the sick world."));
- list.add(leavemeassages, concat("came, saw and won."));
- list.add(leavemeassages, concat("faded in the face of copper."));
- nomessageworlds = list.new();
- list.add(nomessageworlds, world.get("games"));
- colorcodedeath = "§9";
- death_prefix = "§0§lx §r";
- headlist = list.new();
- headlist2 = list.new();
- defaultdeaths = list.new();
- list.add(defaultdeaths, concat(colorcodedeath, " bled out."));
- list.add(defaultdeaths, concat(colorcodedeath, " wanted to die."));
- list.add(defaultdeaths, concat(colorcodedeath, " isn't hungry anymore."));
- list.add(defaultdeaths, concat(colorcodedeath, " f***ing died."));
- list.add(defaultdeaths, concat(colorcodedeath, " now dines with ghosts."));
- list.add(defaultdeaths, concat(colorcodedeath, " visits kajetan in his heaven."));
- list.add(defaultdeaths, concat(colorcodedeath, " is judged by kajetan (god)."));
- drowndeaths = list.new();
- list.add(drowndeaths, concat(colorcodedeath, " drowned."));
- list.add(drowndeaths, concat(colorcodedeath, " drank too much water."));
- list.add(drowndeaths, concat(colorcodedeath, " didn't grow gills fast enough."));
- list.add(drowndeaths, concat(colorcodedeath, " wanted to visit cthulhu."));
- list.add(drowndeaths, concat(colorcodedeath, " forgot he was in survival."));
- list.add(drowndeaths, concat(colorcodedeath, " believed he can fly."));
- falldeaths = list.new();
- list.add(falldeaths, concat(colorcodedeath, " fell victim to gravitation."));
- list.add(falldeaths, concat(colorcodedeath, " tripped on a banana peal."));
- list.add(falldeaths, concat(colorcodedeath, " jumped into the depths."));
- list.add(falldeaths, concat(colorcodedeath, " jumped into death."));
- list.add(falldeaths, concat(colorcodedeath, " forgot their wings."));
- list.add(falldeaths, concat(colorcodedeath, " forgot their RedBull."));
- firedeaths = list.new();
- list.add(firedeaths, concat(colorcodedeath, " looks hot today."));
- //andere damagecauses: fall, outOfWorld, arrow, drown (ertrinken), player, inWall, mob, magic, starve
- causetolist = map.new();
- map.add(causetolist, "fall", falldeaths);
- map.add(causetolist, "drown", drowndeaths);
- map.add(causetolist, "inFire", firedeaths);
- map.add(causetolist, "onFire", firedeaths);
- map.add(causetolist, "lava", firedeaths);
- map.add(causetolist, "player", list.new());
- setScriptVar("rank_playtime_list", list.new());
- online_list = players.toList();
- iter = list.iterator(online_list);
- while(hasNext(iter)) {
- rank.offerTimeScheduled(next(iter));
- }
-
- msg("dev", "§bChat §rloaded");
- @wait
- wait();
- if(event == "living_death") {
- if(!isPlayer(living_entity)) {
- goto("wait");
- }
- player = living_entity;
- }
- player_name = player.getName(player);
- nickname = player.getNickname(player);
- player_id = player.getId(player);
- //Wenn der Spieler keinen Nicknamen hat, werden die personalisierten Nachrichten geschickt, falls solche vorhanden sind
- if(removeFormat(nickname) == player_name) {
- send_personally_messages = true;
- } else {
- send_personally_messages = false;
- }
- fullname = player.getFullName(player);
- ignoreGoto(event);
- goto("wait");
- @player_login
- first_join = player.hasFirstJoin(player_id);
- if(first_join) {
- entity.teleport(player, serverspawn);
- msg("online", concat("§bWelcome to our sick world §e", player_name, " §b!!!"));
- player.setFirstJoin(player_id, true);
- }
- player.setHeadName(player);
- silentjoin = player.getSilentJoin(player);
- if(!silentjoin) {
- message = text.convert(player.getJoinMessage(player));
- if(message == null || !send_personally_messages) {
- message = concat("§a§l> §r", fullname, " §9", list.getIndex(joinmessages, math.random(0, list.getSize(joinmessages) - 1)));
- } else {
- message = concat("§a§l> §r", fullname, " §9", message);
- }
- msg("online", message);
- }
- player_loc = entity.getLocation(player);
- //Inventory
- inv.loadFromPlayer(player, player, loc.getWorld(player_loc));
- //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
- if(players.getAmount() == 1) {
- if(!loc.isInGamesWorld(player_loc)) {
- if(player.isSurvival(player)) {
- now_time = time.getMillis();
- if(now_time - cookie_time > 300000) {
- cookie_time = now_time;
- msg(player, "§dHere is a cookie for you :D");
- safeGiveItemPlayer(player, cookie);
- }
- }
- }
- }
- player.setTabName(player);
- player.greet(player);
- player.showDefaultStacks(player);
- stacks.setActive(player, true);
- rank.offerTimeScheduled(player);
- displayMoney(player, getMoney(player));
- //send marvinius amount of errors
- if(player_id == 2) {
- error_size = error.getSize();
- if(error_size > 0) {
- msg.prefix(player, "§cError", concat("There are ", text.number(error_size), " errors."));
- }
- }
- goto("wait");
- @player_logout
- message = text.convert(player.getLeaveMessage(player));
- if(message == null || !send_personally_messages) {
- message = concat("§c§l> §r", fullname, " §9", list.getIndex(leavemeassages, math.random(0, list.getSize(leavemeassages) - 1)));
- } else {
- message = concat("§c§l> §r", fullname, " §9", message);
- }
- msg("online", message);
- inv.saveForPlayer(player, player, loc.getWorld(entity.getLocation(player)));
- player.clearBackPos(player);
- rank.removeTimeOffert(player);
- goto("wait");
- @chat
- if(text.startsWith(message, "7", 0)) {
- length = text.length(message);
- space_index = read.number(text.indexOf(message, " ", 1));
- if(length > 1 && space_index == -1 || length > 1 && space_index > 1) {
- cancel = true;
- if(space_index == -1) {
- word = text.subString(message, 1, length);
- } else {
- word = text.subString(message, 1, space_index);
- }
- msg.prefix(player, "§6Commands", concat("You meant /", word, "?"));
- goto("wait");
- }
- }
- cancel = true;
- if(player.isMuted(player)) {
- //minigames check this for themselves. cause: global mute for e.g. specs/ghosts, but spec/ghost chat should be possible without "you are muted" message
- if(!player.hasMinigame(player)) {
- msg.prefix(player, "§6Commands", "You are muted.");
- }
- goto("wait");
- }
- if(perm.has(player, "color")) {
- message = text.replace(message, "&", "§");
- }
- if(text.startsWith(message, "https://", 0)) {
- message = text.link(message, message);
- }
- sendOnlineMessage(player, message);
- goto("wait");
- @living_death
- world = loc.getWorld(entity.getLocation(player));
- if(list.contains(nomessageworlds, world)) {
- goto("wait");
- }
- damage_type = damage.getType(damage_source);
- list = map.getOrDefault(causetolist, damage_type, defaultdeaths);
- if(damage_type == "player") {
- killer = player.getFromDamageSource(damage_source);
- killer_name = player.getName(killer);
- item = entity.getEquip(killer, "hand");
- if(item.hasName(item)) {
- message1 = concat(death_prefix, fullname, colorcodedeath, " killed by ", killer_name, " with ");
- message2 = item.getFullText(item);
- sendMessageToWorld2(world, message1, message2);
- goto("wait");
- }
- list.clear(list);
- list.add(list, concat(death_prefix, fullname, colorcodedeath, " got their last honour from ", killer_name, "."));
- list.add(list, concat(death_prefix, fullname, colorcodedeath, " died by ", killer_name, "'s hand."));
- list.add(list, concat(death_prefix, fullname, colorcodedeath, " was killed by ", killer_name, "."));
- list.add(list, concat(death_prefix, fullname, colorcodedeath, " lost a bet to ", killer_name, "."));
- message = list.getIndex(list, math.random(0, list.getSize(list) - 1));
- } else {
- message = concat(death_prefix, fullname, list.getIndex(list, math.random(0, list.getSize(list) - 1)));
- }
- sendMessageToWorld(world, message);
- goto("wait");
- function player.greet(player) {
- player_name = player.getName(player);
- title.reset(player);
- title.setSub(player, concat("§cNice to see you §6", player_name));
- title.send(player, "");
- list.add($headlist, player);
- sgoto(20, "showHead");
- }
- @showHead
- p = list.getIndex(headlist, 0);
- list.removeIndex(headlist, 0);
- p_name = player.getName(p);
- head.add(p, 0, p_name, 0.4, 0.1, 0.2, 0.35);
- list.add($headlist2, p);
- sgoto(60, "removeHead");
- goto("wait");
- @removeHead
- p = list.getIndex(headlist2, 0);
- list.removeIndex(headlist2, 0);
- head.remove(p, 0);
- goto("wait");
- function rank.removeTimeOffert(player) {
- player_uuid = player.getUuid(player);
- list = getScriptVar("rank_playtime_list");
- for(i = 0; i < list.getSize(list); i++) {
- a = list.getIndex(list, i);
- if(player_uuid == a[0]) {
- list.removeIndex(list, i);
- return;
- }
- }
- }
- function rank.offerTimeScheduled(player) {
- list = getScriptVar("rank_playtime_list");
- a = array.new(2);
- a[0] = player.getUuid(player);
- playtime = playtime.getPlayerTotal(player);
- if(playtime < 1200) {
- diff = 1200 - playtime;
- a[1] = "rank.newcomer";
- } elseif(playtime < 6000) {
- diff = 6000 - playtime;
- a[1] = "rank.frequenter";
- } elseif(playtime < 42000) {
- diff = 42000 - playtime;
- a[1] = "rank.legend";
- } else {
- return;
- }
- if(diff > 1440) {
- return;
- }
- list.add(list, a);
- sgoto(diff * 60 * 20, "offerTimeRank");
- }
- @offerTimeRank
- list = getScriptVar("rank_playtime_list");
- if(list.getSize(list) == 0) {
- goto("wait");
- }
- a = list.getIndex(list, 0);
- list.removeIndex(list, 0);
- player_uuid = a[0];
- tech_name = a[1];
- player = player.get(player_uuid);
- if(player != null) {
- offerRank(player, tech_name);
- }
- goto("wait");
|