Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.LYSwitch.lms;
- import me.LYSwitch.main.main;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.Sound;
- import org.bukkit.World;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.player.PlayerEvent;
- import org.bukkit.event.player.PlayerTeleportEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class LMSEvent implements Listener {
- public main plugin;
- public LMSEvent(main instance) {
- plugin = instance;
- }
- @EventHandler
- //The protection when you're spawned in
- public void LMSprot(PlayerTeleportEvent e) {
- Player p = e.getPlayer();
- if (plugin.lmsarena.contains(p.getName())) {
- p.addPotionEffect(new PotionEffect(
- PotionEffectType.DAMAGE_RESISTANCE, 10 * 20, 5));
- p.sendMessage(ChatColor.RED
- + "You have damage resistance for 10 seconds. RUN");
- }
- }
- @EventHandler
- //The death msg
- public void LMSmsg(PlayerDeathEvent e) {
- Player p = (Player) e.getEntity();
- if (plugin.lmsarena.contains(p.getName())) {
- Bukkit.getServer().broadcastMessage(
- p.getName() + " has been slain in the LMS arena.");
- plugin.lmsarena.remove(p.getName());
- plugin.lmshost.remove(p.getName());
- plugin.lmsjoin.remove(p.getName());
- }
- }
- @EventHandler
- //The lms end and lms end msg.
- public void LMSend(PlayerEvent e) {
- Player p = e.getPlayer();
- World w = p.getWorld();
- Location ploc = p.getLocation();
- int x = 0;
- int z = 50;
- int y = 0;
- if (plugin.lmsarena.size() == 1) {
- if(plugin.lmsarena.contains(p.getName())){
- Bukkit.getServer().broadcastMessage(
- ChatColor.RED + p.getName() + " has won the LMS!");
- p.teleport(new Location(w, x, y, z));
- p.playSound(ploc, Sound.FIREWORK_LARGE_BLAST2, 1, 5);
- p.sendMessage(ChatColor.GRAY + "Congratulations. You have been awarded 50 credits.");
- plugin.lmsarena.remove(p.getName());
- plugin.lmshost.remove(p.getName());
- plugin.lmsjoin.remove(p.getName());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement