diff --git a/.gitignore b/.gitignore
index ae132941..9f0b0667 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,3 +65,6 @@ target/maven-archiver
.mvn
mvnw
mvnw.cmd
+
+# maven stuff
+target/maven-status
\ No newline at end of file
diff --git a/README.md b/README.md
index f7833e16..58ab4883 100644
--- a/README.md
+++ b/README.md
@@ -24,8 +24,13 @@ and connect it to a Bukkit server running this plugin and a websocket relay.
- world.getBlocks(x1:int, y1:int, z1:int, x2:int, y2:int, z2:int) -> list
- Get the blocks of the input position range
+
+
+ - world.getBlockData(x:int, y:int, z:int) -> str
+ - Get the state of the block at the input position, including material
+ (block type) and any other attributes (differ by block type).
-
+
- world.setBlock(x:int, y:int, z:int, block:str) -> None:
- Set the block of the input position
@@ -223,3 +228,4 @@ mvn package
- [opticyclic](https://github.com/opticyclic)
- [timcu](https://www.triptera.com.au/wordpress/)
- [pxai](https://github.com/pxai)
+ - [mwrowe](https://github.com/mwrowe)
diff --git a/README_server_setup.md b/README_server_setup.md
index 9988ce12..c6f62581 100644
--- a/README_server_setup.md
+++ b/README_server_setup.md
@@ -37,14 +37,14 @@ Note: updates to servers/plugins may require stopping your server, repeating ste
1. Make sure java is up to date
```
-java –-version
+java -version
```
If this is not 21 or higher, you need to update java.
See here for more general directions: https://docs.papermc.io/misc/java-install
-On the Raspberry Pi, the default repo isn’t good enough. This will install jdk-21 from zulu (thanks https://pimylifeup.com/raspberry-pi-java/, modified to use non-headless as recommended by paper)
+On the Raspberry Pi, the default repo isn�t good enough. This will install jdk-21 from zulu (thanks https://pimylifeup.com/raspberry-pi-java/, modified to use non-headless as recommended by paper)
```
sudo apt update
@@ -115,7 +115,7 @@ java -Xmx2048M -Xms2048M -jar paper-1.20-17.jar
13. You can skip this step if you're only connecting locally (from computers all connected to the same router), and not with scratch.
-On your router, forward ports 19132 (bedrock), 25565 (java), 4711 (python), 14711 (scratch), 80 (http) and 443 (https) to the same ports on your server (or different port numbers if you’ve changed the defaults).
+On your router, forward ports 19132 (bedrock), 25565 (java), 4711 (python), 14711 (scratch), 80 (http) and 443 (https) to the same ports on your server (or different port numbers if you�ve changed the defaults).
Unfortunately, the details depend on the specifics of your router. You can google something like "{router model} + port forwarding", but generally it's something like
@@ -232,7 +232,7 @@ https://www.minecraft.net/en-us/download
- Select "servers" tab
- Click "add server"
- Enter whatever you like for "Server name"
- - Enter the server’s IP for "Server address"
+ - Enter the server�s IP for "Server address"
- For WAN connections, this should be the external IP
- For LAN connections, this should be the internal IP
- Enter 19132 for the port
@@ -244,7 +244,7 @@ https://www.minecraft.net/en-us/download
https://www.python.org/downloads/
-During the installation, be sure to check the box to update your path to include python and pip, or you’ll get "command not found" errors in the next steps
+During the installation, be sure to check the box to update your path to include python and pip, or you�ll get "command not found" errors in the next steps
2. Install [pyncraft](https://github.com/jdeast/pyncraft). In a terminal, type
diff --git a/pom.xml b/pom.xml
index 9181f92d..ae822809 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.jdeast
FruitJuice
- 0.3.0
+ 0.4.0b
diff --git a/server_setup/.env b/server_setup/.env
new file mode 100644
index 00000000..f8783055
--- /dev/null
+++ b/server_setup/.env
@@ -0,0 +1,11 @@
+# change the "values" of the ENVIRONMENT_VARIABLES below
+# lines that start with a # are comments and will be ignored
+
+# note that env vars defined in the shell will override these!
+
+# admin players (can run *all* commands): commas-separated like this:
+# OPS_PLAYERS="admin_player_name,another_admin_name"
+OPS_PLAYERS=""
+
+# password for remote console (RCON) access; YOU SHOULD CHANGE THIS!
+RCON_PASSWORD="pick-a-better-password"
\ No newline at end of file
diff --git a/server_setup/README_setup.md b/server_setup/README_setup.md
new file mode 100644
index 00000000..a609c9f6
--- /dev/null
+++ b/server_setup/README_setup.md
@@ -0,0 +1,381 @@
+# Minecraft Server Setup Using Docker
+### Customized to run python using PynCraft via FruitJuice and RCON
+
+How to set up a Python- and Scratch-enabled, Java+Bedrock server using Docker
+that allows remote connections. You can interact with the Minecraft world
+hosted on this server using the
+[PynCraft python package](https://github.com/jdeast/pyncraft/tree/main).
+Details on setting up python and `PynCraft` are provided at that link.
+
+## Overview
+
+Setting up your own server can be challenging. Luckily, you shouldn't have
+to! Docker is an application that lets you run a "container" from your
+computer, or from a server in the cloud. This container acts like a separate
+server even though it is using its host computer's resources.
+
+You configure the container to specify what resources-- like memory,
+communication ports and shared directories-- it can use. Even though it
+is running on the host, it is isolated from the host and can only access
+what you specify. Often the container will be running a different OS, and
+is provisioned with exactly the software it needs to do its job. If it
+needs to install, say, a different C or Java compiler, you don't have to
+worry about it messing with your system, because it is isolated. When you
+are done with it, you shut it down, and delete it, leaving your system
+unchanged.
+
+The recommended procedure here is:
+
+1) Install the software you need-- Minecraft and Docker
+2) Configure the directory you will work in.
+3) Copy and customize the `docker-compose.yml` file that specifies the
+ docker configuration.
+4) Run `docker compose up` to start the server!
+
+Once the minecraft server is running, multiple players can connect to it.
+This guide assumes you will be setting up the server on a personal computer
+that sits behind a firewall in your home or school network. To connect to
+the server from that network, you can use `localhost` if you are connecting
+from the same machine that is running docker (the host); otherwise,
+you will need to know the IP address of the host.
+
+Caveat emptor: if you expose ports in your local network to let others
+connect to your server from the internet, you expose yourself to being hacked!
+It is probably best to set up a DMZ within your network to isolate the server
+from your other computers/devices, or better yet, use cloud hosting. If you
+have no idea what I am talking about, you are probably better off keeping access
+to within your VPN.
+
+## The Dreaded Command Line
+
+All of what is described here can be done without using the command line--
+the terminal app. But once you get used to it, the terminal is probably
+easier, and you should really learn to use the terminal if you want to
+be a programmer.
+
+Windows now includes WSL, the "Windows Subsystem for Linux". This allows you to
+install a Linux distribution (like Ubuntu, Debian, Fedora or Mint) with
+`bash` or another shell (like, terminal app). If you learn `bash`, it gives you
+super powers on all three major operating systems (Windows, Linux, MacOS)!
+
+The only part of this that **has** to be run from the command line (I think)
+is the `docker compose` command for starting and stoppin the docker container.
+You can accomplish the same thing from within the Desktop app (I think),
+but docker compose makes it super easy.
+
+_(work in progress -- not sure how much detail to go into)_
+
+## Software Installs
+
+### Minecraft:
+
+You will need a current copy of Minecraft, and a Minecraft account to use
+on the server. If you've already been playing Minecraft, you're good to go.
+
+Otherwise, go to https://www.minecraft.net/en-us/download and then buy
+the "Minecraft: Java & Bedrock" game license. Choose a player name.
+
+### Docker
+
+Docker desktop can be downloaded for free by individuals and schools
+from https://docs.docker.com/get-started/get-docker/. Choose the appropriate
+version for your operating system. Note that **you must have Docker running
+when you launch the minecraft server.**
+
+## Server Directory Configuration
+
+You will need to set up the directory where you will run your server from.
+It's easiest (in terms of less typing) if you use your home directory as
+the root. I would suggest something like this:
+
+```
+~/minecraft
+ /server
+ /plugins
+ FruitJuice.jar
+ ViaVersion.jar
+ /data
+ docker-compose.yml
+ .env
+ /code
+ venv
+ (the python files you write)
+```
+
+All your server stuff will go in the the (you guessed it) server subdirectory.
+It holds:
+
+- The `/plugins` subdirectory:
+
+ This is used to add plugins, as `*.jar` files, to the server.
+
+ - **FruitJuice.jar** contains the compiled source code of this package,
+ which enables your server to provide an API you can use with Python.
+
+ Download the FruitJuice plugin from the FruitJuice git repo:
+ https://github.com/jdeast/FruitJuice/tree/master/target
+
+ Click on the `FruitJuice-0.x.0.jar` file that is the latest version,
+ choose "download raw", then copy it to the `plugins` directory(s) shown above.
+
+ - The **ViaVersion.jar** plugin lets users connect to your server when
+ they are running newer versions of Minecraft, so you don't always have
+ to update your server to the latest. This is helpful if, for instance,
+ PaperMC is lagging behind the current version.
+
+ Download it from https://hangar.papermc.io/ViaVersion/ViaVersion.
+
+- The `data` subdirectory:
+
+ This will be "mapped" to the directory on the server that contains all
+ the data for the minecraft world that you are hosting. That way you can
+ get things like snapshots. The contents will be created when you create
+ the server.
+
+ If at some point you want to delete this world (for example, if you wanted
+ to change to a different seed), delete this directory and then
+ recreate it witout contents.
+
+ You can give this a different name for each world if you want to maintain
+ more than one. If you do, you have to change the mapping in the
+ `docker-compose.yml` file (see Configuring the Server below).
+
+- The `docker-compose.yml` file specifies your server configuration.
+
+ Download it from here and add it to `minecraft/server/` as shown:
+ https://github.com/jdeast/FruitJuice/tree/master/server_setup
+
+- The `.env` file defines environment variables used by docker compose.
+
+ These are variables that will be custom to your server. Copy this file
+ from the same directory that `docker-compose.yml` was in, and modify.
+ See below for explanation of values.
+
+
+## Configuring the Server
+
+The `docker-compose.yml` file specifies tells docker what Docker "image" to
+use and what resources and parameters to give it when you run it. The image
+contains the specification for the container: the operating system and all the
+software it needs to host minecraft. We will use an image that is maintained
+by the **itzg group**. This Docker image has been downloaded more than
+100 million times!
+
+The present document is only meant to get you started. For more details on
+how you can customize your server, refer to their
+[documentation](https://hub.docker.com/r/itzg/minecraft-server).
+
+### Environment Variables
+
+You will need to set two environment variables, `OPS_PLAYERS` and
+`RCON_PASSWORD` that are expected by docker compose. You can set these
+by modifying the `.env` file described above, or you can set them from
+the command line. The latter will override the values in the file.
+
+From the **MacOS or Linux** command line, export them as shown below
+("> " is the prompt; don't include it):
+```
+# this first command gives admin powers to the players (one is fine)
+> export OPS_PLAYERS="my_players_name,another_admin_player"
+
+# change this to make your server more secure when running RCON
+> export RCON_PASSWORD="a_secure_password"
+```
+If you don't want to do this manually every time you start your server,
+you can add it to your startup script (usually `~/.bashrc` or `~/.zshrc`).
+
+On **Windows**, right-click the Windows icon on the taskbar and select "System",
+then click "Advanced system settings". In the System Properties window, click
+the "Environment Variables" button. Then choose "System variable" and
+enter "OPS_PLAYERS" and "RCON_PASSWORD" along with your values.
+
+### Mapped Volumes
+
+The `volumes` section tells what local directory on your computer will
+hold the data for your world. If you wanted to have a second world,
+you could do something like this:
+```
+ volumes:
+ # attach the subdirectory 'data' to the container's /data path
+ - ./data-world2:/data
+```
+Leave the `plugins:plugins` mapping alone-- it is how the plugins get loaded.
+
+### Bedrock Edition Compatibility
+
+Two additional plugins will be installed automatically when the server is
+started" `geyser-spiget.jar` and `floodgate-spiget.jar` These will let
+players connect to your server using the **bedrock** edition of Minecraft.
+
+**Note that even though they are connecting from bedrock, the commands they
+run are based on java-edition.**
+
+Bedrock players will connect through the bedrock port.
+
+If you don't want to enable bedrock, you can comment out these lines.
+
+### Remote Console (RCON) Support
+
+RCON is a protocol that lets you issue Minecraft commands to the server.
+If you are using the `pyncraft` package, it exposes this functionality
+through the `Minecraft.runCommands()` method. If you don't want to use
+this, you can comment out the lines related to RCON.
+
+### Other Settings
+
+You may want to customize the `docker-compose.yml` before you use it,
+especially the ones related to game play. Comments start with a `#`; the
+file is annotated to let you know what each line means.
+
+### Many Worlds
+
+Note that each container can only host one world at a time (I think).
+But you can run multiple containers-- just add another service. Most of
+the settings would be the same, but you would have to change the port
+mapping on the host side, and give your players the new port numbers.
+
+For both ports and volumes, the settings are formatted like
+`host:server`. The server value should stay the same, but you would change
+the host value so each server is connected to different ports and volumes
+on the host.
+
+You must also use a different volume (like `/new-world-data:data`)
+
+## Starting the Server!
+
+The Docker Desktop tool (or the VSCode Docker plugin) provide a graphical
+interface for interacting with Docker images, containers or volumes.
+BUT they don't support `docker compose`-- you have to use the command line
+for that. You can open a terminal from the Docker Desktop app (look
+at the bottom right edge for ">_ Terminal") or in VSCode (at the upper
+right of the menu bar, click the middle rectangle where the bottom half
+is highlighted) or as a standalone app.
+
+### From the command line:
+- Navigate to the directory for your server type:
+ ```
+ cd ~/minecraft-server/je
+ ```
+- Start the container!
+ ```
+ docker compose up
+ ```
+ The first time you run this, Docker will download the `itzg/minecraft-server`
+ image from Dockerhub. Then it will start the container; you will see its
+ progress in the terminal. It may give you some warnings; look over this
+ stuff carefully if it fails to start properly.
+
+### Join the server:
+
+Start Minecraft. From the launcher, choose either Java or Bedrock Edition
+to match your server.
+
+The first time you connect, you will then need to create an New installation.
+Give it a name like "Pycraft-1.20.6" (if that is the version of Minecraft
+you are using) and select the version of Minecraft you specified in
+the `docker-compose.yml` file.
+
+Then launch minecraft with this installation. Pick **Multiplayer** mode,
+then (the first time), "Add Server". If you are running Minecraft on the
+same computer that is hosting the server, you can set the Server Address
+to `localhost:25565` where the number is the gameplay port in the
+`docker-compose.yml` file. If the server is running on a different
+computer, replace `localhost` with the host computer's IP address.
+
+Once the server has been added, you should be able to click on it to join.
+You should disconnect when you are not playing.
+
+### Stopping the server
+
+- To stop the server, hit control-C from the command line. This will kick
+ off anyone who is playing, so maybe warn them! Note that you have to be
+ in the same terminal session that is showing output from the server.
+
+- If you started the server in detached (`-d`) mode, make sure you are in
+ in the same directory as the docker-compose.yml file, then enter:
+ ```
+ docker compose down
+ ```
+ This will both stop the container and remove it. You should do this if
+ you update the container's configuration.
+
+- To list what containers you have running, you can type:
+ ```
+ docker ps -a
+ ```
+- You can see what docker images you have on your computer with:
+ ```
+ docker images
+ ```
+- If you want to remove an image to free up space, enter:
+ ```
+ docker image rm
+ ```
+ ...where `` can be just the first 5 characters of the
+ CONTAINER ID shown by the `docker images` command. Note that you have
+ to stop all the containers that use a given image before it can be deleted.
+
+ ## Scratch
+
+ ### Server Configuration
+
+ This is not set up yet. But I think the way to do this is to create
+ a `Dockerfile` that looks something like this:
+
+```
+FROM itzg/minecraft-server
+
+RUN apt-get install certbot websockify
+
+ENV MINECRAFT_SERVER="my-minecraft-server-name"
+
+RUN certbot certonly --standalone -d ${MINECRAFT_SERVER}.duckdns.org \
+ && chmod -R 755 /etc/letsencrypt/ \
+ && certbot renew
+
+RUN websockify \
+ --cert=/etc/letsencrypt/live/${MINECRAFT_SERVER}.duckdns.org/fullchain.pem \
+ --key=/etc/letsencrypt/live/${MINECRAFT_SERVER}.duckdns.org/privkey.pem \
+ 14711 localhost:4711 & # must be running for scratch
+
+EXPOSE 4711
+
+# need to set this up to run the service automatically too...
+ ```
+
+### Client Configuration
+
+1. In a java-enabled web browser (some browsers on tablets do not allow this),
+navigate to [this URL](https://jdeast.github.io/FruitJuice/?load_plugin=scratch.js)
+
+ This loads a standard scratch interface, but with an additional "Minecraft"
+ set of command blocks that allow you to connect to your server, chat, set
+ blocks, spawn entities, etc.
+
+2. Load FruitJuice/scratch/examples/rainbowtower.sb
+
+3. Edit the address in the connect block to match your server's domain
+ (MY_MINECRAFT_SERVER.duckdns.org).
+
+4. Click the green flag and watch it build a rainbow tower.
+
+NOTE: Debugging is hard as many failures are silent. Your browser's developer
+tools may help.
+
+# Credits
+
+A huge thank you to Geoff Bourne and the other contributors to the
+`itzg/docker-minecraft-server` Docker image. Also many thanks to the developers
+of all the plugins (Paper, RaspberryJuice, Geyser, Floodgate, ViaVersion) used!
+
+These directions were a combination of the directions here (java+bedrock)
+https://jamesachambers.com/minecraft-java-bedrock-server-together-geyser-floodgate/
+
+And here: (python)
+https://jeremypedersen.com/posts/2022-03-28-mcpi-macos/
+
+And here: (scratch)
+https://www.instructables.com/Coding-in-Minecraft-With-Scratch/
+
+Along with useful discussions with James A. Chambers (https://jamesachambers.com/)
+
diff --git a/server_setup/docker-compose.yml b/server_setup/docker-compose.yml
new file mode 100644
index 00000000..5ccb7e4f
--- /dev/null
+++ b/server_setup/docker-compose.yml
@@ -0,0 +1,84 @@
+# Micraft Server with FruitJuice plugin
+# This file is used to set up a Minecraft server using Docker Compose.
+# The FruitJuice plugin lets you connect to the server from python using
+# the `pyncraft` python library.
+
+# It expects two environment variables to be set:
+# - OPS_PLAYERS: a comma-separated list of players to assign admin privileges
+# - RCON_PASSWORD: the password for RCON commands
+# These may be defined in a .env file in the same directory as this file, or set
+# in your environment before running the docker-compose command.
+
+# It also expects a directory named 'data' to exist in the same directory as
+# this file, and a directory named 'plugins' to exist, which will be used to
+# store the FruitJuice plugin and any other plugins you want to use.
+
+# ViaVersion lets players connect to the server from newer versions of Minecraft.
+# Get the latest ViaVersion.jar and it add to /plugins subdirectory
+# https://hangar.papermc.io/ViaVersion/ViaVersion
+
+# Get the latest FruitJuice_*.jar and it add to /plugins subdirectory
+# https://github.com/jdeast/FruitJuice/tree/master/target
+
+services:
+ # you can launch multiple servers by adding more services, with unique names
+ pyncraft:
+ image: itzg/minecraft-server # java edition
+
+ # this lets you connect to the server using ssh
+ tty: true
+ stdin_open: true
+
+ # ports enable communication between the host and container
+ # format is host_port:container_port; container_port should not change
+ ports:
+ # for game play
+ - "25565:25565"
+ # for FruitJuice plugin
+ - "4711:4711"
+ # for rcon commands -- note that this must be the same as RCON_PORT below
+ - "25575:25575"
+ # for bedrock edition via GeyserMC
+ - "19132:19132/udp" # uncomment to enable Bedrock Edition support
+ # scratch port
+ - 14711:14711
+
+ environment:
+ # this must be set to "TRUE" to accept the EULA
+ # see https://www.minecraft.net/en-us/eula
+ EULA: "TRUE"
+ # adjust this based on your host system's resources
+ MEMORY: "8G"
+ # installs the FruitJuice, Geyser, Floodgate and ViaVersion plugins
+ TYPE: "PAPER"
+ # version of Minecraft-- check PaperMC plugin for compatibility
+ VERSION: "1.20.6"
+
+ # gameplay settings
+ DIFFICULTY: "normal"
+ MODE: "creative" # "survival"
+ SERVER_NAME: "PynCraft"
+ ALLOW_CHEATS: "true"
+ SEED: "9064150133272194"
+ # assign admin privileges to particular players (comma-separated)
+ OPS: "${OPS_PLAYERS}"
+
+ # automatically download and install the Geyser and Floodgate plugins
+ # these enables players to join the server using Bedrock Edition
+ PLUGINS: |
+ https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot
+ https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot
+
+ # RCON settings - these allow you to send commands to the server
+ ENABLE_RCON: "true"
+ RCON_PASSWORD: "${RCON_PASSWORD}"
+ RCON_PORT: "25575"
+
+ volumes:
+ # attach the subdirectory 'data' to the container's /data path
+ # format is host_path:container_path (container path should not change)
+ - ./data:/data
+ # attach a plugins subdirectory to load the FruitJuice plugin
+ - ./plugins:/plugins
+
+
\ No newline at end of file
diff --git a/src/main/java/CustomBlockFace.java b/src/main/java/FruitJuice/CustomBlockFace.java
similarity index 87%
rename from src/main/java/CustomBlockFace.java
rename to src/main/java/FruitJuice/CustomBlockFace.java
index bc216024..ddcd3795 100644
--- a/src/main/java/CustomBlockFace.java
+++ b/src/main/java/FruitJuice/CustomBlockFace.java
@@ -1,11 +1,11 @@
-package fruitjuice;
+package FruitJuice;
-import org.bukkit.Material;
+// import org.bukkit.Material;
import org.bukkit.block.BlockFace;
public class CustomBlockFace {
- //TODO
+ // TODO
public static BlockFace getSignValueOf(String str){
//NORTH
//NORTH_NORTH_EAST
diff --git a/src/main/java/FruitJuicePlugin.java b/src/main/java/FruitJuice/FruitJuicePlugin.java
similarity index 99%
rename from src/main/java/FruitJuicePlugin.java
rename to src/main/java/FruitJuice/FruitJuicePlugin.java
index e36e2e2a..468c8891 100644
--- a/src/main/java/FruitJuicePlugin.java
+++ b/src/main/java/FruitJuice/FruitJuicePlugin.java
@@ -1,4 +1,4 @@
-package fruitjuice;
+package FruitJuice;
import org.bukkit.Bukkit;
import org.bukkit.Material;
diff --git a/src/main/java/HitClickType.java b/src/main/java/FruitJuice/HitClickType.java
similarity index 90%
rename from src/main/java/HitClickType.java
rename to src/main/java/FruitJuice/HitClickType.java
index 22696ce4..29230ff1 100644
--- a/src/main/java/HitClickType.java
+++ b/src/main/java/FruitJuice/HitClickType.java
@@ -1,4 +1,4 @@
-package fruitjuice;
+package FruitJuice;
/**
* Config option to determine whether hit events are triggered by LEFT clicks, RIGHT clicks (like the Pi) or BOTH
diff --git a/src/main/java/LocationType.java b/src/main/java/FruitJuice/LocationType.java
similarity index 90%
rename from src/main/java/LocationType.java
rename to src/main/java/FruitJuice/LocationType.java
index 016f1d8f..0b955ff9 100644
--- a/src/main/java/LocationType.java
+++ b/src/main/java/FruitJuice/LocationType.java
@@ -1,4 +1,4 @@
-package fruitjuice;
+package FruitJuice;
/**
* Config option to determine whether locations are relative to the spawn point (default like pi) or absolute
diff --git a/src/main/java/RemoteSession.java b/src/main/java/FruitJuice/RemoteSession.java
similarity index 99%
rename from src/main/java/RemoteSession.java
rename to src/main/java/FruitJuice/RemoteSession.java
index ddb14c57..b58cff93 100644
--- a/src/main/java/RemoteSession.java
+++ b/src/main/java/FruitJuice/RemoteSession.java
@@ -1,9 +1,4 @@
-package fruitjuice;
-
-import fruitjuice.cmd.CmdEntity;
-import fruitjuice.cmd.CmdEvent;
-import fruitjuice.cmd.CmdPlayer;
-import fruitjuice.cmd.CmdWorld;
+package FruitJuice;
import org.bukkit.*;
import org.bukkit.block.Block;
@@ -13,6 +8,11 @@
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
+import FruitJuice.cmd.CmdEntity;
+import FruitJuice.cmd.CmdEvent;
+import FruitJuice.cmd.CmdPlayer;
+import FruitJuice.cmd.CmdWorld;
+
import java.io.*;
import java.net.Socket;
import java.util.ArrayDeque;
diff --git a/src/main/java/ServerListenerThread.java b/src/main/java/FruitJuice/ServerListenerThread.java
similarity index 98%
rename from src/main/java/ServerListenerThread.java
rename to src/main/java/FruitJuice/ServerListenerThread.java
index 6951cb6c..c2bbb926 100644
--- a/src/main/java/ServerListenerThread.java
+++ b/src/main/java/FruitJuice/ServerListenerThread.java
@@ -1,4 +1,4 @@
-package fruitjuice;
+package FruitJuice;
import java.io.*;
import java.net.*;
diff --git a/src/main/java/cmd/CmdEntity.java b/src/main/java/FruitJuice/cmd/CmdEntity.java
similarity index 96%
rename from src/main/java/cmd/CmdEntity.java
rename to src/main/java/FruitJuice/cmd/CmdEntity.java
index 1c57e4ce..35cb3d12 100644
--- a/src/main/java/cmd/CmdEntity.java
+++ b/src/main/java/FruitJuice/cmd/CmdEntity.java
@@ -1,12 +1,13 @@
-package fruitjuice.cmd;
+package FruitJuice.cmd;
-import fruitjuice.FruitJuicePlugin;
-import fruitjuice.RemoteSession;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
+import FruitJuice.FruitJuicePlugin;
+import FruitJuice.RemoteSession;
+
public class CmdEntity {
private final String preFix = "entity.";
private RemoteSession session;
@@ -26,6 +27,7 @@ public void execute(String command, String[] args) {
if (entity == null) {
plugin.getLogger().info("Entity [" + args[0] + "] not found.");
session.send("Fail,This entity identity not exist");
+ return;
}
// entity.getTile
diff --git a/src/main/java/cmd/CmdEvent.java b/src/main/java/FruitJuice/cmd/CmdEvent.java
similarity index 95%
rename from src/main/java/cmd/CmdEvent.java
rename to src/main/java/FruitJuice/cmd/CmdEvent.java
index 89735f10..e28aac88 100644
--- a/src/main/java/cmd/CmdEvent.java
+++ b/src/main/java/FruitJuice/cmd/CmdEvent.java
@@ -1,12 +1,13 @@
-package fruitjuice.cmd;
+package FruitJuice.cmd;
-import fruitjuice.RemoteSession;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
+import FruitJuice.RemoteSession;
+
public class CmdEvent {
private final String preFix = "events.";
private RemoteSession session;
@@ -30,7 +31,7 @@ public void execute(String command, String[] args) {
Location loc = block.getLocation();
b.append(session.blockLocationToRelative(loc));
b.append(",");
- b.append(session.blockFaceToNotch(event.getBlockFace()));
+ b.append(RemoteSession.blockFaceToNotch(event.getBlockFace()));
b.append(",");
b.append(event.getPlayer().getEntityId());
if (session.interactEventQueue.size() > 0) {
diff --git a/src/main/java/cmd/CmdPlayer.java b/src/main/java/FruitJuice/cmd/CmdPlayer.java
similarity index 98%
rename from src/main/java/cmd/CmdPlayer.java
rename to src/main/java/FruitJuice/cmd/CmdPlayer.java
index ef32d3e4..5c5e6ddd 100644
--- a/src/main/java/cmd/CmdPlayer.java
+++ b/src/main/java/FruitJuice/cmd/CmdPlayer.java
@@ -1,12 +1,13 @@
-package fruitjuice.cmd;
+package FruitJuice.cmd;
-import fruitjuice.RemoteSession;
-import fruitjuice.FruitJuicePlugin;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
+import FruitJuice.FruitJuicePlugin;
+import FruitJuice.RemoteSession;
+
public class CmdPlayer {
private final String preFix = "player.";
private RemoteSession session;
diff --git a/src/main/java/cmd/CmdWorld.java b/src/main/java/FruitJuice/cmd/CmdWorld.java
similarity index 95%
rename from src/main/java/cmd/CmdWorld.java
rename to src/main/java/FruitJuice/cmd/CmdWorld.java
index bc48cb24..28491f54 100644
--- a/src/main/java/cmd/CmdWorld.java
+++ b/src/main/java/FruitJuice/cmd/CmdWorld.java
@@ -1,7 +1,5 @@
-package fruitjuice.cmd;
+package FruitJuice.cmd;
-import fruitjuice.FruitJuicePlugin;
-import fruitjuice.RemoteSession;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -19,6 +17,9 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
+import FruitJuice.FruitJuicePlugin;
+import FruitJuice.RemoteSession;
+
import java.util.Collection;
public class CmdWorld {
@@ -46,10 +47,13 @@ public void execute(World world, String command, String[] args) {
session.send(getBlocks(loc1, loc2));
-// // world.getBlockWithData untested
-// } else if (c.equals("world.getBlockWithData")) {
-// Location loc = parseRelativeBlockLocation(args[0], args[1], args[2]);
-// send(world.getBlockTypeIdAt(loc) + "," + world.getBlockAt(loc).getData());
+ // world.getBlockData
+ } else if (command.equals("getBlockData")) {
+ Location loc = session.parseRelativeBlockLocation(args[0], args[1], args[2]);
+ Block thisBlock = world.getBlockAt(loc);
+ BlockData blockData = thisBlock.getBlockData();
+
+ session.send(blockData.toString());
// world.setBlock
} else if (command.equals("setBlock")) {
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index b278981a..3af1bbfd 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,8 +1,8 @@
-author: [Zhuowei,MinecraftDawn,jdeast]
-database: false
-description: Implementation of the Minecraft Python API
-main: fruitjuice.FruitJuicePlugin
name: FruitJuice
-startup: postworld
-version: '0.1.0'
-api-version: 1.13
\ No newline at end of file
+description: A plugin that provides a Python SDK for the Minecraft API.
+author: [Zhuowei,MinecraftDawn,jdeast,mwrowe]
+version: '0.4.0b'
+api-version: 1.13
+main: FruitJuice.FruitJuicePlugin
+database: false
+startup: postworld
\ No newline at end of file
diff --git a/target/FruitJuice-0.4.0b.jar b/target/FruitJuice-0.4.0b.jar
new file mode 100644
index 00000000..977936de
Binary files /dev/null and b/target/FruitJuice-0.4.0b.jar differ