inventory click bug fix attempt #2
This commit is contained in:
parent
b5c626cf3e
commit
b6ab82c8e1
|
@ -64,7 +64,9 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
File f = new File("plugins/CubeTP/config.yml");
|
File f = new File("plugins/CubeTP/config.yml");
|
||||||
if(!f.exists())
|
if(!f.exists())
|
||||||
{
|
{
|
||||||
|
getLogger().info("Generating config...");
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("Loading config...");
|
getLogger().info("Loading config...");
|
||||||
|
@ -96,7 +98,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
Sign sign = (Sign) state;
|
Sign sign = (Sign) state;
|
||||||
SignSide sside = sign.getSide(Side.FRONT);
|
SignSide sside = sign.getSide(Side.FRONT);
|
||||||
curCubeName = sside.getLine(0);
|
curCubeName = sside.getLine(0);
|
||||||
if(!sside.getLine(1).isEmpty()){
|
if(sside.getLine(1).equals("pri")){
|
||||||
curCubePrivate = true;
|
curCubePrivate = true;
|
||||||
} else {
|
} else {
|
||||||
curCubePrivate = false;
|
curCubePrivate = false;
|
||||||
|
@ -104,7 +106,6 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
curCubeX = clickedBlock.getLocation().getBlockX();
|
curCubeX = clickedBlock.getLocation().getBlockX();
|
||||||
curCubeY = clickedBlock.getLocation().getBlockY();
|
curCubeY = clickedBlock.getLocation().getBlockY();
|
||||||
curCubeZ = clickedBlock.getLocation().getBlockZ();
|
curCubeZ = clickedBlock.getLocation().getBlockZ();
|
||||||
inCubeTPInventory = true;
|
|
||||||
ShowUI(player);
|
ShowUI(player);
|
||||||
}
|
}
|
||||||
if(action == Action.RIGHT_CLICK_BLOCK){
|
if(action == Action.RIGHT_CLICK_BLOCK){
|
||||||
|
@ -112,7 +113,6 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
if(mhi.getItemMeta() != null){
|
if(mhi.getItemMeta() != null){
|
||||||
String mainhand = mhi.getItemMeta().getDisplayName();
|
String mainhand = mhi.getItemMeta().getDisplayName();
|
||||||
if(mainhand.equals("Tome de portail")){
|
if(mainhand.equals("Tome de portail")){
|
||||||
inCubeTPInventory = true;
|
|
||||||
ShowUIPortal(player);
|
ShowUIPortal(player);
|
||||||
mhi.setAmount(0);
|
mhi.setAmount(0);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(final InventoryClickEvent e) throws SQLException {
|
public void onInventoryClick(final InventoryClickEvent e) throws SQLException {
|
||||||
if(inCubeTPInventory){
|
if(e.getInventory().equals(inv)){
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (!e.isLeftClick()) return;
|
if (!e.isLeftClick()) return;
|
||||||
|
|
||||||
|
@ -147,7 +147,6 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
p.sendMessage(MessageFormat.format("§bLe cube {0} a été ajouté.", curCubeName));
|
p.sendMessage(MessageFormat.format("§bLe cube {0} a été ajouté.", curCubeName));
|
||||||
ShowUI(p);
|
ShowUI(p);
|
||||||
}
|
}
|
||||||
inCubeTPInventory = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a tome of portal from a book
|
// create a tome of portal from a book
|
||||||
|
@ -159,7 +158,6 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage("§bVous devez posséder un livre pour créer cet objet.");
|
p.sendMessage("§bVous devez posséder un livre pour créer cet objet.");
|
||||||
}
|
}
|
||||||
inCubeTPInventory = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unregister a cube
|
// unregister a cube
|
||||||
|
@ -171,21 +169,18 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(MessageFormat.format("§bLe cube {0} n'existe pas.", curCubeName));
|
p.sendMessage(MessageFormat.format("§bLe cube {0} n'existe pas.", curCubeName));
|
||||||
}
|
}
|
||||||
inCubeTPInventory = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tp to a remote cube
|
// tp to a remote cube
|
||||||
if (e.getRawSlot() >= 9){
|
if (e.getRawSlot() >= 9){
|
||||||
String name = e.getCurrentItem().getItemMeta().getDisplayName();
|
String name = e.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
CubeTP(p,name);
|
CubeTP(p,name);
|
||||||
inCubeTPInventory = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void InventoryCloseEvent(final InventoryCloseEvent e) throws SQLException {
|
public void InventoryCloseEvent(final InventoryCloseEvent e) throws SQLException {
|
||||||
inCubeTPInventory = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -348,6 +343,7 @@ public final class CubeTP extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
//Disable message
|
||||||
|
getLogger().info("Disabled!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: CubeTP
|
name: CubeTP
|
||||||
version: '1.2.1'
|
version: '1.2.2'
|
||||||
main: ovh.mxg.cubetp.CubeTP
|
main: ovh.mxg.cubetp.CubeTP
|
||||||
api-version: '1.20'
|
api-version: '1.20'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: CubeTP
|
name: CubeTP
|
||||||
version: '1.2.1'
|
version: '1.2.2'
|
||||||
main: ovh.mxg.cubetp.CubeTP
|
main: ovh.mxg.cubetp.CubeTP
|
||||||
api-version: '1.20'
|
api-version: '1.20'
|
||||||
|
|
Loading…
Reference in New Issue