Jump to content

[SHARE]Trade refusal mode for players


Intrepid

Recommended Posts

disable or enable the trade for you.

credits to me.

For L2J CT2.2

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;

/**
* @author Intrepid
*
*/

public class tradeoff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = 
{ 
	"tradeoff",
	"tradeon"
};

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	if ((command.startsWith("tradeoff")))
	{
		activeChar.setTradeRefusal(true);
		activeChar.sendMessage("Trade refusal enabled");
	}
	if ((command.startsWith("tradeon")))
	{
		activeChar.setTradeRefusal(false);
		activeChar.sendMessage("Trade refusal disabled");
	}
	return true;
}

public String[] getVoicedCommandList()
{
	return VOICED_COMMANDS;
}
}

Link to comment
Share on other sites

Really nice idea! Thank you for sharing this, but... How can I use this on L2JFree?

 

PS: Why all you ppl share thisns for L2JServer? :P

 

Thank you in advice.

 

everybody share it for l2j because l2j have better support than l2jfree and if something wrong you can get help faster

 

to make it compatible with l2jfree change the imports from net.sf.l2j to com.l2jfree

Link to comment
Share on other sites

Thank you ^^ Hmm, I can't get it... I need to create new .java file or edit existing? If new, then which name I need to use and if existing, which one?

 

You need new one the name is what you want but the name of the file need to be the same like in that line:

 

public class tradeoff implements IVoicedCommandHandler

 

so in my share tradeoff.java

 

and you need to register that name if you dont know how to register:

 

http://www.maxcheaters.com/forum/index.php?topic=44325.0

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Well, I'm not sure if it works...need test, but I set this in the code ( Nothing exeptional...just for information to the player, not needed )

 

/*

* This program is free software: you can redistribute it and/or modify it under

* the terms of the GNU General Public License as published by the Free Software

* Foundation, either version 3 of the License, or (at your option) any later

* version.

*

* This program is distributed in the hope that it will be useful, but WITHOUT

* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more

* details.

*

* You should have received a copy of the GNU General Public License along with

* this program. If not, see <http://www.gnu.org/licenses/>.

*/

package com.l2jfree.gameserver.handler.voicedcommandhandlers;

 

import com.l2jfree.gameserver.handler.IVoicedCommandHandler;

import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;

import com.l2jfree.gameserver.network.SystemMessageId;

import com.l2jfree.gameserver.network.serverpackets.SystemMessage;

 

/**

* @author Intrepid

*

*/

 

public class TradeOff implements IVoicedCommandHandler

{

private static final String[] VOICED_COMMANDS =

{

"tradeoff",

"tradeon"

};

 

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)

{

if ((command.startsWith("tradeoff")))

{

if(activeChar.getTradeRefusal())

{

activeChar.sendMessage("Trade refusal is already enabled!");

}

else

{

activeChar.setTradeRefusal(true);

activeChar.sendMessage("Trade refusal enabled");

}

}

if ((command.startsWith("tradeon")))

{

if(!activeChar.getTradeRefusal())

{

activeChar.sendMessage("Trade refusal is already disabled!");

}

else

{

activeChar.setTradeRefusal(false);

activeChar.sendMessage("Trade refusal disabled");

}

}

return true;

}

 

public String[] getVoicedCommandList()

{

return VOICED_COMMANDS;

}

}

Link to comment
Share on other sites

  • 5 weeks later...
Guest
This topic is now closed to further replies.


×
×
  • Create New...