So. Im trying to make talismans tele to the altars.
I made this Talisman.java
Code:
package src.server.model.players.packets;
import java.util.HashMap;
import java.util.Map;
import src.server.world.Map;
public enum TallyData {
EARTH(1440, 2660, 4839);
//Etc.
/**
* The tab id.
*/
private int tallyId;
/**
* The x-axis.
*/
private int posX;
/**
* The y-axis.
*/
private int posY;
/**
* A map of tally ids.
*/
private static Map<Integer, TallyData> tally = new HashMap<Integer, TallyData>();
/**
* Populates the tally map.
*/
static {
for (TallyData tab : TallyData.values()) {
tally.put(tab.getTallyId(), tally);
}
}
/**
* Gets a tab by an item id.
* @param item The item id.
*/
public static TallyData forId(int item) {
return tally.get(item);
}
/**
* Teleports
* @param tabletId The tab.
* @param posX The x-axis.
* @param posY The y-axis.
*/
private TallyData(int tallyId, int posX, int posY) {
this.tallyId = tallyId;
this.posX = posX;
this.posY = posY;
}
/**
* Gets the tab id
*
* @return The tab.
*/
int getTallyId() {
return tallyId;
}
/**
* Gets the x-axis.
*
* @return The x-axis.
*/
int getPostionX() {
return posX;
}
/**
* Gets the y-axis.
*
* @return The y-axis.
*/
int getPostionY() {
return posY;
}
}
and TalismanAction.java
Code:
package src.server.model.players.packets;
import src.server.model.players.Talisman;
import src.server.model.players.packets.ClickItem;
import src.server.model.players.Player;
public class TallyTeleporting {
/**
* Checks if <code>item</code> is a valid tally.
* @param player The player.
* @param item The item.
* @param slot The slot.
* @return If <code>true</code> player will proceed to to teleport.
*/
public static boolean isTally(Player player, Item item, int slot) {
TallyData tab = TallyData.forId(item.getId());
if (tab != null) {
execute(player, tally, slot);
return true;
}
return false;
}
/**
* Activating the tally tab.
* @param player The player.
* @param item The tab.
* @param slot The item slot.
* @return
*/
private static void execute(final Player player, final TallyData tally, int slot) {
if (tally != null) {
player.getPacketSender().sendMessage("You teleport with the Talisman!.");
@Override
//protected void execute() {
player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
stop();
//}
};
}
}
I get this error: e09f02ec32fc19c6a51e263fc4361e27.png
any idea's what's wrong, or how to make this work a simpiler way?