mcblocky 0.1.0.pre.alpha.pre.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +11 -0
- data/.travis.yml +16 -0
- data/Gemfile +4 -0
- data/README.md +34 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/workon.cmd +1 -0
- data/doc/Introduction.md +144 -0
- data/examples/ctf/arena.rb +14 -0
- data/examples/ctf/config.example.yml +15 -0
- data/examples/ctf/ctf.rb +316 -0
- data/examples/ctf/lobby.rb +20 -0
- data/examples/hello/config.example.yml +14 -0
- data/examples/hello/hello.rb +81 -0
- data/examples/hello/helpers/bar.rb +3 -0
- data/examples/hello/helpers/foo.rb +3 -0
- data/exe/mcblocky +6 -0
- data/lib/mcblocky/cli.rb +108 -0
- data/lib/mcblocky/config.rb +63 -0
- data/lib/mcblocky/context.rb +87 -0
- data/lib/mcblocky/dsl/block.rb +13 -0
- data/lib/mcblocky/dsl/command_block.rb +23 -0
- data/lib/mcblocky/dsl/commands.rb +152 -0
- data/lib/mcblocky/dsl/container.rb +24 -0
- data/lib/mcblocky/dsl/repeat_chain.rb +9 -0
- data/lib/mcblocky/dsl/selector.rb +29 -0
- data/lib/mcblocky/dsl.rb +146 -0
- data/lib/mcblocky/executor.rb +149 -0
- data/lib/mcblocky/listener.rb +69 -0
- data/lib/mcblocky/location.rb +95 -0
- data/lib/mcblocky/logging.rb +45 -0
- data/lib/mcblocky/server.rb +143 -0
- data/lib/mcblocky/version.rb +3 -0
- data/lib/mcblocky.rb +23 -0
- data/mcblocky.gemspec +28 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODNmOWY2ZWVlZDliZmZlZGMzOGIxMjZjZjQxZjIwMGRhZGZlYTA3YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzMxM2ViNThiNjVkMzBmMjg4ZWNlYzNlOTY4ODg5OGViMTcwYzFlYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDg2YTg0MDQyNTg3MDU5MGZiYzQyNmRjODVhNDI0ZTYyYWZlZWQwZTA5OWVl
|
10
|
+
ZThjNDZlMTQzYjZiOTBhYjEwOTc0MTMwOWRkNzUzY2Q2Mjg5NTA3MzNhNmQ5
|
11
|
+
YWJhYmE4NDViMmQwZGFiNGVmMjdmNGFlMzI3YmI1YzE2N2ZjZDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MGIzN2MxNTJiZWE3NDZmMTNmNGNlMDZjOTg5ZjY3YTNmZDRiNWI0NDQ1MzNl
|
14
|
+
OGNlNzdlNjNkOGYyYWE0NDcwNzc5MGIwMmUxNjZmYTRlNjlhN2UyYzFmYWYz
|
15
|
+
ZDQ0YjM0YTQ2MTE0YjY0MmU2NmU5ZDk0ZjcyNjBlYjJhN2UzMmE=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.3.0
|
4
|
+
- 2.2.4
|
5
|
+
- 2.1.8
|
6
|
+
- 2.0.0
|
7
|
+
before_install:
|
8
|
+
- gem install bundler
|
9
|
+
- bundle --version
|
10
|
+
deploy:
|
11
|
+
provider: rubygems
|
12
|
+
api_key:
|
13
|
+
secure: d2sBTznIo/xcoSPAvPCGrizeQlvVQOh2Vma6GK/vZrM4EiOjzQTe8UB21WiOHjoPejI1+wi1V+Vf4Ule4K01xzQDrL6DdcdNSplmrS73GPYDEcYJMQcRUkup1WNpUsO0z1gpiw6eKDVObyxtnFjH1cwU4mDkip9NiPhrGbig5rEn0EUJkQxWn3QHHp/IfwOBagIjLecFTP27A/diWsdlkIzBt9TS1HsKUx7dF7ktJQIgbgXCgD4Rr2PfrelsPA6e5vrSvxo8ORr6j978N8ZPpDSZtBQbDR7i4KA8WYr4cprDa6PEhGMMvTb1b7mBoXnbfTPCgJcWVB0/Y9A4qlV9pcU+nEb9hN6E8CcvtgvmBYDD4PUAj0gE8nGg9eO84VrII7KaZRJkGXITR9kpNaglZrwyncOZ3tt8AV7Ee46VEpSGNlWXZdFRm4i1QKnE0iExPB1UOiLjpFjspljTzCHV4tt5s+eEthTx4Lqw3iqBqpcn/bpVOXypCxSkr0AfM2xSGFG27ItDy0i2K+evOKlIlRu0AFGhhHlBpkccOxW9I7SmY2LW9jrvSV8HBp6msrnncQOfGaA61bgQy9o8qKTDGeJ4p3MyhOSV7aSHFNSdo9/7f26G+jH/CZnk8lsN5RfY1X8v3kJxZX7eB+lcaV/oyHr5Q95+vkBuW92oHb6uxec=
|
14
|
+
gem: mcblocky
|
15
|
+
on:
|
16
|
+
repo: DeltaWhy/mcblocky
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# McBlocky
|
2
|
+
|
3
|
+
McBlocky is a Ruby DSL for creating Minecraft command block contraptions and
|
4
|
+
maps.
|
5
|
+
|
6
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
7
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
8
|
+
|
9
|
+
|
10
|
+
- [Installation](#installation)
|
11
|
+
- [Usage](#usage)
|
12
|
+
- [Development](#development)
|
13
|
+
- [Contributing](#contributing)
|
14
|
+
|
15
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
$ gem install mcblocky
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
See [the documentation](doc/Introduction.md).
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DeltaWhy/mcblocky.
|
34
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mcblocky"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bin/workon.cmd
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
doskey mcblocky=set BUNDLE_GEMFILE=%CD%\Gemfile ^& bundle exec ruby %CD%\exe\mcblocky $1 $2 $3 $4 $5 $6 $7 $8 $9
|
data/doc/Introduction.md
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
|
2
|
+
# McBlocky
|
3
|
+
McBlocky is a Ruby DSL for creating Minecraft command block contraptions and maps. It allows you to write Ruby code that gets translated into commands and command blocks in the Minecraft world. Because it does everything by executing commands in the server console, you can see the results of your changes in-game almost immediately after you hit 'Save' in your editor -- no need to restart the server to run MCEdit.
|
4
|
+
|
5
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
6
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
7
|
+
|
8
|
+
|
9
|
+
- [Getting Started](#getting-started)
|
10
|
+
- [Basic commands](#basic-commands)
|
11
|
+
- [Leveraging Ruby](#leveraging-ruby)
|
12
|
+
- [Placing blocks](#placing-blocks)
|
13
|
+
- [Command chains](#command-chains)
|
14
|
+
- [Next steps](#next-steps)
|
15
|
+
|
16
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
17
|
+
|
18
|
+
## Getting Started
|
19
|
+
To start your project, you first need to create a `config.yml` that tells McBlocky how to run the server. See an example [here](../examples/ctf/config.example.yml). Next, create your main Ruby file. By default McBlocky will look for a `.rb` file with the same name as the folder containing your `config.yml`, but you can specify another name if you prefer.
|
20
|
+
|
21
|
+
Let's start with an empty file called `hello.rb`. Now, start the server:
|
22
|
+
```
|
23
|
+
mcblocky start path/to/config.yml
|
24
|
+
```
|
25
|
+
If you've gotten your configuration right, you should see this message:
|
26
|
+
```
|
27
|
+
---> Server is ready! Connect to 127.0.0.1:25565
|
28
|
+
```
|
29
|
+
Start up Minecraft and connect to the server so you can see your changes in real time. You can stop the server by pressing `CTRL-C` or running the `stop` command in the console (other server commands work too).
|
30
|
+
|
31
|
+
## Basic commands
|
32
|
+
Add this to `hello.rb`:
|
33
|
+
```ruby
|
34
|
+
initial do
|
35
|
+
say 'Hello', @p
|
36
|
+
end
|
37
|
+
```
|
38
|
+
When you save the file, you should see `Reloading...` in the McBlocky console and a greeting in-game. This is not terribly exciting, so let's do some useful setup.
|
39
|
+
```ruby
|
40
|
+
initial do
|
41
|
+
say 'Hello', @p
|
42
|
+
time :set, :day
|
43
|
+
gamerule :doDaylightCycle, false
|
44
|
+
end
|
45
|
+
```
|
46
|
+
You should notice that the server doesn't greet you again. McBlocky tries to avoid redoing work where possible, so it will skip the first command since it has already run. If you add more commands onto the end of the `initial` block, only the new commands get executed, but if you add them in the middle, it will execute everything after the first change since it can't tell which commands might depend on each other.
|
47
|
+
|
48
|
+
## Leveraging Ruby
|
49
|
+
Let's create some teams for a minigame.
|
50
|
+
```ruby
|
51
|
+
initial do
|
52
|
+
scoreboard :teams, :add, 'Red'
|
53
|
+
scoreboard :teams, :option, 'Red', :color, 'red'
|
54
|
+
scoreboard :teams, :add, 'Blue'
|
55
|
+
scoreboard :teams, :option, 'Blue', :color, 'blue'
|
56
|
+
scoreboard :teams, :add, 'Yellow'
|
57
|
+
scoreboard :teams, :option, 'Yellow', :color, 'yellow'
|
58
|
+
scoreboard :teams, :add, 'Green'
|
59
|
+
scoreboard :teams, :option, 'Green', :color, 'green'
|
60
|
+
end
|
61
|
+
```
|
62
|
+
Hmm, this is a bit repetitive isn't it? Fortunately there is a shorthand for `scoreboard`:
|
63
|
+
```ruby
|
64
|
+
initial do
|
65
|
+
scoreboard :teams do
|
66
|
+
add 'Red'
|
67
|
+
option 'Red', :color, 'red'
|
68
|
+
add 'Blue'
|
69
|
+
option 'Blue', :color, 'blue'
|
70
|
+
add 'Yellow'
|
71
|
+
option 'Yellow', :color, 'yellow'
|
72
|
+
add 'Green'
|
73
|
+
option 'Green', :color, 'green'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
```
|
77
|
+
This is a more readable but if we wanted more than four teams it would still be a bit unwieldy. But since this is just Ruby code, we can use an `each` loop instead of repeating ourselves.
|
78
|
+
```ruby
|
79
|
+
initial do
|
80
|
+
['red', 'blue', 'yellow', 'green'].each do |color|
|
81
|
+
scoreboard :teams do
|
82
|
+
add color.capitalize
|
83
|
+
option color.capitalize, :color, color
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
```
|
88
|
+
All three snippets are equivalent, so you can use whichever form you prefer.
|
89
|
+
|
90
|
+
## Placing blocks
|
91
|
+
Initial commands are useful for setting up the scoreboard and gamerules, but to do anything interesting we'll need some command blocks. You can use a `setblock` command (outside of the `initial` block) to place one. Let's give it a button too. (Change the coordinates to somewhere above ground and close to your player).
|
92
|
+
```ruby
|
93
|
+
setblock -89, 34, -95, 'minecraft:command_block', 0, :replace, {Command: 'say Hello @p'}
|
94
|
+
setblock -90, 34, -95, 'minecraft:stone_button', 2
|
95
|
+
```
|
96
|
+
Try commenting out one of these lines -- you'll notice McBlocky tries to clean up after itself by setting the block back to air. You can set any block this way, but there is a shorthand for command blocks:
|
97
|
+
```ruby
|
98
|
+
at -89, 34, -95 do
|
99
|
+
say 'Hello', @p
|
100
|
+
end
|
101
|
+
```
|
102
|
+
You can also set the direction, type, and NBT tags of the command block:
|
103
|
+
```ruby
|
104
|
+
at -89, 34, -95, Facing::EAST, :repeating, {auto: 1} do
|
105
|
+
say 'Hello', @p
|
106
|
+
end
|
107
|
+
```
|
108
|
+
Try out the `fill` command (outside of the `initial` block) too.
|
109
|
+
|
110
|
+
## Command chains
|
111
|
+
Of course, we don't really want to specify the position and data tags of every command block individually, we just want to write code and have it do cool stuff! For the common pattern of an always-on repeating command block followed by always-on chain command blocks, we can just specify a bounding box and let McBlocky handle the rest.
|
112
|
+
|
113
|
+
Let's create some pads that players can step on to join a team.
|
114
|
+
```ruby
|
115
|
+
# ...scoreboard setup omitted
|
116
|
+
|
117
|
+
setblock -5, 34, 0, 'minecraft:wool', Color::RED
|
118
|
+
setblock 5, 34, 0, 'minecraft:wool', Color::BLUE
|
119
|
+
|
120
|
+
# use an underground area that's much bigger than we really need
|
121
|
+
repeat -5, 5, -5, 5, 10, 5 do
|
122
|
+
scoreboard :players, :set, @a[x: -5, y: 35, z: 0, r: 1, team: '!Red'], 'SwitchingTeam', 1
|
123
|
+
scoreboard :players, :set, @a[x: 5, y: 35, z: 0, r: 1, team: '!Blue'], 'SwitchingTeam', 1
|
124
|
+
|
125
|
+
execute @a[x: -5, y: 35, z: 0, r: 1, score_SwitchingTeam_min: 1] do
|
126
|
+
scoreboard :teams, :join, 'Red', @p
|
127
|
+
tellraw @a, {selector: @p}, {text: ' joined the ', color: 'reset'}, {text: 'Red team', color: 'red'}
|
128
|
+
end
|
129
|
+
|
130
|
+
execute @a[x: 5, y: 35, z: 0, r: 1, score_SwitchingTeam_min: 1] do
|
131
|
+
scoreboard :teams, :join, 'Blue', @p
|
132
|
+
tellraw @a, {selector: @p}, {text: ' joined the ', color: 'reset'}, {text: 'Blue team', color: 'blue'}
|
133
|
+
end
|
134
|
+
|
135
|
+
scoreboard :players, :reset, @a, 'SwitchingTeam'
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
## Next steps
|
140
|
+
Check out the [examples folder](../examples) for some longer examples. Then try making one of your own! Also have a look at the rest of the [documentation](../doc) *(coming soon)*.
|
141
|
+
|
142
|
+
Please report bugs and feature requests on the [issue tracker](https://github.com/DeltaWhy/mcblocky/issues). I will also accept pull requests for the code, documentation, and examples.
|
143
|
+
|
144
|
+
If you build a map with this, I'd love to hear about it! Drop me a line on Twitter [@michaellimiero](https://twitter.com/michaellimiero) and I'll add a link to your project in the README.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
fill 0, 32, 0, 50, 32, 24, 'minecraft:stone'
|
2
|
+
fill 0, 33, 0, 50, 33, 24, 'minecraft:grass'
|
3
|
+
fill -1, 32, -1, 51, 52, -1, 'minecraft:stonebrick'
|
4
|
+
fill -1, 32, 25, 51, 52, 25, 'minecraft:stonebrick'
|
5
|
+
fill -1, 32, -1, -1, 52, 25, 'minecraft:stained_hardened_clay', Color::RED
|
6
|
+
fill 51, 32, -1, 51, 52, 25, 'minecraft:stained_hardened_clay', Color::BLUE
|
7
|
+
|
8
|
+
fill 0, 33, 10, 0, 33, 14, 'minecraft:stained_hardened_clay', Color::RED
|
9
|
+
fill 1, 33, 11, 1, 33, 13, 'minecraft:stained_hardened_clay', Color::RED
|
10
|
+
setblock 0, 33, 12, 'minecraft:gold_block'
|
11
|
+
|
12
|
+
fill 50, 33, 10, 50, 33, 14, 'minecraft:stained_hardened_clay', Color::BLUE
|
13
|
+
fill 49, 33, 11, 49, 33, 13, 'minecraft:stained_hardened_clay', Color::BLUE
|
14
|
+
setblock 50, 33, 12, 'minecraft:gold_block'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
server:
|
2
|
+
# If java is not on your $PATH you must set this
|
3
|
+
# java: path/to/java
|
4
|
+
jar: path/to/minecraft_server.1.9.jar
|
5
|
+
workdir: server
|
6
|
+
ops:
|
7
|
+
- DeltaWhy
|
8
|
+
eula: true
|
9
|
+
properties:
|
10
|
+
gamemode: 2
|
11
|
+
motd: McBlocky Capture the Flag
|
12
|
+
generator-settings: '3;minecraft:air;127;decoration;2;'
|
13
|
+
code:
|
14
|
+
# Defaults to the name of the directory
|
15
|
+
# main: ctf.rb
|
data/examples/ctf/ctf.rb
ADDED
@@ -0,0 +1,316 @@
|
|
1
|
+
# Capture the Flag
|
2
|
+
#
|
3
|
+
# Made for 1.9 void world preset
|
4
|
+
|
5
|
+
red_spawn = Location.new(0, 34, 12)
|
6
|
+
blue_spawn = Location.new(50, 34, 12)
|
7
|
+
|
8
|
+
helper 'clean' do |args, user|
|
9
|
+
Executor.to_commands($context).each{|c| server.command c}
|
10
|
+
end
|
11
|
+
|
12
|
+
helper 'blue' do |args, user|
|
13
|
+
user = user.gsub(/[^A-Za-z0-9_]./, '')
|
14
|
+
server.command "scoreboard teams join Blue #{user}"
|
15
|
+
end
|
16
|
+
|
17
|
+
helper 'red' do |args, user|
|
18
|
+
user = user.gsub(/[^A-Za-z0-9_]./, '')
|
19
|
+
server.command "scoreboard teams join Red #{user}"
|
20
|
+
end
|
21
|
+
|
22
|
+
helper 'reset' do |args, user|
|
23
|
+
server.command "scoreboard players set @a GAME 1"
|
24
|
+
end
|
25
|
+
|
26
|
+
initial do
|
27
|
+
time :set, 'day'
|
28
|
+
gamerule :doDaylightCycle, false
|
29
|
+
gamerule :logAdminCommands, false
|
30
|
+
gamerule :commandBlockOutput, false
|
31
|
+
weather :clear, 999999
|
32
|
+
|
33
|
+
scoreboard :teams do
|
34
|
+
add 'Red'
|
35
|
+
option 'Red', :color, 'red'
|
36
|
+
add 'Blue'
|
37
|
+
option 'Blue', :color, 'blue'
|
38
|
+
join 'Red', '--RED--'
|
39
|
+
join 'Blue', '--BLUE--'
|
40
|
+
add 'Spectators'
|
41
|
+
end
|
42
|
+
|
43
|
+
scoreboard :objectives do
|
44
|
+
add 'LOGIN', :dummy
|
45
|
+
add 'GAME', :dummy
|
46
|
+
add 'SwitchingTeam', :dummy
|
47
|
+
add 'Score', :dummy
|
48
|
+
add 'CapturingFlag', :dummy
|
49
|
+
add 'CapturingOwnFlag', :dummy
|
50
|
+
add 'HasFlag', :dummy
|
51
|
+
add 'HasOwnFlag', :dummy
|
52
|
+
add 'ReturningFlag', :dummy
|
53
|
+
add 'ReturningOwnFlag', :dummy
|
54
|
+
add 'IsDead', :deathCount
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# login
|
59
|
+
repeat -8, 6, -8, 8, 8, -8 do
|
60
|
+
scoreboard :players, :add, @a, 'LOGIN', 0
|
61
|
+
tp @a[score_LOGIN:0], -95, 33, -95
|
62
|
+
clear @a[score_LOGIN:0]
|
63
|
+
scoreboard :teams, :join, 'Spectators', @a[score_LOGIN:0]
|
64
|
+
tellraw @a[score_LOGIN:0], [
|
65
|
+
{text: "Welcome to ", color: "gold"},
|
66
|
+
{text: "McBlocky ", color: "aqua"},
|
67
|
+
{text: "C", color: "red"},
|
68
|
+
{text: "T", color: "green"},
|
69
|
+
{text: "F", color: "blue"},
|
70
|
+
{text: "!", color: "gold"}
|
71
|
+
]
|
72
|
+
scoreboard :players, :set, @a[score_LOGIN:0], 'LOGIN', 1
|
73
|
+
end
|
74
|
+
|
75
|
+
# room construction
|
76
|
+
require_relative 'arena'
|
77
|
+
require_relative 'lobby'
|
78
|
+
|
79
|
+
# team join/leave
|
80
|
+
repeat 10, 6, -8, 24, 8, -8 do
|
81
|
+
scoreboard :players do
|
82
|
+
set @a[team: '!Red', x: -95, y: 33, z: -102, r:4], 'SwitchingTeam', 1
|
83
|
+
set @a[team: '!Blue', x: -95, y: 33, z: -88, r:4], 'SwitchingTeam', 1
|
84
|
+
set @a[team: '!Spectators', x: -102, y: 33, z: -95, r: 4], 'SwitchingTeam', 1
|
85
|
+
end
|
86
|
+
scoreboard :teams do
|
87
|
+
join 'Red', @a[team: '!Red', x: -95, y: 33, z: -102, r:4]
|
88
|
+
join 'Blue', @a[team: '!Blue', x: -95, y: 33, z: -88, r:4]
|
89
|
+
join 'Spectators', @a[team: '!Spectators', x: -102, y: 33, z: -95, r: 4]
|
90
|
+
end
|
91
|
+
execute @a[score_SwitchingTeam_min:1, team: 'Red'] do
|
92
|
+
tellraw @a, {selector: "@p"},
|
93
|
+
{text: " joined the ", color: "reset"},
|
94
|
+
{text: "Red", color: "red"},
|
95
|
+
{text: " team", color: "reset"}
|
96
|
+
end
|
97
|
+
execute @a[score_SwitchingTeam_min:1, team: 'Blue'] do
|
98
|
+
tellraw @a, {selector: "@p"},
|
99
|
+
{text: " joined the ", color: "reset"},
|
100
|
+
{text: "Blue", color: "blue"},
|
101
|
+
{text: " team", color: "reset"}
|
102
|
+
end
|
103
|
+
execute @a[score_SwitchingTeam_min:1, team: 'Spectators'] do
|
104
|
+
tellraw @a, {selector: "@p"},
|
105
|
+
{text: " is now spectating", color: "reset"}
|
106
|
+
end
|
107
|
+
scoreboard :players, :reset, @a[score_SwitchingTeam_min:1], 'SwitchingTeam'
|
108
|
+
end
|
109
|
+
|
110
|
+
# game start
|
111
|
+
repeat -8, 6, -6, 8, 8, -6 do
|
112
|
+
a = @a[score_GAME_min:1]
|
113
|
+
p = @p[score_GAME_min:1]
|
114
|
+
|
115
|
+
gamemode 3, a[team:'Spectators']
|
116
|
+
gamemode 2, a[team:'!Spectators']
|
117
|
+
tp a[team:'Red'], 0, 34, 12, 270, 0
|
118
|
+
tp a[team:'Blue'], 50, 34, 12, 90, 0
|
119
|
+
tp a[team:'Spectators'], 25, 38, 12
|
120
|
+
clear a
|
121
|
+
replaceitem :entity, a[team:'Red'], 'slot.armor.chest', 'minecraft:leather_chestplate', 1, 0, {display:{color:10040115}}
|
122
|
+
replaceitem :entity, a[team:'Blue'], 'slot.armor.chest', 'minecraft:leather_chestplate', 1, 0, {display:{color:3361970}}
|
123
|
+
|
124
|
+
execute p do
|
125
|
+
scoreboard :objectives, :setdisplay, :sidebar, 'Score'
|
126
|
+
fill 0, 34, 0, 50, 36, 24, 'minecraft:air', 0, :replace, 'minecraft:standing_banner'
|
127
|
+
setblock 0, 34, 12, 'minecraft:standing_banner', 12
|
128
|
+
blockdata 0, 34, 12, {Base: 1}
|
129
|
+
setblock 50, 34, 12, 'minecraft:standing_banner', 4
|
130
|
+
blockdata 50, 34, 12, {Base: 4}
|
131
|
+
%w(HasFlag HasOwnFlag CapturingFlag CapturingOwnFlag ReturningFlag ReturningOwnFlag).each do |s|
|
132
|
+
scoreboard :players, :reset, @a, s
|
133
|
+
end
|
134
|
+
scoreboard :players, :reset, '*', 'Score'
|
135
|
+
scoreboard :players, :set, '--RED--', 'Score', 0
|
136
|
+
scoreboard :players, :set, '--BLUE--', 'Score', 0
|
137
|
+
end
|
138
|
+
|
139
|
+
effect a, 'minecraft:saturation', 1, 99
|
140
|
+
effect a, 'minecraft:instant_health', 1, 99
|
141
|
+
spawnpoint a[team:'Red'], 0, 34, 12
|
142
|
+
spawnpoint a[team:'Blue'], 50, 34, 12
|
143
|
+
scoreboard :players, :reset, @a, 'GAME'
|
144
|
+
end
|
145
|
+
|
146
|
+
# pick up enemy flag
|
147
|
+
repeat 10, 6, -6, 24, 8, -6 do
|
148
|
+
detect @a[team:'Red'], '~ ~ ~', 'minecraft:standing_banner', 4 do
|
149
|
+
scoreboard :players, :set, @p, 'CapturingFlag', 1
|
150
|
+
end
|
151
|
+
detect @a[team:'Blue'], '~ ~ ~', 'minecraft:standing_banner', 12 do
|
152
|
+
scoreboard :players, :set, @p, 'CapturingFlag', 1
|
153
|
+
end
|
154
|
+
red = @p[team:'Red', score_CapturingFlag_min:1]
|
155
|
+
blue = @p[team:'Blue', score_CapturingFlag_min:1]
|
156
|
+
|
157
|
+
execute red do
|
158
|
+
tellraw @a, {selector: "@p"},
|
159
|
+
{text: " got the ", color: "reset"},
|
160
|
+
{text: "Blue Flag", color: "blue"}
|
161
|
+
end
|
162
|
+
replaceitem :entity, red, 'slot.armor.head', 'minecraft:banner', 1, 4
|
163
|
+
execute blue do
|
164
|
+
tellraw @a, {selector: "@p"},
|
165
|
+
{text: " got the ", color: "reset"},
|
166
|
+
{text: "Red Flag", color: "red"}
|
167
|
+
end
|
168
|
+
replaceitem :entity, blue, 'slot.armor.head', 'minecraft:banner', 1, 1
|
169
|
+
|
170
|
+
execute @a[score_CapturingFlag_min:1] do
|
171
|
+
setblock '~ ~ ~', 'minecraft:air'
|
172
|
+
scoreboard :players, :set, @p, 'HasFlag', 1
|
173
|
+
scoreboard :players, :reset, @p, 'CapturingFlag'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# capture enemy flag
|
178
|
+
repeat -8, 6, -4, 8, 8, -4 do
|
179
|
+
detect @p[team:'Red', score_HasFlag_min:1, loc: red_spawn, r: 1], '~ ~ ~', 'minecraft:standing_banner', 12 do
|
180
|
+
scoreboard :players, :set, @p, 'ReturningFlag', 1
|
181
|
+
end
|
182
|
+
detect @p[team:'Blue', score_HasFlag_min:1, loc: blue_spawn, r: 1], '~ ~ ~', 'minecraft:standing_banner', 4 do
|
183
|
+
scoreboard :players, :set, @p, 'ReturningFlag', 1
|
184
|
+
end
|
185
|
+
red = @p[team:'Red', score_ReturningFlag_min:1]
|
186
|
+
blue = @p[team:'Blue', score_ReturningFlag_min:1]
|
187
|
+
|
188
|
+
execute red do
|
189
|
+
title @a, :title, {text: "Score", color: "red"}
|
190
|
+
title @a, :subtitle,
|
191
|
+
{selector: "@p"},
|
192
|
+
{text: " captured the flag", color: "reset"}
|
193
|
+
end
|
194
|
+
|
195
|
+
execute blue do
|
196
|
+
title @a, :title, {text: "Score", color: "blue"}
|
197
|
+
title @a, :subtitle,
|
198
|
+
{selector: "@p"},
|
199
|
+
{text: " captured the flag", color: "reset"}
|
200
|
+
end
|
201
|
+
|
202
|
+
# reset the flag
|
203
|
+
execute red do
|
204
|
+
setblock 50, 34, 12, 'minecraft:standing_banner', 4
|
205
|
+
blockdata 50, 34, 12, {Base: 4}
|
206
|
+
end
|
207
|
+
execute blue do
|
208
|
+
setblock 0, 34, 12, 'minecraft:standing_banner', 12
|
209
|
+
blockdata 0, 34, 12, {Base: 1}
|
210
|
+
end
|
211
|
+
replaceitem :entity, @a[score_ReturningFlag_min:1], 'slot.armor.head', 'minecraft:air'
|
212
|
+
|
213
|
+
# scores
|
214
|
+
execute red do
|
215
|
+
scoreboard :players, :add, '--RED--', 'Score', 1
|
216
|
+
end
|
217
|
+
execute blue do
|
218
|
+
scoreboard :players, :add, '--BLUE--', 'Score', 1
|
219
|
+
end
|
220
|
+
scoreboard :players, :add, @a[score_ReturningFlag_min:1], 'Score', 1
|
221
|
+
execute @a[score_ReturningFlag_min:1] do
|
222
|
+
scoreboard :players, :reset, @p, 'HasFlag'
|
223
|
+
scoreboard :players, :reset, @p, 'ReturningFlag'
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# drop flag on death
|
228
|
+
repeat 10, 6, -4, 24, 8, -4 do
|
229
|
+
# only @a includes dead players
|
230
|
+
red = @a[score_IsDead_min:1, score_HasFlag_min:1, team: 'Red']
|
231
|
+
blue = @a[score_IsDead_min:1, score_HasFlag_min:1, team: 'Blue']
|
232
|
+
|
233
|
+
execute red do
|
234
|
+
tellraw @a, {selector: red},
|
235
|
+
{text: " dropped the ", color: "reset"},
|
236
|
+
{text: "Blue Flag", color: "blue"}
|
237
|
+
end
|
238
|
+
execute blue do
|
239
|
+
tellraw @a, {selector: blue},
|
240
|
+
{text: " dropped the ", color: "reset"},
|
241
|
+
{text: "Red Flag", color: "red"}
|
242
|
+
end
|
243
|
+
execute red do
|
244
|
+
setblock '~ ~ ~', 'minecraft:standing_banner', 4
|
245
|
+
blockdata '~ ~ ~', {Base: 4}
|
246
|
+
end
|
247
|
+
execute blue do
|
248
|
+
setblock '~ ~ ~', 'minecraft:standing_banner', 12
|
249
|
+
blockdata '~ ~ ~', {Base: 1}
|
250
|
+
end
|
251
|
+
|
252
|
+
scoreboard :players, :reset, @a[score_IsDead_min:1], 'HasFlag'
|
253
|
+
scoreboard :players, :reset, @a[score_IsDead_min:1], 'HasOwnFlag'
|
254
|
+
scoreboard :players, :reset, @a[score_IsDead_min:1], 'IsDead'
|
255
|
+
end
|
256
|
+
|
257
|
+
# pick up own flag
|
258
|
+
repeat -8, 6, -2, 8, 8, -2 do
|
259
|
+
detect @a[team:'Blue'], '~ ~ ~', 'minecraft:standing_banner', 4 do
|
260
|
+
scoreboard :players, :set, @p, 'CapturingOwnFlag', 1
|
261
|
+
end
|
262
|
+
detect @a[team:'Red'], '~ ~ ~', 'minecraft:standing_banner', 12 do
|
263
|
+
scoreboard :players, :set, @p, 'CapturingOwnFlag', 1
|
264
|
+
end
|
265
|
+
# can't pick up own flag when it's at base
|
266
|
+
detect @a[score_CapturingOwnFlag_min:1], '~ ~-1 ~', 'minecraft:gold_block', 0 do
|
267
|
+
scoreboard :players, :reset, @p, 'CapturingOwnFlag'
|
268
|
+
end
|
269
|
+
blue = @p[team:'Blue', score_CapturingOwnFlag_min:1]
|
270
|
+
red = @p[team:'Red', score_CapturingOwnFlag_min:1]
|
271
|
+
|
272
|
+
execute blue do
|
273
|
+
tellraw @a, {selector: "@p"},
|
274
|
+
{text: " got the ", color: "reset"},
|
275
|
+
{text: "Blue Flag", color: "blue"}
|
276
|
+
end
|
277
|
+
replaceitem :entity, blue, 'slot.armor.head', 'minecraft:banner', 1, 4
|
278
|
+
execute red do
|
279
|
+
tellraw @a, {selector: "@p"},
|
280
|
+
{text: " got the ", color: "reset"},
|
281
|
+
{text: "Red Flag", color: "red"}
|
282
|
+
end
|
283
|
+
replaceitem :entity, red, 'slot.armor.head', 'minecraft:banner', 1, 1
|
284
|
+
execute @a[score_CapturingOwnFlag_min:1] do
|
285
|
+
setblock '~ ~ ~', 'minecraft:air'
|
286
|
+
scoreboard :players, :set, @p, 'HasOwnFlag', 1
|
287
|
+
scoreboard :players, :reset, @p, 'CapturingOwnFlag'
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
# return own flag
|
292
|
+
repeat 10, 6, -2, 24, 8, -2 do
|
293
|
+
execute @a[team:'Blue', loc: blue_spawn, r: 1, score_HasOwnFlag_min: 1] do
|
294
|
+
scoreboard :players, :set, @p, 'ReturningOwnFlag', 1
|
295
|
+
end
|
296
|
+
execute @a[team:'Red', loc: red_spawn, r: 1, score_HasOwnFlag_min: 1] do
|
297
|
+
scoreboard :players, :set, @p, 'ReturningOwnFlag', 1
|
298
|
+
end
|
299
|
+
execute @a[team:'Blue',score_ReturningOwnFlag_min:1] do
|
300
|
+
setblock 50, 34, 12, 'minecraft:standing_banner', 4
|
301
|
+
blockdata 50, 34, 12, {Base: 4}
|
302
|
+
tellraw @a, {selector: "@p"},
|
303
|
+
{text: " returned the ", color: "reset"},
|
304
|
+
{text: "Blue Flag", color: "blue"}
|
305
|
+
end
|
306
|
+
execute @a[team:'Red',score_ReturningOwnFlag_min:1] do
|
307
|
+
setblock 0, 34, 12, 'minecraft:standing_banner', 12
|
308
|
+
blockdata 0, 34, 12, {Base: 1}
|
309
|
+
tellraw @a, {selector: "@p"},
|
310
|
+
{text: " returned the ", color: "reset"},
|
311
|
+
{text: "Red Flag", color: "red"}
|
312
|
+
end
|
313
|
+
replaceitem :entity, @a[score_ReturningOwnFlag_min:1], 'slot.armor.head', 'minecraft:air'
|
314
|
+
scoreboard :players, :reset, @a[score_ReturningOwnFlag_min:1], 'HasOwnFlag'
|
315
|
+
scoreboard :players, :reset, @a[score_ReturningOwnFlag_min:1], 'ReturningOwnFlag'
|
316
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
fill -100, 32, -100, -90, 32, -90, 'minecraft:log'
|
2
|
+
fill -101, 33, -101, -89, 34, -101, 'minecraft:barrier'
|
3
|
+
fill -101, 33, -89, -89, 34, -89, 'minecraft:barrier'
|
4
|
+
fill -101, 33, -100, -101, 34, -90, 'minecraft:barrier'
|
5
|
+
fill -89, 33, -100, -89, 34, -90, 'minecraft:stained_hardened_clay', Color::LIGHT_BLUE
|
6
|
+
|
7
|
+
setblock -95, 32, -95, 'minecraft:glowstone'
|
8
|
+
setblock -89, 34, -95, 'minecraft:wool', Color::LIME
|
9
|
+
setblock -90, 34, -95, 'minecraft:stone_button', 2
|
10
|
+
setblock -90, 33, -95, 'minecraft:wall_sign', Facing::WEST, 'replace', {'Text2'=>'{"text":"Start Game"}'}
|
11
|
+
at -88, 34, -95 do
|
12
|
+
scoreboard :players, :set, @a, 'GAME', 1
|
13
|
+
end
|
14
|
+
|
15
|
+
fill -100, 32, -92, -100, 32, -98, 'minecraft:wool', Color::WHITE
|
16
|
+
fill -99, 32, -93, -99, 32, -97, 'minecraft:wool', Color::WHITE
|
17
|
+
fill -92, 32, -100, -98, 32, -100, 'minecraft:wool', Color::RED
|
18
|
+
fill -93, 32, -99, -97, 32, -99, 'minecraft:wool', Color::RED
|
19
|
+
fill -92, 32, -90, -98, 32, -90, 'minecraft:wool', Color::BLUE
|
20
|
+
fill -93, 32, -91, -97, 32, -91, 'minecraft:wool', Color::BLUE
|
@@ -0,0 +1,14 @@
|
|
1
|
+
server:
|
2
|
+
# If java is not on your $PATH you must set this
|
3
|
+
# java: path/to/java
|
4
|
+
jar: path/to/minecraft_server.1.9.jar
|
5
|
+
workdir: server
|
6
|
+
ops:
|
7
|
+
- DeltaWhy
|
8
|
+
eula: true
|
9
|
+
properties:
|
10
|
+
gamemode: 1
|
11
|
+
motd: McBlocky Hello World
|
12
|
+
code:
|
13
|
+
# Defaults to the name of the directory
|
14
|
+
# main: hello.rb
|