#898: Use Java Consumer instead of Bukkit Consumer

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-09-22 02:57:09 +10:00
parent a67391a13e
commit 8f34277f6a
3 changed files with 10 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package org.bukkit;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@@ -10,7 +11,6 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@@ -33,7 +34,6 @@ import org.bukkit.persistence.PersistentDataHolder;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.PluginMessageRecipient; import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.util.BoundingBox; import org.bukkit.util.BoundingBox;
import org.bukkit.util.Consumer;
import org.bukkit.util.RayTraceResult; import org.bukkit.util.RayTraceResult;
import org.bukkit.util.StructureSearchResult; import org.bukkit.util.StructureSearchResult;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@@ -521,7 +521,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param delegate A class to call for each block changed as a result of * @param delegate A class to call for each block changed as a result of
* this method * this method
* @return true if the tree was created successfully, otherwise false * @return true if the tree was created successfully, otherwise false
* @see #generateTree(org.bukkit.Location, java.util.Random, org.bukkit.TreeType, org.bukkit.util.Consumer) * @see #generateTree(org.bukkit.Location, java.util.Random, org.bukkit.TreeType, java.util.function.Consumer)
* @deprecated this method does not handle tile entities (bee nests) * @deprecated this method does not handle tile entities (bee nests)
*/ */
@Deprecated @Deprecated

View File

@@ -5,13 +5,19 @@ package org.bukkit.util;
* result. * result.
* *
* @param <T> the type of the input to the operation * @param <T> the type of the input to the operation
* @deprecated Use {@link java.util.function.Consumer} instead
*/ */
public interface Consumer<T> { // Bukkit developer note (NOT plugin developers):
// NEVER use this consumer in the API.
// API methods which use this consumer will be remapped to Java's consumer at runtime, resulting in an error.
@Deprecated
public interface Consumer<T> extends java.util.function.Consumer<T> {
/** /**
* Performs this operation on the given argument. * Performs this operation on the given argument.
* *
* @param t the input argument * @param t the input argument
*/ */
@Override
void accept(T t); void accept(T t);
} }