diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/CreationOptions.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/CreationOptions.java index 6abf92bc7..88dec6711 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/CreationOptions.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/CreationOptions.java @@ -6,7 +6,6 @@ import com.janboerman.invsee.spigot.api.template.EnderChestSlot; import com.janboerman.invsee.spigot.api.template.Mirror; import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/InvseeAPI.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/InvseeAPI.java index 0f9a7219b..886069939 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/InvseeAPI.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/InvseeAPI.java @@ -15,9 +15,6 @@ import com.janboerman.invsee.spigot.internal.OpenSpectatorsCache; import com.janboerman.invsee.spigot.internal.inventory.ShallowCopy; import com.janboerman.invsee.spigot.internal.inventory.Personal; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; import com.janboerman.invsee.utils.*; import org.bukkit.*; import org.bukkit.entity.*; diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/SpectatorInventoryView.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/SpectatorInventoryView.java index 565bb814f..6b0ebf4a9 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/SpectatorInventoryView.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/SpectatorInventoryView.java @@ -17,7 +17,7 @@ public interface SpectatorInventoryView { * Get the top inventory of this view. * @return the top inventory */ - public SpectatorInventory getTopInventory(); + public SpectatorInventory getTopInventory(); /** * Get the difference tracked by this window. diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/Title.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/Title.java index a4927ec3c..1feaabfe3 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/Title.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/Title.java @@ -2,7 +2,6 @@ import com.janboerman.invsee.spigot.api.target.Target; import com.janboerman.invsee.spigot.internal.ConstantTitle; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; import java.util.function.Function; diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/Difference.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/Difference.java index 2d60eb701..b3d54ab03 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/Difference.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/Difference.java @@ -9,7 +9,7 @@ import java.util.Map; import java.util.Objects; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; /** * The Difference of a {@link SpectatorInventoryView} is the set of items that were added and removed the {@link com.janboerman.invsee.spigot.api.SpectatorInventory}. diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogGranularity.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogGranularity.java index 105a2f08a..be1881271 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogGranularity.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogGranularity.java @@ -1,6 +1,6 @@ package com.janboerman.invsee.spigot.api.logging; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; /** * Granularity for logging. diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogOptions.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogOptions.java index d12355949..9d274b144 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogOptions.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/logging/LogOptions.java @@ -12,7 +12,7 @@ import java.util.Objects; import java.util.Set; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; /** * Options for logging interactions with {@link SpectatorInventoryView}s. diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/response/OpenResponse.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/response/OpenResponse.java index 8e30886d4..3c0674007 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/response/OpenResponse.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/api/response/OpenResponse.java @@ -1,6 +1,6 @@ package com.janboerman.invsee.spigot.api.response; -import com.janboerman.invsee.spigot.internal.view.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; import java.util.NoSuchElementException; import java.util.Objects; diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/InvseePlatform.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/InvseePlatform.java index 7d8b7c034..fd296c3a3 100644 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/InvseePlatform.java +++ b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/InvseePlatform.java @@ -2,9 +2,9 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Title; import com.janboerman.invsee.spigot.api.logging.LogGranularity; import com.janboerman.invsee.spigot.api.logging.LogOptions; diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/EnderSpectatorInventoryView.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/EnderSpectatorInventoryView.java deleted file mode 100644 index ecb630290..000000000 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/EnderSpectatorInventoryView.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.janboerman.invsee.spigot.internal.view; - -import com.janboerman.invsee.spigot.api.CreationOptions; -import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.api.template.EnderChestSlot; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.ItemStack; - -/** - * Represents an open window for an {@link EnderSpectatorInventory}. - */ -public abstract class EnderSpectatorInventoryView extends SpectatorInventoryView { - - protected EnderSpectatorInventoryView(CreationOptions creationOptions) { - super(creationOptions); - } - - /** {@inheritDoc} */ - @Override - public abstract EnderSpectatorInventory getTopInventory(); - - /** Sets the item in the desired slot of the InventoryView. If the slot is in the top inventory, then the inventory slot will be computed using - * {@code getMirror().getSlot(slot).defaultIndex()}. - * @see com.janboerman.invsee.spigot.api.template.Mirror */ - @Override - public void setItem(int slot, ItemStack item) { - if (slot == -999 || slot >= getTopInventory().getSize()) { - super.setItem(slot, item); - } else { - EnderChestSlot ecSlot = getMirror().getSlot(slot); - if (ecSlot != null) super.setItem(ecSlot.defaultIndex(), item); - } - } - - /** Gets the item in the desired slot of the InventoryView. If the slot is in the top inventory, then the inventory slot will be computed using - * {@code getMirror().getSlot(slot).defaultIndex()}. - * @see com.janboerman.invsee.spigot.api.template.Mirror */ - @Override - public ItemStack getItem(int slot) { - if (slot == -999 || slot >= getTopInventory().getSize()) { - return super.getItem(slot); - } else { - EnderChestSlot ecSlot = getMirror().getSlot(slot); - return ecSlot == null ? null : super.getItem(ecSlot.defaultIndex()); - } - } - - /** {@inheritDoc} */ - @Override - public InventoryType getType() { - return InventoryType.CHEST; - } - -} diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/MainSpectatorInventoryView.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/MainSpectatorInventoryView.java deleted file mode 100644 index 836baaa9d..000000000 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/MainSpectatorInventoryView.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.janboerman.invsee.spigot.internal.view; - -import com.janboerman.invsee.spigot.api.CreationOptions; -import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.ItemStack; - -/** - * Represents an open window for a {@link MainSpectatorInventory}. - */ -public abstract class MainSpectatorInventoryView extends SpectatorInventoryView { - - protected MainSpectatorInventoryView(CreationOptions creationOptions) { - super(creationOptions); - } - - /** {@inheritDoc} */ - @Override - public abstract MainSpectatorInventory getTopInventory(); - - /** Sets the item in the desired slot of the InventoryView. If the slot is in the top inventory, then the inventory slot will be computed using - * {@code getMirror().getSlot(slot).defaultIndex()}. - * @see com.janboerman.invsee.spigot.api.template.Mirror */ - @Override - public void setItem(int slot, ItemStack item) { - if (0 <= slot && slot < getTopInventory().getSize()) { - PlayerInventorySlot piSlot = getMirror().getSlot(slot); - if (piSlot != null) super.setItem(piSlot.defaultIndex(), item); - } else { - super.setItem(slot, item); - } - } - - /** Gets the item in the desired slot of the InventoryView. If the slot is in the top inventory, then the inventory slot will be computed using - * {@code getMirror().getSlot(slot).defaultIndex()}. - * @see com.janboerman.invsee.spigot.api.template.Mirror */ - @Override - public ItemStack getItem(int slot) { - if (0 <= slot && slot < getTopInventory().getSize()) { - PlayerInventorySlot piSlot = getMirror().getSlot(slot); - return piSlot == null ? null : super.getItem(piSlot.defaultIndex()); - } else { - return super.getItem(slot); - } - } - - /** {@inheritDoc} */ - @Override - public InventoryType getType() { - return InventoryType.CHEST; - } - -} diff --git a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/SpectatorInventoryView.java b/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/SpectatorInventoryView.java deleted file mode 100644 index 0db92dae1..000000000 --- a/InvSee++_Common/src/main/java/com/janboerman/invsee/spigot/internal/view/SpectatorInventoryView.java +++ /dev/null @@ -1,281 +0,0 @@ -package com.janboerman.invsee.spigot.internal.view; - -import com.google.common.base.Preconditions; -import com.janboerman.invsee.spigot.api.CreationOptions; -import com.janboerman.invsee.spigot.api.SpectatorInventory; -import com.janboerman.invsee.spigot.api.logging.Difference; -import com.janboerman.invsee.spigot.api.target.Target; -import com.janboerman.invsee.spigot.api.template.Mirror; - -import javax.annotation.Nullable; -import java.util.Objects; - -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -/** - * Represents an open window for a {@link SpectatorInventory}. - * @param the inventory's slot type. - */ -public abstract class SpectatorInventoryView implements com.janboerman.invsee.spigot.api.SpectatorInventoryView { - - private final CreationOptions creationOptions; - protected Target target; - - protected SpectatorInventoryView(CreationOptions creationOptions) { - this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); - } - - /** {@inheritDoc} */ - @Override - public abstract SpectatorInventory getTopInventory(); - - /** - * Get the difference tracked by this window. - * @return the difference - */ - public abstract @Nullable Difference getTrackedDifference(); - - /** - * Get the options this window was created with. - * @return a copy of the creation options - */ - public CreationOptions getCreationOptions() { - return creationOptions.clone(); - } - - //can't override getTitle because that does not work on 1.12 (the method is final :/) - //can't override title() either because of Adventure Text (because I can't have return type String) - //ooh the burden of supporting multiple versions! - - /** - * Get the mirror the {@link SpectatorInventory} is viewed through. - * @return the mirror - * @see Mirror explanation in the InvSee++ wiki - */ - public Mirror getMirror() { - return creationOptions.getMirror(); - } - - /** - * Get the target of the {@link SpectatorInventory}. - * @return the target - */ - public Target getTarget() { - SpectatorInventory top = getTopInventory(); - return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; - } - - @Override - public void setItem(final int slot, @org.jetbrains.annotations.Nullable final ItemStack item) { - Inventory inventory = getInventory(slot); - if (inventory != null) { - inventory.setItem(convertSlot(slot), item); - } else if (item != null) { - getPlayer().getWorld().dropItemNaturally(getPlayer().getLocation(), item); - } - } - - @org.jetbrains.annotations.Nullable - @Override - public ItemStack getItem(final int slot) { - Inventory inventory = getInventory(slot); - return (inventory == null) ? null : inventory.getItem(convertSlot(slot)); - } - - @Override - public void setCursor(@org.jetbrains.annotations.Nullable final ItemStack item) { - getPlayer().setItemOnCursor(item); - } - - @org.jetbrains.annotations.Nullable - @Override - public ItemStack getCursor() { - return getPlayer().getItemOnCursor(); - } - - @org.jetbrains.annotations.Nullable - @Override - public Inventory getInventory(final int rawSlot) { - // Slot may be -1 if not properly detected due to client bug - // e.g. dropping an item into part of the enchantment list section of an enchanting table - if (rawSlot == OUTSIDE || rawSlot == -1) { - return null; - } - Preconditions.checkArgument(rawSlot >= 0, "Negative, non outside slot %s", rawSlot); - Preconditions.checkArgument(rawSlot < countSlots(), "Slot %s greater than inventory slot count", rawSlot); - - if (rawSlot < getTopInventory().getSize()) { - return getTopInventory(); - } else { - return getBottomInventory(); - } - } - - @Override - public int convertSlot(final int rawSlot) { - int numInTop = getTopInventory().getSize(); - // Index from the top inventory as having slots from [0,size] - if (rawSlot < numInTop) { - return rawSlot; - } - - // Move down the slot index by the top size - int slot = rawSlot - numInTop; - - // Player crafting slots are indexed differently. The matrix is caught by the first return. - // Creative mode is the same, except that you can't see the crafting slots (but the IDs are still used) - if (getType() == InventoryType.CRAFTING || getType() == InventoryType.CREATIVE) { - /* - * Raw Slots: - * - * 5 1 2 0 - * 6 3 4 - * 7 - * 8 45 - * 9 10 11 12 13 14 15 16 17 - * 18 19 20 21 22 23 24 25 26 - * 27 28 29 30 31 32 33 34 35 - * 36 37 38 39 40 41 42 43 44 - */ - - /* - * Converted Slots: - * - * 39 1 2 0 - * 38 3 4 - * 37 - * 36 40 - * 9 10 11 12 13 14 15 16 17 - * 18 19 20 21 22 23 24 25 26 - * 27 28 29 30 31 32 33 34 35 - * 0 1 2 3 4 5 6 7 8 - */ - - if (slot < 4) { - // Send [5,8] to [39,36] - return 39 - slot; - } else if (slot > 39) { - // Slot lives in the extra slot section - return slot; - } else { - // Reset index so 9 -> 0 - slot -= 4; - } - } - - // 27 = 36 - 9 - if (slot >= 27) { - // Put into hotbar section - slot -= 27; - } else { - // Take out of hotbar section - // 9 = 36 - 27 - slot += 9; - } - - return slot; - } - - @NotNull - @Override - public InventoryType.SlotType getSlotType(final int slot) { - InventoryType.SlotType type = InventoryType.SlotType.CONTAINER; - if (slot >= 0 && slot < this.getTopInventory().getSize()) { - switch (this.getType()) { - case BLAST_FURNACE: - case FURNACE: - case SMOKER: - if (slot == 2) { - type = InventoryType.SlotType.RESULT; - } else if (slot == 1) { - type = InventoryType.SlotType.FUEL; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - case BREWING: - if (slot == 3) { - type = InventoryType.SlotType.FUEL; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - case ENCHANTING: - type = InventoryType.SlotType.CRAFTING; - break; - case WORKBENCH: - case CRAFTING: - if (slot == 0) { - type = InventoryType.SlotType.RESULT; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - case BEACON: - type = InventoryType.SlotType.CRAFTING; - break; - case ANVIL: - case SMITHING: - case CARTOGRAPHY: - case GRINDSTONE: - case MERCHANT: - if (slot == 2) { - type = InventoryType.SlotType.RESULT; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - case STONECUTTER: - if (slot == 1) { - type = InventoryType.SlotType.RESULT; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - case LOOM: - case SMITHING_NEW: - if (slot == 3) { - type = InventoryType.SlotType.RESULT; - } else { - type = InventoryType.SlotType.CRAFTING; - } - break; - default: - // Nothing to do, it's a CONTAINER slot - } - } else { - if (slot < 0) { - type = InventoryType.SlotType.OUTSIDE; - } else if (this.getType() == InventoryType.CRAFTING) { // Also includes creative inventory - if (slot < 9) { - type = InventoryType.SlotType.ARMOR; - } else if (slot > 35) { - type = InventoryType.SlotType.QUICKBAR; - } - } else if (slot >= (this.countSlots() - (9 + 4 + 1))) { // Quickbar, Armor, Offhand - type = InventoryType.SlotType.QUICKBAR; - } - } - return type; - } - - @Override - public void close() { - getPlayer().closeInventory(); - } - - @Override - public int countSlots() { - return getTopInventory().getSize() + getBottomInventory().getSize(); - } - - @Override - public boolean setProperty(@NotNull final InventoryView.Property prop, final int value) { - return getPlayer().setWindowProperty(prop, value); - } - -} diff --git a/InvSee++_Give_Platforms/Give_Impl_1_20_4_R3/.gitignore b/InvSee++_Give_Platforms/Give_Impl_1_20_4_R3/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/InvSee++_Give_Platforms/Give_Impl_1_20_4_R3/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/InvSee++_Give_Platforms/Give_Impl_Glowstone/.gitignore b/InvSee++_Give_Platforms/Give_Impl_Glowstone/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/InvSee++_Give_Platforms/Give_Impl_Glowstone/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/InvSee++_PerWorldInventory/src/main/java/com/janboerman/invsee/spigot/perworldinventory/PerWorldInventorySeeApi.java b/InvSee++_PerWorldInventory/src/main/java/com/janboerman/invsee/spigot/perworldinventory/PerWorldInventorySeeApi.java index 34af8be2e..0d564a050 100644 --- a/InvSee++_PerWorldInventory/src/main/java/com/janboerman/invsee/spigot/perworldinventory/PerWorldInventorySeeApi.java +++ b/InvSee++_PerWorldInventory/src/main/java/com/janboerman/invsee/spigot/perworldinventory/PerWorldInventorySeeApi.java @@ -4,10 +4,10 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.InvseeAPI; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.SpectatorInventory; import com.janboerman.invsee.spigot.api.response.NotCreatedReason; import com.janboerman.invsee.spigot.api.response.OpenResponse; diff --git a/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/BukkitInventoryView.java new file mode 100644 index 000000000..dbb87bc96 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_12_R1; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/EnderBukkitInventoryView.java index 5f26d4a32..90c896e57 100644 --- a/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/EnderBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; + import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -65,5 +68,10 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/MainBukkitInventoryView.java index b731f70d8..72fb225bb 100644 --- a/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_12_2_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_12_R1/MainBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -65,5 +68,10 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/BukkitInventoryView.java new file mode 100644 index 000000000..ccab549c9 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_16_R3; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/EnderBukkitInventoryView.java index f4ba32732..407c34eb8 100644 --- a/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/EnderBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; + import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -70,4 +73,10 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } + } diff --git a/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/MainBukkitInventoryView.java index 91a425410..55c0b0f6e 100644 --- a/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_16_5_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_16_R3/MainBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -70,4 +73,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/BukkitInventoryView.java new file mode 100644 index 000000000..3696754a6 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_17_1_R1; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/EnderBukkitInventoryView.java index e9b03d9c4..745b472ee 100644 --- a/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/EnderBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; + import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -70,4 +73,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/MainBukkitInventoryView.java index 9eceac704..ea165be7b 100644 --- a/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_17_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_17_1_R1/MainBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -70,4 +73,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/BukkitInventoryView.java new file mode 100644 index 000000000..e0beb7040 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_18_2_R2; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/EnderBukkitInventoryView.java index a8cf8dc8e..621671b26 100644 --- a/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/EnderBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; + import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -70,4 +73,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/MainBukkitInventoryView.java index 8a6e90115..ad4a09e07 100644 --- a/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_18_2_R2/src/main/java/com/janboerman/invsee/spigot/impl_1_18_2_R2/MainBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -70,4 +73,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/BukkitInventoryView.java new file mode 100644 index 000000000..393b3c3c7 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_19_4_R3; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/EnderBukkitInventoryView.java index 6f0656bd0..ca7168d7d 100644 --- a/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/EnderBukkitInventoryView.java @@ -4,15 +4,18 @@ import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; + import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryView; import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -82,4 +85,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/MainBukkitInventoryView.java index e6de31e49..213f24b5e 100644 --- a/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_19_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_19_4_R3/MainBukkitInventoryView.java @@ -4,15 +4,18 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryView; import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -82,4 +85,9 @@ public ItemStack getItem(int slot) { DifferenceTracker tracker = nms.tracker; return tracker == null ? null : tracker.getDifference(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/EnderBukkitInventoryView.java index 3ce825303..84611742d 100644 --- a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/EnderBukkitInventoryView.java @@ -1,8 +1,8 @@ package com.janboerman.invsee.spigot.impl_1_20_1_R1; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.template.EnderChestSlot; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftInventoryView; @@ -14,7 +14,7 @@ import javax.annotation.Nullable; -class EnderBukkitInventoryView extends BukkitInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/InvseeImpl.java b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/InvseeImpl.java index f00ddf24e..310427ffe 100644 --- a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/InvseeImpl.java +++ b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/InvseeImpl.java @@ -2,9 +2,9 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Scheduler; import com.janboerman.invsee.spigot.api.SpectatorInventory; import com.janboerman.invsee.spigot.api.event.SpectatorInventorySaveEvent; diff --git a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/MainBukkitInventoryView.java index 23bafc4f2..19be9db9b 100644 --- a/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_1_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_20_1_R1/MainBukkitInventoryView.java @@ -1,9 +1,11 @@ package com.janboerman.invsee.spigot.impl_1_20_1_R1; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftInventoryView; import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; @@ -13,7 +15,7 @@ import javax.annotation.Nullable; -class MainBukkitInventoryView extends BukkitInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_20_4_R3/.gitignore b/InvSee++_Platforms/Impl_1_20_4_R3/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/InvSee++_Platforms/Impl_1_20_4_R3/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/EnderBukkitInventoryView.java index 8320c8696..c20f2c86d 100644 --- a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/EnderBukkitInventoryView.java @@ -1,8 +1,8 @@ package com.janboerman.invsee.spigot.impl_1_20_4_R3; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.template.EnderChestSlot; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryView; @@ -14,7 +14,7 @@ import javax.annotation.Nullable; -class EnderBukkitInventoryView extends BukkitInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/InvseeImpl.java b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/InvseeImpl.java index 7de7a7f92..848159a1f 100644 --- a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/InvseeImpl.java +++ b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/InvseeImpl.java @@ -2,9 +2,9 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Scheduler; import com.janboerman.invsee.spigot.api.SpectatorInventory; import com.janboerman.invsee.spigot.api.event.SpectatorInventorySaveEvent; diff --git a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/MainBukkitInventoryView.java index 1f190d575..db234fd93 100644 --- a/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_4_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_20_4_R3/MainBukkitInventoryView.java @@ -1,6 +1,7 @@ package com.janboerman.invsee.spigot.impl_1_20_4_R3; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; @@ -13,7 +14,7 @@ import javax.annotation.Nullable; -class MainBukkitInventoryView extends BukkitInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/EnderBukkitInventoryView.java index b866aae61..05257f79d 100644 --- a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/EnderBukkitInventoryView.java @@ -1,6 +1,7 @@ package com.janboerman.invsee.spigot.impl_1_20_6_R4; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.template.EnderChestSlot; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; @@ -13,7 +14,7 @@ import javax.annotation.Nullable; -class EnderBukkitInventoryView extends BukkitInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/InvseeImpl.java b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/InvseeImpl.java index 900d80d60..9e5bb8441 100644 --- a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/InvseeImpl.java +++ b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/InvseeImpl.java @@ -2,9 +2,9 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Scheduler; import com.janboerman.invsee.spigot.api.SpectatorInventory; import com.janboerman.invsee.spigot.api.event.SpectatorInventorySaveEvent; diff --git a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/MainBukkitInventoryView.java index d9ac896f7..0076f0f34 100644 --- a/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_20_6_R4/src/main/java/com/janboerman/invsee/spigot/impl_1_20_6_R4/MainBukkitInventoryView.java @@ -1,6 +1,7 @@ package com.janboerman.invsee.spigot.impl_1_20_6_R4; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; @@ -13,7 +14,7 @@ import javax.annotation.Nullable; -class MainBukkitInventoryView extends BukkitInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; diff --git a/InvSee++_Platforms/Impl_1_21_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_21_R1/InvseeImpl.java b/InvSee++_Platforms/Impl_1_21_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_21_R1/InvseeImpl.java index d768fbd0b..9fb12281a 100644 --- a/InvSee++_Platforms/Impl_1_21_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_21_R1/InvseeImpl.java +++ b/InvSee++_Platforms/Impl_1_21_R1/src/main/java/com/janboerman/invsee/spigot/impl_1_21_R1/InvseeImpl.java @@ -2,9 +2,9 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Scheduler; import com.janboerman.invsee.spigot.api.SpectatorInventory; import com.janboerman.invsee.spigot.api.event.SpectatorInventorySaveEvent; diff --git a/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/BukkitInventoryView.java b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/BukkitInventoryView.java new file mode 100644 index 000000000..2f79f0a5e --- /dev/null +++ b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.spigot.impl_1_8_R3; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/EnderBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/EnderBukkitInventoryView.java index 7ae3ff69b..ed9e2dec6 100644 --- a/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/EnderBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/EnderBukkitInventoryView.java @@ -1,17 +1,20 @@ package com.janboerman.invsee.spigot.impl_1_8_R3; -import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; -import com.janboerman.invsee.spigot.api.logging.Difference; -import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import javax.annotation.Nullable; + import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import javax.annotation.Nullable; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.logging.Difference; +import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.EnderChestSlot; -class EnderBukkitInventoryView extends EnderSpectatorInventoryView { +class EnderBukkitInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { final EnderNmsContainer nms; @@ -35,6 +38,11 @@ public HumanEntity getPlayer() { return nms.player.getBukkitEntity(); } + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } + @Override public void setItem(int slot, ItemStack item) { net.minecraft.server.v1_8_R3.ItemStack stack = CraftItemStack.asNMSCopy(item); diff --git a/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/MainBukkitInventoryView.java b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/MainBukkitInventoryView.java index 003664ed0..f26391c75 100644 --- a/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/MainBukkitInventoryView.java +++ b/InvSee++_Platforms/Impl_1_8_8_R3/src/main/java/com/janboerman/invsee/spigot/impl_1_8_R3/MainBukkitInventoryView.java @@ -4,14 +4,17 @@ import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.logging.Difference; import com.janboerman.invsee.spigot.api.logging.DifferenceTracker; +import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; + import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import javax.annotation.Nullable; -class MainBukkitInventoryView extends MainSpectatorInventoryView { +class MainBukkitInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { final MainNmsContainer nms; @@ -66,4 +69,9 @@ public ItemStack getItem(int slot) { return tracker == null ? null : tracker.getDifference(); } + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } + } diff --git a/InvSee++_Platforms/Impl_Glowstone/.gitignore b/InvSee++_Platforms/Impl_Glowstone/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/InvSee++_Platforms/Impl_Glowstone/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/BukkitInventoryView.java b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/BukkitInventoryView.java new file mode 100644 index 000000000..77391cc55 --- /dev/null +++ b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/BukkitInventoryView.java @@ -0,0 +1,38 @@ +package com.janboerman.invsee.glowstone; + +import java.util.Objects; + +import com.janboerman.invsee.spigot.api.CreationOptions; +import com.janboerman.invsee.spigot.api.SpectatorInventory; +import com.janboerman.invsee.spigot.api.SpectatorInventoryView; +import com.janboerman.invsee.spigot.api.target.Target; +import com.janboerman.invsee.spigot.api.template.Mirror; + +import org.bukkit.inventory.InventoryView; + +abstract class BukkitInventoryView extends InventoryView implements SpectatorInventoryView { + + private final CreationOptions creationOptions; + protected Target target; + + BukkitInventoryView(CreationOptions creationOptions) { + this.creationOptions = Objects.requireNonNull(creationOptions, "creation options cannot be null"); + } + + @Override + public CreationOptions getCreationOptions() { + return creationOptions.clone(); + } + + @Override + public Mirror getMirror() { + return creationOptions.getMirror(); + } + + @Override + public Target getTarget() { + SpectatorInventory top = getTopInventory(); + return target == null ? target = Target.byGameProfile(top.getSpectatedPlayerId(), top.getSpectatedPlayerName()) : target; + } + +} diff --git a/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/EnderInventoryView.java b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/EnderInventoryView.java index 03617c96e..449e35b8a 100644 --- a/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/EnderInventoryView.java +++ b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/EnderInventoryView.java @@ -10,6 +10,7 @@ import com.janboerman.invsee.spigot.api.template.EnderChestSlot; import org.bukkit.entity.HumanEntity; import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.Plugin; @@ -17,7 +18,7 @@ import javax.annotation.Nullable; import java.util.List; -class EnderInventoryView extends EnderSpectatorInventoryView { +class EnderInventoryView extends BukkitInventoryView implements EnderSpectatorInventoryView { private final HumanEntity spectator; private final EnderInventory top; @@ -100,4 +101,9 @@ void onClose() { if (diffTracker != null) diffTracker.onClose(); } + + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/MainInventoryView.java b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/MainInventoryView.java index e3f9d16d9..01634ea34 100644 --- a/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/MainInventoryView.java +++ b/InvSee++_Platforms/Impl_Glowstone/src/main/java/com/janboerman/invsee/glowstone/MainInventoryView.java @@ -10,6 +10,7 @@ import com.janboerman.invsee.spigot.api.template.PlayerInventorySlot; import org.bukkit.entity.HumanEntity; import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.Plugin; @@ -17,7 +18,7 @@ import javax.annotation.Nullable; import java.util.List; -class MainInventoryView extends MainSpectatorInventoryView { +class MainInventoryView extends BukkitInventoryView implements MainSpectatorInventoryView { private final HumanEntity spectator; private final MainInventory top; @@ -101,5 +102,9 @@ void onClose() { diffTracker.onClose(); } + @Override + public InventoryType getType() { + return InventoryType.CHEST; + } } diff --git a/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/EnderseeCommandExecutor.java b/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/EnderseeCommandExecutor.java index 4ef5985af..58c0164b8 100644 --- a/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/EnderseeCommandExecutor.java +++ b/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/EnderseeCommandExecutor.java @@ -2,7 +2,7 @@ import com.janboerman.invsee.spigot.api.CreationOptions; import com.janboerman.invsee.spigot.api.EnderSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.EnderSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.EnderSpectatorInventoryView; import com.janboerman.invsee.spigot.api.Exempt; import com.janboerman.invsee.spigot.api.InvseeAPI; import com.janboerman.invsee.spigot.api.response.ImplementationFault; diff --git a/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/InvseeCommandExecutor.java b/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/InvseeCommandExecutor.java index 220111060..6a17cb92f 100644 --- a/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/InvseeCommandExecutor.java +++ b/InvSee++_Plugin/src/main/java/com/janboerman/invsee/spigot/InvseeCommandExecutor.java @@ -4,7 +4,7 @@ import com.janboerman.invsee.spigot.api.Exempt; import com.janboerman.invsee.spigot.api.InvseeAPI; import com.janboerman.invsee.spigot.api.MainSpectatorInventory; -import com.janboerman.invsee.spigot.internal.view.MainSpectatorInventoryView; +import com.janboerman.invsee.spigot.api.MainSpectatorInventoryView; import com.janboerman.invsee.spigot.api.response.*; import com.janboerman.invsee.spigot.api.target.Target; /* diff --git a/README.md b/README.md index f5873c4ef..4c9881d47 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Anything else can be discussed via the [discussion thread on SpigotMC](https://w ### Compiling -###### Prerequisites: [JDK-17](https://jdk.java.net/) or newer, [BuildTools](https://www.spigotmc.org/wiki/buildtools/) and [Maven](https://maven.apache.org). +###### Prerequisites: [JDK-21](https://jdk.java.net/) or newer, [BuildTools](https://www.spigotmc.org/wiki/buildtools/) and [Maven](https://maven.apache.org). 1. Install CraftBukkit into your local repository first by running BuildTools with - `java -jar BuildTools.jar --rev 1.8.8 --compile craftbukkit` @@ -128,6 +128,6 @@ and there is a good chance they won't be able to load mods and plugins compiled Is there any server that implements the Bukkit api that I'm missing? Don't hesitate to create [an issue](https://github.com/Jannyboy11/InvSee-plus-plus/issues/new) and request support! ### Supported Java versions -| Minecraft version: | 1.8.x | 1.12.x | 1.16.x | 1.17.x | 1.18.x | 1.19.x | 1.20.[0-4] | 1.20.5+ | -|--------------------|------------|------------|-------------|-------------|-------------|-------------|-------------|-------------| -| Java version: | 8 or newer | 8 or newer | 11 or newer | 16 or newer | 17 or newer | 17 or newer | 17 or newer | 21 or newer | +| Minecraft version: | 1.8.x | 1.12.x | 1.16.x | 1.17.x | 1.18.x | 1.19.x | 1.20.[0-4] | 1.20.[5-6] | 1.20.1 | +|--------------------|------------|------------|-------------|-------------|-------------|-------------|-------------|-------------|-------------| +| Java version: | 8 or newer | 8 or newer | 11 or newer | 16 or newer | 17 or newer | 17 or newer | 17 or newer | 21 or newer | 21 or newer |