2021-01-03 01:55:01 +01:00
|
|
|
package com.Acrobot.ChestShop.Events;
|
|
|
|
|
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
public class ItemStringQueryEvent extends Event {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
|
|
|
|
private String itemString = null;
|
|
|
|
private final ItemStack item;
|
2022-12-29 15:25:26 +01:00
|
|
|
private final int maxWidth;
|
2021-01-03 01:55:01 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the item string representation of a certain item with a certain length
|
|
|
|
* @param item The item to query the string for
|
|
|
|
*/
|
2021-01-03 20:47:07 +01:00
|
|
|
public ItemStringQueryEvent(ItemStack item) {
|
2022-12-29 15:25:26 +01:00
|
|
|
this(item, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the item string representation of a certain item with a certain length
|
|
|
|
* @param item The item to query the string for
|
|
|
|
* @param maxWidth The max width of the item string
|
|
|
|
*/
|
|
|
|
public ItemStringQueryEvent(ItemStack item, int maxWidth) {
|
2021-01-03 01:55:01 +01:00
|
|
|
this.item = item;
|
2022-12-29 15:25:26 +01:00
|
|
|
this.maxWidth = maxWidth;
|
2021-01-03 01:55:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The item for which the string is queried
|
|
|
|
* @return The item
|
|
|
|
*/
|
|
|
|
public ItemStack getItem() {
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the item string that represents the item
|
|
|
|
* @return The item string that represents the item
|
|
|
|
*/
|
|
|
|
public String getItemString() {
|
|
|
|
return itemString;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the item string that represents the item
|
|
|
|
* @param itemString The item string that represents the item
|
|
|
|
*/
|
|
|
|
public void setItemString(String itemString) {
|
|
|
|
this.itemString = itemString;
|
|
|
|
}
|
2022-12-29 15:25:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the max width that the result item string should have
|
|
|
|
* @return The max width of the result item string
|
|
|
|
*/
|
|
|
|
public int getMaxWidth() {
|
|
|
|
return maxWidth;
|
|
|
|
}
|
2021-01-03 01:55:01 +01:00
|
|
|
}
|