Removed useless async task

This commit is contained in:
Jules 2023-03-09 18:45:43 +01:00
parent 73e4f60482
commit 5f1e32d581
3 changed files with 64 additions and 53 deletions

View File

@ -7,66 +7,71 @@ import org.bukkit.event.HandlerList;
import java.util.List; import java.util.List;
/**
* @deprecated Will be removed in the future. SCRIPTS must replace these
* because there are no events which can support both sync and async
*/
@Deprecated
public class GenerateLoreEvent extends Event { public class GenerateLoreEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final MMOItem item; private final MMOItem item;
private final List<String> lore, parsed; private final List<String> lore, parsed;
private final LoreBuilder builder; private final LoreBuilder builder;
public GenerateLoreEvent(MMOItem item, LoreBuilder builder, List<String> lore, List<String> parsed) { public GenerateLoreEvent(MMOItem item, LoreBuilder builder, List<String> lore, List<String> parsed) {
this.item = item; this.item = item;
this.lore = lore; this.lore = lore;
this.parsed = parsed; this.parsed = parsed;
this.builder = builder; this.builder = builder;
} }
/** /**
* @return The MMOItem the lore is being generated for * @return The MMOItem the lore is being generated for
*/ */
public MMOItem getItem() { public MMOItem getItem() {
return item; return item;
} }
/** /**
* @return The LoreBuilder used to build this lore. * @return The LoreBuilder used to build this lore.
*/ */
public LoreBuilder getBuilder() { public LoreBuilder getBuilder() {
return builder; return builder;
} }
/** /**
* @return The list of pre-placeholder lore (before any placeholders have been parsed) * @return The list of pre-placeholder lore (before any placeholders have been parsed)
*/ */
public List<String> getLore() { public List<String> getLore() {
return lore; return lore;
} }
/** /**
* @return The list of parsed lore (after all placeholders have been parsed) * @return The list of parsed lore (after all placeholders have been parsed)
*/ */
public List<String> getParsedLore() { public List<String> getParsedLore() {
return parsed; return parsed;
} }
/** /**
* Sets the final lore of the item. * Sets the final lore of the item.
* <p> * <p>
* This sets the parsed lore, so any future calls of * This sets the parsed lore, so any future calls of
* getParsedLore() will return the new list. * getParsedLore() will return the new list.
* *
* @param lore The new lore of the item * @param lore The new lore of the item
*/ */
public void setFinalLore(List<String> lore) { public void setFinalLore(List<String> lore) {
this.parsed.clear(); this.parsed.clear();
this.parsed.addAll(lore); this.parsed.addAll(lore);
} }
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }
} }

View File

@ -4,6 +4,11 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/**
* @deprecated Will be removed in the future. SCRIPTS must replace these
* because there are no events which can support both sync and async
*/
@Deprecated
public class ItemBuildEvent extends Event { public class ItemBuildEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();

View File

@ -116,7 +116,8 @@ public class CraftingStationView extends PluginInventory {
inv.setItem(layout.getQueueSlots().get(j - queueOffset), inv.setItem(layout.getQueueSlots().get(j - queueOffset),
ConfigItems.QUEUE_ITEM_DISPLAY.newBuilder(queue.getCrafts().get(j), j + 1).build()); ConfigItems.QUEUE_ITEM_DISPLAY.newBuilder(queue.getCrafts().get(j), j + 1).build());
} }
}.runTaskTimerAsynchronously(MMOItems.plugin, 0, 20); }.runTaskTimer(MMOItems.plugin, 0, 20);
if (station.getItemOptions().hasFill()) if (station.getItemOptions().hasFill())
for (int j = 0; j < layout.getSize(); j++) for (int j = 0; j < layout.getSize(); j++)
if (inv.getItem(j) == null || inv.getItem(j).getType() == Material.AIR) if (inv.getItem(j) == null || inv.getItem(j).getType() == Material.AIR)