Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And some extra stuff here and there
- Loading branch information
Showing
18 changed files
with
795 additions
and
839 deletions.
There are no files selected for viewing
462 changes: 462 additions & 0 deletions
462
nmshandler/src/main/java/net/aufdemrand/denizen/nms/abstracts/ImprovedOfflinePlayer.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 12 additions & 64 deletions
76
plugin/src/main/java/net/aufdemrand/denizen/utilities/entity/RabbitType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,23 @@ | ||
package net.aufdemrand.denizen.utilities.entity; | ||
|
||
import net.minecraft.server.v1_10_R1.EntityRabbit; | ||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftRabbit; | ||
import org.bukkit.entity.Rabbit; | ||
|
||
public enum RabbitType { | ||
BROWN(0, 0), | ||
WHITE(1, 1), | ||
BLACK(2, 2), | ||
WHITE_SPLOTCHED(3, 3), | ||
GOLD(4, 4), | ||
SALT(5, 5), | ||
KILLER(6, 99); | ||
BROWN(Rabbit.Type.BROWN), | ||
WHITE(Rabbit.Type.WHITE), | ||
BLACK(Rabbit.Type.BLACK), | ||
WHITE_SPLOTCHED(Rabbit.Type.BLACK_AND_WHITE), | ||
GOLD(Rabbit.Type.GOLD), | ||
SALT(Rabbit.Type.SALT_AND_PEPPER), | ||
KILLER(Rabbit.Type.THE_KILLER_BUNNY); | ||
|
||
public static RabbitType getRabbitType(Rabbit rabbit) { | ||
return RabbitType.getType(getEntityRabbit(rabbit).getRabbitType()); | ||
} | ||
|
||
public static void setRabbitType(Rabbit rabbit, RabbitType type) { | ||
getEntityRabbit(rabbit).setRabbitType(type.getId()); | ||
} | ||
|
||
private static EntityRabbit getEntityRabbit(Rabbit rabbit) { | ||
return (EntityRabbit) ((CraftRabbit) rabbit).getHandle(); | ||
} | ||
|
||
private static final RabbitType[] types = new RabbitType[values().length]; | ||
private final int internalId; | ||
private final int id; | ||
|
||
static { | ||
for (RabbitType type : values()) { | ||
types[type.getInternalId()] = type; | ||
} | ||
} | ||
|
||
private RabbitType(int internalId, int id) { | ||
this.internalId = internalId; | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Gets the ID of this rabbit type. | ||
* | ||
* @return Type ID. | ||
*/ | ||
public int getId() { | ||
return id; | ||
} | ||
private Rabbit.Type type; | ||
|
||
/** | ||
* Gets the internal ID of this rabbit type. | ||
* | ||
* @return Internal Type ID. | ||
*/ | ||
private int getInternalId() { | ||
return internalId; | ||
RabbitType(Rabbit.Type type) { | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* Gets a rabbit type by its ID. | ||
* | ||
* @param id ID of the rabbit type to get. | ||
* @return Resulting type, or null if not found. | ||
*/ | ||
public static RabbitType getType(int id) { | ||
for (RabbitType type : types) { | ||
if (id == type.getId()) { | ||
return type; | ||
} | ||
} | ||
return null; | ||
public Rabbit.Type getType() { | ||
return type; | ||
} | ||
} |
Oops, something went wrong.