質問編集履歴
1
文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,51 @@
|
|
1
1
|
###質問
|
2
2
|
|
3
|
-
|
3
|
+
MinecraftのPluginの作成をしていたのですが、`b.getType().equals(Material.EMERALD_BLOCK`のequalsがわかりません。==と何が違うのでしょうか?超初心者なので、極力分かりやすくお願いします。
|
4
|
+
|
5
|
+
```java
|
6
|
+
|
7
|
+
public class EventsClass implements Listener{
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
@EventHandler
|
12
|
+
|
13
|
+
public void onInteract(PlayerInteractEvent event) {
|
14
|
+
|
15
|
+
Action a = event.getAction();
|
16
|
+
|
17
|
+
Player p = event.getPlayer();
|
18
|
+
|
19
|
+
Block b = event.getClickedBlock();
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
if(a.equals(Action.LEFT_CLICK_BLOCK)) {
|
24
|
+
|
25
|
+
if(b.getType().equals(Material.EMERALD_BLOCK)) {
|
26
|
+
|
27
|
+
p.sendMessage(ChatColor.LIGHT_PURPLE + "test");
|
28
|
+
|
29
|
+
if(p.getHealth() == 20) {
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
}else {
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```
|