Jump to content
  • 0

[Help - request] Teleport Java code


Question

Posted

hi guys i want to add the following java code in my server:

Only 79 lvl+ players could teleport to my custom zone.

Could any1 help me? im newbie on java yet, thnx !

 

1 answer to this question

Recommended Posts

  • 0
Posted

You must add imports yourself

public final class CustomTeleport extends Quest {
private static final String qn = "CustomTeleport";

private static final int X = 0; // Coordinate X from spawn;
private static final int Y = 0; //   "	  "   Y  "     "  
private static final int Z = 0; //   "    "   Z  "     "
private static final int HEADING = 0; // Heading. Can be 0

private static final int NPC_ID = 0; // NPC which will be used as teleport

private static final String HTML_TELEPORTED = "<html><title>Custom Teleport</title><center><br>You are being teleported to YOUR_PLACE</center></body></html>";
private static final String HTML_LOWLEVEL = "<html><title>Custom Teleport</title><center><br>You must be at least level 79</center></body></html>

public CustomTeleport(int questId, String name, String descr) {
	super(questId, name, descr);
	addFirstTalkId(NPC_ID);
}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player) {
	if(player.getQuestState(qn) == null)
		newQuestState(player);

	if(player.getLevel() >= 79) {
		player.teleToLocation(X,Y,Z,HEADING,0);
		return HTML_TELEPORTED
	} else 
		return HTML_LOWLEVEL;
}

public static void main(String...args) {
	new CustomTeleport(-1,qn,"Custom Teleport");
}
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • What's your obsession with me? Or are you just doing this because you're desperate and need to sell something (SkyLord) to eat? Why do you do this on all my posts? Why don't you explain it to the community? ---------------- I will have a special offer until April 19. If you are interested, don’t hesitate to send me a message.  
    • @GX-Ext How many offers does your product have? If I remember correctly, there are about 3.  
    • I will have a special offer until April 19. If you are interested, don’t hesitate to send me a message.
    • ⚔️ LINEAGE II KHADIA ⚔️ Interlude PTS (L2OFF) • Mid Rate PvP • Custom Endgame Experience 🔥 NOT JUST ANOTHER SERVER — A REAL BATTLEFIELD 🔥 Welcome to L2Khadia, where classic Interlude meets competitive PvP and custom progression. No fake numbers, no empty promises — only action, economy, war and long-term gameplay. ━━━━━━━━━━━━━━━━━━━━━━ 📊 SERVER RATES EXP: x100 SP: x150 Adena: x300 Spoil: x15 ━━━━━━━━━━━━━━━━━━━━━━ ⚔️ WHY KHADIA? ✔ Original Interlude Mechanics & Formulas ✔ Mid Rate PvP Balance ✔ Real Clan Wars / Sieges / Olympiad ✔ Stable & Fair Economy ✔ Active Staff Team ✔ Long-Term Project Vision ━━━━━━━━━━━━━━━━━━━━━━ 🗡️ KHADIA CUSTOM CONTENT 🔥 Khadia Weapons – Unique power & visuals 🛡 Khadia Armor – Raid Boss drops & crafting 🧥 Khadia Cloaks – Endgame progression items 💎 Designed for competitive PvP ━━━━━━━━━━━━━━━━━━━━━━ 🎁 REWARD SYSTEMS 🏆 PvP / PK Reward System 📦 Daily PvP Reward Package 👑 Raid Package from Boss Extract Rewards 🗳 Vote Reward System 📈 Rankings: PvP / PK / Clans / Castles ━━━━━━━━━━━━━━━━━━━━━━ 💎 VIP FEATURES ✔ VIP Buff Coin ✔ Nick / Title Colors ✔ Special VIP Chat ( ^ Key ) ✔ Exclusive VIP Benefits ━━━━━━━━━━━━━━━━━━━━━━ 🎮 QUALITY OF LIFE ✔ Auto Loot for Farm ✔ Auto Loot Disabled for Raid Boss ✔ Offline Shop System ✔ Remote Buff Coin ✔ RaidBoss Status NPC ✔ PvP / PK Ranking NPC ━━━━━━━━━━━━━━━━━━━━━━ 🌍 FARM ZONES • Elven Fortress [80] – Medium • Cave of Trials [80+] – Party Hard • Monastery of Silence [80] – Medium • PvP Zones Around Raid Bosses ━━━━━━━━━━━━━━━━━━━━━━ 🏰 CLAN & SIEGE SYSTEM ✔ Full Interlude Clan System ✔ Max Clan Level 8 + Clan Skills ✔ Max 3 Clans per Alliance ✔ No Kick / Leave Penalty ✔ Weekly Castle Sieges ━━━━━━━━━━━━━━━━━━━━━━ 🚀 JOIN NOW – START YOUR LEGEND 🚀 🌐 Website: www.l2khadia.com 💬 Discord: https://discord.gg/DnZrgWn77n ━━━━━━━━━━━━━━━━━━━━━━ No Pay To Win • Fair Gameplay • Real PvP • Custom Endgame Content       We Wish you the best game ! 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..