Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Events;
- import org.bukkit.ChatColor;
- import org.bukkit.GameMode;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.WeatherType;
- import org.bukkit.World;
- import org.bukkit.block.Block;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.block.BlockPlaceEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class EventsClass implements Listener {
- @EventHandler
- public void onJoin (PlayerJoinEvent e) {
- Player p = e.getPlayer();
- if(p.hasPlayedBefore()) {
- e.setJoinMessage(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Hexigon" +
- ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "HF" + ChatColor.AQUA + ">>" +
- ChatColor.GRAY + "" + ChatColor.BOLD + " Welcome back " + ChatColor.LIGHT_PURPLE + ChatColor.BOLD +
- e.getPlayer().getName() + ChatColor.GRAY + "" + ChatColor.BOLD + " to" + ChatColor.DARK_PURPLE + ChatColor.BOLD + " Hexigon" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "HF!");
- }else {
- e.setJoinMessage(ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Hexigon" +
- ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "HF" + ChatColor.AQUA + ">>" +
- ChatColor.GREEN + "" + ChatColor.BOLD + " Welcome " + ChatColor.DARK_GREEN +
- "" + ChatColor.BOLD + e.getPlayer().getName() + ChatColor.GREEN + "" + ChatColor.BOLD + " to" +ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + " Hexigon" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "HF");
- }
- }
- @EventHandler
- public void onInteract(PlayerInteractEvent e) {
- Action a = e.getAction();
- Player p = (Player) e.getPlayer();
- Block b = e.getClickedBlock();
- if(a.equals(Action.LEFT_CLICK_BLOCK)) {
- if(b.getType().equals(Material.BEACON)) {
- if(p.hasPermission("hhf.block.day")) {
- if(p.getGameMode().equals(GameMode.SURVIVAL)) {
- p.setPlayerTime(1000, false);
- p.sendMessage(ChatColor.GREEN + "Your time has been set to" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Day!");
- }
- }
- }
- }
- if(a.equals(Action.RIGHT_CLICK_BLOCK)) {
- if(b.getType().equals(Material.REDSTONE_BLOCK)) {
- if(p.hasPermission("hhf.block.health-deduct")) {
- if(p.getGameMode().equals(GameMode.SURVIVAL)) {
- if(p.getHealth() != 0) {
- p.sendMessage(ChatColor.RED + "Your health has been" + ChatColor.RED + "" + ChatColor.BOLD + " Deducted!");
- p.setHealth(p.getHealth() - 1);
- p.playSound(p.getLocation(), Sound.BLOCK_CHORUS_FLOWER_DEATH, 1.0f, 1.0f);
- }
- }
- }
- if(b.getType().equals(Material.PURPUR_BLOCK)) {
- if(p.hasPermission("hhf.block.weather-clear")) {
- if(p.getGameMode().equals(GameMode.SURVIVAL)) {
- p.sendMessage(ChatColor.GREEN + "Your weather has been" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Cleared!");
- p.setPlayerWeather(WeatherType.CLEAR);
- p.playSound(p.getLocation(), Sound.ENTITY_ELDER_GUARDIAN_DEATH, 1.0f, 1.0f);
- }
- }
- }
- if(b.getType().equals(Material.OBSIDIAN)) {
- if(p.hasPermission("hhf.block.night")) {
- if(p.getGameMode().equals(GameMode.SURVIVAL)) {
- p.setPlayerTime(13000, false);
- p.sendMessage(ChatColor.DARK_GRAY + "Your time has been set to" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + " Night!");
- }
- }
- }
- if(b.getType().equals(Material.EMERALD_BLOCK)) {
- if(p.hasPermission("hhf.block.regen")) {
- if(p.getGameMode().equals(GameMode.SURVIVAL)) {
- if(p.getHealth() != 20);
- p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0));
- p.sendMessage(ChatColor.GREEN + "You have been given" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " Regeneration!");
- p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f);
- }
- }
- }
- }
- }
- }
- @EventHandler
- public void onPlace(BlockPlaceEvent e) {
- Block b = e.getBlock();
- Player p = e.getPlayer();
- World w = b.getWorld();
- if(b.getType().equals(Material.TNT)) {
- if(!p.isOp()) {
- if(p.hasPermission("hhf.tnt.stop")) {
- if(w.getName().equalsIgnoreCase("world")) {
- e.getBlockPlaced().setType(Material.BLAZE_POWDER);
- p.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "HHF" + ChatColor.RED + " - Griefing is not allowed in this world!");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement