Update to Minecraft 1.8

For more information please see http://www.spigotmc.org/

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2014-11-26 08:15:59 +11:00
parent 84fc1478c5
commit 8344aacc6e
29 changed files with 1184 additions and 87 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<version>1.8-R0.1-SNAPSHOT</version>
<name>Bukkit</name>
<url>http://www.bukkit.org</url>
@ -10,34 +10,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<developerConnection>scm:git:git@github.com:Bukkit/Bukkit.git</developerConnection>
<connection>scm:git:git://github.com/Bukkit/Bukkit.git</connection>
<url>https://github.com/Bukkit/Bukkit/tree/master/</url>
</scm>
<ciManagement>
<system>jenkins</system>
<url>http://ci.bukkit.org</url>
</ciManagement>
<distributionManagement>
<site>
<id>jd.bukkit.org</id>
<url>file:///home/javadocs/public_html/</url>
</site>
<repository>
<id>repobo-rel</id>
<name>repo.bukkit.org Releases</name>
<url>http://repo.bukkit.org/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>repobo-snap</id>
<name>repo.bukkit.org Snapshots</name>
<url>http://repo.bukkit.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
@ -115,10 +87,11 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Should be kept in sync with Minecraft -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0.1</version>
<version>17.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View File

@ -37,6 +37,7 @@ public enum Achievement {
FULL_BEACON (KILL_WITHER),
BREED_COW (KILL_COW),
DIAMONDS_TO_YOU (GET_DIAMONDS),
OVERPOWERED (BUILD_BETTER_PICKAXE)
;
private final Achievement parent;

View File

@ -25,7 +25,14 @@ public enum GameMode {
/**
* Adventure mode cannot break blocks without the correct tools.
*/
ADVENTURE(2);
ADVENTURE(2),
/**
* Spectator mode cannot interact with the world in anyway and is
* invisible to normal players. This grants the player the
* ability to no-clip through the world.
*/
SPECTATOR(3);
private final int value;
private final static Map<Integer, GameMode> BY_ID = Maps.newHashMap();

View File

@ -57,6 +57,7 @@ import org.bukkit.potion.Potion;
import org.bukkit.util.Java15Compat;
import com.google.common.collect.Maps;
import org.bukkit.material.Banner;
/**
* An enum of all material IDs accepted by the official server and client
@ -229,12 +230,39 @@ public enum Material {
LOG_2(162),
ACACIA_STAIRS(163, Stairs.class),
DARK_OAK_STAIRS(164, Stairs.class),
SLIME_BLOCK(165),
BARRIER(166),
IRON_TRAPDOOR(167, TrapDoor.class),
PRISMARINE(168),
SEA_LANTERN(169),
HAY_BLOCK(170),
CARPET(171),
HARD_CLAY(172),
COAL_BLOCK(173),
PACKED_ICE(174),
DOUBLE_PLANT(175),
STANDING_BANNER(176, Banner.class),
WALL_BANNER(177, Banner.class),
DAYLIGHT_DETECTOR_INVERTED(178),
RED_SANDSTONE(179),
RED_SANDSTONE_STAIRS(180, Stairs.class),
DOUBLE_STONE_SLAB2(181),
STONE_SLAB2(182),
SPRUCE_FENCE_GATE(183),
BIRCH_FENCE_GATE(184),
JUNGLE_FENCE_GATE(185),
DARK_OAK_FENCE_GATE(186),
ACACIA_FENCE_GATE(187),
SPRUCE_FENCE(188),
BIRCH_FENCE(189),
JUNGLE_FENCE(190),
DARK_OAK_FENCE(191),
ACACIA_FENCE(192),
SPRUCE_DOOR(193),
BIRCH_DOOR(194),
JUNGLE_DOOR(195),
ACACIA_DOOR(196),
DARK_OAK_DOOR(197),
// ----- Item Separator -----
IRON_SPADE(256, 1, 250),
IRON_PICKAXE(257, 1, 250),
@ -304,13 +332,13 @@ public enum Material {
PAINTING(321),
GOLDEN_APPLE(322),
SIGN(323, 16),
WOOD_DOOR(324, 1),
WOOD_DOOR(324, 64),
BUCKET(325, 16),
WATER_BUCKET(326, 1),
LAVA_BUCKET(327, 1),
MINECART(328, 1),
SADDLE(329, 1),
IRON_DOOR(330, 1),
IRON_DOOR(330, 64),
REDSTONE(331),
SNOW_BALL(332, 16),
BOAT(333, 1),
@ -395,12 +423,28 @@ public enum Material {
QUARTZ(406),
EXPLOSIVE_MINECART(407, 1),
HOPPER_MINECART(408, 1),
PRISMARINE_SHARD(409),
PRISMARINE_CRYSTALS(410),
RABBIT(411),
COOKED_RABBIT(412),
RABBIT_STEW(413, 1),
RABBIT_FOOT(414),
RABBIT_HIDE(415),
ARMOR_STAND(416, 16),
IRON_BARDING(417, 1),
GOLD_BARDING(418, 1),
DIAMOND_BARDING(419, 1),
LEASH(420),
NAME_TAG(421),
COMMAND_MINECART(422, 1),
MUTTON(423),
COOKED_MUTTON(424),
BANNER(425, 16),
SPRUCE_DOOR_ITEM(427),
BIRCH_DOOR_ITEM(428),
JUNGLE_DOOR_ITEM(429),
ACACIA_DOOR_ITEM(430),
DARK_OAK_DOOR_ITEM(431),
GOLD_RECORD(2256, 1),
GREEN_RECORD(2257, 1),
RECORD_3(2258, 1),
@ -558,6 +602,11 @@ public enum Material {
case GOLDEN_APPLE:
case ROTTEN_FLESH:
case SPIDER_EYE:
case RABBIT:
case COOKED_RABBIT:
case RABBIT_STEW:
case MUTTON:
case COOKED_MUTTON:
return true;
default:
return false;
@ -777,6 +826,25 @@ public enum Material {
case ACACIA_STAIRS:
case DARK_OAK_STAIRS:
case PACKED_ICE:
case RED_SANDSTONE:
case SLIME_BLOCK:
case BARRIER:
case IRON_TRAPDOOR:
case PRISMARINE:
case SEA_LANTERN:
case DOUBLE_STONE_SLAB2:
case RED_SANDSTONE_STAIRS:
case STONE_SLAB2:
case SPRUCE_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case ACACIA_FENCE_GATE:
case SPRUCE_FENCE:
case BIRCH_FENCE:
case JUNGLE_FENCE:
case DARK_OAK_FENCE:
case ACACIA_FENCE:
return true;
default:
return false;
@ -837,6 +905,7 @@ public enum Material {
case ACTIVATOR_RAIL:
case CARPET:
case DOUBLE_PLANT:
case DAYLIGHT_DETECTOR_INVERTED:
return true;
default:
return false;
@ -889,6 +958,17 @@ public enum Material {
case LOG_2:
case ACACIA_STAIRS:
case DARK_OAK_STAIRS:
case DOUBLE_PLANT:
case SPRUCE_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case ACACIA_FENCE_GATE:
case SPRUCE_FENCE:
case BIRCH_FENCE:
case JUNGLE_FENCE:
case DARK_OAK_FENCE:
case ACACIA_FENCE:
return true;
default:
return false;
@ -928,6 +1008,18 @@ public enum Material {
case LOG_2:
case CARPET:
case DOUBLE_PLANT:
case DEAD_BUSH:
case FENCE_GATE:
case SPRUCE_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case ACACIA_FENCE_GATE:
case SPRUCE_FENCE:
case BIRCH_FENCE:
case JUNGLE_FENCE:
case DARK_OAK_FENCE:
case ACACIA_FENCE:
return true;
default:
return false;
@ -1009,6 +1101,10 @@ public enum Material {
case COAL_BLOCK:
case LOG_2:
case PACKED_ICE:
case SLIME_BLOCK:
case BARRIER:
case PRISMARINE:
case RED_SANDSTONE:
return true;
default:
return false;

View File

@ -27,12 +27,17 @@ public enum Statistic {
BOAT_ONE_CM,
PIG_ONE_CM,
HORSE_ONE_CM,
SPRINT_ONE_CM,
CROUCH_ONE_CM,
MINE_BLOCK(Type.BLOCK),
USE_ITEM(Type.ITEM),
BREAK_ITEM(Type.ITEM),
CRAFT_ITEM(Type.ITEM),
KILL_ENTITY(Type.ENTITY),
ENTITY_KILLED_BY(Type.ENTITY);
ENTITY_KILLED_BY(Type.ENTITY),
TIME_SINCE_DEATH,
TALKED_TO_VILLAGER,
TRADED_WITH_VILLAGER;
private final Type type;

View File

@ -11,7 +11,9 @@ public enum WorldType {
FLAT("FLAT"),
VERSION_1_1("DEFAULT_1_1"),
LARGE_BIOMES("LARGEBIOMES"),
AMPLIFIED("AMPLIFIED");
AMPLIFIED("AMPLIFIED"),
CUSTOMIZED("CUSTOMIZED"),
DEBUG_ALL_BLOCK_STATES("DEBUG_ALL_BLOCK_STATES");
private final static Map<String, WorldType> BY_NAME = Maps.newHashMap();
private final String name;

View File

@ -0,0 +1,77 @@
package org.bukkit.block;
import org.bukkit.DyeColor;
import org.bukkit.block.banner.Pattern;
import java.util.List;
public interface Banner extends BlockState {
/**
* Returns the base color for this banner
*
* @return the base color
*/
DyeColor getBaseColor();
/**
* Sets the base color for this banner
*
* @param color the base color
*/
void setBaseColor(DyeColor color);
/**
* Returns a list of patterns on this banner
*
* @return the patterns
*/
List<Pattern> getPatterns();
/**
* Sets the patterns used on this banner
*
* @param patterns the new list of patterns
*/
void setPatterns(List<Pattern> patterns);
/**
* Adds a new pattern on top of the existing
* patterns
*
* @param pattern the new pattern to add
*/
void addPattern(Pattern pattern);
/**
* Returns the pattern at the specified index
*
* @param i the index
* @return the pattern
*/
Pattern getPattern(int i);
/**
* Removes the pattern at the specified index
*
* @param i the index
* @return the removed pattern
*/
Pattern removePattern(int i);
/**
* Sets the pattern at the specified index
*
* @param i the index
* @param pattern the new pattern
*/
void setPattern(int i, Pattern pattern);
/**
* Returns the number of patterns on this
* banner
*
* @return the number of patterns
*/
int numberOfPatterns();
}

View File

@ -0,0 +1,61 @@
package org.bukkit.block.banner;
import org.bukkit.DyeColor;
import org.bukkit.configuration.serialization.SerializableAs;
@SerializableAs("Pattern")
public class Pattern {
private final DyeColor color;
private final PatternType pattern;
/**
* Creates a new pattern from the specified color and
* pattern type
*
* @param color the pattern color
* @param pattern the pattern type
*/
public Pattern(DyeColor color, PatternType pattern) {
this.color = color;
this.pattern = pattern;
}
/**
* Returns the color of the pattern
*
* @return the color of the pattern
*/
public DyeColor getColor() {
return color;
}
/**
* Returns the type of pattern
*
* @return the pattern type
*/
public PatternType getPattern() {
return pattern;
}
@Override
public int hashCode() {
int hash = 3;
hash = 97 * hash + (this.color != null ? this.color.hashCode() : 0);
hash = 97 * hash + (this.pattern != null ? this.pattern.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pattern other = (Pattern) obj;
return this.color == other.color && this.pattern == other.pattern;
}
}

View File

@ -0,0 +1,80 @@
package org.bukkit.block.banner;
import java.util.HashMap;
import java.util.Map;
public enum PatternType {
BASE("b"),
SQUARE_BOTTOM_LEFT("bl"),
SQUARE_BOTTOM_RIGHT("br"),
SQUARE_TOP_LEFT("tl"),
SQUARE_TOP_RIGHT("tr"),
STRIPE_BOTTOM("bs"),
STRIPE_TOP("ts"),
STRIPE_LEFT("ls"),
STRIPE_RIGHT("rs"),
STRIPE_CENTER("cs"),
STRIPE_MIDDLE("ms"),
STRIPE_DOWNRIGHT("drs"),
STRIPE_DOWNLEFT("dls"),
STRIPE_SMALL("ss"),
CROSS("cr"),
STRAIGHT_CROSS("sc"),
TRIANGLE_BOTTOM("bt"),
TRIANGLE_TOP("tt"),
TRIANGLES_BOTTOM("bts"),
TRIANGLES_TOP("tts"),
DIAGONAL_LEFT("ld"),
DIAGONAL_RIGHT("rd"),
DIAGONAL_LEFT_MIRROR("lud"),
DIAGONAL_RIGHT_MIRROR("rud"),
CIRCLE_MIDDLE("mc"),
RHOMBUS_MIDDLE("mr"),
HALF_VERTICAL("vh"),
HALF_HORIZONTAL("hh"),
HALF_VERTICAL_MIRROR("vhr"),
HALF_HORIZONTAL_MIRROR("hhb"),
BORDER("bo"),
CURLY_BORDER("cbo"),
CREEPER("cre"),
GRADIENT("gra"),
GRADIENT_UP("gru"),
BRICKS("bri"),
SKULL("sku"),
FLOWER("flo"),
MOJANG("moj");
private final String identifier;
private static final Map<String, PatternType> byString = new HashMap<String, PatternType>();
static {
for (PatternType p : values()) {
byString.put(p.identifier, p);
}
}
private PatternType(String key) {
this.identifier = key;
}
/**
* Returns the identifier used to represent
* this pattern type
*
* @return the pattern's identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* Returns the pattern type which matches the passed
* identifier or null if no matches are found
*
* @param identifier the identifier
* @return the matched pattern type or null
*/
public static PatternType getByIdentifier(String identifier) {
return byString.get(identifier);
}
}

View File

@ -15,7 +15,7 @@ import org.bukkit.util.StringUtil;
import com.google.common.collect.ImmutableList;
public class GameModeCommand extends VanillaCommand {
private static final List<String> GAMEMODE_NAMES = ImmutableList.of("adventure", "creative", "survival");
private static final List<String> GAMEMODE_NAMES = ImmutableList.of("adventure", "creative", "survival", "spectator");
public GameModeCommand() {
super("gamemode");
@ -55,6 +55,8 @@ public class GameModeCommand extends VanillaCommand {
mode = GameMode.CREATIVE;
} else if (modeArg.equalsIgnoreCase("adventure") || modeArg.equalsIgnoreCase("a")) {
mode = GameMode.ADVENTURE;
} else if (modeArg.equalsIgnoreCase("spectator") || modeArg.equalsIgnoreCase("sp")) {
mode = GameMode.SPECTATOR;
} else {
mode = GameMode.SURVIVAL;
}

View File

@ -0,0 +1,261 @@
package org.bukkit.entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
public interface ArmorStand extends LivingEntity {
/**
* Returns the item the armor stand is
* currently holding
*
* @return the held item
*/
ItemStack getItemInHand();
/**
* Sets the item the armor stand is currently
* holding
*
* @param item the item to hold
*/
void setItemInHand(ItemStack item);
/**
* Returns the item currently being worn
* by the armor stand on its feet
*
* @return the worn item
*/
ItemStack getBoots();
/**
* Sets the item currently being worn
* by the armor stand on its feet
*
* @param item the item to wear
*/
void setBoots(ItemStack item);
/**
* Returns the item currently being worn
* by the armor stand on its legs
*
* @return the worn item
*/
ItemStack getLeggings();
/**
* Sets the item currently being worn
* by the armor stand on its legs
*
* @param item the item to wear
*/
void setLeggings(ItemStack item);
/**
* Returns the item currently being worn
* by the armor stand on its chest
*
* @return the worn item
*/
ItemStack getChestplate();
/**
* Sets the item currently being worn
* by the armor stand on its chest
*
* @param item the item to wear
*/
void setChestplate(ItemStack item);
/**
* Returns the item currently being worn
* by the armor stand on its head
*
* @return the worn item
*/
ItemStack getHelmet();
/**
* Sets the item currently being worn
* by the armor stand on its head
*
* @param item the item to wear
*/
void setHelmet(ItemStack item);
/**
* Returns the armor stand's body's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getBodyPose();
/**
* Sets the armor stand's body's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setBodyPose(EulerAngle pose);
/**
* Returns the armor stand's left arm's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getLeftArmPose();
/**
* Sets the armor stand's left arm's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setLeftArmPose(EulerAngle pose);
/**
* Returns the armor stand's right arm's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getRightArmPose();
/**
* Sets the armor stand's right arm's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setRightArmPose(EulerAngle pose);
/**
* Returns the armor stand's left leg's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getLeftLegPose();
/**
* Sets the armor stand's left leg's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setLeftLegPose(EulerAngle pose);
/**
* Returns the armor stand's right leg's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getRightLegPose();
/**
* Sets the armor stand's right leg's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setRightLegPose(EulerAngle pose);
/**
* Returns the armor stand's head's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @return the current pose
*/
EulerAngle getHeadPose();
/**
* Sets the armor stand's head's
* current pose as a {@link org.bukkit.util.EulerAngle}
*
* @param pose the current pose
*/
void setHeadPose(EulerAngle pose);
/**
* Returns whether the armor stand has
* a base plate
*
* @return whether it has a base plate
*/
boolean hasBasePlate();
/**
* Sets whether the armor stand has a
* base plate
*
* @param basePlate whether is has a base plate
*/
void setBasePlate(boolean basePlate);
/**
* Returns whether gravity applies to
* this armor stand
*
* @return whether gravity applies
*/
boolean hasGravity();
/**
* Sets whether gravity applies to
* this armor stand
*
* @param gravity whether gravity should apply
*/
void setGravity(boolean gravity);
/**
* Returns whether the armor stand should be
* visible or not
*
* @return whether the stand is visible or not
*/
boolean isVisible();
/**
* Sets whether the armor stand should be
* visible or not
*
* @param visible whether the stand is visible or not
*/
void setVisible(boolean visible);
/**
* Returns whether this armor stand has arms
*
* @return whether this has arms or not
*/
boolean hasArms();
/**
* Sets whether this armor stand has arms
*
* @param arms whether this has arms or not
*/
void setArms(boolean arms);
/**
* Returns whether this armor stand is scaled
* down
*
* @return whether this is scaled down
*/
boolean isSmall();
/**
* Sets whether this armor stand is scaled
* down
*
* @param small whether this is scaled down
*/
void setSmall(boolean small);
}

View File

@ -26,6 +26,8 @@ public enum CreatureType {
BLAZE("Blaze", Blaze.class, 61),
MAGMA_CUBE("LavaSlime", MagmaCube.class, 62),
ENDER_DRAGON("EnderDragon", EnderDragon.class, 63),
ENDERMITE("Endermite", Endermite.class, 67),
GUARDIAN("Guardian", Guardian.class, 68),
PIG("Pig", Pig.class, 90),
SHEEP("Sheep", Sheep.class, 91),
COW("Cow", Cow.class, 92),
@ -34,6 +36,7 @@ public enum CreatureType {
WOLF("Wolf", Wolf.class, 95),
MUSHROOM_COW("MushroomCow", MushroomCow.class, 96),
SNOWMAN("SnowMan", Snowman.class, 97),
RABBIT("Rabbit", Rabbit.class, 101),
VILLAGER("Villager", Villager.class, 120);
private String name;

View File

@ -0,0 +1,4 @@
package org.bukkit.entity;
public interface Endermite extends Monster {
}

View File

@ -295,4 +295,49 @@ public interface Entity extends Metadatable {
* @return The current vehicle.
*/
public Entity getVehicle();
/**
* Sets a custom name on a mob. This name will be used in death messages
* and can be sent to the client as a nameplate over the mob.
* <p>
* Setting the name to null or an empty string will clear it.
* <p>
* This value has no effect on players, they will always use their real
* name.
*
* @param name the name to set
*/
public void setCustomName(String name);
/**
* Gets the custom name on a mob. If there is no name this method will
* return null.
* <p>
* This value has no effect on players, they will always use their real
* name.
*
* @return name of the mob or null
*/
public String getCustomName();
/**
* Sets whether or not to display the mob's custom name client side. The
* name will be displayed above the mob similarly to a player.
* <p>
* This value has no effect on players, they will always display their
* name.
*
* @param flag custom name or not
*/
public void setCustomNameVisible(boolean flag);
/**
* Gets whether or not the mob's custom name is displayed client side.
* <p>
* This value has no effect on players, they will always display their
* name.
*
* @return if the custom name is displayed
*/
public boolean isCustomNameVisible();
}

View File

@ -81,6 +81,7 @@ public enum EntityType {
*/
FALLING_BLOCK("FallingSand", FallingBlock.class, 21, false),
FIREWORK("FireworksRocketEntity", Firework.class, 22, false),
ARMOR_STAND("ArmorStand", ArmorStand.class, 30, false),
/**
* @see CommandMinecart
*/
@ -130,6 +131,8 @@ public enum EntityType {
WITHER("WitherBoss", Wither.class, 64),
BAT("Bat", Bat.class, 65),
WITCH("Witch", Witch.class, 66),
ENDERMITE("Endermite", Endermite.class, 67),
GUARDIAN("Guardian", Guardian.class, 68),
PIG("Pig", Pig.class, 90),
SHEEP("Sheep", Sheep.class, 91),
COW("Cow", Cow.class, 92),
@ -141,6 +144,7 @@ public enum EntityType {
OCELOT("Ozelot", Ocelot.class, 98),
IRON_GOLEM("VillagerGolem", IronGolem.class, 99),
HORSE("EntityHorse", Horse.class, 100),
RABBIT("Rabbit", Rabbit.class, 101),
VILLAGER("Villager", Villager.class, 120),
ENDER_CRYSTAL("EnderCrystal", EnderCrystal.class, 200),
// These don't have an entity ID in nms.EntityTypes.

View File

@ -0,0 +1,4 @@
package org.bukkit.entity;
public interface Guardian extends Monster {
}

View File

@ -320,51 +320,6 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
*/
public boolean getCanPickupItems();
/**
* Sets a custom name on a mob. This name will be used in death messages
* and can be sent to the client as a nameplate over the mob.
* <p>
* Setting the name to null or an empty string will clear it.
* <p>
* This value has no effect on players, they will always use their real
* name.
*
* @param name the name to set
*/
public void setCustomName(String name);
/**
* Gets the custom name on a mob. If there is no name this method will
* return null.
* <p>
* This value has no effect on players, they will always use their real
* name.
*
* @return name of the mob or null
*/
public String getCustomName();
/**
* Sets whether or not to display the mob's custom name client side. The
* name will be displayed above the mob similarly to a player.
* <p>
* This value has no effect on players, they will always display their
* name.
*
* @param flag custom name or not
*/
public void setCustomNameVisible(boolean flag);
/**
* Gets whether or not the mob's custom name is displayed client side.
* <p>
* This value has no effect on players, they will always display their
* name.
*
* @return if the custom name is displayed
*/
public boolean isCustomNameVisible();
/**
* Returns whether the entity is currently leashed.
*

View File

@ -0,0 +1,4 @@
package org.bukkit.entity;
public interface Rabbit extends Animals {
}

View File

@ -3,4 +3,4 @@ package org.bukkit.entity;
/**
* Represents a Water Mob
*/
public interface WaterMob extends Creature {}
public interface WaterMob extends LivingEntity {}

View File

@ -16,17 +16,28 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
private final int length;
private List<Block> blocks;
@Deprecated
public BlockPistonExtendEvent(final Block block, final int length, final BlockFace direction) {
super(block, direction);
this.length = length;
}
public BlockPistonExtendEvent(final Block block, final List<Block> blocks, final BlockFace direction) {
super(block, direction);
this.length = blocks.size();
this.blocks = blocks;
}
/**
* Get the amount of blocks which will be moved while extending.
*
* @return the amount of moving blocks
* @deprecated slime blocks make the value of this method
* inaccurate due to blocks being pushed at the side
*/
@Deprecated
public int getLength() {
return this.length;
}

View File

@ -136,6 +136,15 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
/**
* For custom calls to the event.
*/
CUSTOM
CUSTOM,
/**
* When the entity doesn't have a target, so it attacks the nearest
* entity
*/
CLOSEST_ENTITY,
/**
* A currently unknown reason for the entity changing target.
*/
UNKNOWN;
}
}

View File

@ -30,10 +30,10 @@ public enum InventoryType {
*/
CRAFTING(5,"Crafting"),
/**
* An enchantment table inventory, with one CRAFTING slot and three
* An enchantment table inventory, with two CRAFTING slots and three
* enchanting buttons.
*/
ENCHANTING(1,"Enchanting"),
ENCHANTING(2,"Enchanting"),
/**
* A brewing stand inventory, with one FUEL slot and three CRAFTING slots.
*/

View File

@ -0,0 +1,22 @@
package org.bukkit.event.player;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* Represents an event that is called when a player right clicks an entity
* with a location on the entity the was clicked.
*/
public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent {
private final Vector position;
public PlayerInteractAtEntityEvent(Player who, Entity clickedEntity, Vector position) {
super(who, clickedEntity);
this.position = position;
}
public Vector getClickedPosition() {
return position.clone();
}
}

View File

@ -18,4 +18,18 @@ public interface EnchantingInventory extends Inventory {
* @return The current item.
*/
ItemStack getItem();
/**
* Set the secondary item being used for the enchant.
*
* @param item The new item
*/
void setSecondary(ItemStack item);
/**
* Get the secondary item being used for the enchant.
*
* @return The second item
*/
ItemStack getSecondary();
}

View File

@ -0,0 +1,76 @@
package org.bukkit.inventory.meta;
import java.util.List;
import org.bukkit.DyeColor;
import org.bukkit.block.banner.Pattern;
public interface BannerMeta extends ItemMeta {
/**
* Returns the base color for this banner
*
* @return the base color
*/
DyeColor getBaseColor();
/**
* Sets the base color for this banner
*
* @param color the base color
*/
void setBaseColor(DyeColor color);
/**
* Returns a list of patterns on this banner
*
* @return the patterns
*/
List<Pattern> getPatterns();
/**
* Sets the patterns used on this banner
*
* @param patterns the new list of patterns
*/
void setPatterns(List<Pattern> patterns);
/**
* Adds a new pattern on top of the existing
* patterns
*
* @param pattern the new pattern to add
*/
void addPattern(Pattern pattern);
/**
* Returns the pattern at the specified index
*
* @param i the index
* @return the pattern
*/
Pattern getPattern(int i);
/**
* Removes the pattern at the specified index
*
* @param i the index
* @return the removed pattern
*/
Pattern removePattern(int i);
/**
* Sets the pattern at the specified index
*
* @param i the index
* @param pattern the new pattern
*/
void setPattern(int i, Pattern pattern);
/**
* Returns the number of patterns on this
* banner
*
* @return the number of patterns
*/
int numberOfPatterns();
}

View File

@ -0,0 +1,232 @@
package org.bukkit.material;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
public class Banner extends MaterialData implements Attachable {
public Banner() {
super(Material.BANNER);
}
public Banner(Material type) {
super(type);
}
/**
*
* @deprecated Magic value
*/
@Deprecated
public Banner(int type) {
super(type);
}
/**
*
* @deprecated Magic value
*/
@Deprecated
public Banner(Material type, byte data) {
super(type, data);
}
/**
*
* @deprecated Magic value
*/
@Deprecated
public Banner(int type, byte data) {
super(type, data);
}
public boolean isWallBanner() {
return getItemType() == Material.WALL_BANNER;
}
public BlockFace getAttachedFace() {
if (isWallBanner()) {
byte data = getData();
switch (data) {
case 0x2:
return BlockFace.SOUTH;
case 0x3:
return BlockFace.NORTH;
case 0x4:
return BlockFace.EAST;
case 0x5:
return BlockFace.WEST;
}
return null;
} else {
return BlockFace.DOWN;
}
}
public BlockFace getFacing() {
byte data = getData();
if (!isWallBanner()) {
switch (data) {
case 0x0:
return BlockFace.SOUTH;
case 0x1:
return BlockFace.SOUTH_SOUTH_WEST;
case 0x2:
return BlockFace.SOUTH_WEST;
case 0x3:
return BlockFace.WEST_SOUTH_WEST;
case 0x4:
return BlockFace.WEST;
case 0x5:
return BlockFace.WEST_NORTH_WEST;
case 0x6:
return BlockFace.NORTH_WEST;
case 0x7:
return BlockFace.NORTH_NORTH_WEST;
case 0x8:
return BlockFace.NORTH;
case 0x9:
return BlockFace.NORTH_NORTH_EAST;
case 0xA:
return BlockFace.NORTH_EAST;
case 0xB:
return BlockFace.EAST_NORTH_EAST;
case 0xC:
return BlockFace.EAST;
case 0xD:
return BlockFace.EAST_SOUTH_EAST;
case 0xE:
return BlockFace.SOUTH_EAST;
case 0xF:
return BlockFace.SOUTH_SOUTH_EAST;
}
return null;
} else {
return getAttachedFace().getOppositeFace();
}
}
public void setFacingDirection(BlockFace face) {
byte data;
if (isWallBanner()) {
switch (face) {
case NORTH:
data = 0x2;
break;
case SOUTH:
data = 0x3;
break;
case WEST:
data = 0x4;
break;
case EAST:
default:
data = 0x5;
}
} else {
switch (face) {
case SOUTH:
data = 0x0;
break;
case SOUTH_SOUTH_WEST:
data = 0x1;
break;
case SOUTH_WEST:
data = 0x2;
break;
case WEST_SOUTH_WEST:
data = 0x3;
break;
case WEST:
data = 0x4;
break;
case WEST_NORTH_WEST:
data = 0x5;
break;
case NORTH_WEST:
data = 0x6;
break;
case NORTH_NORTH_WEST:
data = 0x7;
break;
case NORTH:
data = 0x8;
break;
case NORTH_NORTH_EAST:
data = 0x9;
break;
case NORTH_EAST:
data = 0xA;
break;
case EAST_NORTH_EAST:
data = 0xB;
break;
case EAST:
data = 0xC;
break;
case EAST_SOUTH_EAST:
data = 0xD;
break;
case SOUTH_SOUTH_EAST:
data = 0xF;
break;
case SOUTH_EAST:
default:
data = 0xE;
}
}
setData(data);
}
@Override
public String toString() {
return super.toString() + " facing " + getFacing();
}
@Override
public Banner clone() {
return (Banner) super.clone();
}
}

View File

@ -232,11 +232,12 @@ public final class JavaPluginLoader implements PluginLoader {
Set<Method> methods;
try {
Method[] publicMethods = listener.getClass().getMethods();
methods = new HashSet<Method>(publicMethods.length, Float.MAX_VALUE);
Method[] privateMethods = listener.getClass().getDeclaredMethods();
methods = new HashSet<Method>(publicMethods.length + privateMethods.length, 1.0f);
for (Method method : publicMethods) {
methods.add(method);
}
for (Method method : listener.getClass().getDeclaredMethods()) {
for (Method method : privateMethods) {
methods.add(method);
}
} catch (NoClassDefFoundError e) {

View File

@ -14,6 +14,7 @@ public enum PotionType {
INSTANT_DAMAGE(12, PotionEffectType.HARM, 2),
WATER_BREATHING(13, PotionEffectType.WATER_BREATHING, 1),
INVISIBILITY(14, PotionEffectType.INVISIBILITY, 1),
JUMP(15, PotionEffectType.JUMP, 2)
;
private final int damageValue, maxLevel;

View File

@ -0,0 +1,147 @@
package org.bukkit.util;
/**
* EulerAngle is used to represent 3 angles, one for each
* axis (x, y, z). The angles are in radians
*/
public class EulerAngle {
/**
* A EulerAngle with every axis set to 0
*/
public static final EulerAngle ZERO = new EulerAngle(0, 0, 0);
private final double x;
private final double y;
private final double z;
/**
* Creates a EularAngle with each axis set to the
* passed angle in radians
*
* @param x the angle for the x axis in radians
* @param y the angle for the x axis in radians
* @param z the angle for the x axis in radians
*/
public EulerAngle(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
/**
* Returns the angle on the x axis in radians
*
* @return the angle in radians
*/
public double getX() {
return x;
}
/**
* Returns the angle on the y axis in radians
*
* @return the angle in radians
*/
public double getY() {
return y;
}
/**
* Returns the angle on the z axis in radians
*
* @return the angle in radians
*/
public double getZ() {
return z;
}
/**
* Return a EulerAngle which is the result of changing
* the x axis to the passed angle
*
* @param x the angle in radians
* @return the resultant EulerAngle
*/
public EulerAngle setX(double x) {
return new EulerAngle(x, y, z);
}
/**
* Return a EulerAngle which is the result of changing
* the y axis to the passed angle
*
* @param y the angle in radians
* @return the resultant EulerAngle
*/
public EulerAngle setY(double y) {
return new EulerAngle(x, y, z);
}
/**
* Return a EulerAngle which is the result of changing
* the z axis to the passed angle
*
* @param z the angle in radians
* @return the resultant EulerAngle
*/
public EulerAngle setZ(double z) {
return new EulerAngle(x, y, z);
}
/**
* Creates a new EulerAngle which is the result of adding
* the x, y, z components to this EulerAngle
*
* @param x the angle to add to the x axis in radians
* @param y the angle to add to the y axis in radians
* @param z the angle to add to the z axis in radians
* @return the resultant EulerAngle
*/
public EulerAngle add(double x, double y, double z) {
return new EulerAngle(
this.x + x,
this.y + y,
this.z + z
);
}
/**
* Creates a new EulerAngle which is the result of subtracting
* the x, y, z components to this EulerAngle
*
* @param x the angle to subtract to the x axis in radians
* @param y the angle to subtract to the y axis in radians
* @param z the angle to subtract to the z axis in radians
* @return the resultant EulerAngle
*/
public EulerAngle subtract(double x, double y, double z) {
return add(-x, -y, -z);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EulerAngle that = (EulerAngle) o;
return Double.compare(that.x, x) == 0
&& Double.compare(that.y, y) == 0
&& Double.compare(that.z, z) == 0;
}
@Override
public int hashCode() {
int result;
long temp;
temp = Double.doubleToLongBits(x);
result = (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(y);
result = 31 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(z);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}