Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package platinum.server.team.Listener;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.block.Block;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.BlockFromToEvent;
- import platinum.server.team.Config.Config;
- import platinum.server.team.Main;
- /**
- * Created by Lilret123 on 2/25/2015.
- */
- public class LavaListener implements Listener {
- Main plugin;
- public LavaListener(Main instance) {
- plugin = instance;
- }
- public void registerEvents() {
- this.plugin.getServer().getPluginManager().registerEvents(this, this.plugin);
- }
- int check;
- Config config = Main.config;
- @EventHandler
- public void onFlow(BlockFromToEvent e){
- if(!config.getBoolean("LavaFix.Configuration.LavaSlow.Enabled")){
- return;
- }
- else{
- int factor = config.getInt("LavaFix.Configuration.LavaSlow.Factor");
- Block b = e.getBlock();
- Material m = b.getType();
- if(m == Material.LAVA || m == Material.STATIONARY_LAVA) {
- Material lava = Material.LAVA;
- byte data = b.getData();
- if (check < factor) {
- e.setCancelled(true);
- check++;
- b.setType(lava);
- b.setData(data);
- Bukkit.getServer().broadcastMessage("Type is: " + lava + data);
- }
- else{
- check = 0;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement