This commit is contained in:
Blackvein 2012-11-08 10:53:26 -08:00
parent 51e545e26a
commit 33e5b78f2c
3 changed files with 8 additions and 17 deletions

View File

@ -1,16 +1,8 @@
package me.blackvein.quests;
import java.io.File;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import java.util.*;
import org.bukkit.*;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
@ -135,7 +127,7 @@ public class Event {
public void happen(Player player){
if(message.isEmpty() == false)
if(message != null)
player.sendMessage(message);
if(clearInv == true){

View File

@ -394,7 +394,6 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onInventoryClick(InventoryClickEvent evt) {
System.out.println("Click fired.");
Player player = null;
if (evt.getWhoClicked() instanceof Player) {
player = (Player) evt.getWhoClicked();
@ -491,7 +490,7 @@ public class PlayerListener implements Listener {
//Item in clicked slot is a quest item, cursor is not
String s = Quester.checkPlacement(evt.getInventory(), evt.getRawSlot());
if (s != null) {
if (s == null) {
quester.holdingQuestItemFromStorage = true;
}
@ -523,17 +522,18 @@ public class PlayerListener implements Listener {
if (quester.currentQuest != null) {
if (quester.currentQuest.questItems.containsKey(mat)) {
System.out.println(evt.getInventory().getType());
if((evt.getInventory().getType().equals(InventoryType.WORKBENCH) && evt.getRawSlot() == 0) || (evt.getInventory().getType().equals(InventoryType.CRAFTING) && evt.getRawSlot() == 0)){
return;
}
List<Integer> changedSlots = Quester.getChangedSlots(evt.getInventory(), evt.getCurrentItem());
System.out.println("Number of changed slots: " + changedSlots.size());
boolean can = true;
for (int i : changedSlots) {
String s = Quester.checkPlacement(evt.getInventory(), i);
if (s != null) {
System.out.println("BAD Changed slot: " + i);
can = false;
break;
}
@ -541,6 +541,7 @@ public class PlayerListener implements Listener {
}
if (!can) {
System.out.println("Cannot.");
evt.setCancelled(true);
player.updateInventory();

View File

@ -1028,7 +1028,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("collectItem")) {
String message = ChatColor.GREEN + "(Completed) Collect " + prettyItemString(itemstack.getTypeId());
message = message + " " + itemsCollected.get(material) + "/" + itemsCollected.get(material);
message = message + " " + itemsCollected.get(itemstack.getType()) + "/" + itemsCollected.get(itemstack.getType());
p.sendMessage(message);
if (testComplete()) {
@ -2677,13 +2677,11 @@ public class Quester {
}else if(type.equals(InventoryType.CHEST)){
if(inv.getContents().length == 27){
if(rawSlot < 27){
return "You may not store Quest items.";
}
}else {
if(rawSlot < 54){
return "You may not store Quest items.";
}