Skip to content

Commit

Permalink
added methods in Block to send a fake update packet, moved Packet cla…
Browse files Browse the repository at this point in the history
…ss to packet package, adds BlockChangePacket, updates to .gitignore, README, and pom
  • Loading branch information
darkdiplomat committed Sep 4, 2013
1 parent 47cf97c commit 4f1b7de
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/target/
*.prefs
*.sw?
dependency-reduced-pom.xml
/bin
/docs
/javadoc-gen.xml
/.idea/
*.iml
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CanaryLib
=========

[Last Build](http://build.canarymod.net/job/CanaryLib/lastBuild/net.canarymod$CanaryLib/) ![Build Status](http://build.canarymod.net/job/CanaryLib/badge/icon)
[Last Successful Build](http://build.canarymod.net/job/CanaryLib/lastSuccessfulBuild/net.canarymod$CanaryLib/)
[Last Build](http://build.canarymod.net/job/CanaryLib/lastBuild/net.canarymod$CanaryLib/)
[Last Successful Build](http://build.canarymod.net/job/CanaryLib/lastSuccessfulBuild/net.canarymod$CanaryLib/)
[ChangeLog](http://build.canarymod.net/job/CanaryLib/changes)

CanaryMod is a Minecraft Server wrapper and library with built-in data
Expand Down Expand Up @@ -33,7 +33,7 @@ Maven
</dependency>


*Unoffical repository (until the official one is setup):*
*Repository:*

<repository>
<id>vi-repo</id>
Expand All @@ -45,7 +45,7 @@ Maven
Non-Maven
-------------

Add CanaryLib and VIUtils 1.0.4 to the build path of your Plugin project.
Add CanaryLib (unshaded or shaded) and VIUtils 1.1.1 (if using unshaded) to the build path of your Plugin project.
VIUtils downloads can be found at [http://wiki.visualillusionsent.net/VIUtils](http://wiki.visualillusionsent.net/VIUtils) or [http://repo.visualillusionsent.net/net/visualillusionsent/viutils/](http://repo.visualillusionsent.net/net/visualillusionsent/viutils/)

Java Docs
Expand All @@ -65,7 +65,7 @@ http://docs.visualillusionsent.net/VIUtils/
Pull Requests
=============

It helps us when others take the time to submit fixes rather than just pointing out bugs/inconsistancies.
It helps us when others take the time to submit fixes rather than just pointing out bugs/inconsistencies.
However, We have standards for the sources we have. Things like formatting
and generally following the [Sun/Oracle coding standards](http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html)

Expand All @@ -80,5 +80,18 @@ Source Formatting and requirements
If you’re on a Windows machine, set it to true — this converts LF endings into CRLF when you check out code. (git config --global core.autocrlf true)
* Eclipse: http://stackoverflow.com/a/11596227/532590
* NetBeans: http://stackoverflow.com/a/1866385/532590
* IntelliJ: http://stackoverflow.com/a/9872584
* JavaDocs well written (as necessary)
* Matching how we format statements
* Matching how we format statements

public class MyClass { //note the whitespace
public void function() {
if (something) {
// do stuff
} else if (somethingElse) {
// do other stuff
} else {
// do else stuff
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>net.visualillusionsent</groupId>
<artifactId>viutils</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/canarymod/api/ConfigurationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import net.canarymod.api.entity.living.humanoid.Player;
import net.canarymod.api.packet.Packet;
import net.canarymod.api.world.DimensionType;
import net.canarymod.api.world.World;
import net.canarymod.api.world.blocks.Block;
Expand All @@ -20,7 +21,7 @@ public interface ConfigurationManager {
* @param world
* the {@link World} name
* @param packet
* the {@link Packet} to be sent
* the {@link net.canarymod.api.packet.Packet} to be sent
*/
public void sendPacketToAllInWorld(String world, Packet packet);

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/canarymod/api/EntityTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import net.canarymod.api.entity.Entity;
import net.canarymod.api.entity.living.humanoid.Player;
import net.canarymod.api.packet.Packet;
import net.canarymod.api.world.World;

/**
Expand Down Expand Up @@ -50,12 +51,12 @@ public interface EntityTracker {
public World getAttachedDimension();

/**
* Send a {@link Packet} to a tracked {@link Player}
* Send a {@link net.canarymod.api.packet.Packet} to a tracked {@link Player}
*
* @param player
* the {@link Player} to send the {@link Packet}
* the {@link Player} to send the {@link net.canarymod.api.packet.Packet}
* @param packet
* the {@link Packet} to be sent
* the {@link net.canarymod.api.packet.Packet} to be sent
*/
public void sendPacketToTrackedPlayer(Player player, Packet packet);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/canarymod/api/NetServerHandler.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.canarymod.api;

import net.canarymod.api.entity.living.humanoid.Player;
import net.canarymod.api.packet.Packet;

/**
* NetServerHandler wrapper
Expand All @@ -14,7 +15,7 @@ public interface NetServerHandler {
* It will be sent when it's polled form the queue
*
* @param packet
* the {@link Packet} to be sent
* the {@link net.canarymod.api.packet.Packet} to be sent
*/
public void sendPacket(Packet packet);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.canarymod.api.GameMode;
import net.canarymod.api.NetServerHandler;
import net.canarymod.api.Packet;
import net.canarymod.api.packet.Packet;
import net.canarymod.api.PlayerListEntry;
import net.canarymod.api.inventory.Inventory;
import net.canarymod.api.world.blocks.Sign;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/canarymod/api/factory/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ public interface Factory {
*/
public NBTFactory getNBTFactory();

/**
* Gets the {@link PacketFactory} instance
*
* @return {@link PacketFactory}
*/
public PacketFactory getPacketFactory();

}
13 changes: 13 additions & 0 deletions src/main/java/net/canarymod/api/factory/PacketFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.canarymod.api.factory;

/**
* Packet Factory
*
* @author Jason (darkdiplomat)
*/
public interface PacketFactory {

// IMPLEMENTATIONS PENDING


}
133 changes: 133 additions & 0 deletions src/main/java/net/canarymod/api/packet/BlockChangePacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package net.canarymod.api.packet;

import net.canarymod.api.world.blocks.Block;
import net.canarymod.api.world.blocks.BlockType;
import net.canarymod.api.world.position.Position;

/**
* Packet #53 BlockChange
*
* @author Jason (darkdiplomat)
*/
public interface BlockChangePacket extends Packet {

/**
* Gets the X coordinate
*
* @return X coordinate
*/
public int getX();

/**
* Sets the X coordinate
*
* @param x
* the X coordinate
*/
public void setX(int x);

/**
* Gets the Y coordinate
*
* @return Y coordinate
*/
public int getY();

/**
* Sets the Y coordinate
*
* @param y
* the Y coordinate
*/
public void setY(int y);

/**
* Gets the Z coordinate
*
* @return Z coordinate
*/
public int getZ();

/**
* Sets the Z coordinate
*
* @param z
* the Z coordinate
*/
public void setZ(int z);

/**
* Gets the {@link Position}
*
* @return the {@link Position}
*/
public Position getPosition();

/**
* Sets the {@link Position}
*
* @param position
* the {@link Position} to set
*/
public void setPosition(Position position);

/**
* Gets the {@link BlockType}
*
* @return the {@link BlockType}
*/
public BlockType getType();

/**
* Sets the {@link BlockType} (id and data)
*
* @param type
* the {@link BlockType} to set
*/
public void setType(BlockType type);

/**
* Gets the Type ID
*
* @return the Type ID
*/
public int getTypeId();

/**
* Sets the Type Id
*
* @param id
* the Type ID
*/
public void setTypeId(int id);

/**
* Gets the Block Data value
*
* @return the data
*/
public int getData();

/**
* Sets the Block data value
*
* @param data
* the Block data
*/
public void setData(int data);

/**
* Gets the {@link Block}
*
* @return the {@link Block}
*/
public Block getBlock();

/**
* Sets the {@link Block}
*
* @param block
* the {@link Block}
*/
public void setBlock(Block block);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.canarymod.api;
package net.canarymod.api.packet;

/**
* Packet interface.
Expand Down
Loading

0 comments on commit 4f1b7de

Please sign in to comment.