12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- event.load("entity_dismount");
- event.load("block_click");
- event.load("server_pre_stop");
- sitting = map.new();
- stairs_tag = block.getTag("minecraft:stairs");
- msg.string("dev", "§bSitting §rloaded.");
- @wait
- wait();
- ignoreGoto(event);
- goto("wait");
- @entity_dismount
- if(isPlayer(entity)) {
- player = entity;
- player_uuid = player.getUuid(player);
- if(map.contains(sitting, player_uuid)) {
- entity.remove(map.get(sitting, player_uuid));
- map.remove(sitting, player_uuid);
- }
- entity.teleport(player, loc.mod(entity.getLocation(player), 0, 1, 0));
- }
- goto("wait");
- @server_pre_stop
- iter = map.iterator(sitting);
- while(hasNext(iter)) {
- element = next(iter);
- uuid = map.getKey(element);
- p = player.get(uuid);
- if(p != null) {
- entity.unmount(p);
- }
- }
- term();
- @block_click
- if(block == null) {
- goto("wait");
- }
- if(hand == read.slot("OFF_HAND")) {
- goto("wait");
- }
- if(block.hasTag(block, stairs_tag)) {
- if(action != "RIGHT_CLICK_BLOCK") {
- goto("wait");
- }
- if(block.getBisectedHalf(block) != "BOTTOM") {
- goto("wait");
- }
- if(item.getType(living.getHand(player)) != material.getAir()) {
- goto("wait");
- }
- if(!block.isAir(block.mod(block, 0, 1, 0))) {
- goto("wait");
- }
- player_uuid = player.getUuid(player);
- if(map.contains(sitting, player_uuid)) {
- goto("wait");
- }
- if(player.hasMinigame(player)) {
- goto("wait");
- }
- if(!player.hasSittingActivated(player)) {
- goto("wait");
- }
- loc = block.getLocation(block);
- entity = entity.spawnseat(loc);
- map.add(sitting, player_uuid, entity);
- entity.mount(player, entity);
- }
- goto("wait");
|