mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 19:35:10 -06:00
undo incorrect tabs/spaces conversion
This commit is contained in:
parent
d1550675bf
commit
868845eaa9
1 changed files with 109 additions and 109 deletions
|
|
@ -21,127 +21,127 @@ import java.util.Objects;
|
|||
@Initializable
|
||||
public final class SoftclayPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the clay item.
|
||||
*/
|
||||
private static final Item CLAY = new Item(Items.CLAY_434);
|
||||
/**
|
||||
* Represents the clay item.
|
||||
*/
|
||||
private static final Item CLAY = new Item(Items.CLAY_434);
|
||||
|
||||
/**
|
||||
* Represents the soft clay item.
|
||||
*/
|
||||
private static final Item SOFT_CLAY = new Item(Items.SOFT_CLAY_1761);
|
||||
/**
|
||||
* Represents the soft clay item.
|
||||
*/
|
||||
private static final Item SOFT_CLAY = new Item(Items.SOFT_CLAY_1761);
|
||||
|
||||
/**
|
||||
* Represents the bowl of water item.
|
||||
*/
|
||||
private static final Item BOWL_OF_WATER = new Item(Items.BOWL_OF_WATER_1921);
|
||||
/**
|
||||
* Represents the bowl of water item.
|
||||
*/
|
||||
private static final Item BOWL_OF_WATER = new Item(Items.BOWL_OF_WATER_1921);
|
||||
|
||||
/**
|
||||
* Represents the empty bowl item.
|
||||
*/
|
||||
private static final Item BOWL = new Item(Items.BOWL_1923);
|
||||
/**
|
||||
* Represents the empty bowl item.
|
||||
*/
|
||||
private static final Item BOWL = new Item(Items.BOWL_1923);
|
||||
|
||||
/**
|
||||
* Represents the empty bucket item.
|
||||
*/
|
||||
private static final Item BUCKET = new Item(Items.BUCKET_1925);
|
||||
/**
|
||||
* Represents the empty bucket item.
|
||||
*/
|
||||
private static final Item BUCKET = new Item(Items.BUCKET_1925);
|
||||
|
||||
/**
|
||||
* Represents the bucket of water item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_WATER = new Item(Items.BUCKET_OF_WATER_1929);
|
||||
/**
|
||||
* Represents the bucket of water item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_WATER = new Item(Items.BUCKET_OF_WATER_1929);
|
||||
|
||||
/**
|
||||
* Represents the jug item.
|
||||
*/
|
||||
private static final Item JUG = new Item(Items.JUG_1935);
|
||||
/**
|
||||
* Represents the jug item.
|
||||
*/
|
||||
private static final Item JUG = new Item(Items.JUG_1935);
|
||||
|
||||
/**
|
||||
* Represents the jug of water item.
|
||||
*/
|
||||
private static final Item JUG_OF_WATER = new Item(Items.JUG_OF_WATER_1937);
|
||||
/**
|
||||
* Represents the jug of water item.
|
||||
*/
|
||||
private static final Item JUG_OF_WATER = new Item(Items.JUG_OF_WATER_1937);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SoftclayPlugin} {@code Object}.
|
||||
*/
|
||||
public SoftclayPlugin() {
|
||||
super(434);
|
||||
}
|
||||
/**
|
||||
* Constructs a new {@code SoftclayPlugin} {@code Object}.
|
||||
*/
|
||||
public SoftclayPlugin() {
|
||||
super(434);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1921, ITEM_TYPE, this);
|
||||
addHandler(1929, ITEM_TYPE, this);
|
||||
addHandler(1937, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1921, ITEM_TYPE, this);
|
||||
addHandler(1929, ITEM_TYPE, this);
|
||||
addHandler(1937, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, SOFT_CLAY) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new Pulse(2, player) {
|
||||
int count;
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, SOFT_CLAY) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new Pulse(2, player) {
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (!SoftclayPlugin.this.create(player, event)) {
|
||||
return true;
|
||||
}
|
||||
return ++count >= amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (!SoftclayPlugin.this.create(player, event)) {
|
||||
return true;
|
||||
}
|
||||
return ++count >= amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(CLAY);
|
||||
}
|
||||
};
|
||||
if (player.getInventory().getAmount(CLAY) == 1) {
|
||||
create(player, event);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(CLAY);
|
||||
}
|
||||
};
|
||||
if (player.getInventory().getAmount(CLAY) == 1) {
|
||||
create(player, event);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a soft clay.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private boolean create(final Player player, NodeUsageEvent event) {
|
||||
Item removeItem = null;
|
||||
Item returnItem = null;
|
||||
if (event.getUsedItem().getId() == Items.BUCKET_OF_WATER_1929 || event.getBaseItem().getId() == Items.BUCKET_OF_WATER_1929) {
|
||||
removeItem = BUCKET_OF_WATER;
|
||||
returnItem = BUCKET;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.BOWL_OF_WATER_1921 || event.getBaseItem().getId() == Items.BOWL_OF_WATER_1921) {
|
||||
removeItem = BOWL_OF_WATER;
|
||||
returnItem = BOWL;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.JUG_OF_WATER_1937 || event.getBaseItem().getId() == Items.JUG_OF_WATER_1937) {
|
||||
removeItem = JUG_OF_WATER;
|
||||
returnItem = JUG;
|
||||
}
|
||||
/**
|
||||
* Creates a soft clay.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private boolean create(final Player player, NodeUsageEvent event) {
|
||||
Item removeItem = null;
|
||||
Item returnItem = null;
|
||||
if (event.getUsedItem().getId() == Items.BUCKET_OF_WATER_1929 || event.getBaseItem().getId() == Items.BUCKET_OF_WATER_1929) {
|
||||
removeItem = BUCKET_OF_WATER;
|
||||
returnItem = BUCKET;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.BOWL_OF_WATER_1921 || event.getBaseItem().getId() == Items.BOWL_OF_WATER_1921) {
|
||||
removeItem = BOWL_OF_WATER;
|
||||
returnItem = BOWL;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.JUG_OF_WATER_1937 || event.getBaseItem().getId() == Items.JUG_OF_WATER_1937) {
|
||||
removeItem = JUG_OF_WATER;
|
||||
returnItem = JUG;
|
||||
}
|
||||
|
||||
if (player.getInventory().containsItem(CLAY) && player.getInventory().containsItem(Objects.requireNonNull(removeItem))) {
|
||||
player.getInventory().remove(removeItem);
|
||||
player.getInventory().remove(CLAY);
|
||||
player.getPacketDispatch().sendMessage("You mix the clay and water. You now have some soft, workable clay.");
|
||||
player.getInventory().add(SOFT_CLAY);
|
||||
player.getInventory().add(returnItem);
|
||||
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.LUMBRIDGE, 0, 6) && player.getLocation().getRegionId() == 12341) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 6);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (player.getInventory().containsItem(CLAY) && player.getInventory().containsItem(Objects.requireNonNull(removeItem))) {
|
||||
player.getInventory().remove(removeItem);
|
||||
player.getInventory().remove(CLAY);
|
||||
player.getPacketDispatch().sendMessage("You mix the clay and water. You now have some soft, workable clay.");
|
||||
player.getInventory().add(SOFT_CLAY);
|
||||
player.getInventory().add(returnItem);
|
||||
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.LUMBRIDGE, 0, 6) && player.getLocation().getRegionId() == 12341) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 6);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue