Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.TheComboxD.main;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.Random;
- import java.util.UUID;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import java.util.regex.Pattern;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Effect;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.block.Block;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Item;
- import org.bukkit.entity.LivingEntity;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Snowball;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.block.SignChangeEvent;
- import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
- import org.bukkit.event.entity.EntityDamageByEntityEvent;
- import org.bukkit.event.entity.EntityDamageEvent;
- import org.bukkit.event.entity.ItemDespawnEvent;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.inventory.InventoryCloseEvent;
- import org.bukkit.event.player.AsyncPlayerChatEvent;
- import org.bukkit.event.player.PlayerExpChangeEvent;
- import org.bukkit.event.player.PlayerInteractEntityEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerLoginEvent;
- import org.bukkit.event.player.PlayerPickupItemEvent;
- import org.bukkit.event.player.PlayerRespawnEvent;
- import org.bukkit.event.server.ServerListPingEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.scoreboard.DisplaySlot;
- import org.bukkit.scoreboard.Objective;
- import org.bukkit.scoreboard.Scoreboard;
- import com.sk89q.worldedit.bukkit.WorldEditPlugin;
- import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
- import com.xxmicloxx.NoteBlockAPI.NBSDecoder;
- import com.xxmicloxx.NoteBlockAPI.Song;
- import Adventskalendar.Calendar;
- import Adventskalendar.CalendarDoor;
- import Adventskalendar.CalendarField;
- import Adventskalendar.ClientSideBlockHandler;
- import Adventskalendar.commands;
- import Clan.Clan;
- import Clan.PlayerData;
- import Commands.Ban;
- import Commands.Combat;
- import Commands.CommandAFK;
- import Commands.CommandBodysee;
- import Commands.CommandBroadcast;
- import Commands.CommandCB;
- import Commands.CommandCC;
- import Commands.CommandCMDSpy;
- import Commands.CommandChunkinfo;
- import Commands.CommandClear;
- import Commands.CommandConfig;
- import Commands.CommandDelSperre;
- import Commands.CommandDelWarn;
- import Commands.CommandDis;
- import Commands.CommandDrunk;
- import Commands.CommandEnderchest;
- import Commands.CommandEvent;
- import Commands.CommandEventXP;
- import Commands.CommandFeed;
- import Commands.CommandFill;
- import Commands.CommandFly;
- import Commands.CommandFlyAll;
- import Commands.CommandForce;
- import Commands.CommandFrieden;
- import Commands.CommandGamemode;
- import Commands.CommandGiveAllNew;
- import Commands.CommandGod;
- import Commands.CommandGoldswitch;
- import Commands.CommandHat;
- import Commands.CommandHeal;
- import Commands.CommandHealAll;
- import Commands.CommandInvsee;
- import Commands.CommandIteminfo;
- import Commands.CommandKick;
- import Commands.CommandKill;
- import Commands.CommandKopf;
- import Commands.CommandLag;
- import Commands.CommandLogoutall;
- import Commands.CommandLotto;
- import Commands.CommandMOTD;
- import Commands.CommandMSG;
- import Commands.CommandMSGSpy;
- import Commands.CommandMore;
- import Commands.CommandMute;
- import Commands.CommandOPS;
- import Commands.CommandPickup;
- import Commands.CommandPinfo;
- import Commands.CommandPing;
- import Commands.CommandPvP;
- import Commands.CommandRandom;
- import Commands.CommandRandomTP;
- import Commands.CommandRegeln;
- import Commands.CommandRenameRelore;
- import Commands.CommandRepair;
- import Commands.CommandRestart;
- import Commands.CommandSign;
- import Commands.CommandSilentium;
- import Commands.CommandSpawn;
- import Commands.CommandSpeed;
- import Commands.CommandSperre;
- import Commands.CommandStack;
- import Commands.CommandSudo;
- import Commands.CommandSupport;
- import Commands.CommandT;
- import Commands.CommandTP;
- import Commands.CommandTPA;
- import Commands.CommandTPHere;
- import Commands.CommandTeam;
- import Commands.CommandTime;
- import Commands.CommandTpAll;
- import Commands.CommandUmfrage;
- import Commands.CommandVanish;
- import Commands.CommandWarn;
- import Commands.CommandWarns;
- import Commands.CommandWordfilter;
- import Commands.CommandWorkbench;
- import Commands.CommandWtp;
- import Commands.CommandZaubertisch;
- import Commands.CommandZeitsperre;
- import Commands.CountdownCommand;
- import Commands.Mute;
- import Commands.PlayerCombatTaggedEvent;
- import Commands.PvPEvent;
- import Commands.ReportSystem;
- import Commands.Stats;
- import Listener.CMDEvent;
- import Listener.CommandMap;
- import Listener.Events;
- import Listener.GlobalListener;
- import Listener.JoinListener;
- import Listener.MainEvents;
- import Listener.OnPlayerChatListener;
- import Listener.PreprocessListener;
- import NameTag.Healthbar;
- import NameTag.PexTagEdit;
- public class main
- extends JavaPlugin
- implements Listener
- {
- public static Map<String, String> names = new HashMap();
- public static final Logger logger = Logger.getLogger("Minecraft");
- public static int slots;
- public static main inst;
- public static int taskid = 0;
- public static Scoreboard s;
- public static Location eventspawn;
- public static Location eventlobby;
- public static List<Player> godMode = new ArrayList();
- private static SQL sqlManager;
- public static boolean eventstart = false;
- public static HashMap<Item, LootProtection> lootItems = new HashMap();
- public static HashMap<Player, Integer> auslogg = new HashMap();
- public static List<String> lp = new ArrayList();
- public static List<String> espieler = new ArrayList();
- public static int combatTime;
- public static main plugin;
- public static ArrayList<String> event = new ArrayList();
- public static final List<String> tplist = new ArrayList();
- public static int Countdown = 1;
- public static boolean isRunning = false;
- public static File locations = new File("plugins/BMW/", "locations.yml");
- public static FileConfiguration locationsCfg = YamlConfiguration.loadConfiguration(locations);
- public static HashMap<Player, Player> SupportChat = new HashMap();
- public static File ipfile = new File("plugins/BMW/", "ips.yml");
- public static FileConfiguration ips = YamlConfiguration.loadConfiguration(ipfile);
- public static File sqlfile = new File("plugins/BMW/", "sql.yml");
- public static FileConfiguration sqlCfg = YamlConfiguration.loadConfiguration(locations);
- public static String prefix = "§8§l> ";
- public static String KeineRechte = prefix + "§cDu hast keinen Zugriff auf diesen Befehl!";
- public static String GibtsNet = prefix + "§cDiesen Befehl gibt es nicht! §8§l/support§c!";
- public static String pvpeventprefix = "§bPvPEvent§8§l> ";
- public static String eventprefix = "§bEvent§8§l> ";
- public static List<Player> vanishedPlayer = new ArrayList();
- public static List<Player> afkPlayers = new ArrayList();
- public static List<Player> playersInvsee = new ArrayList();
- public static List<Player> PlayerInEnderchest = new ArrayList();
- public static List<Player> inBodysee = new ArrayList();
- public static HashMap<UUID, Mute> mutedPlayers = new HashMap();
- String prefix2 = "§§8§§l>";
- public static Map<Player, Player> LastMessageContacts = new HashMap();
- public static HashMap<Player, String> chat = new HashMap();
- public static boolean all;
- public static List<UUID> players = new ArrayList();
- public static HashMap<Player, CommandMSG> messageSpyPlayers = new HashMap();
- public static HashMap<Player, CommandMSG> commandSpyPlayers = new HashMap();
- public static Map<UUID, Long> healCooldown = new HashMap();
- public static Map<Player, TPDelay> teleportDelays = new HashMap();
- public static Map<Player, Location> lastPositions = new HashMap();
- public static Map<Player, Long> teleportCooldowns = new HashMap();
- public static Map<Player, CommandTPA> tpRequests = new HashMap();
- public static List<String> lore = new ArrayList();
- public static ArrayList<Player> inEnchanting = new ArrayList();
- public static Calendar calendar = new Calendar();
- public static Song christmasSong = NBSDecoder.parse(new File("plugins/BMW", "christmas.nbs"));
- public static EventXP eventXP = EventXP.NONE;
- public static String MySQL_host = "";
- public static String MySQL_user = "";
- public static String MySQL_pass = "";
- public static String MySQL_db = "";
- public static String MySQL_port = "";
- public static String adventprefix = "§cADVENT §8§l> ";
- public static WorldEditPlugin worldEdit;
- public main()
- {
- plugin = this;
- inst = this;
- }
- @EventHandler
- public void onJoin(PlayerJoinEvent e)
- {
- Player p = e.getPlayer();
- String name = p.getName();
- if (!getConfig().getBoolean("Spieler." + e.getPlayer().getName() + ".Gejoint"))
- {
- int ids = getConfig().getInt("Config.Userid");
- ids++;
- getConfig().set("Config.Userid", Integer.valueOf(ids));
- getConfig().set("Spieler." + e.getPlayer().getName() + ".Gejoint", Boolean.valueOf(true));
- saveConfig();
- Location loc = new Location(plugin.getServer().getWorld(CommandSpawn.locationsCfg.getString("spawn.world")), CommandSpawn.locationsCfg.getDouble("spawn.x"), CommandSpawn.locationsCfg.getDouble("spawn.y"), CommandSpawn.locationsCfg.getDouble("spawn.z"));
- Bukkit.broadcastMessage("§7[]== §bWillkommen auf §e§lBMW §e" + e.getPlayer().getName() + " §7==[] §b[#" + getConfig().getInt("Config.Userid") + "§b]");
- p.teleport(loc);
- p.sendMessage("§7§l[]=================================================[]");
- p.sendMessage("§7§lWillkommen auf dem §e§lBMW-Server!");
- p.sendMessage("§7§l[]==================================================[]");
- ItemStack axe = new ItemStack(Material.DIAMOND_SWORD);
- axe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 5);
- axe.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 2);
- ItemMeta meta0 = axe.getItemMeta();
- meta0.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- axe.setItemMeta(meta0);
- p.getInventory().addItem(new ItemStack[] { axe });
- ItemStack is1 = new ItemStack(Material.DIAMOND_HELMET);
- is1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
- ItemMeta meta1 = is1.getItemMeta();
- meta1.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is1.setItemMeta(meta1);
- p.getInventory().setHelmet(is1);
- ItemStack is2 = new ItemStack(Material.DIAMOND_CHESTPLATE);
- is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
- ItemMeta meta2 = is2.getItemMeta();
- meta2.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is2.setItemMeta(meta2);
- p.getInventory().setChestplate(is2);
- ItemStack is3 = new ItemStack(Material.DIAMOND_LEGGINGS);
- is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
- ItemMeta meta3 = is3.getItemMeta();
- meta3.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is3.setItemMeta(meta3);
- p.getInventory().setLeggings(is3);
- ItemStack is4 = new ItemStack(Material.DIAMOND_BOOTS);
- is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
- ItemMeta meta4 = is4.getItemMeta();
- meta4.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is4.setItemMeta(meta4);
- p.getInventory().setBoots(is4);
- ItemStack is5 = new ItemStack(Material.POTION, 64, (short)16421);
- ItemMeta meta5 = is5.getItemMeta();
- meta5.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is5.setItemMeta(meta5);
- ItemStack is7 = new ItemStack(Material.POTION, 64, (short)16425);
- ItemMeta meta7 = is7.getItemMeta();
- meta7.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is7.setItemMeta(meta7);
- ItemStack is8 = new ItemStack(Material.POTION, 64, (short)16418);
- ItemMeta meta8 = is8.getItemMeta();
- meta8.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is8.setItemMeta(meta8);
- is8.setItemMeta(meta8);
- ItemStack is9 = new ItemStack(Material.POTION, 64, (short)16451);
- ItemMeta meta9 = is9.getItemMeta();
- meta9.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is9.setItemMeta(meta9);
- ItemStack is10 = new ItemStack(Material.GOLDEN_APPLE, 3, (short)1);
- ItemMeta meta10 = is10.getItemMeta();
- meta10.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is10.setItemMeta(meta10);
- ItemStack is11 = new ItemStack(Material.POTION, 64, (short)16417);
- ItemMeta meta11 = is11.getItemMeta();
- meta11.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
- is11.setItemMeta(meta11);
- is10.setItemMeta(meta10);
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is10 });
- p.getInventory().addItem(new ItemStack[] { is7 });
- p.getInventory().addItem(new ItemStack[] { is8 });
- p.getInventory().addItem(new ItemStack[] { is9 });
- p.getInventory().addItem(new ItemStack[] { is11 });
- p.getInventory().addItem(new ItemStack[] { new ItemStack(Material.SNOW_BALL, 5) });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- p.getInventory().addItem(new ItemStack[] { is5 });
- return;
- }
- PlayerData pd = new PlayerData(e.getPlayer().getName());
- p.sendMessage("§7[]======= §e§lBMW §7=======[]");
- p.sendMessage("§bWillkommen zur§ck §9" + e.getPlayer().getName() + " §bauf BMW");
- p.sendMessage("§bKills: §a" + pd.getKills());
- p.sendMessage("§bTode: §a" + pd.getDeaths());
- p.sendMessage("§bKDR: §a" + pd.getKDR());
- p.sendMessage("§bWarns: §a" + pd.getWarns());
- if ((p.getGameMode() == GameMode.CREATIVE) && (!p.hasPermission("pvp.creativebypass"))) {
- p.setGameMode(GameMode.SURVIVAL);
- }
- if (!ips.contains(p.getAddress().getAddress().getHostAddress()))
- {
- List iplayers = new ArrayList();
- iplayers.add(p.getName());
- ips.set(p.getAddress().getAddress().getHostAddress(), iplayers);
- try
- {
- ips.save(ipfile);
- }
- catch (IOException e1)
- {
- e1.printStackTrace();
- }
- }
- else
- {
- List iplayers = new ArrayList();
- iplayers = ips.getStringList(p.getAddress().getAddress().getHostAddress());
- if (!iplayers.contains(p.getName()))
- {
- iplayers.add(p.getName());
- ips.set(p.getAddress().getAddress().getHostAddress(), iplayers);
- try
- {
- ips.save(ipfile);
- }
- catch (IOException e1)
- {
- e1.printStackTrace();
- }
- Collection<? extends Player> arrayOfPlayer;
- int i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).size();
- Collection<? extends Player> arrayOfPlayer1;
- int j = (arrayOfPlayer1 = Bukkit.getOnlinePlayers()).size();
- for (int i1 = 0; i1 < j; i1++)
- {
- Player online = (Player)arrayOfPlayer.toArray()[i];
- if (online.hasPermission("pvp.sameip"))
- {
- online.sendMessage("§7[]======= §eBMWSameIP 7=======[]");
- online.sendMessage("§a" + p.getName() + " §chat die gleiche IP wie §a" + (String)ips.getStringList(p.getAddress().getAddress().getHostAddress()).get(0) + "§c !!!");
- online.sendMessage("§7[]=========================[]");
- }
- }
- }
- }
- }
- @EventHandler
- public void onClose(InventoryCloseEvent e)
- {
- Player p = (Player)e.getPlayer();
- if (!(e.getPlayer() instanceof Player)) {
- return;
- }
- if (playersInvsee.contains(p)) {
- playersInvsee.remove(p);
- }
- if (PlayerInEnderchest.contains(p)) {
- PlayerInEnderchest.remove(p);
- }
- if (inBodysee.contains(p)) {
- inBodysee.remove(p);
- }
- if(inEnchanting.contains(p)) {
- inEnchanting.remove(p);
- }
- }
- @EventHandler
- public void onEntityInteract(PlayerInteractEntityEvent e)
- {
- Player p = e.getPlayer();
- Entity ent = e.getRightClicked();
- if (ent.getType() == EntityType.MINECART_CHEST)
- {
- e.setCancelled(true);
- p.sendMessage(main.prefix+"§cUm einen Bug zu verhindern darfst du nicht mit Kisten-Minecarts interagieren.");
- return;
- }
- }
- @EventHandler
- public void onExpChange(PlayerExpChangeEvent e)
- {
- int amount = e.getAmount();
- if (eventXP != eventXP.NONE)
- {
- amount *= eventXP.getMultiplier();
- e.setAmount(amount);
- }
- }
- @EventHandler
- public void onCliick(InventoryClickEvent e)
- {
- if (!(e.getWhoClicked() instanceof Player)) {
- return;
- }
- Player p = (Player)e.getWhoClicked();
- Inventory inv = e.getInventory();
- if ((PlayerInEnderchest.contains(p)) &&
- (!p.hasPermission("pvp.enderchest.edit")))
- {
- e.setCancelled(true);
- return;
- }
- if ((playersInvsee.contains(p)) &&
- (!p.hasPermission("pvp.invsee.edit")))
- {
- e.setCancelled(true);
- return;
- }
- if ((inBodysee.contains(p)) && (!p.hasPermission("pvp.bodysee.edit")))
- {
- e.setCancelled(true);
- return;
- }
- }
- @EventHandler
- public void onPlayerLogin(EntityDamageByEntityEvent event)
- {
- Player p = (Player)event.getEntity();
- if (godMode.contains(p)) {
- event.setCancelled(true);
- }
- }
- @EventHandler
- public void onKilld(PlayerDeathEvent e){
- Player p = e.getEntity();
- final Player killer = p.getKiller();
- killer.sendMessage(main.prefix+"§7Der Loot wurde für kurze Zeit geschützt!");
- final List<Item> droppedItems = new ArrayList();
- for (ItemStack drops : e.getDrops()) {
- if ((drops != null) && (drops.getType() != Material.AIR))
- {
- ItemMeta meta = drops.getItemMeta();
- List<String> lore = meta.getLore();
- if (lore == null) {
- lore = new ArrayList();
- }
- meta.setLore(lore);
- drops.setItemMeta(meta);
- Item item = p.getWorld().dropItemNaturally(p.getLocation(), drops);
- droppedItems.add(item);
- }
- }
- e.getDrops().clear();
- createLootProtection(droppedItems, killer.getUniqueId());
- int count = Bukkit.getScheduler().scheduleSyncDelayedTask(main.plugin, new Runnable() {
- public void run() {
- if(lootItems.containsKey(droppedItems)){
- lootItems.remove(droppedItems);
- LootProtection prot = (LootProtection)lootItems.get(droppedItems);
- prot.getItems().remove(droppedItems);
- killer.sendMessage(main.prefix+"§7Jeder kann jetzt die Items aufsammeln!");
- }
- }
- }, 600L);
- }
- @EventHandler(priority=EventPriority.LOWEST)
- public void onPlayerLogin(PlayerLoginEvent event)
- {
- if ((Bukkit.getServer().hasWhitelist()) && (!event.getPlayer().isWhitelisted())) {
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "§6§lWartungsarbeiten! Bald wieder on!");
- }
- }
- @EventHandler
- public void onPickup(PlayerPickupItemEvent e)
- {
- Player p = e.getPlayer();
- Item item = e.getItem();
- if (lootItems.containsKey(item)) {
- LootProtection prot = getLootProtection(item);
- if (prot.getOwner() == p.getUniqueId())
- {
- e.setCancelled(false);
- removeLootProtection(item);
- clearRandomKey(item);
- return;
- }
- if (!prot.isFFA())
- {
- e.setCancelled(true);
- return;
- }
- e.setCancelled(false);
- removeLootProtection(item);
- clearRandomKey(item);
- }
- }
- @EventHandler
- public void onDespawn(ItemDespawnEvent e)
- {
- Item item = e.getEntity();
- if (!lootItems.containsKey(item)) {
- return;
- }
- removeLootProtection(item);
- }
- private void clearRandomKey(Item item)
- {
- ItemStack st = item.getItemStack();
- ItemMeta meta = st.getItemMeta();
- List<String> lore = meta.getLore();
- if (lore == null) {
- return;
- }
- lore.remove(lore.size() - 1);
- meta.setLore(lore);
- st.setItemMeta(meta);
- item.setItemStack(st);
- }
- @EventHandler
- public void onRespawn(PlayerRespawnEvent e)
- {
- Player p = e.getPlayer();
- if (!PvPEvent.inEvent.contains(p))
- {
- Location loc1 = new Location(plugin.getServer().getWorld(CommandSpawn.locationsCfg.getString("spawn.world")), CommandSpawn.locationsCfg.getDouble("spawn.x"), CommandSpawn.locationsCfg.getDouble("spawn.y"), CommandSpawn.locationsCfg.getDouble("spawn.z"));
- e.setRespawnLocation(loc1);
- }
- }
- @EventHandler
- public void onChat1(AsyncPlayerChatEvent event1)
- {
- Player p = event1.getPlayer();
- if (event1.getMessage().startsWith("7"))
- {
- event1.setCancelled(true);
- p.sendMessage("§8§l> §eDu solltest ein / statt einer 7 benutzen!");
- }
- }
- @EventHandler
- public void onChat(AsyncPlayerChatEvent ev)
- {
- Player p = ev.getPlayer();
- String m = ev.getMessage().toLowerCase();
- if ((m.contains("meinpvp")) || (m.contains("muxcraft")) || (m.contains("minetime")) || (m.contains("ultimacraft")) || (m.contains("(punkt)")) || (m.contains("emperion")) || (m.contains("minecrime")) || (m.contains("soulpvp")) || (m.contains(".minecraft.gs")) || (m.contains(".minecraft.to")) || (m.contains(".nitrado.net")) || (m.contains("pvpfeeling")))
- {
- ev.setCancelled(true);
- p.chat("BMW ist der beste Server!");
- Collection<? extends Player> arrayOfPlayer;
- int j = (arrayOfPlayer = Bukkit.getOnlinePlayers()).size();
- for (int i = 0; i < j; i++)
- {
- Player of = (Player)arrayOfPlayer.toArray()[i];
- if (of.hasPermission("pvp.werbung")) {
- of.sendMessage("§8§l> §cWerbung: §b" + p.getName());
- }
- }
- }
- }
- @EventHandler
- public void onInteract1(PlayerInteractEvent e)
- {
- Player p = e.getPlayer();
- PlayerData pd = new PlayerData(p.getName());
- if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
- {
- Block b = e.getClickedBlock();
- if (b.getType() == Material.LEVER)
- {
- Location blockLocation = CommandRandomTP.randomTPBlockLocation;
- if ((blockLocation != null) &&
- (blockLocation.equals(b.getLocation())))
- {
- e.setCancelled(true);
- if (!pd.hasFreeTP())
- {
- p.sendMessage(prefix + "§cDu hast keinen Teleport mehr frei!");
- return;
- }
- lastPositions.put(p, p.getLocation());
- teleportToRandomPosition(p, -45000, 45000);
- p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F);
- p.playEffect(p.getLocation(), Effect.ENDER_SIGNAL, null);
- p.sendMessage(prefix + "§aDu wurdest an eine zufällige Position teleportiert!");
- pd.setFreeTP(false);
- }
- }
- }
- }
- @EventHandler(priority=EventPriority.NORMAL)
- public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
- {
- if ((event.getDamager() instanceof Snowball))
- {
- Snowball snowball = (Snowball)event.getDamager();
- Entity hitBySnowball = event.getEntity();
- LivingEntity shooter = (LivingEntity)snowball.getShooter();
- if ((hitBySnowball instanceof Player))
- {
- Player player = (Player)hitBySnowball;
- player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500, 0));
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 500, 0));
- if ((shooter instanceof Player))
- {
- Player sp = (Player)shooter;
- sp.sendMessage(prefix + "§aDu hast " + ChatColor.YELLOW + player.getName() + "§a getroffen!");
- player.sendMessage(prefix + "§aDu wurdest von " + ChatColor.YELLOW + sp.getName() + "§a getroffen!");
- player.sendMessage(prefix + "§aDu bist nun Blind für 25 Sekunden.");
- }
- }
- }
- }
- @EventHandler
- public void onChat22(AsyncPlayerChatEvent ev)
- {
- Player p = ev.getPlayer();
- if (mutedPlayers.containsKey(p.getUniqueId()))
- {
- Mute mute = (Mute)mutedPlayers.get(p.getUniqueId());
- boolean muted = true;
- if (Mute.getMuteTime() != -1L)
- {
- long diff = Mute.getMuteTime() - System.currentTimeMillis();
- if (diff < 0L)
- {
- mutedPlayers.remove(p.getUniqueId());
- muted = false;
- }
- }
- if (muted)
- {
- if (CommandSupport.user.containsKey(p)) {
- ev.setCancelled(false);
- }
- ev.setCancelled(true);
- long time = Mute.getMuteTime() == -1L ? -1L : Mute.getMuteTime() - System.currentTimeMillis();
- p.sendMessage(prefix + "§9Du bist derzeit gemutet! Fragen? §6§l/support");
- return;
- }
- }
- }
- @EventHandler
- public void onChat2(AsyncPlayerChatEvent ev)
- {
- Player p = ev.getPlayer();
- String m = ev.getMessage().toLowerCase();
- if (!p.isOp()) {
- if (chat.containsKey(p))
- {
- String message = (String)chat.get(p);
- if (m.equalsIgnoreCase(message))
- {
- p.sendMessage(prefix + "§cDeine Nachricht wurde als Spam markiert!");
- ev.setCancelled(true);
- }
- chat.remove(p);
- chat.put(p, m);
- }
- else
- {
- chat.put(p, m);
- }
- }
- if (!p.hasPermission("pvp.protection.prevent"))
- {
- if (checkForBadWords(ev)) {
- return;
- }
- }
- }
- @EventHandler
- public void onPrepareEnchant(PrepareItemEnchantEvent e)
- {
- Player p = e.getEnchanter();
- if (main.inEnchanting.contains(p))
- {
- e.getExpLevelCostsOffered()[0] = 1;
- e.getExpLevelCostsOffered()[1] = 10;
- e.getExpLevelCostsOffered()[2] = 30;
- }
- }
- @EventHandler
- public void onPing(ServerListPingEvent e)
- {
- if (main.slots == 0) {
- main.slots = Bukkit.getMaxPlayers();
- }
- try
- {
- e.setMotd(ChatColor.translateAlternateColorCodes('&', this.plugin
- .getConfig().getString("System.motd")));
- e.setMaxPlayers(main.slots);
- }
- catch (NullPointerException e1)
- {
- System.out.println("Fehler bei der Motd!");
- }
- }
- @EventHandler
- public void onSignChange(SignChangeEvent e)
- {
- Player p = e.getPlayer();
- if (p.hasPermission("pvp.sign.color")) {
- for (int i = 0; i < e.getLines().length; i++)
- {
- String line = e.getLine(i);
- line = ChatColor.translateAlternateColorCodes('&', line);
- e.setLine(i, line);
- }
- }
- }
- @EventHandler
- public void onEntityDamage(EntityDamageEvent event)
- {
- if (!(event.getEntity() instanceof Player)) {
- return;
- }
- if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
- event.setCancelled(true);
- }
- }
- @EventHandler
- public void on(PlayerDeathEvent e)
- {
- Player p = e.getEntity();
- Player k = p.getKiller();
- PlayerData kd = new PlayerData(k.getName());
- PlayerData pd = new PlayerData(p.getName());
- kd.addKills(1);
- pd.addDeaths(1);
- if (((p.getKiller() instanceof Player)) && ((p instanceof Player)) && (p.isDead()))
- {
- p.sendMessage(prefix + "§cDu wurdest von §e" + k.getName() + " §cgetötet!");
- k.sendMessage(prefix + "§aDu hast §e" + p.getName() + " §agetötet!");
- e.setDeathMessage(null);
- }
- }
- @EventHandler(priority=EventPriority.HIGH)
- public void onDeath(PlayerDeathEvent e)
- {
- Player p = e.getEntity();
- e.setDroppedExp(0);
- }
- public void onEnable()
- {
- new BroadcastMessages(this);
- plugin = this;
- new Calendar();
- PexTagEdit.onEnable(this);
- taskid = getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable()
- {
- public void run()
- {
- Collection<? extends Player> arrayOfPlayer;
- int j = (arrayOfPlayer = Bukkit.getServer().getOnlinePlayers()).size();
- for (int i = 0; i < j; i++)
- {
- Player ps = (Player)arrayOfPlayer.toArray()[i];
- ps.sendMessage("§7[--- §eBMW §7---]");
- int players = Bukkit.getServer().getOnlinePlayers().size();
- int maxplayers = 250;
- ps.sendMessage("§6" + players + " / " + maxplayers + " §bsind online");
- }
- }
- }, 0L, 200000L);
- try
- {
- ips.save(ipfile);
- }
- catch (IOException localIOException1) {}
- inst = this;
- slots = getConfig().getInt("Slots");
- logger.log(Level.INFO, "BMW> Commands werden geladen...");
- ClientSideBlockHandler.onEnable();
- getCommand("giveall").setExecutor(new CommandGiveAllNew());
- getCommand("cc").setExecutor(new CommandCC());
- getCommand("silentium").setExecutor(new CommandSilentium());
- getCommand("umfrage").setExecutor(new CommandUmfrage());
- getCommand("ja").setExecutor(new CommandUmfrage());
- getCommand("goldswitch").setExecutor(new CommandGoldswitch());
- getCommand("sudo").setExecutor(new CommandSudo());
- getCommand("bodysee").setExecutor(new CommandBodysee());
- getCommand("iteminfo").setExecutor(new CommandIteminfo());
- getCommand("chunkinfo").setExecutor(new CommandChunkinfo());
- getCommand("workbench").setExecutor(new CommandWorkbench());
- getCommand("heal").setExecutor(new CommandHeal());
- getCommand("randomtp").setExecutor(new CommandRandomTP());
- getCommand("hat").setExecutor(new CommandHat());
- getCommand("eventxp").setExecutor(new CommandEventXP());
- getCommand("tpall").setExecutor(new CommandTpAll());
- getCommand("nein").setExecutor(new CommandUmfrage());
- getCommand("mute").setExecutor(new CommandMute());
- getCommand("mutes").setExecutor(new CommandMute());
- getCommand("unmute").setExecutor(new CommandMute());
- getCommand("spawn").setExecutor(new CommandSpawn());
- getCommand("setspawn").setExecutor(new CommandSpawn());
- getCommand("afk").setExecutor(new CommandAFK());
- getCommand("tpa").setExecutor(new CommandTPA(null, null, false));
- getCommand("tpahere").setExecutor(new CommandTPA(null, null, false));
- getCommand("tpaall").setExecutor(new CommandTPA(null, null, false));
- getCommand("tpaccept").setExecutor(new CommandTPA(null, null, false));
- getCommand("tpdeny").setExecutor(new CommandTPA(null, null, false));
- getCommand("team").setExecutor(new CommandTeam());
- getCommand("ergebnis").setExecutor(new CommandUmfrage());
- getCommand("support").setExecutor(new CommandSupport());
- getCommand("pvp").setExecutor(new CommandPvP());
- getCommand("random").setExecutor(new CommandRandom());
- getCommand("motd").setExecutor(new CommandMOTD());
- getCommand("lag").setExecutor(new CommandLag());
- getCommand("zaubertisch").setExecutor(new CommandZaubertisch());
- getCommand("wordfilter").setExecutor(new CommandWordfilter());
- getCommand("gamemode").setExecutor(new CommandGamemode());
- getCommand("sperre").setExecutor(new CommandSperre());
- getCommand("sign").setExecutor(new CommandSign());
- getCommand("zeitsperre").setExecutor(new CommandZeitsperre());
- getCommand("time").setExecutor(new CommandTime());
- getCommand("msg").setExecutor(new CommandMSG(true));
- getCommand("r").setExecutor(new CommandMSG(true));
- getCommand("socialspy").setExecutor(new CommandMSGSpy());
- getCommand("vanish").setExecutor(new CommandVanish());
- getCommand("delsperre").setExecutor(new CommandDelSperre());
- getCommand("warn").setExecutor(new CommandWarn());
- getCommand("warns").setExecutor(new CommandWarns());
- getCommand("delwarn").setExecutor(new CommandDelWarn());
- getCommand("ping").setExecutor(new CommandPing());
- getCommand("god").setExecutor(new CommandGod());
- getCommand("frieden").setExecutor(new CommandFrieden());
- getCommand("annehmen").setExecutor(new CommandFrieden());
- getCommand("commandspy").setExecutor(new CommandCMDSpy());
- getCommand("ablehnen").setExecutor(new CommandFrieden());
- getCommand("logoutall").setExecutor(new CommandLogoutall());
- getCommand("more").setExecutor(new CommandMore());
- getCommand("kopf").setExecutor(new CommandKopf());
- getCommand("kick").setExecutor(new CommandKick());
- getCommand("flyall").setExecutor(new CommandFlyAll());
- getCommand("kill").setExecutor(new CommandKill());
- getCommand("stats").setExecutor(new Stats(this));
- getCommand("rename").setExecutor(new CommandRenameRelore());
- getCommand("abfall").setExecutor(new CommandDis());
- getCommand("relore").setExecutor(new CommandRenameRelore());
- getCommand("c").setExecutor(new Clan(this));
- getCommand("invsee").setExecutor(new CommandInvsee());
- getCommand("enderchest").setExecutor(new CommandEnderchest());
- getCommand("drunk").setExecutor(new CommandDrunk());
- getCommand("wtp").setExecutor(new CommandWtp());
- getCommand("cfg").setExecutor(new CommandConfig());
- getCommand("healall").setExecutor(new CommandHealAll());
- getCommand("regeln").setExecutor(new CommandRegeln());
- getCommand("stack").setExecutor(new CommandStack(this));
- getCommand("ifix").setExecutor(new CommandRepair());
- getCommand("broadcast").setExecutor(new CommandBroadcast());
- getCommand("user").setExecutor(new CommandPinfo());
- getCommand("pickup").setExecutor(new CommandPickup());
- getCommand("fill").setExecutor(new CommandFill());
- getCommand("force").setExecutor(new CommandForce());
- getCommand("fly").setExecutor(new CommandFly());
- getCommand("tphere").setExecutor(new CommandTPHere());
- getCommand("feed").setExecutor(new CommandFeed());
- getCommand("ops").setExecutor(new CommandOPS());
- getCommand("event").setExecutor(new CommandEvent());
- getCommand("lotto").setExecutor(new CommandLotto(this));
- getCommand("tc").setExecutor(new CommandT());
- getCommand("tp").setExecutor(new CommandTP());
- getCommand("cb").setExecutor(new CommandCB());
- getCommand("report").setExecutor(new ReportSystem());
- getCommand("countdown").setExecutor(new CountdownCommand(this));
- getCommand("restart").setExecutor(new CommandRestart(this));
- getCommand("ping").setExecutor(new CommandPing());
- getCommand("pvpevent").setExecutor(new PvPEvent(this));
- getCommand("calendar").setExecutor(new commands());
- getCommand("clear").setExecutor(new CommandClear());
- getCommand("speed").setExecutor(new CommandSpeed());
- logger.info("BMW> Commands wurden geladen.");
- combatTime = 8;
- startTimer();
- logger.info("BMW> Listener werden geladen.");
- PluginManager pm = getServer().getPluginManager();
- pm.registerEvents(new PreprocessListener(), this);
- pm.registerEvents(new Healthbar(), this);
- pm.registerEvents(new Events(), this);
- pm.registerEvents(new GlobalListener(), this);
- pm.registerEvents(new OnPlayerChatListener(), this);
- pm.registerEvents(new Ban(this), this);
- pm.registerEvents(new CommandFrieden(), this);
- pm.registerEvents(new Stats(this), this);
- pm.registerEvents(new PvPEvent(this), this);
- pm.registerEvents(this, this);
- pm.registerEvents(new Clan(this), this);
- pm.registerEvents(new CMDEvent(), this);
- pm.registerEvents(new CommandPickup(), this);
- pm.registerEvents(new CommandMap(), this);
- pm.registerEvents(new JoinListener(this), this);
- pm.registerEvents(new Adventskalendar.Events(), this);
- pm.registerEvents(new CommandSupport(), this);
- pm.registerEvents(new CommandSilentium(), this);
- pm.registerEvents(new PexTagEdit(), this);
- pm.registerEvents(new CommandStack(this), this);
- pm.registerEvents(new MainEvents(this), this);
- logger.log(Level.INFO, "[]===================================[]");
- logger.log(Level.INFO, "| BMW-System Aktiviert! |");
- logger.log(Level.INFO, "| Made by TheComboxD ! |");
- logger.log(Level.INFO, "[]===================================[]");
- }
- public void onDisable()
- {
- inst = null;
- if (eventstart)
- {
- eventstart = false;
- for (String spielerName : espieler)
- {
- Player p1 = Bukkit.getPlayer(spielerName);
- if (p1 != null)
- {
- p1.teleport(eventlobby);
- Bukkit.broadcastMessage(prefix + "§eDas Event wurde wegen einem Reload gestoppt!");
- }
- }
- }
- logger.log(Level.INFO, "[]===================================[]");
- logger.log(Level.INFO, "| BMW-System Deaktiviert! |");
- logger.log(Level.INFO, "| Made by TheComboxD! |");
- logger.log(Level.INFO, "[]===================================[]");
- }
- public WorldGuardPlugin getWorldGuard()
- {
- Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
- if ((plugin == null) || (!(plugin instanceof WorldGuardPlugin))) {
- return null;
- }
- return (WorldGuardPlugin)plugin;
- }
- private static void startTimer()
- {
- Bukkit.getScheduler().runTaskTimer(main.plugin, new Runnable()
- {
- public void run()
- {
- for (Map.Entry<Player, Long> entryTagged : ((HashMap<Player, Long>)Combat.tagged.clone()).entrySet())
- {
- long diff = Combat.getSystemTime() - ((Long)entryTagged.getValue()).longValue();
- if (diff >= main.combatTime)
- {
- PlayerCombatTaggedEvent event = new PlayerCombatTaggedEvent((Player)entryTagged.getKey(), false);
- Bukkit.getPluginManager().callEvent(event);
- if (!event.isCancelled())
- {
- Combat.setTagged((Player)entryTagged.getKey(), false);
- ((Player)entryTagged.getKey()).sendMessage(Combat.outcombat);
- }
- }
- }
- }
- }, 20L, 20L);
- }
- public static boolean all(boolean b)
- {
- return all;
- }
- public static void teleportToRandomPosition(Player p, int min, int max)
- {
- Location loc = null;
- Random rnd = new Random();
- Location loc1 = new Location(plugin.getServer().getWorld(locationsCfg.getString("spawn.world")), locationsCfg.getDouble("spawn.x"), locationsCfg.getDouble("spawn.y"), locationsCfg.getDouble("spawn.z"));
- while ((loc == null) || ((CommandSpawn.locationsCfg.getString("spawn.world") != null) && (loc1.distanceSquared(loc) < 1.0E8D)))
- {
- int x = rnd.nextInt(max - min + 1) + min;
- int z = rnd.nextInt(max - min + 1) + min;
- loc = p.getWorld().getHighestBlockAt(x, z).getLocation().add(0.5D, 0.0D, 0.5D);
- }
- p.teleport(loc);
- if (!loc.subtract(0.0D, 1.0D, 0.0D).getBlock().getType().isSolid()) {
- loc.getBlock().setType(Material.STONE);
- }
- }
- public void loadConfig() {
- getConfig().addDefault("Config.MySQL.Host", "Eintragen");
- getConfig().addDefault("Config.MySQL.User", "Eintragen");
- getConfig().addDefault("Config.MySQL.Password", "Eintragen");
- getConfig().addDefault("Config.MySQL.DB", "Eintragen");
- getConfig().addDefault("Config.MySQL.Port", "Eintragen");
- getConfig().options().copyDefaults(true);
- saveConfig();
- }
- public static void setEventXP(EventXP eventXP)
- {
- main.eventXP = eventXP;
- }
- private boolean checkForBadWords(AsyncPlayerChatEvent e)
- {
- Player p = e.getPlayer();
- String message = e.getMessage().replaceAll("[^a-zA-Z\\d\\s:]", "");
- for (Pattern wordPattern : CommandWordfilter.blockedWordPatterns) {
- if (wordPattern.matcher(message).find())
- {
- e.setCancelled(true);
- p.sendMessage(main.prefix+"§cBitte achte auf deine Wortwahl!");
- return true;
- }
- }
- return false;
- }
- public LootProtection getLootProtection(Item item)
- {
- if (!lootItems.containsKey(item)) {
- return null;
- }
- return (LootProtection)this.lootItems.get(item);
- }
- public void createLootProtection(List<Item> items, UUID owner)
- {
- LootProtection prot = new LootProtection(items, owner);
- for (Item item : items) {
- this.lootItems.put(item, prot);
- }
- }
- public void removeLootProtection(Item item)
- {
- if (!lootItems.containsKey(item)) {
- return;
- }
- LootProtection prot = (LootProtection)this.lootItems.get(item);
- prot.getItems().remove(item);
- this.lootItems.remove(item);
- }
- private boolean isWorldEditActive()
- {
- if (getServer().getPluginManager().getPlugin("WorldEdit") == null)
- {
- getLogger().severe("WorldEdit wird ben�tigt! Deaktiviere Plugin..");
- getServer().getPluginManager().disablePlugin(this);
- return false;
- }
- WorldEditPlugin worldEdit = (WorldEditPlugin)getServer().getPluginManager().getPlugin("WorldEdit");
- return true;
- }
- public static final main getInstance(){
- return plugin;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement