-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1036: Add API for InventoryView derivatives
- Loading branch information
Showing
17 changed files
with
478 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.bukkit.inventory.view; | ||
|
||
import org.bukkit.inventory.InventoryView; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* An instance of {@link InventoryView} which provides extra methods related to | ||
* anvil view data. | ||
*/ | ||
public interface AnvilView extends InventoryView { | ||
|
||
/** | ||
* Gets the rename text specified within the anvil's text field. | ||
* | ||
* @return The text within the anvil's text field if an item is present | ||
* otherwise null | ||
*/ | ||
@Nullable | ||
String getRenameText(); | ||
|
||
/** | ||
* Gets the amount of items needed to repair. | ||
* | ||
* @return The amount of materials required to repair the item | ||
*/ | ||
int getRepairItemCountCost(); | ||
|
||
/** | ||
* Gets the experience cost needed to repair. | ||
* | ||
* @return The repair cost in experience | ||
*/ | ||
int getRepairCost(); | ||
|
||
/** | ||
* Gets the maximum repair cost needed to repair. | ||
* | ||
* @return The maximum repair cost in experience | ||
*/ | ||
int getMaximumRepairCost(); | ||
|
||
/** | ||
* Sets the amount of repair materials required to repair the item. | ||
* | ||
* @param amount the amount of repair materials | ||
*/ | ||
void setRepairItemCountCost(int amount); | ||
|
||
/** | ||
* Sets the repair cost in experience. | ||
* | ||
* @param cost the experience cost to repair | ||
*/ | ||
void setRepairCost(int cost); | ||
|
||
/** | ||
* Sets maximum repair cost in experience. | ||
* | ||
* @param levels the levels to set | ||
*/ | ||
void setMaximumRepairCost(int levels); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package org.bukkit.inventory.view; | ||
|
||
import org.bukkit.inventory.InventoryView; | ||
import org.bukkit.potion.PotionEffectType; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* An instance of {@link InventoryView} which provides extra methods related to | ||
* beacon view data. | ||
*/ | ||
public interface BeaconView extends InventoryView { | ||
|
||
/** | ||
* Gets the tier of the beacon | ||
* <p> | ||
* Beacon tier is deduced by the height of the pyramid the beacon is | ||
* standing on. The level of the beacon is 0 unless the beacon is activated. | ||
* | ||
* @return The tier of the beacon | ||
*/ | ||
int getTier(); | ||
|
||
/** | ||
* Gets the primary effect of the beacon. | ||
* <p> | ||
* If the beacon level is high enough where the primary effect can be | ||
* upgraded to level two, e.g. Speed 2. Instead of | ||
* {@link #getSecondaryEffect()} being null it {@link #getSecondaryEffect()} | ||
* returns the same {@link PotionEffectType} as this method. | ||
* | ||
* @return The primary effect enabled on the beacon | ||
*/ | ||
@Nullable | ||
PotionEffectType getPrimaryEffect(); | ||
|
||
/** | ||
* Gets the secondary effect of the beacon. | ||
* <p> | ||
* If the beacon level is high enough where the primary effect can be | ||
* upgraded to level two, e.g. Speed 2. The secondary effect will return the | ||
* same effect as {@link #getPrimaryEffect()}. | ||
* | ||
* @return The secondary effect enabled on the beacon | ||
*/ | ||
@Nullable | ||
PotionEffectType getSecondaryEffect(); | ||
|
||
/** | ||
* Sets the primary effect of the beacon, or null to clear | ||
* <p> | ||
* The {@link PotionEffectType} provided must be one that is already within | ||
* the beacon as a valid option. | ||
* <ol> | ||
* <li>{@link PotionEffectType#SPEED} | ||
* <li>{@link PotionEffectType#HASTE} | ||
* <li>{@link PotionEffectType#RESISTANCE} | ||
* <li>{@link PotionEffectType#JUMP_BOOST} | ||
* <li>{@link PotionEffectType#STRENGTH} | ||
* <li>{@link PotionEffectType#REGENERATION} | ||
* </ol> | ||
* | ||
* @param effect desired primary effect | ||
*/ | ||
void setPrimaryEffect(@Nullable final PotionEffectType effect); | ||
|
||
/** | ||
* Sets the secondary effect on this beacon, or null to clear. Note that | ||
* tier must be >= 4 for this effect to be active. | ||
* <p> | ||
* The {@link PotionEffectType} provided must be one that is already within | ||
* the beacon as a valid option. | ||
* <ol> | ||
* <li>{@link PotionEffectType#SPEED} | ||
* <li>{@link PotionEffectType#HASTE} | ||
* <li>{@link PotionEffectType#RESISTANCE} | ||
* <li>{@link PotionEffectType#JUMP_BOOST} | ||
* <li>{@link PotionEffectType#STRENGTH} | ||
* <li>{@link PotionEffectType#REGENERATION} | ||
* </ol> | ||
* | ||
* @param effect the desired secondary effect | ||
*/ | ||
void setSecondaryEffect(@Nullable final PotionEffectType effect); | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/org/bukkit/inventory/view/BrewingStandView.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.bukkit.inventory.view; | ||
|
||
import org.bukkit.inventory.InventoryView; | ||
|
||
/** | ||
* An instance of {@link InventoryView} which provides extra methods related to | ||
* brewing stand view data. | ||
*/ | ||
public interface BrewingStandView extends InventoryView { | ||
|
||
/** | ||
* Gets the fuel level of this brewing stand. | ||
* <p> | ||
* The default maximum fuel level in minecraft is 20. | ||
* | ||
* @return The amount of fuel level left | ||
*/ | ||
int getFuelLevel(); | ||
|
||
/** | ||
* Gets the amount of brewing ticks left. | ||
* | ||
* @return The amount of ticks left for the brewing task | ||
*/ | ||
int getBrewingTicks(); | ||
|
||
/** | ||
* Sets the fuel level left. | ||
* | ||
* @param level the level of the fuel, which is no less than 0 | ||
* @throws IllegalArgumentException if the level is less than 0 | ||
*/ | ||
void setFuelLevel(final int level) throws IllegalArgumentException; | ||
|
||
/** | ||
* Sets the brewing ticks left. | ||
* | ||
* @param ticks the ticks left, which is no less than 0 | ||
* @throws IllegalArgumentException if the ticks are less than 0 | ||
*/ | ||
void setBrewingTicks(final int ticks) throws IllegalArgumentException; | ||
} |
Oops, something went wrong.