mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
split direct holder support up from ctor accepting Holder
Enchantment shouldn't support direct holders despite the ctor accepting a Holder type. We want to limit the types to ones that are actually used as direct holders in the game
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package io.papermc.testplugin;
|
||||
|
||||
import io.papermc.paper.event.player.ChatEvent;
|
||||
import io.papermc.paper.registry.keys.PaintingVariantKeys;
|
||||
import org.bukkit.Art;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -12,4 +18,11 @@ public final class TestPlugin extends JavaPlugin implements Listener {
|
||||
// io.papermc.testplugin.brigtests.Registration.registerViaOnEnable(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvent(ChatEvent event) {
|
||||
final Entity targetEntity = event.getPlayer().getTargetEntity(10);
|
||||
if (targetEntity instanceof Painting painting) {
|
||||
painting.setArt(Art.create(f -> f.copyFrom(PaintingVariantKeys.BAROQUE).height(10)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user