mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-29 12:17:36 +01:00
Remove unnecessary interfaces
This commit is contained in:
parent
323998845b
commit
525622b59a
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) filoghost and contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
package me.filoghost.holographicdisplays.core.api.current;
|
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.api.beta.hologram.line.ClickableHologramLine;
|
|
||||||
import me.filoghost.holographicdisplays.api.beta.hologram.line.HologramLineClickListener;
|
|
||||||
import me.filoghost.holographicdisplays.core.base.ClickCallbackProvider;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
interface APIClickableHologramLine extends ClickableHologramLine, APIHologramLine, ClickCallbackProvider {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean hasClickCallback() {
|
|
||||||
return getClickListener() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default void invokeClickCallback(Player player) {
|
|
||||||
HologramLineClickListener clickListener = getClickListener();
|
|
||||||
if (clickListener != null) {
|
|
||||||
clickListener.onClick(new SimpleHologramLineClickEvent(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
class APIItemHologramLine extends BaseItemHologramLine implements ItemHologramLine, APIClickableHologramLine {
|
class APIItemHologramLine extends BaseItemHologramLine implements ItemHologramLine, APIHologramLine {
|
||||||
|
|
||||||
private HologramLinePickupListener pickupListener;
|
private HologramLinePickupListener pickupListener;
|
||||||
private HologramLineClickListener clickListener;
|
private HologramLineClickListener clickListener;
|
||||||
@ -39,6 +39,18 @@ class APIItemHologramLine extends BaseItemHologramLine implements ItemHologramLi
|
|||||||
return clickListener;
|
return clickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPickupCallback() {
|
||||||
|
return pickupListener != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void invokePickupCallback(Player player) {
|
||||||
|
if (pickupListener != null) {
|
||||||
|
pickupListener.onPickup(new SimpleHologramLinePickupEvent(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setClickListener(@Nullable HologramLineClickListener clickListener) {
|
public void setClickListener(@Nullable HologramLineClickListener clickListener) {
|
||||||
checkNotDeleted();
|
checkNotDeleted();
|
||||||
@ -47,14 +59,14 @@ class APIItemHologramLine extends BaseItemHologramLine implements ItemHologramLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPickupCallback() {
|
public boolean hasClickCallback() {
|
||||||
return pickupListener != null;
|
return clickListener != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invokePickupCallback(Player player) {
|
protected void invokeClickCallback(Player player) {
|
||||||
if (pickupListener != null) {
|
if (clickListener != null) {
|
||||||
pickupListener.onPickup(new SimpleHologramLinePickupEvent(player));
|
clickListener.onClick(new SimpleHologramLineClickEvent(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,10 @@ import me.filoghost.holographicdisplays.api.beta.hologram.PlaceholderSetting;
|
|||||||
import me.filoghost.holographicdisplays.api.beta.hologram.line.HologramLineClickListener;
|
import me.filoghost.holographicdisplays.api.beta.hologram.line.HologramLineClickListener;
|
||||||
import me.filoghost.holographicdisplays.api.beta.hologram.line.TextHologramLine;
|
import me.filoghost.holographicdisplays.api.beta.hologram.line.TextHologramLine;
|
||||||
import me.filoghost.holographicdisplays.core.base.BaseTextHologramLine;
|
import me.filoghost.holographicdisplays.core.base.BaseTextHologramLine;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
class APITextHologramLine extends BaseTextHologramLine implements TextHologramLine, APIClickableHologramLine {
|
class APITextHologramLine extends BaseTextHologramLine implements TextHologramLine, APIHologramLine {
|
||||||
|
|
||||||
private final APIHologram hologram;
|
private final APIHologram hologram;
|
||||||
|
|
||||||
@ -39,4 +40,16 @@ class APITextHologramLine extends BaseTextHologramLine implements TextHologramLi
|
|||||||
return clickListener;
|
return clickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasClickCallback() {
|
||||||
|
return clickListener != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void invokeClickCallback(Player player) {
|
||||||
|
if (clickListener != null) {
|
||||||
|
clickListener.onClick(new SimpleHologramLineClickEvent(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) filoghost and contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
package me.filoghost.holographicdisplays.core.api.v2;
|
|
||||||
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler;
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.line.CollectableLine;
|
|
||||||
import me.filoghost.holographicdisplays.core.base.PickupCallbackProvider;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
interface V2CollectableLine extends CollectableLine, V2HologramLine, PickupCallbackProvider {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean hasPickupCallback() {
|
|
||||||
return getPickupHandler() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default void invokePickupCallback(Player player) {
|
|
||||||
PickupHandler pickupListener = getPickupHandler();
|
|
||||||
if (pickupListener != null) {
|
|
||||||
pickupListener.onPickup(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -9,10 +9,11 @@ import com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler;
|
|||||||
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
||||||
import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
|
import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
|
||||||
import me.filoghost.holographicdisplays.core.base.BaseItemHologramLine;
|
import me.filoghost.holographicdisplays.core.base.BaseItemHologramLine;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
class V2ItemLine extends BaseItemHologramLine implements ItemLine, V2CollectableLine, V2TouchableLine {
|
class V2ItemLine extends BaseItemHologramLine implements ItemLine, V2HologramLine {
|
||||||
|
|
||||||
private final V2Hologram hologram;
|
private final V2Hologram hologram;
|
||||||
|
|
||||||
@ -39,6 +40,18 @@ class V2ItemLine extends BaseItemHologramLine implements ItemLine, V2Collectable
|
|||||||
return touchHandler;
|
return touchHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasClickCallback() {
|
||||||
|
return touchHandler != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void invokeClickCallback(Player player) {
|
||||||
|
if (touchHandler != null) {
|
||||||
|
touchHandler.onTouch(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPickupHandler(PickupHandler pickupHandler) {
|
public void setPickupHandler(PickupHandler pickupHandler) {
|
||||||
this.pickupHandler = pickupHandler;
|
this.pickupHandler = pickupHandler;
|
||||||
@ -49,4 +62,16 @@ class V2ItemLine extends BaseItemHologramLine implements ItemLine, V2Collectable
|
|||||||
return pickupHandler;
|
return pickupHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPickupCallback() {
|
||||||
|
return pickupHandler != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void invokePickupCallback(Player player) {
|
||||||
|
if (pickupHandler != null) {
|
||||||
|
pickupHandler.onPickup(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,10 @@ package me.filoghost.holographicdisplays.core.api.v2;
|
|||||||
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
||||||
import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
|
import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
|
||||||
import me.filoghost.holographicdisplays.core.base.BaseTextHologramLine;
|
import me.filoghost.holographicdisplays.core.base.BaseTextHologramLine;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
class V2TextLine extends BaseTextHologramLine implements TextLine, V2TouchableLine {
|
class V2TextLine extends BaseTextHologramLine implements TextLine, V2HologramLine {
|
||||||
|
|
||||||
private final V2Hologram hologram;
|
private final V2Hologram hologram;
|
||||||
|
|
||||||
@ -41,4 +42,16 @@ class V2TextLine extends BaseTextHologramLine implements TextLine, V2TouchableLi
|
|||||||
return touchHandler;
|
return touchHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasClickCallback() {
|
||||||
|
return touchHandler != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void invokeClickCallback(Player player) {
|
||||||
|
if (touchHandler != null) {
|
||||||
|
touchHandler.onTouch(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) filoghost and contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
package me.filoghost.holographicdisplays.core.api.v2;
|
|
||||||
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.line.TouchableLine;
|
|
||||||
import me.filoghost.holographicdisplays.core.base.ClickCallbackProvider;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
interface V2TouchableLine extends TouchableLine, V2HologramLine, ClickCallbackProvider {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean hasClickCallback() {
|
|
||||||
return getTouchHandler() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default void invokeClickCallback(Player player) {
|
|
||||||
TouchHandler touchHandler = getTouchHandler();
|
|
||||||
if (touchHandler != null) {
|
|
||||||
touchHandler.onTouch(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -10,7 +10,7 @@ import me.filoghost.holographicdisplays.common.PositionCoordinates;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public abstract class BaseClickableHologramLine extends BaseHologramLine implements ClickCallbackProvider {
|
public abstract class BaseClickableHologramLine extends BaseHologramLine {
|
||||||
|
|
||||||
protected BaseClickableHologramLine(BaseHologram hologram) {
|
protected BaseClickableHologramLine(BaseHologram hologram) {
|
||||||
super(hologram);
|
super(hologram);
|
||||||
@ -27,6 +27,10 @@ public abstract class BaseClickableHologramLine extends BaseHologramLine impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract boolean hasClickCallback();
|
||||||
|
|
||||||
|
protected abstract void invokeClickCallback(Player player);
|
||||||
|
|
||||||
private boolean isInClickRange(Player player) {
|
private boolean isInClickRange(Player player) {
|
||||||
Location playerLocation = player.getLocation();
|
Location playerLocation = player.getLocation();
|
||||||
PositionCoordinates position = this.getPosition();
|
PositionCoordinates position = this.getPosition();
|
||||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class BaseItemHologramLine extends BaseClickableHologramLine implements PickupCallbackProvider {
|
public abstract class BaseItemHologramLine extends BaseClickableHologramLine {
|
||||||
|
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
|
|
||||||
@ -39,6 +39,10 @@ public abstract class BaseItemHologramLine extends BaseClickableHologramLine imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract boolean hasPickupCallback();
|
||||||
|
|
||||||
|
protected abstract void invokePickupCallback(Player player);
|
||||||
|
|
||||||
public @Nullable ItemStack getItemStack() {
|
public @Nullable ItemStack getItemStack() {
|
||||||
return clone(itemStack);
|
return clone(itemStack);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) filoghost and contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
package me.filoghost.holographicdisplays.core.base;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public interface ClickCallbackProvider {
|
|
||||||
|
|
||||||
boolean hasClickCallback();
|
|
||||||
|
|
||||||
void invokeClickCallback(Player player);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) filoghost and contributors
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
package me.filoghost.holographicdisplays.core.base;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public interface PickupCallbackProvider {
|
|
||||||
|
|
||||||
boolean hasPickupCallback();
|
|
||||||
|
|
||||||
void invokePickupCallback(Player player);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user