-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestHead.java
More file actions
39 lines (33 loc) · 1.01 KB
/
TestHead.java
File metadata and controls
39 lines (33 loc) · 1.01 KB
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
39
package fr.iglee42.customheads;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
/*
* @author iglee42
*/
public class TestHead extends CustomHead implements Listener {
public TestHead(){
super("test", "iglee42");
// Name of the head | Name of the player for the head skin
}
@Override
public void activate(Player p){
super.activate(p);
p.sendMessage("§aYou activate the head :" + this.getName());
}
@Override
public void desactivate(Player p){
super.desactivate(p);
p.sendMessage("§cYou desactivate the head :" + this.getName());
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
if (event.getBlock().getType() == Material.TNT){
CustomHead h = HeadsManager.activatedHead.get(event.getPlayer());
h.desactivate(event.getPlayer());
event.getBlock().getLocation().getWorld().createExplosion(event.getBlock().getLocation(),10.0f);
}
}
}