Thread: TalisMans Teleing to the Altars

Results 1 to 10 of 10
  1. #1 TalisMans Teleing to the Altars 
    Naughty Toys
    Toys's Avatar
    Join Date
    Sep 2013
    Posts
    201
    Thanks given
    21
    Thanks received
    9
    Rep Power
    37
    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?
    Reply With Quote  
     

  2. #2  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    i don't think you made them classes, otherwise you'd be able to figure out the error easy

    the code you posted dosn't match up to the error anyway
    Reply With Quote  
     

  3. #3  
    Naughty Toys
    Toys's Avatar
    Join Date
    Sep 2013
    Posts
    201
    Thanks given
    21
    Thanks received
    9
    Rep Power
    37
    Quote Originally Posted by Harlan View Post
    i don't think you made them classes, otherwise you'd be able to figure out the error easy

    the code you posted dosn't match up to the error anyway

    Well, My friend made em, but he doesn't know what's wrong either. He SAYS he made them. If you don't believe me ill show him sendin me them, but still. Any clue what's wrong with it? ;/
    or is there a easier way to make talismans tele you to altars.

    http://gyazo.com/e353efce293222500cb89288cbd1922e

    he says he wrote em, so i believed him.
    Reply With Quote  
     

  4. #4  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Quote Originally Posted by Evion View Post
    Well, My friend made em, but he doesn't know what's wrong either. He SAYS he made them. If you don't believe me ill show him sendin me them, but still. Any clue what's wrong with it? ;/
    or is there a easier way to make talismans tele you to altars.

    e353efce293222500cb89288cbd1922e.png

    he says he wrote em, so i believed him.
    all you had to do was remove the ; from protected void execute(); {

    which looks like you did, but then you commented it out
    Reply With Quote  
     

  5. #5  
    Naughty Toys
    Toys's Avatar
    Join Date
    Sep 2013
    Posts
    201
    Thanks given
    21
    Thanks received
    9
    Rep Power
    37
    Quote Originally Posted by Harlan View Post
    all you had to do was remove the ; from protected void execute(); {

    which looks like you did, but then you commented it out
    3b48060c8b318038863bfe5a342f9273.png
    Reply With Quote  
     

  6. #6  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Quote Originally Posted by Evion View Post
    it should look something like

    Code:
    World.getWorld().submit(new Event(500) {
    @Override
    				protected void execute() {
    					player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
    					stop();
    				}
    			};
    idk what event manager u use though
    Reply With Quote  
     

  7. #7  
    Naughty Toys
    Toys's Avatar
    Join Date
    Sep 2013
    Posts
    201
    Thanks given
    21
    Thanks received
    9
    Rep Power
    37
    Quote Originally Posted by Harlan View Post
    it should look something like

    Code:
    World.getWorld().submit(new Event(500) {
    @Override
    				protected void execute() {
    					player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
    					stop();
    				}
    			};
    idk what event manager u use though

    using that, I got this
    c9baf5b99806b00f9bad8baa97f433d6.png
    Reply With Quote  
     

  8. #8  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Quote Originally Posted by Evion View Post

    Code:
    World.getWorld().submit(new Event(500) {
    @Override
    				protected void execute() {
    					player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
    					stop();
    				}
    			});
    >..>
    Reply With Quote  
     

  9. #9  
    Naughty Toys
    Toys's Avatar
    Join Date
    Sep 2013
    Posts
    201
    Thanks given
    21
    Thanks received
    9
    Rep Power
    37
    Quote Originally Posted by Harlan View Post
    Code:
    World.getWorld().submit(new Event(500) {
    @Override
    				protected void execute() {
    					player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
    					stop();
    				}
    			});
    >..>
    I had that and got 13 more errors so I figured it was wrong >.>
    Screw it man this isn't worth the trouble, thanks for the help though.
    Any Idea's how I could make it so when I click 'locate' on a talisman it teleports me.
    Reply With Quote  
     

  10. #10  
    Registered Member Nicholas's Avatar
    Join Date
    May 2011
    Posts
    416
    Thanks given
    160
    Thanks received
    65
    Rep Power
    37
    Code:
    private static void execute(final Player player, final TallyData tally, int slot) {
            if (tally != null) {
                player.getPacketSender().sendMessage("You teleport with the Talisman!.");
                player.sendTeleport(tally.getPostionX(), tally.getPostionY(), 0);
            }
        }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Tele to the correct Height
    By Nintendo in forum Help
    Replies: 4
    Last Post: 09-04-2010, 02:29 AM
  2. adding the teles to lunar [PI]
    By drunklilkidz in forum Help
    Replies: 2
    Last Post: 08-17-2010, 06:17 AM
  3. Replies: 17
    Last Post: 11-28-2008, 08:54 AM
  4. Switching to Ancients by Clicking on the Altar.
    By Full Metalst in forum Tutorials
    Replies: 6
    Last Post: 11-02-2008, 09:56 PM
  5. Replies: 10
    Last Post: 09-21-2007, 02:40 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •