@EventHandler
public void onCellPhoneInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (p.getInventory().getItemInMainHand().getType() != Material.WATCH)
return;
e.setCancelled(true);
CellularPhone phone = new CellularPhone(main);
// Left click for recipient toggle
if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
if (p.isSneaking()) {
phone.getNextContact(p);
} else {
phone.getPreviousContact(p);
}
}
// Right click for text messages
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.isSneaking()) {
phone.checkTextMessages(p);
} else {
phone.deleteTextMessage(p);
}
}
}
CellularPhoneListener.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:MT_Communication
作者:
评论列表
文章目录