October 2014
Beginner to intermediate
285 pages
6h 24m
English
Let’s play with this a bit. We’ll start with the ArrayOfBlocks plugin but change it to use an ArrayList instead of an Array. We’ll call the new plugin ArrayAddMoreBlocks.
Since we can add to the array list easily, let’s make it static:
| | public static List<BlockType> towerMaterials = new ArrayList<BlockType>(); |
Then, thanks to the wonder of ArrayList, we can add a couple of blocks to the new tower each time we call /arrayaddmoreblocks:
| ArrayAddMoreBlocks/src/arrayaddmoreblocks/ArrayAddMoreBlocks.java | |
| | public void buildTower(Player me) { |
| | if (towerLoc == null) { |
| ① | towerLoc = new Location(me.getLocation()); |
| | towerLoc.setX(towerLoc.getX() + 2); // Not right on top of player |
| ② | towerBase = ... |
Read now
Unlock full access