mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Use new inventoryview abstraction
This commit is contained in:
parent
d291d259e2
commit
8cc2f0ea48
@ -17,7 +17,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -60,6 +59,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.Placeholders;
|
||||
import net.citizensnpcs.api.util.SpigotUtil;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.api.util.Storage;
|
||||
import net.citizensnpcs.api.util.Translator;
|
||||
import net.citizensnpcs.api.util.YamlStorage;
|
||||
@ -106,8 +106,8 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryView openAnvilInventory(Player player, Inventory inventory, String title) {
|
||||
return NMS.openAnvilInventory(player, inventory, title);
|
||||
public InventoryViewAPI openAnvilInventory(Player player, Inventory inventory, String title) {
|
||||
return new InventoryViewAPI(NMS.openAnvilInventory(player, inventory, title));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,10 +132,10 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
if (view.getTopInventory().getType() == InventoryType.CRAFTING
|
||||
|| view.getTopInventory().getType() == InventoryType.CREATIVE
|
||||
|| view.getTopInventory().getType() == InventoryType.PLAYER)
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
Inventory top = view.getTopInventory();
|
||||
if (top.getType() == InventoryType.CRAFTING || top.getType() == InventoryType.CREATIVE
|
||||
|| top.getType() == InventoryType.PLAYER)
|
||||
return;
|
||||
NMS.updateInventoryTitle(player, view, newTitle);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
@ -959,7 +960,7 @@ public class NMS {
|
||||
BRIDGE.trySwim(entity, power);
|
||||
}
|
||||
|
||||
public static void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public static void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
BRIDGE.updateInventoryTitle(player, view, newTitle);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
@ -306,7 +307,7 @@ public interface NMSBridge {
|
||||
|
||||
public void trySwim(Entity entity, float power);
|
||||
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle);
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle);
|
||||
|
||||
public void updateNavigationWorld(Entity entity, World world);
|
||||
|
||||
|
1
pom.xml
1
pom.xml
@ -16,6 +16,7 @@
|
||||
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
|
||||
<maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>
|
||||
<maven-shade-plugin.version>3.5.2</maven-shade-plugin.version>
|
||||
<special-source-plugin.version>2.0.3</special-source-plugin.version>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
@ -85,6 +85,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.BlazeController;
|
||||
@ -1415,7 +1416,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Container active = handle.activeContainer;
|
||||
InventoryType type = view.getTopInventory().getType();
|
||||
|
@ -85,6 +85,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.BlazeController;
|
||||
@ -1475,7 +1476,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Container active = handle.activeContainer;
|
||||
InventoryType type = view.getTopInventory().getType();
|
||||
|
@ -86,6 +86,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_12_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_12_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_12_R1.entity.BlazeController;
|
||||
@ -1483,7 +1484,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Container active = handle.activeContainer;
|
||||
InventoryType type = view.getTopInventory().getType();
|
||||
|
@ -86,6 +86,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_13_R2.entity.BlazeController;
|
||||
@ -1522,7 +1523,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Container active = handle.activeContainer;
|
||||
InventoryType type = view.getTopInventory().getType();
|
||||
|
@ -83,6 +83,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.BlazeController;
|
||||
@ -1536,7 +1537,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Containers<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -83,6 +83,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_15_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_15_R1.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_15_R1.entity.BeeController;
|
||||
@ -1585,7 +1586,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Containers<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -85,6 +85,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_16_R3.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_16_R3.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_16_R3.entity.BeeController;
|
||||
@ -1604,7 +1605,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Containers<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<version>${special-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -80,6 +80,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_17_R1.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_17_R1.entity.AxolotlController;
|
||||
import net.citizensnpcs.nms.v1_17_R1.entity.BatController;
|
||||
@ -1599,7 +1600,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
ServerPlayer handle = (ServerPlayer) getHandle(player);
|
||||
MenuType<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<version>${special-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -81,6 +81,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_18_R2.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_18_R2.entity.AxolotlController;
|
||||
import net.citizensnpcs.nms.v1_18_R2.entity.BatController;
|
||||
@ -1609,7 +1610,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
ServerPlayer handle = (ServerPlayer) getHandle(player);
|
||||
MenuType<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.4</version>
|
||||
<version>${special-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -88,6 +88,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_19_R3.entity.AllayController;
|
||||
import net.citizensnpcs.nms.v1_19_R3.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_19_R3.entity.AxolotlController;
|
||||
@ -1805,7 +1806,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
ServerPlayer handle = (ServerPlayer) getHandle(player);
|
||||
MenuType<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>${special-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -78,6 +78,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_20_R4.entity.AllayController;
|
||||
import net.citizensnpcs.nms.v1_20_R4.entity.ArmadilloController;
|
||||
import net.citizensnpcs.nms.v1_20_R4.entity.ArmorStandController;
|
||||
@ -1801,7 +1802,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
ServerPlayer handle = (ServerPlayer) getHandle(player);
|
||||
MenuType<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>${special-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -78,6 +78,7 @@ import net.citizensnpcs.api.trait.TraitInfo;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_21_R1.entity.AllayController;
|
||||
import net.citizensnpcs.nms.v1_21_R1.entity.ArmadilloController;
|
||||
import net.citizensnpcs.nms.v1_21_R1.entity.ArmorStandController;
|
||||
@ -1780,7 +1781,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
ServerPlayer handle = (ServerPlayer) getHandle(player);
|
||||
MenuType<?> menuType = null;
|
||||
switch (view.getTopInventory().getType()) {
|
||||
|
@ -81,6 +81,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.api.util.EntityDim;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.SpigotUtil.InventoryViewAPI;
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.ArmorStandController;
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.BatController;
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.BlazeController;
|
||||
@ -1340,7 +1341,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInventoryTitle(Player player, InventoryView view, String newTitle) {
|
||||
public void updateInventoryTitle(Player player, InventoryViewAPI view, String newTitle) {
|
||||
EntityPlayer handle = (EntityPlayer) getHandle(player);
|
||||
Container active = handle.activeContainer;
|
||||
InventoryType type = view.getTopInventory().getType();
|
||||
|
Loading…
Reference in New Issue
Block a user