Skip to content

Commit

Permalink
1.17 support (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev authored Oct 17, 2021
1 parent 9b27977 commit 84419d8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.inventivetalent</groupId>
<artifactId>animatedframes</artifactId>
<version>4.13.2-SNAPSHOT</version>
<version>4.13.3-SNAPSHOT</version>
<name>AnimatedFrames</name>

<properties>
Expand Down Expand Up @@ -110,10 +110,15 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>reflectionhelper</artifactId>
<version>1.18.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>mapmanager</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.inventivetalent</groupId>
Expand All @@ -128,7 +133,7 @@
<dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>boundingboxapi</artifactId>
<version>1.3.6-SNAPSHOT</version>
<version>1.3.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.inventivetalent</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEntityEvent;
Expand All @@ -58,7 +57,9 @@
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

public class Commands {

Expand Down Expand Up @@ -151,7 +152,7 @@ public void frameCreate(final Player sender, final String name, final String ima
plugin.interactListener.listenForEntityInteract(sender, new Callback<PlayerInteractEntityEvent>() {
@Override
public void call(PlayerInteractEntityEvent event) {
if (event != null && event.getRightClicked().getType() == EntityType.ITEM_FRAME) {
if (event != null && event.getRightClicked() instanceof ItemFrame) {
final ItemFrame firstFrame = (ItemFrame) event.getRightClicked();
sender.sendMessage(MESSAGE_LOADER.getMessage("create.setup.set.first", "create.setup.set.first"));
sender.sendMessage(" ");
Expand All @@ -163,7 +164,7 @@ public void run() {
plugin.interactListener.listenForEntityInteract(sender, new Callback<PlayerInteractEntityEvent>() {
@Override
public void call(final PlayerInteractEntityEvent event) {
if (event != null && event.getRightClicked().getType() == EntityType.ITEM_FRAME) {
if (event != null && event.getRightClicked() instanceof ItemFrame) {
final ItemFrame secondFrame = (ItemFrame) event.getRightClicked();
sender.sendMessage(MESSAGE_LOADER.getMessage("create.setup.set.second", "create.setup.set.second"));
sender.sendMessage(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

package org.inventivetalent.animatedframes;

import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -75,7 +75,7 @@ public void listenForMapInteract(Player player, Callback<MapInteractEvent> callb

@EventHandler
public void on(PlayerInteractEntityEvent event) {
if (event.getRightClicked().getType() == EntityType.ITEM_FRAME) {
if (event.getRightClicked() instanceof ItemFrame) {
Callback<PlayerInteractEntityEvent> callback;
while ((callback = entityInteractMap.remove(event.getPlayer().getUniqueId())) != null)
callback.call(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.inventivetalent.animatedframes.AnimatedFrame;
Expand Down Expand Up @@ -53,7 +52,7 @@ public static CursorResult calculateRaw(Player player, int cursorDistance) {
List<BoundingBox> boundingBoxes = new ArrayList<>();
for (Iterator<Entity> iterator = entities.iterator(); iterator.hasNext(); ) {
Entity entity = iterator.next();
if (entity.getType() != EntityType.ITEM_FRAME) {
if (!(entity instanceof ItemFrame)) {
iterator.remove(); // Filter non-ItemFrame entities
continue;
}
Expand Down Expand Up @@ -185,4 +184,4 @@ public static class CursorMapQueryResult {
Clickable clickable;
}

}
}
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ name: AnimatedFrames
main: org.inventivetalent.animatedframes.AnimatedFramesPlugin
author: inventivetalent
version: ${project.version}
api-version: 1.13

softdepend: [PacketListenerApi, MapManager]
softdepend: [PacketListenerApi, MapManager]

0 comments on commit 84419d8

Please sign in to comment.