Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.04 KB | None | 0 0
  1. package me.TheComboxD.main;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.util.ArrayList;
  6. import java.util.Collection;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import java.util.Random;
  11. import java.util.UUID;
  12. import java.util.logging.Level;
  13. import java.util.logging.Logger;
  14. import java.util.regex.Pattern;
  15.  
  16. import org.bukkit.Bukkit;
  17. import org.bukkit.ChatColor;
  18. import org.bukkit.Effect;
  19. import org.bukkit.GameMode;
  20. import org.bukkit.Location;
  21. import org.bukkit.Material;
  22. import org.bukkit.Sound;
  23. import org.bukkit.block.Block;
  24. import org.bukkit.configuration.file.FileConfiguration;
  25. import org.bukkit.configuration.file.YamlConfiguration;
  26. import org.bukkit.enchantments.Enchantment;
  27. import org.bukkit.entity.Entity;
  28. import org.bukkit.entity.EntityType;
  29. import org.bukkit.entity.Item;
  30. import org.bukkit.entity.LivingEntity;
  31. import org.bukkit.entity.Player;
  32. import org.bukkit.entity.Snowball;
  33. import org.bukkit.event.EventHandler;
  34. import org.bukkit.event.EventPriority;
  35. import org.bukkit.event.Listener;
  36. import org.bukkit.event.block.Action;
  37. import org.bukkit.event.block.SignChangeEvent;
  38. import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
  39. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  40. import org.bukkit.event.entity.EntityDamageEvent;
  41. import org.bukkit.event.entity.ItemDespawnEvent;
  42. import org.bukkit.event.entity.PlayerDeathEvent;
  43. import org.bukkit.event.inventory.InventoryClickEvent;
  44. import org.bukkit.event.inventory.InventoryCloseEvent;
  45. import org.bukkit.event.player.AsyncPlayerChatEvent;
  46. import org.bukkit.event.player.PlayerExpChangeEvent;
  47. import org.bukkit.event.player.PlayerInteractEntityEvent;
  48. import org.bukkit.event.player.PlayerInteractEvent;
  49. import org.bukkit.event.player.PlayerJoinEvent;
  50. import org.bukkit.event.player.PlayerLoginEvent;
  51. import org.bukkit.event.player.PlayerPickupItemEvent;
  52. import org.bukkit.event.player.PlayerRespawnEvent;
  53. import org.bukkit.event.server.ServerListPingEvent;
  54. import org.bukkit.inventory.Inventory;
  55. import org.bukkit.inventory.ItemStack;
  56. import org.bukkit.inventory.meta.ItemMeta;
  57. import org.bukkit.plugin.Plugin;
  58. import org.bukkit.plugin.PluginManager;
  59. import org.bukkit.plugin.java.JavaPlugin;
  60. import org.bukkit.potion.PotionEffect;
  61. import org.bukkit.potion.PotionEffectType;
  62. import org.bukkit.scoreboard.DisplaySlot;
  63. import org.bukkit.scoreboard.Objective;
  64. import org.bukkit.scoreboard.Scoreboard;
  65.  
  66. import com.sk89q.worldedit.bukkit.WorldEditPlugin;
  67. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
  68. import com.xxmicloxx.NoteBlockAPI.NBSDecoder;
  69. import com.xxmicloxx.NoteBlockAPI.Song;
  70.  
  71. import Adventskalendar.Calendar;
  72. import Adventskalendar.CalendarDoor;
  73. import Adventskalendar.CalendarField;
  74. import Adventskalendar.ClientSideBlockHandler;
  75. import Adventskalendar.commands;
  76. import Clan.Clan;
  77. import Clan.PlayerData;
  78. import Commands.Ban;
  79. import Commands.Combat;
  80. import Commands.CommandAFK;
  81. import Commands.CommandBodysee;
  82. import Commands.CommandBroadcast;
  83. import Commands.CommandCB;
  84. import Commands.CommandCC;
  85. import Commands.CommandCMDSpy;
  86. import Commands.CommandChunkinfo;
  87. import Commands.CommandClear;
  88. import Commands.CommandConfig;
  89. import Commands.CommandDelSperre;
  90. import Commands.CommandDelWarn;
  91. import Commands.CommandDis;
  92. import Commands.CommandDrunk;
  93. import Commands.CommandEnderchest;
  94. import Commands.CommandEvent;
  95. import Commands.CommandEventXP;
  96. import Commands.CommandFeed;
  97. import Commands.CommandFill;
  98. import Commands.CommandFly;
  99. import Commands.CommandFlyAll;
  100. import Commands.CommandForce;
  101. import Commands.CommandFrieden;
  102. import Commands.CommandGamemode;
  103. import Commands.CommandGiveAllNew;
  104. import Commands.CommandGod;
  105. import Commands.CommandGoldswitch;
  106. import Commands.CommandHat;
  107. import Commands.CommandHeal;
  108. import Commands.CommandHealAll;
  109. import Commands.CommandInvsee;
  110. import Commands.CommandIteminfo;
  111. import Commands.CommandKick;
  112. import Commands.CommandKill;
  113. import Commands.CommandKopf;
  114. import Commands.CommandLag;
  115. import Commands.CommandLogoutall;
  116. import Commands.CommandLotto;
  117. import Commands.CommandMOTD;
  118. import Commands.CommandMSG;
  119. import Commands.CommandMSGSpy;
  120. import Commands.CommandMore;
  121. import Commands.CommandMute;
  122. import Commands.CommandOPS;
  123. import Commands.CommandPickup;
  124. import Commands.CommandPinfo;
  125. import Commands.CommandPing;
  126. import Commands.CommandPvP;
  127. import Commands.CommandRandom;
  128. import Commands.CommandRandomTP;
  129. import Commands.CommandRegeln;
  130. import Commands.CommandRenameRelore;
  131. import Commands.CommandRepair;
  132. import Commands.CommandRestart;
  133. import Commands.CommandSign;
  134. import Commands.CommandSilentium;
  135. import Commands.CommandSpawn;
  136. import Commands.CommandSpeed;
  137. import Commands.CommandSperre;
  138. import Commands.CommandStack;
  139. import Commands.CommandSudo;
  140. import Commands.CommandSupport;
  141. import Commands.CommandT;
  142. import Commands.CommandTP;
  143. import Commands.CommandTPA;
  144. import Commands.CommandTPHere;
  145. import Commands.CommandTeam;
  146. import Commands.CommandTime;
  147. import Commands.CommandTpAll;
  148. import Commands.CommandUmfrage;
  149. import Commands.CommandVanish;
  150. import Commands.CommandWarn;
  151. import Commands.CommandWarns;
  152. import Commands.CommandWordfilter;
  153. import Commands.CommandWorkbench;
  154. import Commands.CommandWtp;
  155. import Commands.CommandZaubertisch;
  156. import Commands.CommandZeitsperre;
  157. import Commands.CountdownCommand;
  158. import Commands.Mute;
  159. import Commands.PlayerCombatTaggedEvent;
  160. import Commands.PvPEvent;
  161. import Commands.ReportSystem;
  162. import Commands.Stats;
  163. import Listener.CMDEvent;
  164. import Listener.CommandMap;
  165. import Listener.Events;
  166. import Listener.GlobalListener;
  167. import Listener.JoinListener;
  168. import Listener.MainEvents;
  169. import Listener.OnPlayerChatListener;
  170. import Listener.PreprocessListener;
  171. import NameTag.Healthbar;
  172. import NameTag.PexTagEdit;
  173.  
  174. public class main
  175. extends JavaPlugin
  176. implements Listener
  177. {
  178. public static Map<String, String> names = new HashMap();
  179. public static final Logger logger = Logger.getLogger("Minecraft");
  180. public static int slots;
  181. public static main inst;
  182. public static int taskid = 0;
  183. public static Scoreboard s;
  184. public static Location eventspawn;
  185. public static Location eventlobby;
  186. public static List<Player> godMode = new ArrayList();
  187. private static SQL sqlManager;
  188. public static boolean eventstart = false;
  189. public static HashMap<Item, LootProtection> lootItems = new HashMap();
  190. public static HashMap<Player, Integer> auslogg = new HashMap();
  191. public static List<String> lp = new ArrayList();
  192. public static List<String> espieler = new ArrayList();
  193. public static int combatTime;
  194. public static main plugin;
  195. public static ArrayList<String> event = new ArrayList();
  196. public static final List<String> tplist = new ArrayList();
  197. public static int Countdown = 1;
  198. public static boolean isRunning = false;
  199. public static File locations = new File("plugins/BMW/", "locations.yml");
  200. public static FileConfiguration locationsCfg = YamlConfiguration.loadConfiguration(locations);
  201. public static HashMap<Player, Player> SupportChat = new HashMap();
  202. public static File ipfile = new File("plugins/BMW/", "ips.yml");
  203. public static FileConfiguration ips = YamlConfiguration.loadConfiguration(ipfile);
  204. public static File sqlfile = new File("plugins/BMW/", "sql.yml");
  205. public static FileConfiguration sqlCfg = YamlConfiguration.loadConfiguration(locations);
  206. public static String prefix = "§8§l> ";
  207. public static String KeineRechte = prefix + "§cDu hast keinen Zugriff auf diesen Befehl!";
  208. public static String GibtsNet = prefix + "§cDiesen Befehl gibt es nicht! §8§l/support§c!";
  209. public static String pvpeventprefix = "§bPvPEvent§8§l> ";
  210. public static String eventprefix = "§bEvent§8§l> ";
  211. public static List<Player> vanishedPlayer = new ArrayList();
  212. public static List<Player> afkPlayers = new ArrayList();
  213. public static List<Player> playersInvsee = new ArrayList();
  214. public static List<Player> PlayerInEnderchest = new ArrayList();
  215. public static List<Player> inBodysee = new ArrayList();
  216. public static HashMap<UUID, Mute> mutedPlayers = new HashMap();
  217. String prefix2 = "§§8§§l>";
  218. public static Map<Player, Player> LastMessageContacts = new HashMap();
  219. public static HashMap<Player, String> chat = new HashMap();
  220. public static boolean all;
  221. public static List<UUID> players = new ArrayList();
  222. public static HashMap<Player, CommandMSG> messageSpyPlayers = new HashMap();
  223. public static HashMap<Player, CommandMSG> commandSpyPlayers = new HashMap();
  224. public static Map<UUID, Long> healCooldown = new HashMap();
  225. public static Map<Player, TPDelay> teleportDelays = new HashMap();
  226. public static Map<Player, Location> lastPositions = new HashMap();
  227. public static Map<Player, Long> teleportCooldowns = new HashMap();
  228. public static Map<Player, CommandTPA> tpRequests = new HashMap();
  229. public static List<String> lore = new ArrayList();
  230. public static ArrayList<Player> inEnchanting = new ArrayList();
  231. public static Calendar calendar = new Calendar();
  232. public static Song christmasSong = NBSDecoder.parse(new File("plugins/BMW", "christmas.nbs"));
  233.  
  234. public static EventXP eventXP = EventXP.NONE;
  235. public static String MySQL_host = "";
  236. public static String MySQL_user = "";
  237. public static String MySQL_pass = "";
  238. public static String MySQL_db = "";
  239. public static String MySQL_port = "";
  240. public static String adventprefix = "§cADVENT §8§l> ";
  241. public static WorldEditPlugin worldEdit;
  242.  
  243. public main()
  244. {
  245. plugin = this;
  246. inst = this;
  247. }
  248.  
  249. @EventHandler
  250. public void onJoin(PlayerJoinEvent e)
  251. {
  252. Player p = e.getPlayer();
  253. String name = p.getName();
  254. if (!getConfig().getBoolean("Spieler." + e.getPlayer().getName() + ".Gejoint"))
  255. {
  256. int ids = getConfig().getInt("Config.Userid");
  257. ids++;
  258. getConfig().set("Config.Userid", Integer.valueOf(ids));
  259. getConfig().set("Spieler." + e.getPlayer().getName() + ".Gejoint", Boolean.valueOf(true));
  260. saveConfig();
  261.  
  262. 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"));
  263. Bukkit.broadcastMessage("§7[]== §bWillkommen auf §e§lBMW §e" + e.getPlayer().getName() + " §7==[] §b[#" + getConfig().getInt("Config.Userid") + "§b]");
  264. p.teleport(loc);
  265. p.sendMessage("§7§l[]=================================================[]");
  266. p.sendMessage("§7§lWillkommen auf dem §e§lBMW-Server!");
  267. p.sendMessage("§7§l[]==================================================[]");
  268.  
  269. ItemStack axe = new ItemStack(Material.DIAMOND_SWORD);
  270. axe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 5);
  271. axe.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 2);
  272. ItemMeta meta0 = axe.getItemMeta();
  273. meta0.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  274. axe.setItemMeta(meta0);
  275. p.getInventory().addItem(new ItemStack[] { axe });
  276.  
  277. ItemStack is1 = new ItemStack(Material.DIAMOND_HELMET);
  278. is1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  279. ItemMeta meta1 = is1.getItemMeta();
  280. meta1.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  281. is1.setItemMeta(meta1);
  282. p.getInventory().setHelmet(is1);
  283.  
  284. ItemStack is2 = new ItemStack(Material.DIAMOND_CHESTPLATE);
  285. is2.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  286. ItemMeta meta2 = is2.getItemMeta();
  287. meta2.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  288. is2.setItemMeta(meta2);
  289. p.getInventory().setChestplate(is2);
  290.  
  291. ItemStack is3 = new ItemStack(Material.DIAMOND_LEGGINGS);
  292. is3.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  293. ItemMeta meta3 = is3.getItemMeta();
  294. meta3.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  295. is3.setItemMeta(meta3);
  296. p.getInventory().setLeggings(is3);
  297.  
  298. ItemStack is4 = new ItemStack(Material.DIAMOND_BOOTS);
  299. is4.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
  300. ItemMeta meta4 = is4.getItemMeta();
  301. meta4.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  302. is4.setItemMeta(meta4);
  303. p.getInventory().setBoots(is4);
  304.  
  305. ItemStack is5 = new ItemStack(Material.POTION, 64, (short)16421);
  306. ItemMeta meta5 = is5.getItemMeta();
  307. meta5.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  308. is5.setItemMeta(meta5);
  309.  
  310. ItemStack is7 = new ItemStack(Material.POTION, 64, (short)16425);
  311. ItemMeta meta7 = is7.getItemMeta();
  312. meta7.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  313. is7.setItemMeta(meta7);
  314. ItemStack is8 = new ItemStack(Material.POTION, 64, (short)16418);
  315. ItemMeta meta8 = is8.getItemMeta();
  316. meta8.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  317. is8.setItemMeta(meta8);
  318.  
  319. is8.setItemMeta(meta8);
  320. ItemStack is9 = new ItemStack(Material.POTION, 64, (short)16451);
  321. ItemMeta meta9 = is9.getItemMeta();
  322. meta9.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  323. is9.setItemMeta(meta9);
  324.  
  325. ItemStack is10 = new ItemStack(Material.GOLDEN_APPLE, 3, (short)1);
  326. ItemMeta meta10 = is10.getItemMeta();
  327. meta10.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  328. is10.setItemMeta(meta10);
  329.  
  330. ItemStack is11 = new ItemStack(Material.POTION, 64, (short)16417);
  331. ItemMeta meta11 = is11.getItemMeta();
  332. meta11.setDisplayName("§c§lBMW§8§l> §bAnfängerkit");
  333. is11.setItemMeta(meta11);
  334.  
  335. is10.setItemMeta(meta10);
  336. p.getInventory().addItem(new ItemStack[] { is5 });
  337. p.getInventory().addItem(new ItemStack[] { is5 });
  338. p.getInventory().addItem(new ItemStack[] { is10 });
  339. p.getInventory().addItem(new ItemStack[] { is7 });
  340.  
  341. p.getInventory().addItem(new ItemStack[] { is8 });
  342.  
  343. p.getInventory().addItem(new ItemStack[] { is9 });
  344. p.getInventory().addItem(new ItemStack[] { is11 });
  345.  
  346. p.getInventory().addItem(new ItemStack[] { new ItemStack(Material.SNOW_BALL, 5) });
  347. p.getInventory().addItem(new ItemStack[] { is5 });
  348. p.getInventory().addItem(new ItemStack[] { is5 });
  349. p.getInventory().addItem(new ItemStack[] { is5 });
  350. p.getInventory().addItem(new ItemStack[] { is5 });
  351. p.getInventory().addItem(new ItemStack[] { is5 });
  352. p.getInventory().addItem(new ItemStack[] { is5 });
  353. p.getInventory().addItem(new ItemStack[] { is5 });
  354. return;
  355. }
  356. PlayerData pd = new PlayerData(e.getPlayer().getName());
  357. p.sendMessage("§7[]======= §e§lBMW §7=======[]");
  358. p.sendMessage("§bWillkommen zur§ck §9" + e.getPlayer().getName() + " §bauf BMW");
  359. p.sendMessage("§bKills: §a" + pd.getKills());
  360. p.sendMessage("§bTode: §a" + pd.getDeaths());
  361. p.sendMessage("§bKDR: §a" + pd.getKDR());
  362. p.sendMessage("§bWarns: §a" + pd.getWarns());
  363. if ((p.getGameMode() == GameMode.CREATIVE) && (!p.hasPermission("pvp.creativebypass"))) {
  364. p.setGameMode(GameMode.SURVIVAL);
  365. }
  366. if (!ips.contains(p.getAddress().getAddress().getHostAddress()))
  367. {
  368. List iplayers = new ArrayList();
  369. iplayers.add(p.getName());
  370. ips.set(p.getAddress().getAddress().getHostAddress(), iplayers);
  371. try
  372. {
  373. ips.save(ipfile);
  374. }
  375. catch (IOException e1)
  376. {
  377. e1.printStackTrace();
  378. }
  379. }
  380. else
  381. {
  382. List iplayers = new ArrayList();
  383. iplayers = ips.getStringList(p.getAddress().getAddress().getHostAddress());
  384. if (!iplayers.contains(p.getName()))
  385. {
  386. iplayers.add(p.getName());
  387. ips.set(p.getAddress().getAddress().getHostAddress(), iplayers);
  388. try
  389. {
  390. ips.save(ipfile);
  391. }
  392. catch (IOException e1)
  393. {
  394. e1.printStackTrace();
  395. }
  396. Collection<? extends Player> arrayOfPlayer;
  397. int i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).size();
  398. Collection<? extends Player> arrayOfPlayer1;
  399. int j = (arrayOfPlayer1 = Bukkit.getOnlinePlayers()).size();
  400. for (int i1 = 0; i1 < j; i1++)
  401. {
  402. Player online = (Player)arrayOfPlayer.toArray()[i];
  403. if (online.hasPermission("pvp.sameip"))
  404. {
  405. online.sendMessage("§7[]======= §eBMWSameIP 7=======[]");
  406. online.sendMessage("§a" + p.getName() + " §chat die gleiche IP wie §a" + (String)ips.getStringList(p.getAddress().getAddress().getHostAddress()).get(0) + "§c !!!");
  407. online.sendMessage("§7[]=========================[]");
  408. }
  409. }
  410. }
  411. }
  412. }
  413.  
  414. @EventHandler
  415. public void onClose(InventoryCloseEvent e)
  416. {
  417. Player p = (Player)e.getPlayer();
  418. if (!(e.getPlayer() instanceof Player)) {
  419. return;
  420. }
  421. if (playersInvsee.contains(p)) {
  422. playersInvsee.remove(p);
  423. }
  424. if (PlayerInEnderchest.contains(p)) {
  425. PlayerInEnderchest.remove(p);
  426. }
  427. if (inBodysee.contains(p)) {
  428. inBodysee.remove(p);
  429. }
  430. if(inEnchanting.contains(p)) {
  431. inEnchanting.remove(p);
  432. }
  433. }
  434. @EventHandler
  435. public void onEntityInteract(PlayerInteractEntityEvent e)
  436. {
  437. Player p = e.getPlayer();
  438. Entity ent = e.getRightClicked();
  439. if (ent.getType() == EntityType.MINECART_CHEST)
  440. {
  441. e.setCancelled(true);
  442. p.sendMessage(main.prefix+"§cUm einen Bug zu verhindern darfst du nicht mit Kisten-Minecarts interagieren.");
  443. return;
  444. }
  445. }
  446. @EventHandler
  447. public void onExpChange(PlayerExpChangeEvent e)
  448. {
  449. int amount = e.getAmount();
  450. if (eventXP != eventXP.NONE)
  451. {
  452. amount *= eventXP.getMultiplier();
  453. e.setAmount(amount);
  454. }
  455. }
  456.  
  457. @EventHandler
  458. public void onCliick(InventoryClickEvent e)
  459. {
  460. if (!(e.getWhoClicked() instanceof Player)) {
  461. return;
  462. }
  463. Player p = (Player)e.getWhoClicked();
  464. Inventory inv = e.getInventory();
  465. if ((PlayerInEnderchest.contains(p)) &&
  466. (!p.hasPermission("pvp.enderchest.edit")))
  467. {
  468. e.setCancelled(true);
  469. return;
  470. }
  471. if ((playersInvsee.contains(p)) &&
  472. (!p.hasPermission("pvp.invsee.edit")))
  473. {
  474. e.setCancelled(true);
  475. return;
  476. }
  477. if ((inBodysee.contains(p)) && (!p.hasPermission("pvp.bodysee.edit")))
  478. {
  479. e.setCancelled(true);
  480. return;
  481. }
  482. }
  483.  
  484. @EventHandler
  485. public void onPlayerLogin(EntityDamageByEntityEvent event)
  486. {
  487. Player p = (Player)event.getEntity();
  488. if (godMode.contains(p)) {
  489. event.setCancelled(true);
  490. }
  491. }
  492. @EventHandler
  493. public void onKilld(PlayerDeathEvent e){
  494. Player p = e.getEntity();
  495. final Player killer = p.getKiller();
  496.  
  497. killer.sendMessage(main.prefix+"§7Der Loot wurde für kurze Zeit geschützt!");
  498.  
  499. final List<Item> droppedItems = new ArrayList();
  500. for (ItemStack drops : e.getDrops()) {
  501. if ((drops != null) && (drops.getType() != Material.AIR))
  502. {
  503. ItemMeta meta = drops.getItemMeta();
  504. List<String> lore = meta.getLore();
  505. if (lore == null) {
  506. lore = new ArrayList();
  507. }
  508.  
  509. meta.setLore(lore);
  510. drops.setItemMeta(meta);
  511. Item item = p.getWorld().dropItemNaturally(p.getLocation(), drops);
  512. droppedItems.add(item);
  513. }
  514. }
  515. e.getDrops().clear();
  516. createLootProtection(droppedItems, killer.getUniqueId());
  517.  
  518.  
  519. int count = Bukkit.getScheduler().scheduleSyncDelayedTask(main.plugin, new Runnable() {
  520.  
  521. public void run() {
  522. if(lootItems.containsKey(droppedItems)){
  523. lootItems.remove(droppedItems);
  524. LootProtection prot = (LootProtection)lootItems.get(droppedItems);
  525. prot.getItems().remove(droppedItems);
  526. killer.sendMessage(main.prefix+"§7Jeder kann jetzt die Items aufsammeln!");
  527.  
  528. }
  529. }
  530.  
  531. }, 600L);
  532. }
  533.  
  534. @EventHandler(priority=EventPriority.LOWEST)
  535. public void onPlayerLogin(PlayerLoginEvent event)
  536. {
  537. if ((Bukkit.getServer().hasWhitelist()) && (!event.getPlayer().isWhitelisted())) {
  538. event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "§6§lWartungsarbeiten! Bald wieder on!");
  539. }
  540. }
  541. @EventHandler
  542. public void onPickup(PlayerPickupItemEvent e)
  543. {
  544. Player p = e.getPlayer();
  545. Item item = e.getItem();
  546. if (lootItems.containsKey(item)) {
  547.  
  548. LootProtection prot = getLootProtection(item);
  549. if (prot.getOwner() == p.getUniqueId())
  550. {
  551. e.setCancelled(false);
  552. removeLootProtection(item);
  553. clearRandomKey(item);
  554. return;
  555. }
  556. if (!prot.isFFA())
  557. {
  558. e.setCancelled(true);
  559. return;
  560. }
  561. e.setCancelled(false);
  562. removeLootProtection(item);
  563. clearRandomKey(item);
  564. }
  565. }
  566. @EventHandler
  567. public void onDespawn(ItemDespawnEvent e)
  568. {
  569. Item item = e.getEntity();
  570. if (!lootItems.containsKey(item)) {
  571. return;
  572. }
  573. removeLootProtection(item);
  574. }
  575. private void clearRandomKey(Item item)
  576. {
  577. ItemStack st = item.getItemStack();
  578. ItemMeta meta = st.getItemMeta();
  579. List<String> lore = meta.getLore();
  580. if (lore == null) {
  581. return;
  582. }
  583. lore.remove(lore.size() - 1);
  584. meta.setLore(lore);
  585. st.setItemMeta(meta);
  586. item.setItemStack(st);
  587. }
  588. @EventHandler
  589. public void onRespawn(PlayerRespawnEvent e)
  590. {
  591. Player p = e.getPlayer();
  592. if (!PvPEvent.inEvent.contains(p))
  593. {
  594. 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"));
  595. e.setRespawnLocation(loc1);
  596. }
  597. }
  598.  
  599. @EventHandler
  600. public void onChat1(AsyncPlayerChatEvent event1)
  601. {
  602. Player p = event1.getPlayer();
  603. if (event1.getMessage().startsWith("7"))
  604. {
  605. event1.setCancelled(true);
  606. p.sendMessage("§8§l> §eDu solltest ein / statt einer 7 benutzen!");
  607. }
  608. }
  609.  
  610. @EventHandler
  611. public void onChat(AsyncPlayerChatEvent ev)
  612. {
  613. Player p = ev.getPlayer();
  614. String m = ev.getMessage().toLowerCase();
  615. 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")))
  616. {
  617. ev.setCancelled(true);
  618.  
  619. p.chat("BMW ist der beste Server!");
  620. Collection<? extends Player> arrayOfPlayer;
  621. int j = (arrayOfPlayer = Bukkit.getOnlinePlayers()).size();
  622. for (int i = 0; i < j; i++)
  623. {
  624. Player of = (Player)arrayOfPlayer.toArray()[i];
  625. if (of.hasPermission("pvp.werbung")) {
  626. of.sendMessage("§8§l> §cWerbung: §b" + p.getName());
  627. }
  628. }
  629. }
  630. }
  631.  
  632. @EventHandler
  633. public void onInteract1(PlayerInteractEvent e)
  634. {
  635. Player p = e.getPlayer();
  636. PlayerData pd = new PlayerData(p.getName());
  637. if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
  638. {
  639. Block b = e.getClickedBlock();
  640. if (b.getType() == Material.LEVER)
  641. {
  642. Location blockLocation = CommandRandomTP.randomTPBlockLocation;
  643. if ((blockLocation != null) &&
  644. (blockLocation.equals(b.getLocation())))
  645. {
  646. e.setCancelled(true);
  647. if (!pd.hasFreeTP())
  648. {
  649. p.sendMessage(prefix + "§cDu hast keinen Teleport mehr frei!");
  650. return;
  651. }
  652. lastPositions.put(p, p.getLocation());
  653. teleportToRandomPosition(p, -45000, 45000);
  654. p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F);
  655. p.playEffect(p.getLocation(), Effect.ENDER_SIGNAL, null);
  656. p.sendMessage(prefix + "§aDu wurdest an eine zufällige Position teleportiert!");
  657. pd.setFreeTP(false);
  658. }
  659. }
  660. }
  661. }
  662.  
  663. @EventHandler(priority=EventPriority.NORMAL)
  664. public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
  665. {
  666. if ((event.getDamager() instanceof Snowball))
  667. {
  668. Snowball snowball = (Snowball)event.getDamager();
  669. Entity hitBySnowball = event.getEntity();
  670. LivingEntity shooter = (LivingEntity)snowball.getShooter();
  671. if ((hitBySnowball instanceof Player))
  672. {
  673. Player player = (Player)hitBySnowball;
  674. player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500, 0));
  675. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 500, 0));
  676. if ((shooter instanceof Player))
  677. {
  678. Player sp = (Player)shooter;
  679. sp.sendMessage(prefix + "§aDu hast " + ChatColor.YELLOW + player.getName() + "§a getroffen!");
  680. player.sendMessage(prefix + "§aDu wurdest von " + ChatColor.YELLOW + sp.getName() + "§a getroffen!");
  681. player.sendMessage(prefix + "§aDu bist nun Blind für 25 Sekunden.");
  682. }
  683. }
  684. }
  685. }
  686.  
  687. @EventHandler
  688. public void onChat22(AsyncPlayerChatEvent ev)
  689. {
  690. Player p = ev.getPlayer();
  691. if (mutedPlayers.containsKey(p.getUniqueId()))
  692. {
  693. Mute mute = (Mute)mutedPlayers.get(p.getUniqueId());
  694. boolean muted = true;
  695. if (Mute.getMuteTime() != -1L)
  696. {
  697. long diff = Mute.getMuteTime() - System.currentTimeMillis();
  698. if (diff < 0L)
  699. {
  700. mutedPlayers.remove(p.getUniqueId());
  701. muted = false;
  702. }
  703. }
  704. if (muted)
  705. {
  706. if (CommandSupport.user.containsKey(p)) {
  707. ev.setCancelled(false);
  708. }
  709. ev.setCancelled(true);
  710.  
  711. long time = Mute.getMuteTime() == -1L ? -1L : Mute.getMuteTime() - System.currentTimeMillis();
  712.  
  713. p.sendMessage(prefix + "§9Du bist derzeit gemutet! Fragen? §6§l/support");
  714. return;
  715. }
  716. }
  717. }
  718.  
  719. @EventHandler
  720. public void onChat2(AsyncPlayerChatEvent ev)
  721. {
  722. Player p = ev.getPlayer();
  723. String m = ev.getMessage().toLowerCase();
  724. if (!p.isOp()) {
  725. if (chat.containsKey(p))
  726. {
  727. String message = (String)chat.get(p);
  728. if (m.equalsIgnoreCase(message))
  729. {
  730. p.sendMessage(prefix + "§cDeine Nachricht wurde als Spam markiert!");
  731. ev.setCancelled(true);
  732. }
  733. chat.remove(p);
  734. chat.put(p, m);
  735. }
  736. else
  737. {
  738. chat.put(p, m);
  739. }
  740. }
  741. if (!p.hasPermission("pvp.protection.prevent"))
  742. {
  743. if (checkForBadWords(ev)) {
  744. return;
  745. }
  746. }
  747. }
  748. @EventHandler
  749. public void onPrepareEnchant(PrepareItemEnchantEvent e)
  750. {
  751. Player p = e.getEnchanter();
  752. if (main.inEnchanting.contains(p))
  753. {
  754. e.getExpLevelCostsOffered()[0] = 1;
  755. e.getExpLevelCostsOffered()[1] = 10;
  756. e.getExpLevelCostsOffered()[2] = 30;
  757. }
  758. }
  759. @EventHandler
  760. public void onPing(ServerListPingEvent e)
  761. {
  762. if (main.slots == 0) {
  763. main.slots = Bukkit.getMaxPlayers();
  764. }
  765. try
  766. {
  767. e.setMotd(ChatColor.translateAlternateColorCodes('&', this.plugin
  768. .getConfig().getString("System.motd")));
  769. e.setMaxPlayers(main.slots);
  770. }
  771. catch (NullPointerException e1)
  772. {
  773. System.out.println("Fehler bei der Motd!");
  774. }
  775. }
  776. @EventHandler
  777. public void onSignChange(SignChangeEvent e)
  778. {
  779. Player p = e.getPlayer();
  780. if (p.hasPermission("pvp.sign.color")) {
  781. for (int i = 0; i < e.getLines().length; i++)
  782. {
  783. String line = e.getLine(i);
  784. line = ChatColor.translateAlternateColorCodes('&', line);
  785. e.setLine(i, line);
  786. }
  787. }
  788. }
  789.  
  790. @EventHandler
  791. public void onEntityDamage(EntityDamageEvent event)
  792. {
  793. if (!(event.getEntity() instanceof Player)) {
  794. return;
  795. }
  796. if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {
  797. event.setCancelled(true);
  798. }
  799. }
  800.  
  801. @EventHandler
  802. public void on(PlayerDeathEvent e)
  803. {
  804. Player p = e.getEntity();
  805. Player k = p.getKiller();
  806. PlayerData kd = new PlayerData(k.getName());
  807. PlayerData pd = new PlayerData(p.getName());
  808.  
  809. kd.addKills(1);
  810. pd.addDeaths(1);
  811. if (((p.getKiller() instanceof Player)) && ((p instanceof Player)) && (p.isDead()))
  812. {
  813. p.sendMessage(prefix + "§cDu wurdest von §e" + k.getName() + " §cgetötet!");
  814. k.sendMessage(prefix + "§aDu hast §e" + p.getName() + " §agetötet!");
  815. e.setDeathMessage(null);
  816. }
  817. }
  818.  
  819. @EventHandler(priority=EventPriority.HIGH)
  820. public void onDeath(PlayerDeathEvent e)
  821. {
  822. Player p = e.getEntity();
  823.  
  824. e.setDroppedExp(0);
  825. }
  826.  
  827. public void onEnable()
  828. {
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835. new BroadcastMessages(this);
  836. plugin = this;
  837. new Calendar();
  838. PexTagEdit.onEnable(this);
  839.  
  840.  
  841.  
  842. taskid = getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable()
  843. {
  844. public void run()
  845. {
  846. Collection<? extends Player> arrayOfPlayer;
  847. int j = (arrayOfPlayer = Bukkit.getServer().getOnlinePlayers()).size();
  848. for (int i = 0; i < j; i++)
  849. {
  850. Player ps = (Player)arrayOfPlayer.toArray()[i];
  851.  
  852. ps.sendMessage("§7[--- §eBMW §7---]");
  853. int players = Bukkit.getServer().getOnlinePlayers().size();
  854. int maxplayers = 250;
  855. ps.sendMessage("§6" + players + " / " + maxplayers + " §bsind online");
  856. }
  857. }
  858. }, 0L, 200000L);
  859.  
  860. try
  861. {
  862. ips.save(ipfile);
  863. }
  864. catch (IOException localIOException1) {}
  865. inst = this;
  866.  
  867. slots = getConfig().getInt("Slots");
  868.  
  869. logger.log(Level.INFO, "BMW> Commands werden geladen...");
  870. ClientSideBlockHandler.onEnable();
  871. getCommand("giveall").setExecutor(new CommandGiveAllNew());
  872. getCommand("cc").setExecutor(new CommandCC());
  873. getCommand("silentium").setExecutor(new CommandSilentium());
  874. getCommand("umfrage").setExecutor(new CommandUmfrage());
  875. getCommand("ja").setExecutor(new CommandUmfrage());
  876. getCommand("goldswitch").setExecutor(new CommandGoldswitch());
  877. getCommand("sudo").setExecutor(new CommandSudo());
  878. getCommand("bodysee").setExecutor(new CommandBodysee());
  879. getCommand("iteminfo").setExecutor(new CommandIteminfo());
  880. getCommand("chunkinfo").setExecutor(new CommandChunkinfo());
  881. getCommand("workbench").setExecutor(new CommandWorkbench());
  882. getCommand("heal").setExecutor(new CommandHeal());
  883. getCommand("randomtp").setExecutor(new CommandRandomTP());
  884. getCommand("hat").setExecutor(new CommandHat());
  885. getCommand("eventxp").setExecutor(new CommandEventXP());
  886. getCommand("tpall").setExecutor(new CommandTpAll());
  887. getCommand("nein").setExecutor(new CommandUmfrage());
  888. getCommand("mute").setExecutor(new CommandMute());
  889. getCommand("mutes").setExecutor(new CommandMute());
  890. getCommand("unmute").setExecutor(new CommandMute());
  891. getCommand("spawn").setExecutor(new CommandSpawn());
  892. getCommand("setspawn").setExecutor(new CommandSpawn());
  893. getCommand("afk").setExecutor(new CommandAFK());
  894. getCommand("tpa").setExecutor(new CommandTPA(null, null, false));
  895. getCommand("tpahere").setExecutor(new CommandTPA(null, null, false));
  896. getCommand("tpaall").setExecutor(new CommandTPA(null, null, false));
  897. getCommand("tpaccept").setExecutor(new CommandTPA(null, null, false));
  898. getCommand("tpdeny").setExecutor(new CommandTPA(null, null, false));
  899. getCommand("team").setExecutor(new CommandTeam());
  900. getCommand("ergebnis").setExecutor(new CommandUmfrage());
  901. getCommand("support").setExecutor(new CommandSupport());
  902.  
  903. getCommand("pvp").setExecutor(new CommandPvP());
  904. getCommand("random").setExecutor(new CommandRandom());
  905. getCommand("motd").setExecutor(new CommandMOTD());
  906. getCommand("lag").setExecutor(new CommandLag());
  907. getCommand("zaubertisch").setExecutor(new CommandZaubertisch());
  908. getCommand("wordfilter").setExecutor(new CommandWordfilter());
  909. getCommand("gamemode").setExecutor(new CommandGamemode());
  910. getCommand("sperre").setExecutor(new CommandSperre());
  911. getCommand("sign").setExecutor(new CommandSign());
  912. getCommand("zeitsperre").setExecutor(new CommandZeitsperre());
  913. getCommand("time").setExecutor(new CommandTime());
  914. getCommand("msg").setExecutor(new CommandMSG(true));
  915. getCommand("r").setExecutor(new CommandMSG(true));
  916. getCommand("socialspy").setExecutor(new CommandMSGSpy());
  917. getCommand("vanish").setExecutor(new CommandVanish());
  918. getCommand("delsperre").setExecutor(new CommandDelSperre());
  919. getCommand("warn").setExecutor(new CommandWarn());
  920. getCommand("warns").setExecutor(new CommandWarns());
  921.  
  922. getCommand("delwarn").setExecutor(new CommandDelWarn());
  923.  
  924. getCommand("ping").setExecutor(new CommandPing());
  925. getCommand("god").setExecutor(new CommandGod());
  926.  
  927. getCommand("frieden").setExecutor(new CommandFrieden());
  928. getCommand("annehmen").setExecutor(new CommandFrieden());
  929. getCommand("commandspy").setExecutor(new CommandCMDSpy());
  930. getCommand("ablehnen").setExecutor(new CommandFrieden());
  931. getCommand("logoutall").setExecutor(new CommandLogoutall());
  932. getCommand("more").setExecutor(new CommandMore());
  933. getCommand("kopf").setExecutor(new CommandKopf());
  934. getCommand("kick").setExecutor(new CommandKick());
  935. getCommand("flyall").setExecutor(new CommandFlyAll());
  936. getCommand("kill").setExecutor(new CommandKill());
  937. getCommand("stats").setExecutor(new Stats(this));
  938. getCommand("rename").setExecutor(new CommandRenameRelore());
  939.  
  940. getCommand("abfall").setExecutor(new CommandDis());
  941. getCommand("relore").setExecutor(new CommandRenameRelore());
  942. getCommand("c").setExecutor(new Clan(this));
  943. getCommand("invsee").setExecutor(new CommandInvsee());
  944. getCommand("enderchest").setExecutor(new CommandEnderchest());
  945.  
  946. getCommand("drunk").setExecutor(new CommandDrunk());
  947. getCommand("wtp").setExecutor(new CommandWtp());
  948.  
  949. getCommand("cfg").setExecutor(new CommandConfig());
  950. getCommand("healall").setExecutor(new CommandHealAll());
  951.  
  952. getCommand("regeln").setExecutor(new CommandRegeln());
  953. getCommand("stack").setExecutor(new CommandStack(this));
  954.  
  955. getCommand("ifix").setExecutor(new CommandRepair());
  956. getCommand("broadcast").setExecutor(new CommandBroadcast());
  957. getCommand("user").setExecutor(new CommandPinfo());
  958. getCommand("pickup").setExecutor(new CommandPickup());
  959. getCommand("fill").setExecutor(new CommandFill());
  960. getCommand("force").setExecutor(new CommandForce());
  961.  
  962. getCommand("fly").setExecutor(new CommandFly());
  963. getCommand("tphere").setExecutor(new CommandTPHere());
  964. getCommand("feed").setExecutor(new CommandFeed());
  965. getCommand("ops").setExecutor(new CommandOPS());
  966. getCommand("event").setExecutor(new CommandEvent());
  967. getCommand("lotto").setExecutor(new CommandLotto(this));
  968. getCommand("tc").setExecutor(new CommandT());
  969.  
  970. getCommand("tp").setExecutor(new CommandTP());
  971. getCommand("cb").setExecutor(new CommandCB());
  972.  
  973. getCommand("report").setExecutor(new ReportSystem());
  974.  
  975. getCommand("countdown").setExecutor(new CountdownCommand(this));
  976.  
  977. getCommand("restart").setExecutor(new CommandRestart(this));
  978. getCommand("ping").setExecutor(new CommandPing());
  979. getCommand("pvpevent").setExecutor(new PvPEvent(this));
  980. getCommand("calendar").setExecutor(new commands());
  981. getCommand("clear").setExecutor(new CommandClear());
  982. getCommand("speed").setExecutor(new CommandSpeed());
  983. logger.info("BMW> Commands wurden geladen.");
  984.  
  985. combatTime = 8;
  986. startTimer();
  987.  
  988. logger.info("BMW> Listener werden geladen.");
  989.  
  990. PluginManager pm = getServer().getPluginManager();
  991. pm.registerEvents(new PreprocessListener(), this);
  992. pm.registerEvents(new Healthbar(), this);
  993. pm.registerEvents(new Events(), this);
  994. pm.registerEvents(new GlobalListener(), this);
  995. pm.registerEvents(new OnPlayerChatListener(), this);
  996. pm.registerEvents(new Ban(this), this);
  997. pm.registerEvents(new CommandFrieden(), this);
  998.  
  999. pm.registerEvents(new Stats(this), this);
  1000. pm.registerEvents(new PvPEvent(this), this);
  1001. pm.registerEvents(this, this);
  1002.  
  1003. pm.registerEvents(new Clan(this), this);
  1004. pm.registerEvents(new CMDEvent(), this);
  1005. pm.registerEvents(new CommandPickup(), this);
  1006. pm.registerEvents(new CommandMap(), this);
  1007. pm.registerEvents(new JoinListener(this), this);
  1008. pm.registerEvents(new Adventskalendar.Events(), this);
  1009. pm.registerEvents(new CommandSupport(), this);
  1010. pm.registerEvents(new CommandSilentium(), this);
  1011. pm.registerEvents(new PexTagEdit(), this);
  1012. pm.registerEvents(new CommandStack(this), this);
  1013. pm.registerEvents(new MainEvents(this), this);
  1014.  
  1015. logger.log(Level.INFO, "[]===================================[]");
  1016. logger.log(Level.INFO, "| BMW-System Aktiviert! |");
  1017. logger.log(Level.INFO, "| Made by TheComboxD ! |");
  1018. logger.log(Level.INFO, "[]===================================[]");
  1019. }
  1020.  
  1021. public void onDisable()
  1022. {
  1023. inst = null;
  1024. if (eventstart)
  1025. {
  1026. eventstart = false;
  1027. for (String spielerName : espieler)
  1028. {
  1029. Player p1 = Bukkit.getPlayer(spielerName);
  1030. if (p1 != null)
  1031. {
  1032. p1.teleport(eventlobby);
  1033.  
  1034. Bukkit.broadcastMessage(prefix + "§eDas Event wurde wegen einem Reload gestoppt!");
  1035. }
  1036. }
  1037. }
  1038.  
  1039. logger.log(Level.INFO, "[]===================================[]");
  1040. logger.log(Level.INFO, "| BMW-System Deaktiviert! |");
  1041. logger.log(Level.INFO, "| Made by TheComboxD! |");
  1042. logger.log(Level.INFO, "[]===================================[]");
  1043. }
  1044.  
  1045. public WorldGuardPlugin getWorldGuard()
  1046. {
  1047. Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
  1048. if ((plugin == null) || (!(plugin instanceof WorldGuardPlugin))) {
  1049. return null;
  1050. }
  1051. return (WorldGuardPlugin)plugin;
  1052. }
  1053.  
  1054. private static void startTimer()
  1055. {
  1056. Bukkit.getScheduler().runTaskTimer(main.plugin, new Runnable()
  1057. {
  1058. public void run()
  1059. {
  1060. for (Map.Entry<Player, Long> entryTagged : ((HashMap<Player, Long>)Combat.tagged.clone()).entrySet())
  1061. {
  1062. long diff = Combat.getSystemTime() - ((Long)entryTagged.getValue()).longValue();
  1063. if (diff >= main.combatTime)
  1064. {
  1065. PlayerCombatTaggedEvent event = new PlayerCombatTaggedEvent((Player)entryTagged.getKey(), false);
  1066. Bukkit.getPluginManager().callEvent(event);
  1067. if (!event.isCancelled())
  1068. {
  1069. Combat.setTagged((Player)entryTagged.getKey(), false);
  1070. ((Player)entryTagged.getKey()).sendMessage(Combat.outcombat);
  1071. }
  1072. }
  1073. }
  1074. }
  1075. }, 20L, 20L);
  1076. }
  1077.  
  1078. public static boolean all(boolean b)
  1079. {
  1080. return all;
  1081. }
  1082.  
  1083. public static void teleportToRandomPosition(Player p, int min, int max)
  1084. {
  1085. Location loc = null;
  1086. Random rnd = new Random();
  1087. Location loc1 = new Location(plugin.getServer().getWorld(locationsCfg.getString("spawn.world")), locationsCfg.getDouble("spawn.x"), locationsCfg.getDouble("spawn.y"), locationsCfg.getDouble("spawn.z"));
  1088. while ((loc == null) || ((CommandSpawn.locationsCfg.getString("spawn.world") != null) && (loc1.distanceSquared(loc) < 1.0E8D)))
  1089. {
  1090. int x = rnd.nextInt(max - min + 1) + min;
  1091. int z = rnd.nextInt(max - min + 1) + min;
  1092. loc = p.getWorld().getHighestBlockAt(x, z).getLocation().add(0.5D, 0.0D, 0.5D);
  1093. }
  1094. p.teleport(loc);
  1095. if (!loc.subtract(0.0D, 1.0D, 0.0D).getBlock().getType().isSolid()) {
  1096. loc.getBlock().setType(Material.STONE);
  1097. }
  1098. }
  1099.  
  1100. public void loadConfig() {
  1101. getConfig().addDefault("Config.MySQL.Host", "Eintragen");
  1102. getConfig().addDefault("Config.MySQL.User", "Eintragen");
  1103. getConfig().addDefault("Config.MySQL.Password", "Eintragen");
  1104. getConfig().addDefault("Config.MySQL.DB", "Eintragen");
  1105. getConfig().addDefault("Config.MySQL.Port", "Eintragen");
  1106. getConfig().options().copyDefaults(true);
  1107. saveConfig();
  1108. }
  1109. public static void setEventXP(EventXP eventXP)
  1110. {
  1111. main.eventXP = eventXP;
  1112. }
  1113.  
  1114. private boolean checkForBadWords(AsyncPlayerChatEvent e)
  1115. {
  1116. Player p = e.getPlayer();
  1117. String message = e.getMessage().replaceAll("[^a-zA-Z\\d\\s:]", "");
  1118. for (Pattern wordPattern : CommandWordfilter.blockedWordPatterns) {
  1119. if (wordPattern.matcher(message).find())
  1120. {
  1121. e.setCancelled(true);
  1122. p.sendMessage(main.prefix+"§cBitte achte auf deine Wortwahl!");
  1123. return true;
  1124. }
  1125. }
  1126. return false;
  1127. }
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134. public LootProtection getLootProtection(Item item)
  1135. {
  1136. if (!lootItems.containsKey(item)) {
  1137. return null;
  1138. }
  1139. return (LootProtection)this.lootItems.get(item);
  1140. }
  1141.  
  1142. public void createLootProtection(List<Item> items, UUID owner)
  1143. {
  1144. LootProtection prot = new LootProtection(items, owner);
  1145. for (Item item : items) {
  1146. this.lootItems.put(item, prot);
  1147. }
  1148. }
  1149.  
  1150. public void removeLootProtection(Item item)
  1151. {
  1152. if (!lootItems.containsKey(item)) {
  1153. return;
  1154. }
  1155. LootProtection prot = (LootProtection)this.lootItems.get(item);
  1156. prot.getItems().remove(item);
  1157. this.lootItems.remove(item);
  1158. }
  1159.  
  1160. private boolean isWorldEditActive()
  1161. {
  1162. if (getServer().getPluginManager().getPlugin("WorldEdit") == null)
  1163. {
  1164. getLogger().severe("WorldEdit wird ben�tigt! Deaktiviere Plugin..");
  1165. getServer().getPluginManager().disablePlugin(this);
  1166. return false;
  1167. }
  1168. WorldEditPlugin worldEdit = (WorldEditPlugin)getServer().getPluginManager().getPlugin("WorldEdit");
  1169. return true;
  1170. }
  1171.  
  1172.  
  1173. public static final main getInstance(){
  1174. return plugin;
  1175. }
  1176.  
  1177.  
  1178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement