mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-03 06:57:58 +01:00
Unstable (test)
This commit is contained in:
parent
b5481a7663
commit
13a88b7022
@ -261,21 +261,19 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCraftItem(CraftItemEvent evt) {
|
public void onCraftItem(final CraftItemEvent evt) {
|
||||||
|
|
||||||
if (evt.getWhoClicked() instanceof Player) {
|
if (evt.getWhoClicked() instanceof Player) {
|
||||||
|
|
||||||
Player p = (Player) evt.getWhoClicked();
|
Player p = (Player) evt.getWhoClicked();
|
||||||
if (plugin.checkQuester(p.getName()) == false) {
|
if (plugin.checkQuester(p.getName()) == false) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(p.getName());
|
final Quester quester = plugin.getQuester(p.getName());
|
||||||
if (quester.hasObjective("craftItem")) {
|
if (evt.isShiftClick() == false && quester.hasObjective("craftItem")) {
|
||||||
|
|
||||||
quester.craftItem(evt.getCurrentItem());
|
quester.craftItem(evt.getCurrentItem());
|
||||||
|
|
||||||
}
|
}else if(quester.hasObjective("craftItem")){
|
||||||
|
|
||||||
if(evt.isShiftClick()){
|
|
||||||
|
|
||||||
final int amntBefore = Quests.countInv(evt.getInventory(), evt.getCurrentItem().getType());
|
final int amntBefore = Quests.countInv(evt.getInventory(), evt.getCurrentItem().getType());
|
||||||
final Material mat = evt.getCurrentItem().getType();
|
final Material mat = evt.getCurrentItem().getType();
|
||||||
@ -285,7 +283,12 @@ public class PlayerListener implements Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void run(){
|
public void run(){
|
||||||
|
|
||||||
int amntAfter = Quests.countInv(evt.getInventory(), mat);
|
if(evt.isCancelled() == false){
|
||||||
|
|
||||||
|
int amntAfter = Quests.countInv(inv, mat);
|
||||||
|
quester.craftItem(new ItemStack(mat, amntAfter - amntBefore));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user