1不等于1,布尔问题



我是疯了还是什么的,或者我需要更多的睡眠。。。谁能给我第二双眼睛吗?

boolean slotTypeMatch = false;
System.out.println("waiType: " + waiType);
if (waiType.equals("W")){
} else if(waiType.equals("A")){
    itemFilename = MyServer.armorMap.get(waiId).getFilename();
    System.out.println("endContainerSlot: " + endContainerSlot + ", getSlot: " + MyServer.weaponMap.get(waiId).getSlot());
    if (endContainerSlot == MyServer.armorMap.get(waiId).getSlot()){
        System.out.println("WHY DONT I MAKE IT HERE!!!!");
        slotTypeMatch = true;
    }
}
System.out.println("itemFilename: " + itemFilename);
System.out.println("slotTypeMatch: " + slotTypeMatch);
if (slotTypeMatch){
    //not making it here, I must be going insane

这是我的控制台输出。。。我一辈子都想不通…

waiType: A 
endContainerSlot: 1, getSlot: 1
itemFilename: images/armor/armor_tunic.png 
slotTypeMatch: false

编辑它们都是int

int endContainerSlot - com.jayavon.game.server.MyCommandHandler.run()
int com.jayavon.game.actualgame.Armor.getSlot()

您输出MyServer.weaponMap,但您正在比较endContainerSlotMyServer.armorMap。我认为您想与weaponMap进行比较,或者您正在进行正确的比较,但在输出中看到了错误的映射。

System.out.println("endContainerSlot: " + endContainerSlot + ", getSlot: " + MyServer.weaponMap.get(waiId).getSlot());
if (endContainerSlot == MyServer.armorMap.get(waiId).getSlot()){
    System.out.println("WHY DONT I MAKE IT HERE!!!!");
    slotTypeMatch = true;
}

你在这里比较不同的地图,armorMap与weaponMap,我认为这是你的问题。。。

MyServer.armorMap&CCD_ 6不同。我认为你应该更新你的代码,睡一觉。:(

if (endContainerSlot == MyServer.weaponMap.get(waiId).getSlot()){...}

最新更新