Code:
/*
* Class ShopBuyConfig
*
* Version 1.0
*
* Novemeber 20, 2008
*
* Created by Dragonking <[email protected]>
*/
package net.com.codeusa.net.packethandler;
import net.com.codeusa.model.Player;
import net.com.codeusa.util.Misc;
import net.com.codeusa.model.items.PlayerItems;
import net.com.codeusa.*;
public class ShopBuyConfig implements Packet {
/**
* Handles operating equipped items.
* @param p The Player which the frame should be handled for.
* @param packetId The packet id this belongs to.
* @param packetSize The amount of bytes being recieved for this packet.
*/
public Server Server;
public void handlePacket(Player p, int packetId, int packetSize) {
if (p == null || p.stream == null) {
return;
}
PlayerItems pi = new PlayerItems();
NPCOption1 N1 = new NPCOption1();
int junk = p.stream.readDWord();
int itemId = p.stream.readUnsignedWordA();
int itemSlot = p.stream.readUnsignedWordBigEndianA();
//if (itemSlot < 0 || itemSlot >= p.equipment.length || p.equipment[itemSlot] != itemId) {
// return;
//}
if (p.shopid == 2 && pi.hasPlayerItemAmount(p, 995, p.shop2p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop2p[itemSlot]);
pi.addItem(p, p.shop2[itemSlot], 1);
}
else if (p.shopid == 12 && pi.hasPlayerItemAmount(p, 995, p.shop12p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop12p[0]);
pi.addItem(p, p.shop12[itemSlot], 1);
}
else if (p.shopid == 3 && pi.hasPlayerItemAmount(p, 995, p.shop3p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop3p[0]);
pi.addItem(p, p.shop3[itemSlot], 1);
}
else if (p.shopid == 9 && pi.hasPlayerItemAmount(p, 995, p.shop9p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop9p[itemSlot]);
pi.addItem(p, p.shop9[itemSlot], 1);
}
else if (p.shopid == 13 && pi.hasPlayerItemAmount(p, 995, p.shop13p[itemSlot]))
{
pi.addItem(p, p.shop13[itemSlot], 1);
}
else if (p.shopid == 11 && pi.hasPlayerItemAmount(p, 995, p.shop11p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop11p[itemSlot]);
pi.addItem(p, p.shop11[itemSlot], 1);
}
else if (p.shopid == 10 && pi.hasPlayerItemAmount(p, 995, p.shop10p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop10p[itemSlot]);
pi.addItem(p, p.shop10[itemSlot], 1);
}
else if (p.shopid == 8 && pi.hasPlayerItemAmount(p, 995, p.shop8p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop8p[itemSlot]);
pi.addItem(p, p.shop8[itemSlot], 1);
}
else if (p.shopid == 4 && pi.hasPlayerItemAmount(p, 995, p.shop4p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop4p[itemSlot]);
pi.addItem(p, p.shop4[itemSlot], 1);
}
else if (p.shopid == 6 && pi.hasPlayerItemAmount(p, 995, p.shop4p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop6p[itemSlot]);
pi.addItem(p, p.shop6[itemSlot], 1);
}
else if (p.shopid == 7 && pi.hasPlayerItemAmount(p, 995, p.shop7p[itemSlot]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop7p[itemSlot]);
pi.addItem(p, p.shop7[itemSlot], 1);
}
else if (p.shopid == 5 && pi.hasPlayerItemAmount(p, 995, p.shop5p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop5p[0]);
pi.addItem(p, p.shop5[itemSlot], 1);
}
else if (p.shopid == 14 && pi.hasPlayerItemAmount(p, 995, p.shop14p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop14p[0]);
pi.addItem(p, p.shop14[itemSlot], 5000);
}
else if (p.shopid == 15 && pi.hasPlayerItemAmount(p, 995, p.shop15p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop15p[0]);
pi.addItem(p, p.shop15[itemSlot], 1);
}
else if (p.shopid == 16 && pi.hasPlayerItemAmount(p, 995, p.shop16p[0]))
{
pi.deleteItem(p, 995, pi.getItemSlot(p, 995), p.shop16p[0]);
pi.addItem(p, p.shop16[itemSlot], 1);
}
else
{
p.getActionSender().sendMessage(p,"You dont have enough coins. Try doing ::cash");
}
}
}
i saved it as ShopBuyConfig.java and when i compile it says bad class file, and the guy told me to make a java class file how do i do that?