[1.15.2.a.4] Add /ec support + ec in sightline for search toggle
This commit is contained in:
parent
857af88a7c
commit
1f83b3989b
@ -13,9 +13,15 @@ Page_Price_Addition: 0
|
|||||||
#This is how much the bank page cost will be increased
|
#This is how much the bank page cost will be increased
|
||||||
#by for every additional page.
|
#by for every additional page.
|
||||||
|
|
||||||
|
Must_Look_At_Chest_To_Search: true
|
||||||
|
#This makes it so players must be looking at an EnderChest
|
||||||
|
#to utilize the search feature, resulting in a "never left
|
||||||
|
#the chest" experience despite actually exiting their bank
|
||||||
|
#to enter their search term in the chat.
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Version #
|
# Version #
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|
||||||
VERSION: 1
|
VERSION: 2
|
||||||
#Do not touch this. No touchy.
|
#Do not touch this. No touchy.
|
||||||
@ -1,6 +1,6 @@
|
|||||||
name: "EnderBank"
|
name: "EnderBank"
|
||||||
author: TheTealViper
|
author: TheTealViper
|
||||||
version: "1.15.2.a.3"
|
version: "1.15.2.a.4"
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
description: "Bank system from popular RPG's."
|
description: "Bank system from popular RPG's."
|
||||||
main: me.TheTealViper.enderbank.EnderBank
|
main: me.TheTealViper.enderbank.EnderBank
|
||||||
|
|||||||
@ -19,6 +19,8 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.inventory.InventoryAction;
|
import org.bukkit.event.inventory.InventoryAction;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -313,27 +315,30 @@ public class EnderBank extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**[1.15.2.a.3] Using "onChestClick()" instead as the method below forces chest animation to stay open
|
//[1.15.2.a.3] Using "onChestClick()" instead as the method below forces chest animation to stay open
|
||||||
|
//[1.15.2.a.4] This is still here to handle the command /ec as that would open vanilla chest
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryOpen(InventoryOpenEvent e) {
|
public void onInventoryOpen(InventoryOpenEvent e) {
|
||||||
if(e.getInventory().getType().equals(InventoryType.ENDER_CHEST)) {
|
if(e.getInventory().getType().equals(InventoryType.ENDER_CHEST)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Player p = (Player) e.getPlayer();
|
Player p = (Player) e.getPlayer();
|
||||||
BankStorage bank = BankStorage.getBank(p);
|
openEnderBank(p);
|
||||||
bank.openPage(1, p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
**/
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChestClick(PlayerInteractEvent e) {
|
public void onChestClick(PlayerInteractEvent e) {
|
||||||
if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().equals(Material.ENDER_CHEST)) {
|
if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().equals(Material.ENDER_CHEST)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Player p = (Player) e.getPlayer();
|
Player p = (Player) e.getPlayer();
|
||||||
|
openEnderBank(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openEnderBank(Player p) {
|
||||||
BankStorage bank = BankStorage.getBank(p);
|
BankStorage bank = BankStorage.getBank(p);
|
||||||
bank.openPage(1, p);
|
bank.openPage(1, p);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChat(AsyncPlayerChatEvent e) {
|
public void onChat(AsyncPlayerChatEvent e) {
|
||||||
@ -354,7 +359,7 @@ public class EnderBank extends JavaPlugin implements Listener {
|
|||||||
queue.remove(queue.size() - 1);
|
queue.remove(queue.size() - 1);
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Block b = p.getTargetBlock(null, 10);
|
Block b = p.getTargetBlock(null, 10);
|
||||||
if(b.getType().equals(Material.ENDER_CHEST)) {
|
if(!getConfig().getBoolean("Must_Look_At_Chest_To_Search") || b.getType().equals(Material.ENDER_CHEST)) {
|
||||||
String search = e.getMessage();
|
String search = e.getMessage();
|
||||||
BankStorage bank = BankStorage.searchDatabase.get(p);
|
BankStorage bank = BankStorage.searchDatabase.get(p);
|
||||||
bank.openSearch(search, p);
|
bank.openSearch(search, p);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user