Last active
December 21, 2015 16:39
-
-
Save Bakies/6335443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EventHandler | |
public void onPlayerInteract1(PlayerInteractEvent e) { | |
if (e.getAction() == Action.LEFT_CLICK_BLOCK) { | |
Block b = e.getClickedBlock(); | |
if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST) { | |
// Begin pseudo-code | |
ResultSet res = sqlQuery("SELECT command FROM signs WHERE x= " + b.getX() + " AND y=" + b.getY() + " AND z=" + b.getZ()); | |
if(res != null){ | |
Bukkit.dispatchCommand(e.getPlayer(), res.getString(1)); // res.getString(0)? res.getString("command")? | |
} | |
} | |
} | |
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) { | |
Block b = e.getClickedBlock(); | |
if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST) { | |
// TODO run command | |
} | |
} | |
} | |
/* | |
database columns ideas: | |
author | x | y | z | command | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment