Vkouk Posted June 16, 2011 Posted June 16, 2011 //sit - click target and player you target will sit down //stand - click target and player you target will stand up //rangesit - players in 240 radius will sit down //rangestand - players in 240 radius will stand up /** * */ package handlers.admincommandhandlers; import java.util.Collection; import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * @author Ventic * */ public class AdminSit implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "sit" , "stand", "rangesit", "rangestand" }; @Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("sit")) { L2Object target = activeChar.getTarget(); if (target == null) { activeChar.sendMessage("No target found"); return false; } else { ((L2PcInstance) target).sitDown(); } if (command.startsWith("stand")) { L2Object targetPc = activeChar.getTarget(); if (targetPc == null) { activeChar.sendMessage("No target found"); return false; } else { ((L2PcInstance) targetPc).standUp(); } } if (command.startsWith("rangesit")) { Collection<L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240); for (L2Character p : players) { if (p instanceof L2PcInstance) { ((L2PcInstance) p).sitDown(); } else { if (p == null) { activeChar.sendMessage("No players found so close"); return false; } } } } if (command.startsWith("rangestand")) { Collection <L2Character> playersPc = activeChar.getKnownList().getKnownCharactersInRadius(240); for (L2Character pPc : playersPc) { if (pPc instanceof L2PcInstance) { ((L2PcInstance) pPc).standUp(); } else { if (pPc == null) { activeChar.sendMessage("No players found so close"); return false; } } } } } return true; } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Idea Dialogos Credits,coded by me ps:dont forget to register it Quote
pipiou21 Posted June 16, 2011 Posted June 16, 2011 Preety useful for events or smthing :D!!! Thanks! Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 Preety useful for events or smthing :D!!! Thanks! right for events :P thanks Quote
Versusa® Posted June 16, 2011 Posted June 16, 2011 yes, for events its the best one :) simple and perfect , GJ Ven Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 yes, for events its the best one :) simple and perfect , GJ Ven sure,thanks :) Quote
Versusa® Posted June 16, 2011 Posted June 16, 2011 One question[no reason], you have coded in Hi5 or freya l2j? Because i see the com.l2jserver Quote
Vkouk Posted June 16, 2011 Author Posted June 16, 2011 One question[no reason], you have coded in Hi5 or freya l2j? Because i see the com.l2jserver epilogue but really it doesnt matter Quote
FighterBoss Posted August 9, 2011 Posted August 9, 2011 Quite easy,anyway thanks for sharing it. Quote
gRfd` Posted August 16, 2011 Posted August 16, 2011 usefully for events! very interesting! Quite easy,anyway thanks for sharing it. LOLS? [Hidden post: You need 150 posts to see it. You currently have 45.] Quote
ScRaB4ever Posted December 4, 2012 Posted December 4, 2012 the code is not working... thats the real code /** * */ package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.util.Collection; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2Object; import net.sf.l2j.gameserver.model.L2Character; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; /** * @author Ventic * */ public class AdminSit implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_sit" , "admin_stand", "admin_rangesit", "admin_rangestand" }; @Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("admin_sit")) { L2Object target = activeChar.getTarget(); if (target instanceof L2NpcInstance) { activeChar.sendMessage("You can not use it at NPCs!"); return false; } else if (target == null) { activeChar.sendMessage("You have no target!"); return false; } else { ((L2PcInstance) target).sitDown(); } } if (command.startsWith("admin_stand")) { L2Object target = activeChar.getTarget(); if (target instanceof L2NpcInstance) { activeChar.sendMessage("You can not use it at NPCs!"); return false; } else if (target == null) { activeChar.sendMessage("You have no target!"); return false; } else { ((L2PcInstance) target).standUp(); } } if (command.startsWith("admin_rangesit")) { Collection<L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240); for (L2Character p : players) { if (p instanceof L2PcInstance) { ((L2PcInstance) p).sitDown(); } } } if (command.startsWith("admin_rangestand")) { Collection <L2Character> players = activeChar.getKnownList().getKnownCharactersInRadius(240); for (L2Character p : players) { if (p instanceof L2PcInstance) { ((L2PcInstance) p).standUp(); } } } return true; } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.