Jump to content
  • 0
Sign in to follow this  
Miss Emily

How to make items untradeable?

Question

Haii everyone,

I am trying to make some items untradeable. Let's use a mystery box for example.


I followed a tutorial by someone and it said in "Itemconstants.java" under the "switch (item.getId()) {" put "case (item id): underneathe it and it will make the item untradeable.
[CODE] public static boolean isTradeable(Item item) {
if (item.getDefinitions().isLended()
|| ItemConstants.getItemDefaultCharges(item.getId()) != -1)
return false;
switch (item.getId()) {
case 6199: //Mystery Box
default:
return true;
}
}
}[/CODE]

When I went ingame, I could still trade the mystery box. Does anyone know how to actually make an item untradeable? I will need to make chaotics untradeable aswel.
All help is greatly appreciated!

Emily x

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
Instead of

[code]
case 6199:
[/code]

Put

[code]
case 6199:
return false;
break;
[/code]

If you want to do multiple items do something like:

[code]
case 6199:
case 6300:
case 6200:
return false;
break;
[/code]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Citellum']Instead of

[code]
case 6199:
[/code]

Put

[code]
case 6199:
return false;
break;
[/code]

If you want to do multiple items do something like:

[code]
case 6199:
case 6300:
case 6200:
return false;
break;
[/code][/QUOTE]
Didn't work :L I can still trade m boxes

Share this post


Link to post
Share on other sites
  • 0
[code]
public static boolean isTradeable(Item item) {
if (item.getDefinitions().isLended()
|| ItemConstants.getItemDefaultCharges(item.getId()) != -1)
return false;
switch (item.getId()) {
case 6199: //Mystery Box
return false;
default:
return true;
}
}
[/code]

Just gotta add return false after the case id, and call this method in your Trade.java in addItem method (i think)

if (ItemConstants.isTradeable(item)) {
// stuff
return;
}

Share this post


Link to post
Share on other sites
  • 0
in config,java... there should be something like
[CODE]public static final int[] ITEM_TRADEABLE[/CODE]
under it should say untradeable item and a bunch of item codes. just add the id of the mystery box in there then save and compile Edited by entirety

Share this post


Link to post
Share on other sites
Sign in to follow this  

×