1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.encrox.zombie.interactable;
import org.bukkit.util.BlockVector;
public class Lever extends Interactable {
private boolean toggle;
private Lever[] others;
public Lever(BlockVector bv, int cost, boolean toggle, Lever[] others) {
super(bv, cost);
this.toggle = toggle;
this.others = others;
}
public Lever(BlockVector bv, int cost, Lever[] others) {
this(bv, cost, false, others);
}
public Lever(BlockVector bv, int cost, boolean toggle) {
this(bv, cost, toggle, new Lever[0]);
}
public Lever(BlockVector bv, int cost) {
this(bv, cost, false);
}
public void toggle() {
toggle = !toggle;
for(int i = 0; i<others.length; i++)
others[i].toggle();
}
public boolean isToggled() {
return toggle;
}
}
|