Fix MemoryDataView bugs. Fix a lot of outstanding OCD issues.

Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
This commit is contained in:
Gabriel Harris-Rouquette committed 2015-03-23 18:46:33 -07:00
1 parent b4a899d9f3
commit a9f19a5bc6
82 files changed
+348 -146

No files matched your search

+6
View File
@@ -122,6 +122,12 @@ configure([compileJava, compileTestJava]) {
javadoc {
options.jFlags('-Xms256m', '-Xmx512m')
options.links("http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/",
"http://google.github.io/guice/api-docs/latest/javadoc/",
"http://flowpowered.com/math/",
"http://asm.ow2.org/asm50/javadoc/user/",
"http://www.slf4j.org/apidocs/",
"http://docs.oracle.com/javase/6/docs/api/")
}
if (JavaVersion.current().isJava8Compatible()) {
@@ -28,8 +28,8 @@ package org.spongepowered.api.attribute;
import com.google.common.base.Predicate;
/**
* Represents an type of attribute that can be applied to a
* {@link AttributeHolder}.
* Represents a type of attribute that can be applied to an {@link
* AttributeHolder}.
*/
public interface Attribute {
@@ -35,7 +35,7 @@ public interface AttributeCalculator {
* Calculates the value of an attribute given a base value and a set of
* {@link Operation}s and modification values. The order of operation
* evaluation will be decided according to a list sorted by each operations
* {@link Operation#compareTo(Operation)} method. Their
* {@link Operation#compareTo} method. Their
* {@link Operation#changeValueImmediately()} will determine whether after
* being evaluated, an operation's incrementation will be added to the value
* immediately, or be summed with all other incrementations from the same
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.effect.particle;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.item.inventory.ItemStack;
import java.awt.Color;
@@ -46,14 +46,14 @@ public interface ParticleEffect {
*
* @return The motion vector
*/
Vector3f getMotion();
Vector3d getMotion();
/**
* Gets the offset vector of the particle effect.
*
* @return The offset vector
*/
Vector3f getOffset();
Vector3d getOffset();
/**
* Gets the amount of particles that will be spawned.
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.effect.particle;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.ItemStack;
@@ -38,22 +38,22 @@ public interface ParticleEffectBuilder {
/**
* Sets the motion vector of the particle effect.
*
* <p>The default motion vector is {@link Vector3f#ZERO}.</p>
* <p>The default motion vector is {@link Vector3d#ZERO}.</p>
*
* @param motion The motion vector
* @return This builder
*/
ParticleEffectBuilder motion(Vector3f motion);
ParticleEffectBuilder motion(Vector3d motion);
/**
* Sets the offset vector of the particle effect.
*
* <p>The default offset vector is {@link Vector3f#ZERO}.</p>
* <p>The default offset vector is {@link Vector3d#ZERO}.</p>
*
* @param offset The offset vector
* @return This builder
*/
ParticleEffectBuilder offset(Vector3f offset);
ParticleEffectBuilder offset(Vector3d offset);
/**
* Sets the amount of particles of the particle effect.
@@ -90,10 +90,10 @@ public interface ParticleEffectBuilder {
Colorable color(Color color);
@Override
Colorable motion(Vector3f motion);
Colorable motion(Vector3d motion);
@Override
Colorable offset(Vector3f offset);
Colorable offset(Vector3d offset);
@Override
Colorable count(int count);
@@ -120,10 +120,10 @@ public interface ParticleEffectBuilder {
Resizable size(float size);
@Override
Resizable motion(Vector3f motion);
Resizable motion(Vector3d motion);
@Override
Resizable offset(Vector3f offset);
Resizable offset(Vector3d offset);
@Override
Resizable count(int count);
@@ -151,10 +151,10 @@ public interface ParticleEffectBuilder {
Note note(float note);
@Override
Note motion(Vector3f motion);
Note motion(Vector3d motion);
@Override
Note offset(Vector3f offset);
Note offset(Vector3d offset);
@Override
Note count(int count);
@@ -189,10 +189,10 @@ public interface ParticleEffectBuilder {
Material itemType(ItemType item);
@Override
Material motion(Vector3f motion);
Material motion(Vector3d motion);
@Override
Material offset(Vector3f offset);
Material offset(Vector3d offset);
@Override
Material count(int count);
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.effect.sound;
/**
* An enumeration of vanilla {@link SoundType}s.
*/
public final class SoundTypes {
public static final SoundType AMBIENCE_CAVE = null;
@@ -26,7 +26,6 @@
package org.spongepowered.api.entity;
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3f;
import com.google.common.base.Optional;
import org.spongepowered.api.service.persistence.data.DataHolder;
import org.spongepowered.api.util.Identifiable;
@@ -79,30 +78,59 @@ public interface Entity extends Identifiable, EntityState, DataHolder {
*/
boolean setLocation(Location location);
/**
* Moves the entity to the specified location, and sets the rotation.
*
* <p>The format of the rotation is represented by:</p>
*
* <ul><code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll
* </code></ul>
*
* @param location The location to set
* @param rotation The rotation to set
* @return True if the teleport was successful
*/
boolean setLocationAndRotation(Location location, Vector3d rotation);
/**
* Moves the entity to the specified location, and sets the rotation. {@link RelativePositions}
* listed inside the EnumSet are considered relative.
*
* <p>The format of the rotation is represented by:</p>
*
* <ul><code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll
* </code></ul>
*
* @param location The location to set
* @param rotation The rotation to set
* @param relativePositions The coordinates to set relatively
* @return True if the teleport was successful
*/
boolean setLocationAndRotation(Location location, Vector3f rotation, EnumSet<RelativePositions> relativePositions);
boolean setLocationAndRotation(Location location, Vector3d rotation, EnumSet<RelativePositions> relativePositions);
/**
* Gets the rotation as a Vector3f.
*
* <p>The format of the rotation is represented by:</p>
*
* <ul><code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll
* </code></ul>
*
* @return The rotation as a Vector3f
*/
Vector3f getRotation();
Vector3d getRotation();
/**
* Sets the rotation of this entity.
*
* <p>The format of the rotation is represented by:</p>
*
* <ul><code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll
* </code></ul>
*
* @param rotation The rotation to set the entity to
*/
void setRotation(Vector3f rotation);
void setRotation(Vector3d rotation);
/**
* Gets the current velocity of this entity.
@@ -29,8 +29,7 @@ import org.spongepowered.api.util.Identifiable;
public interface Tamer extends Identifiable {
/**
* Gets the name of this tamer to reference on tamed entities or null
* if it cannot be obtained.
* Gets the name of this tamer to reference on tamed entities.
*
* @return The name to reference this tamer
*/
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.entity.living;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.entity.ArmorEquipable;
/**
@@ -37,84 +37,84 @@ public interface ArmorStand extends Living, ArmorEquipable {
*
* @return The direction the headpiece is aiming at
*/
Vector3f getHeadDirection();
Vector3d getHeadDirection();
/**
* Sets the direction of the head.
*
* @param direction The direction of the head
*/
void setHeadDirection(Vector3f direction);
void setHeadDirection(Vector3d direction);
/**
* Gets the direction the body is aiming at.
*
* @return The direction the body is aiming at
*/
Vector3f getBodyRotation();
Vector3d getBodyRotation();
/**
* Sets the direction of the body.
*
* @param direction The direction of the body
*/
void setBodyDirection(Vector3f direction);
void setBodyDirection(Vector3d direction);
/**
* Gets the direction the left arm is aiming at.
*
* @return The direction the left arm is aiming at
*/
Vector3f getLeftArmDirection();
Vector3d getLeftArmDirection();
/**
* Sets the direction of the left arm.
*
* @param direction The direction of the left arm
*/
void setLeftArmDirection(Vector3f direction);
void setLeftArmDirection(Vector3d direction);
/**
* Gets the direction the right arm is aiming at.
*
* @return The direction the right arm is aiming at
*/
Vector3f getRightArmDirection();
Vector3d getRightArmDirection();
/**
* Sets the direction of the right arm.
*
* @param direction The direction of the right arm
*/
void setRightArmDirection(Vector3f direction);
void setRightArmDirection(Vector3d direction);
/**
* Gets the direction the left leg is aiming at.
*
* @return The direction the left leg is aiming at
*/
Vector3f getLeftLegDirection();
Vector3d getLeftLegDirection();
/**
* Sets the direction of the left leg.
*
* @param direction The direction of the left leg
*/
void setLeftLegDirection(Vector3f direction);
void setLeftLegDirection(Vector3d direction);
/**
* Gets the direction the right leg is aiming at.
*
* @return The direction the right leg is aiming at
*/
Vector3f getRightLegDirection();
Vector3d getRightLegDirection();
/**
* Sets the direction of the right leg.
*
* @param direction The direction of the right leg
*/
void setRightLegDirection(Vector3f direction);
void setRightLegDirection(Vector3d direction);
/**
* Returns whether this armor stand is a small armor stand or not.
@@ -121,7 +121,7 @@ public interface Human extends Living, ProjectileSource, ArmorEquipable, Tamer,
* Gets the experience required since the last level to level up.
*
* <p>For example, if level 14 reqiures 280 experience points, level 15
* requires 315, and the player is at level 14, this method will return 35.
* requires 315, and the player is at level 14, this method will return
* 35.</p>
*
* @return the experience required since the last level to level up
@@ -25,7 +25,7 @@
package org.spongepowered.api.entity.living;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import com.google.common.base.Optional;
import org.spongepowered.api.attribute.AttributeHolder;
import org.spongepowered.api.entity.Entity;
@@ -178,7 +178,7 @@ public interface Living extends Entity, AttributeHolder {
*
* @return The camera location
*/
Vector3f getEyeLocation();
Vector3d getEyeLocation();
/**
* Gets the remaining ticks of air.
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.animal;
/**
* An enumeration of known vanilla {@link HorseColor}s.
*/
public final class HorseColors {
public static final HorseColor WHITE = null;
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.animal;
/**
* An enumeration of known vanilla {@link HorseStyle}s.
*/
public final class HorseStyles {
public static final HorseStyle NONE = null;
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.animal;
/**
* An enumeration of known vanilla {@link HorseVariant}s.
*/
public final class HorseVariants {
public static final HorseVariant HORSE = null;
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.animal;
/**
* An enumeration of known vanilla {@link OcelotType}s.
*/
public final class OcelotTypes {
public static final OcelotType WILD_OCELOT = null;
@@ -26,6 +26,9 @@ package org.spongepowered.api.entity.living.animal;
import org.spongepowered.api.service.persistence.DataSerializable;
/**
* Represents a type of {@link Rabbit}.
*/
public interface RabbitType extends DataSerializable {
/**
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.animal;
/**
* An enumeration of known vanilla {@link RabbitType}s.
*/
public final class RabbitTypes {
public static final RabbitType BROWN = null;
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.entity.living.monster;
/**
* An enumeration of known vanilla {@link SkeletonType}s.
*/
public final class SkeletonTypes {
public static final SkeletonType NORMAL = null;
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.entity.projectile.source;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.entity.projectile.Projectile;
/**
@@ -49,5 +49,5 @@ public interface ProjectileSource {
* @param <T> The Type of Projectile
* @return The projectile instance that was launched
*/
<T extends Projectile> T launchProjectile(Class<T> projectileClass, Vector3f velocity);
<T extends Projectile> T launchProjectile(Class<T> projectileClass, Vector3d velocity);
}
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.entity.projectile.source;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.entity.projectile.Projectile;
/**
@@ -39,7 +39,7 @@ public final class UnknownProjectileSource implements ProjectileSource {
}
@Override
public <T extends Projectile> T launchProjectile(Class<T> projectileClass, Vector3f velocity) {
public <T extends Projectile> T launchProjectile(Class<T> projectileClass, Vector3d velocity) {
return null;
}
}
@@ -28,6 +28,10 @@ package org.spongepowered.api.event;
import org.spongepowered.api.util.event.Event;
import org.spongepowered.api.util.event.callback.CallbackList;
/**
* An abstract event that can be extended for any and all custom events as
* necessary.
*/
public abstract class AbstractEvent implements Event {
private final CallbackList callbacks = new CallbackList();
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.event;
/**
* An event that is related to experience.
*/
public interface ExperienceEvent {
/**
@@ -26,7 +26,6 @@
package org.spongepowered.api.event;
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3i;
import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilder;
@@ -91,26 +90,26 @@ import org.spongepowered.api.event.entity.EntityTameEvent;
import org.spongepowered.api.event.entity.EntityTeleportEvent;
import org.spongepowered.api.event.entity.EntityUpdateEvent;
import org.spongepowered.api.event.entity.ProjectileLaunchEvent;
import org.spongepowered.api.event.entity.living.player.PlayerBreakBlockEvent;
import org.spongepowered.api.event.entity.living.player.PlayerChangeBlockEvent;
import org.spongepowered.api.event.entity.living.player.PlayerChangeGameModeEvent;
import org.spongepowered.api.event.entity.living.player.PlayerChangeWorldEvent;
import org.spongepowered.api.event.entity.living.player.PlayerChatEvent;
import org.spongepowered.api.event.entity.living.player.PlayerDeathEvent;
import org.spongepowered.api.event.entity.living.player.PlayerDropItemEvent;
import org.spongepowered.api.event.entity.living.player.PlayerHarvestBlockEvent;
import org.spongepowered.api.event.entity.living.player.PlayerInteractBlockEvent;
import org.spongepowered.api.event.entity.living.player.PlayerInteractEntityEvent;
import org.spongepowered.api.event.entity.living.player.PlayerInteractEvent;
import org.spongepowered.api.event.entity.living.player.PlayerJoinEvent;
import org.spongepowered.api.event.entity.living.player.PlayerMoveEvent;
import org.spongepowered.api.event.entity.living.player.PlayerPickUpItemEvent;
import org.spongepowered.api.event.entity.living.player.PlayerPlaceBlockEvent;
import org.spongepowered.api.event.entity.living.player.PlayerQuitEvent;
import org.spongepowered.api.event.entity.living.player.PlayerUpdateEvent;
import org.spongepowered.api.event.entity.living.player.fishing.PlayerCastFishingLineEvent;
import org.spongepowered.api.event.entity.living.player.fishing.PlayerHookedEntityEvent;
import org.spongepowered.api.event.entity.living.player.fishing.PlayerRetractFishingLineEvent;
import org.spongepowered.api.event.entity.player.PlayerBreakBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerChangeBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerChangeGameModeEvent;
import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent;
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
import org.spongepowered.api.event.entity.player.PlayerDeathEvent;
import org.spongepowered.api.event.entity.player.PlayerDropItemEvent;
import org.spongepowered.api.event.entity.player.PlayerHarvestBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerInteractEntityEvent;
import org.spongepowered.api.event.entity.player.PlayerInteractEvent;
import org.spongepowered.api.event.entity.player.PlayerJoinEvent;
import org.spongepowered.api.event.entity.player.PlayerMoveEvent;
import org.spongepowered.api.event.entity.player.PlayerPickUpItemEvent;
import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerQuitEvent;
import org.spongepowered.api.event.entity.player.PlayerUpdateEvent;
import org.spongepowered.api.event.entity.player.fishing.PlayerCastFishingLineEvent;
import org.spongepowered.api.event.entity.player.fishing.PlayerHookedEntityEvent;
import org.spongepowered.api.event.entity.player.fishing.PlayerRetractFishingLineEvent;
import org.spongepowered.api.event.message.CommandEvent;
import org.spongepowered.api.event.message.MessageEvent;
import org.spongepowered.api.event.server.StatusPingEvent;
@@ -596,7 +595,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static EntityDisplaceEvent createEntityDisplace(Game game, Entity entity,
Location oldLocation, Location newLocation, Vector3f rotation) {
Location oldLocation, Location newLocation, Vector3d rotation) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("entity", entity);
@@ -721,7 +720,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static EntityMoveEvent createEntityMove(Game game, Entity entity,
Location oldLocation, Location newLocation, Vector3f rotation) {
Location oldLocation, Location newLocation, Vector3d rotation) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("entity", entity);
@@ -827,7 +826,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static EntityTeleportEvent createEntityTeleport(Game game, Cause cause, Entity entity, Location oldLocation, Location newLocation,
Vector3f rotation, boolean keepsVelocity) {
Vector3d rotation, boolean keepsVelocity) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("cause", Optional.fromNullable(cause));
@@ -1185,7 +1184,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static PlayerInteractBlockEvent createPlayerInteractBlock(Game game, Cause cause, Player player, BlockLoc block,
EntityInteractionType interactionType, @Nullable Vector3f location) {
EntityInteractionType interactionType, @Nullable Vector3d location) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("cause", Optional.fromNullable(cause));
@@ -1210,7 +1209,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static PlayerInteractEntityEvent createPlayerInteractEntity(Game game, Player player, Entity targetEntity,
EntityInteractionType interactionType, @Nullable Vector3f location) {
EntityInteractionType interactionType, @Nullable Vector3d location) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("entity", player);
@@ -1233,7 +1232,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static PlayerInteractEvent createPlayerInteract(Game game, Player player, EntityInteractionType interactionType,
@Nullable Vector3f location) {
@Nullable Vector3d location) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("entity", player);
@@ -1275,7 +1274,7 @@ public final class SpongeEventFactory {
* @return A new instance of the event
*/
public static PlayerMoveEvent createPlayerMove(Game game, Player player,
Location oldLocation, Location newLocation, Vector3f rotation) {
Location oldLocation, Location newLocation, Vector3d rotation) {
Map<String, Object> values = Maps.newHashMap();
values.put("game", game);
values.put("entity", player);
@@ -27,6 +27,9 @@ package org.spongepowered.api.event.block.data;
import org.spongepowered.api.block.data.Furnace;
import org.spongepowered.api.event.inventory.BlockInventoryEvent;
/**
* An event that involves a {@link Furnace}.
*/
public interface FurnaceEvent extends TileEntityEvent, BlockInventoryEvent {
@Override
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.event.entity;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.util.event.Cancellable;
import org.spongepowered.api.world.Location;
@@ -63,13 +63,13 @@ public interface EntityDisplaceEvent extends EntityEvent, Cancellable {
*
* @return The rotation the entity is facing
*/
Vector3f getRotation();
Vector3d getRotation();
/**
* Sets the rotation the entity is facing.
*
* @param rotation The rotation the entity is facing
*/
void setRotation(Vector3f rotation);
void setRotation(Vector3d rotation);
}
@@ -27,6 +27,9 @@ package org.spongepowered.api.event.entity.living;
import org.spongepowered.api.event.entity.EntityPickUpItemEvent;
/**
* An event where a living entity is picking up an item.
*/
public interface LivingPickUpItemEvent extends LivingEvent, EntityPickUpItemEvent {
}
@@ -27,6 +27,9 @@ package org.spongepowered.api.event.entity.living.human;
import org.spongepowered.api.event.entity.living.LivingPickUpItemEvent;
/**
* An event where a human is picking up an item.
*/
public interface HumanPickUpItemEvent extends HumanEvent, LivingPickUpItemEvent {
}
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.block.BlockLoc;
import org.spongepowered.api.entity.player.Player;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.block.BlockLoc;
import org.spongepowered.api.entity.player.Player;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.player.gamemode.GameMode;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.entity.living.human.HumanChangeHealthEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.util.event.Cancellable;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.message.MessageEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.entity.living.human.HumanDeathEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.entity.living.human.HumanDropItemEvent;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanEnterBedEvent;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanEquipmentChangeEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanExpChangeEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.block.BlockLoc;
import org.spongepowered.api.entity.player.Player;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.block.BlockLoc;
import org.spongepowered.api.entity.player.Player;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.player.Player;
@@ -23,9 +23,9 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import com.google.common.base.Optional;
import org.spongepowered.api.entity.EntityInteractionType;
import org.spongepowered.api.entity.player.Player;
@@ -54,6 +54,6 @@ public interface PlayerInteractEvent extends PlayerEvent, HumanInteractEvent {
*
* @return The position, if available
*/
Optional<Vector3f> getClickedPosition();
Optional<Vector3d> getClickedPosition();
}
@@ -22,10 +22,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanItemConsumeEvent;
/**
* An event when a player consumes an item. Examples may include: eating,
* drinking a potion, etc.
*/
public interface PlayerItemConsumeEvent extends PlayerEvent, HumanItemConsumeEvent {
}
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.text.Text;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import com.google.common.base.Optional;
import org.spongepowered.api.event.entity.living.human.HumanLeaveBedEvent;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanLevelChangeEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.entity.living.human.HumanMoveEvent;
@@ -23,10 +23,13 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanPickUpItemEvent;
/**
* An event where a player is picking up an item.
*/
public interface PlayerPickUpItemEvent extends PlayerEvent, HumanPickUpItemEvent {
}
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.block.BlockLoc;
import org.spongepowered.api.entity.player.Player;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.text.Text;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.world.Location;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.event.entity.living.human.HumanSleepEvent;
@@ -23,7 +23,7 @@
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player;
package org.spongepowered.api.event.entity.player;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.entity.living.human.HumanUpdateEvent;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player.fishing;
package org.spongepowered.api.event.entity.player.fishing;
import org.spongepowered.api.event.entity.living.human.fishing.HumanCastFishingLineEvent;
@@ -22,10 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player.fishing;
package org.spongepowered.api.event.entity.player.fishing;
import org.spongepowered.api.event.entity.living.human.fishing.HumanFishEvent;
import org.spongepowered.api.event.entity.living.player.PlayerEvent;
import org.spongepowered.api.event.entity.player.PlayerEvent;
/**
* Called when a {@link org.spongepowered.api.entity.player.Player} performs
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player.fishing;
package org.spongepowered.api.event.entity.player.fishing;
import org.spongepowered.api.event.entity.living.human.fishing.HumanHookedEntityEvent;
@@ -22,7 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player.fishing;
package org.spongepowered.api.event.entity.player.fishing;
import org.spongepowered.api.event.entity.living.human.fishing.HumanRetractFishingLineEvent;
@@ -22,5 +22,5 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.entity.living.player.fishing;
package org.spongepowered.api.event.entity.player.fishing;
@@ -23,4 +23,4 @@
* THE SOFTWARE.
*/
@org.spongepowered.api.util.annotation.NonnullByDefault package org.spongepowered.api.event.entity.living.player;
@org.spongepowered.api.util.annotation.NonnullByDefault package org.spongepowered.api.event.entity.player;
@@ -24,5 +24,10 @@
*/
package org.spongepowered.api.event.inventory;
/**
* Represents an event when a viewer has clicked inside an inventory.
*
* <p>Note that this event is incomplete.</p>
*/
public interface InventoryClickEvent extends ViewerEvent {
}
@@ -0,0 +1,26 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
@org.spongepowered.api.util.annotation.NonnullByDefault package org.spongepowered.api.event.net;
@@ -27,6 +27,9 @@ package org.spongepowered.api.event.rcon;
import org.spongepowered.api.event.message.CommandEvent;
import org.spongepowered.api.util.command.source.RconSource;
/**
* An event when an {@link RconSource} executes a command.
*/
public interface RconCommandEvent extends CommandEvent, RconEvent {
@Override
@@ -27,6 +27,9 @@ package org.spongepowered.api.event.rcon;
import org.spongepowered.api.event.GameEvent;
import org.spongepowered.api.util.command.source.RconSource;
/**
* An event that is associated with an {@link RconSource}.
*/
public interface RconEvent extends GameEvent {
/**
@@ -26,6 +26,9 @@ package org.spongepowered.api.event.rcon;
import org.spongepowered.api.util.event.Cancellable;
/**
* An event when an Rcon source logs in to the server.
*/
public interface RconLoginEvent extends RconEvent, Cancellable {
/**
@@ -22,4 +22,5 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
@org.spongepowered.api.util.annotation.NonnullByDefault
package org.spongepowered.api.event.rcon;
@@ -29,7 +29,11 @@ import com.flowpowered.math.vector.Vector3i;
import org.spongepowered.api.event.GameEvent;
import org.spongepowered.api.world.ChunkManager;
// NOTE: This does not extend ChunkEvent as Chunk may not be currently loaded.
/**
* Represents a {@link org.spongepowered.api.world.ChunkManager.LoadingTicket}
* forcing a chunk to load into the world. Note that the loading ticket may
* have not finished so the chunk may not have finished loading yet.
*/
public interface ChunkForcedEvent extends GameEvent {
/**
@@ -27,7 +27,7 @@ package org.spongepowered.api.item;
public final class Fishes {
public static final Fish RAW_FISH = null;
public static final Fish COD = null;
public static final Fish SALMON = null;
public static final Fish CLOWNFISH = null;
public static final Fish PUFFERFISH = null;
@@ -153,7 +153,7 @@ public interface ItemStack extends DataHolder, DataSerializable, AttributeSource
* @param container The raw data to validate
* @return True if the data is valid
*/
boolean vaildateData(DataContainer container);
boolean validateData(DataContainer container);
/**
* Attempts to set all data of this {@link ItemStack} according to the
@@ -30,6 +30,11 @@ import org.slf4j.Logger;
import java.util.Collection;
/**
* The manager that manages plugins. This manager can retrieve {@link
* PluginContainer}s from {@link Plugin} instances, getting {@link Logger}s,
* etc.
*/
public interface PluginManager {
/**
@@ -43,6 +43,9 @@ import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.Nullable;
import javax.inject.Inject;
/**
* The default implementation of {@link ServiceManager}.
*/
public class SimpleServiceManager implements ServiceManager {
private final ConcurrentMap<Class<?>, Provider> providers =
@@ -26,6 +26,11 @@ package org.spongepowered.api.service.persistence.data;
import com.google.common.base.Optional;
/**
* The default implementation of {@link DataContainer} that can be instantiated
* for any use. This is the primary implementation of any {@link DataView} that
* is used throughout both SpongeAPI and Sponge implementation.
*/
public class MemoryDataContainer extends MemoryDataView implements DataContainer {
@Override
@@ -190,38 +190,38 @@ public class MemoryDataView implements DataView {
checkState(this.container != null);
if (value instanceof DataView) {
checkArgument(!(value).equals(this));
checkArgument(value != this);
copyDataView(path, (DataView) value);
} else if (value instanceof DataSerializable) {
DataContainer valueContainer = ((DataSerializable) value).toContainer();
checkArgument(!(valueContainer).equals(this));
copyDataView(path, valueContainer);
}
List<String> parts = path.getParts();
if (parts.size() > 1) {
String subKey = parts.get(0);
DataQuery subQuery = new DataQuery(subKey);
Optional<DataView> subViewOptional = this.getUnsafeView(subQuery);
DataView subView;
if (!subViewOptional.isPresent()) {
this.createView(subQuery);
subView = (DataView) this.map.get(subKey);
} else {
subView = subViewOptional.get();
}
List<String> subParts = Lists.newArrayListWithCapacity(parts.size() - 1);
for (int i = 1; i < parts.size(); i++) {
subParts.add(parts.get(i));
}
subView.set(new DataQuery(subParts), value);
} else {
if (value instanceof Collection) {
setCollection(parts.get(0), (Collection) value);
} else if (value instanceof Object[]) {
setCollection(parts.get(0), Lists.newArrayList((Object[]) value));
List<String> parts = path.getParts();
if (parts.size() > 1) {
String subKey = parts.get(0);
DataQuery subQuery = new DataQuery(subKey);
Optional<DataView> subViewOptional = this.getUnsafeView(subQuery);
DataView subView;
if (!subViewOptional.isPresent()) {
this.createView(subQuery);
subView = (DataView) this.map.get(subKey);
} else {
subView = subViewOptional.get();
}
List<String> subParts = Lists.newArrayListWithCapacity(parts.size() - 1);
for (int i = 1; i < parts.size(); i++) {
subParts.add(parts.get(i));
}
subView.set(new DataQuery(subParts), value);
} else {
this.map.put(parts.get(0), value);
if (value instanceof Collection) {
setCollection(parts.get(0), (Collection) value);
} else if (value instanceof Object[]) {
setCollection(parts.get(0), Lists.newArrayList((Object[]) value));
} else {
this.map.put(parts.get(0), value);
}
}
}
}
@@ -252,7 +252,7 @@ public class MemoryDataView implements DataView {
private void copyDataView(DataQuery path, DataView value) {
Collection<DataQuery> valueKeys = value.getKeys(true);
for (DataQuery oldKey : valueKeys) {
set(path.then(oldKey), value.get(oldKey));
set(path.then(oldKey), value.get(oldKey).get());
}
}
@@ -24,7 +24,7 @@
*/
package org.spongepowered.api.text.selector;
import com.flowpowered.math.vector.Vector3f;
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3i;
import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.entity.player.gamemode.GameMode;
@@ -120,7 +120,7 @@ public final class ArgumentTypes {
* {@code rx}/{@code ry} (for minimum) and {@code rxm}/{@code rym} selector
* keys.</p>
*/
public static final ArgumentType.Limit<ArgumentType.Vector3<Vector3f, Float>> ROTATION = null;
public static final ArgumentType.Limit<ArgumentType.Vector3<Vector3d, Float>> ROTATION = null;
/**
* The argument type filtering targets based on the {@link EntityType}.
@@ -27,6 +27,9 @@ package org.spongepowered.api.util;
import com.flowpowered.math.vector.Vector3d;
/**
* Represents a three dimensional cartesian axis.
*/
public enum Axis {
X(new Vector3d(1, 0, 0)),
@@ -24,6 +24,10 @@
*/
package org.spongepowered.api.util;
/**
* Represents the directional axis is either
* positive, zero, or negative.
*/
public enum AxisDirection {
PLUS(1),
@@ -27,7 +27,7 @@ package org.spongepowered.api.util.command.source;
import java.net.InetSocketAddress;
/**
* Represents an Rcon client
* Represents an Rcon client.
*/
public interface RconSource extends RemoteSource {
@@ -25,6 +25,9 @@
package org.spongepowered.api.util.event;
/**
* Represents an event that can be cancelled.
*/
public interface Cancellable {
/**
@@ -37,6 +37,10 @@ import org.spongepowered.api.entity.Entity;
import java.util.List;
import java.util.UUID;
/**
* A manager of chunks. Chunks can be managed via tickets that may represent
* forced-chunk-loading, player-chunk-loading, entity-chunk-loading, etc.
*/
public interface ChunkManager {
/**
@@ -71,6 +71,13 @@ public interface EntityUniverse {
/**
* Create an entity instance at the given position.
*
* <p>Creating an entity does not spawn the entity into the world. An
* entity created means the entity can be spawned at the given location.
* If {@link Optional#absent()} was returned, the entity is not able to
* spawn at the given location. Furthermore, this allows for the {@link
* Entity} to be customized further prior to traditional "ticking" and
* processing by core systems.</p>
*
* @param type The type
* @param position The position
* @return An entity, if one was created
@@ -80,6 +87,13 @@ public interface EntityUniverse {
/**
* Create an entity instance at the given position.
*
* <p>Creating an entity does not spawn the entity into the world. An
* entity created means the entity can be spawned at the given location.
* If {@link Optional#absent()} was returned, the entity is not able to
* spawn at the given location. Furthermore, this allows for the {@link
* Entity} to be customized further prior to traditional "ticking" and
* processing by core systems.</p>
*
* @param snapshot The snapshot
* @param position The position
* @return An entity, if one was created
@@ -89,6 +103,13 @@ public interface EntityUniverse {
/**
* Create an entity instance at the given position.
*
* <p>Creating an entity does not spawn the entity into the world. An
* entity created means the entity can be spawned at the given location.
* If {@link Optional#absent()} was returned, the entity is not able to
* spawn at the given location. Furthermore, this allows for the {@link
* Entity} to be customized further prior to traditional "ticking" and
* processing by core systems.</p>
*
* @param type The type
* @param position The position
* @return An entity, if one was created
@@ -98,6 +119,13 @@ public interface EntityUniverse {
/**
* Create an entity instance at the given position.
*
* <p>Creating an entity does not spawn the entity into the world. An
* entity created means the entity can be spawned at the given location.
* If {@link Optional#absent()} was returned, the entity is not able to
* spawn at the given location. Furthermore, this allows for the {@link
* Entity} to be customized further prior to traditional "ticking" and
* processing by core systems.</p>
*
* @param snapshot The snapshot
* @param position The position
* @return An entity, if one was created
@@ -107,13 +135,29 @@ public interface EntityUniverse {
/**
* Create an entity instance at the given position.
*
* <p>Creating an entity does not spawn the entity into the world. An
* entity created means the entity can be spawned at the given location.
* If {@link Optional#absent()} was returned, the entity is not able to
* spawn at the given location. Furthermore, this allows for the {@link
* Entity} to be customized further prior to traditional "ticking" and
* processing by core systems.</p>
*
* @param entityContainer The data container of the entity
* @return An entity, if one was created
*/
Optional<Entity> createEntity(DataContainer entityContainer);
/**
* Spawns an entity using the already set properties (extent, position, rotation).
* Spawns an entity using the already set properties (extent, position,
* rotation).
*
* <p>The requirements involve that all necessary setup of states and data
* is already preformed on the entity retrieved from the various {@link
* #createEntity(EntityType,Vector3d)} methods. Calling this will make the
* now-spawned entity able to be processed by various systems.</p>
*
* <p>If the entity was unable to spawn, the entity is not removed, but it
* should be taken note that there can be many reasons for a failure.</p>
*
* @param entity The entity to spawn
* @return True if successful, false if not
@@ -30,6 +30,13 @@ import com.google.common.util.concurrent.ListenableFuture;
import org.spongepowered.api.service.persistence.data.DataContainer;
import org.spongepowered.api.world.Chunk;
/**
* Represents the storage manager of a particular {@link org.spongepowered.api.world.World}.
*
* <p>It should be noted that this can have direct access to the underlying
* storage system of the world and interface with deleting and modifying
* chunks.</p>
*/
public interface WorldStorage {
/**
@@ -215,7 +215,7 @@ public class MemoryDataTest {
List<String> myList = ImmutableList.of("foo", "bar", "baz");
SimpleData temp = new SimpleData(1, 2.0, "foo", ImmutableList.of("foo", "bar", "baz"));
SimpleData temp = new SimpleData(1, 2.0, "foo", myList);
DataContainer container = temp.toContainer();
Optional<SimpleData> fromContainer = container.getSerializable(new DataQuery(), SimpleData.class, service);