· 8 years ago · Mar 03, 2018, 05:14 PM
1
2package pl.kopara.guild;
3
4import pl.kopara.guild.listeners.CobblexListener;
5import magiccase.listeners.CaseKickQuitListener;
6import magiccase.listeners.CaseDropListener;
7import pl.kopara.guild.listeners.SignChangeListener;
8import pl.kopara.guild.listeners.OpenInventoryListener;
9import pl.kopara.guild.listeners.EntityDeathListener;
10import pl.kopara.guild.listeners.DropBlockBreakListener;
11import pl.kopara.guild.listeners.PunchPotyListener;
12import pl.kopara.guild.listeners.PlayerInteractListener;
13import pl.kopara.guild.listeners.BoyListener;
14import pl.kopara.guild.listeners.CheckLoginListener;
15import pl.kopara.guild.listeners.BorderMapListener;
16import pl.kopara.guild.listeners.InventoryListener;
17import pl.kopara.guild.listeners.TakeCrystalListener;
18import pl.kopara.guild.listeners.BlokowanieListener;
19import pl.kopara.guild.listeners.InCommbatInGuildListener;
20import pl.kopara.guild.listeners.PlayerDeathListener;
21import pl.kopara.guild.listeners.EntityDamageListener;
22import pl.kopara.guild.listeners.EntityDamageByEntityListener;
23import pl.kopara.guild.listeners.GuildExplodeListener;
24import pl.kopara.guild.listeners.action.PlayerBucketFillListener;
25import pl.kopara.guild.listeners.action.PlayerBucketEmptyListener;
26import pl.kopara.guild.listeners.action.BlockPlaceListener;
27import pl.kopara.guild.listeners.action.BlockBreakListener;
28import pl.kopara.guild.listeners.PlayerMoveListener;
29import pl.kopara.guild.listeners.DiamondCraftingBlocker;
30import pl.kopara.guild.listeners.ChatGuildsListener;
31import pl.kopara.guild.listeners.AsyncPlayerChatListener;
32import pl.kopara.guild.managers.TimerManager;
33import pl.kopara.guild.listeners.PlayerJoinListener;
34import pl.kopara.guild.listeners.PlayerQuitJoinListener;
35import pl.kopara.guild.listeners.InventoryClickListener;
36import pl.kopara.guild.rank.variable.TopGuildVariable;
37import pl.kopara.guild.rank.variable.TopVariable;
38import pl.kopara.guild.rank.variable.GuildLimitVariable;
39import pl.kopara.guild.rank.variable.GuildLifeVariable;
40import pl.kopara.guild.rank.variable.GuildSizeVariable;
41import pl.kopara.guild.rank.variable.GuildDeathsVariable;
42import pl.kopara.guild.rank.variable.GuildKillsVariable;
43import pl.kopara.guild.rank.variable.GuildPointsVariable;
44import pl.kopara.guild.rank.variable.GuildVariable;
45import pl.kopara.guild.rank.variable.DeathsVariable;
46import pl.kopara.guild.rank.variable.KillsVariable;
47import codecrafter47.bungeetablistplus.api.bukkit.Variable;
48import codecrafter47.bungeetablistplus.api.bukkit.BungeeTabListPlusBukkitAPI;
49import pl.kopara.guild.rank.variable.PointsVariable;
50import pl.kopara.guild.managers.BanIPManager;
51import pl.kopara.guild.managers.BanManager;
52import pl.kopara.guild.managers.DeathBanManager;
53import pl.kopara.guild.managers.GuildManager;
54import pl.kopara.guild.managers.UserManager;
55import pl.kopara.guild.managers.DropManager;
56import pl.kopara.guild.managers.DropFile;
57import pl.kopara.guild.managers.NameTagManager;
58import pl.kopara.guild.tasks.AutoMsgTask;
59import pl.kopara.guild.tasks.LimitTask;
60import pl.kopara.guild.tasks.CombatTask;
61import pl.kopara.guild.tasks.CheckValidityTask;
62import pl.kopara.guild.commands.cmd.SniezkaCommand;
63import pl.kopara.guild.commands.cmd.SkrzynkaCommand;
64import pl.kopara.guild.commands.cmd.SniezkaHelpCommand;
65import pl.kopara.guild.commands.guild.GuildHelpCommand;
66import pl.kopara.guild.commands.cmd.HelpCommand;
67import pl.kopara.guild.commands.guild.LeaveCommand;
68import pl.kopara.guild.commands.cmd.AutoMsgCommand;
69import pl.kopara.guild.commands.cmd.MuteCommand;
70import pl.kopara.guild.commands.guild.PvpCommand;
71import pl.kopara.guild.commands.guild.ProlongCommand;
72import pl.kopara.guild.commands.guild.OwnerCommand;
73import pl.kopara.guild.commands.guild.LeaderCommand;
74import pl.kopara.guild.commands.guild.JoinCommand;
75import pl.kopara.guild.commands.guild.InviteCommand;
76import pl.kopara.guild.commands.guild.InfoCommand;
77import pl.kopara.guild.commands.guild.GuildHomeCommand;
78import pl.kopara.guild.commands.guild.GuildSetHomeCommand;
79import pl.kopara.guild.commands.guild.EnlargeCommand;
80import pl.kopara.guild.commands.guild.DeleteCommand;
81import pl.kopara.guild.commands.guild.CreateCommand;
82import pl.kopara.guild.commands.guild.AllyCommand;
83import pl.kopara.guild.commands.guild.GaCommand;
84import pl.kopara.guild.commands.cmd.ClearEnderchestCommand;
85import pl.kopara.guild.commands.cmd.ConfigCommand;
86import pl.kopara.guild.commands.cmd.EnableCommand;
87import pl.kopara.guild.commands.cmd.NetherCommand;
88import pl.kopara.guild.commands.cmd.DelWarpCommand;
89import pl.kopara.guild.commands.cmd.SetWarpCommand;
90import pl.kopara.guild.commands.cmd.NightCommand;
91import pl.kopara.guild.commands.cmd.DayCommand;
92import pl.kopara.guild.commands.cmd.HcCommand;
93import magiccase.command.CaseCommand;
94import pl.kopara.guild.commands.cmd.StatsCommand;
95import pl.kopara.guild.commands.cmd.TurboCommand;
96import pl.kopara.guild.commands.cmd.LevelCommand;
97import pl.kopara.guild.commands.cmd.BuyCommand;
98import pl.kopara.guild.commands.cmd.SpeedCommand;
99import pl.kopara.guild.commands.cmd.EnderchestCommand;
100import pl.kopara.guild.commands.cmd.WorkBenchCommand;
101import pl.kopara.guild.commands.cmd.CobblexCommand;
102import pl.kopara.guild.commands.cmd.IsCommand;
103import pl.kopara.guild.commands.cmd.BoyFamerCommand;
104import pl.kopara.guild.commands.cmd.RenameCommand;
105import pl.kopara.guild.commands.cmd.BanIPCommand;
106import pl.kopara.guild.commands.cmd.SvipCommand;
107import pl.kopara.guild.commands.cmd.SsCommand;
108import pl.kopara.guild.commands.cmd.BackupCommand;
109import pl.kopara.guild.commands.cmd.TeleportCommand;
110import pl.kopara.guild.commands.cmd.StoneCommand;
111import pl.kopara.guild.commands.cmd.WhoIsCommand;
112import pl.kopara.guild.commands.cmd.WhiteListCommand;
113import pl.kopara.guild.commands.cmd.BroadcastCommand;
114import pl.kopara.guild.commands.cmd.SmietnikCommand;
115import pl.kopara.guild.commands.cmd.CraftCommand;
116import pl.kopara.guild.commands.cmd.YouTubeCommand;
117import pl.kopara.guild.commands.cmd.VipCommand;
118import pl.kopara.guild.commands.cmd.StreamerCommand;
119import pl.kopara.guild.commands.cmd.StpCommand;
120import pl.kopara.guild.commands.cmd.SlowmodeCommand;
121import pl.kopara.guild.commands.cmd.SlotCommand;
122import pl.kopara.guild.commands.cmd.ReplyCommand;
123import pl.kopara.guild.commands.cmd.TellCommand;
124import pl.kopara.guild.commands.cmd.RepairCommand;
125import pl.kopara.guild.commands.cmd.SetHomeCommand;
126import pl.kopara.guild.commands.cmd.KickCommand;
127import pl.kopara.guild.commands.cmd.KickAllCommand;
128import pl.kopara.guild.commands.cmd.HomeCommand;
129import pl.kopara.guild.commands.cmd.HelpOpCommand;
130import pl.kopara.guild.commands.cmd.HealCommand;
131import pl.kopara.guild.commands.cmd.HeadCommand;
132import pl.kopara.guild.commands.cmd.GiveCommand;
133import pl.kopara.guild.commands.cmd.ItemCommand;
134import pl.kopara.guild.commands.cmd.GcCommand;
135import pl.kopara.guild.commands.cmd.EnchantCommand;
136import pl.kopara.guild.commands.cmd.ClearCommand;
137import pl.kopara.guild.commands.cmd.TpaCommand;
138import pl.kopara.guild.commands.cmd.TpdenyCommmand;
139import pl.kopara.guild.commands.cmd.TpacceptCommand;
140import pl.kopara.guild.commands.cmd.KitCommand;
141import pl.kopara.guild.commands.cmd.SetSpawnCommand;
142import pl.kopara.guild.commands.cmd.SpawnCommand;
143import pl.kopara.guild.commands.cmd.FlyCommand;
144import pl.kopara.guild.commands.cmd.GamemodeCommand;
145import pl.kopara.guild.commands.cmd.ChatCommand;
146import pl.kopara.guild.commands.cmd.UnBanIpCommand;
147import pl.kopara.guild.commands.cmd.UnBanCommand;
148import pl.kopara.guild.commands.cmd.BanCommand;
149import pl.kopara.guild.commands.cmd.GodCommand;
150import pl.kopara.guild.commands.cmd.RankingCommand;
151import pl.kopara.guild.commands.cmd.ListCommand;
152import org.bukkit.plugin.RegisteredServiceProvider;
153import org.bukkit.event.Listener;
154import pl.kopara.guild.commands.CommandManager;
155import pl.kopara.guild.commands.Command;
156import pl.kopara.guild.mysql.store.modes.StoreSQLITE;
157import pl.kopara.guild.mysql.store.modes.StoreMySQL;
158import pl.kopara.guild.mysql.store.modes.StoreMode;
159import org.bukkit.World;
160import org.bukkit.plugin.Plugin;
161import java.util.Iterator;
162import pl.kopara.guild.utils.CraftingUtil;
163import pl.kopara.guild.lang.Lang;
164import pl.kopara.guild.lang.Config;
165import pl.kopara.guild.utils.Ticking;
166import pl.kopara.guild.managers.CombatManager;
167import org.bukkit.entity.Player;
168import org.bukkit.Bukkit;
169import pl.kopara.guild.utils.Logger;
170import org.bukkit.plugin.PluginManager;
171import net.milkbowl.vault.chat.Chat;
172import pl.kopara.guild.mysql.store.Store;
173import org.bukkit.plugin.java.JavaPlugin;
174
175public class GuildPlugin extends JavaPlugin
176{
177 private static GuildPlugin plugin;
178 private static Store store;
179 private static Chat chat;
180 private static PluginManager pluginManager;
181
182 public void onLoad() {
183 GuildPlugin.plugin = this;
184 }
185
186 public void onEnable() {
187 this.initTab();
188 if (!this.setupChat()) {
189 Logger.warning("NIE ZNALEZIONO VAULT!");
190 }
191 for (final Player p : Bukkit.getOnlinePlayers()) {
192 final Combat c = CombatManager.getCombat(p);
193 if (c == null) {
194 CombatManager.createCombat(p);
195 }
196 }
197 new Ticking().start();
198 Config.reloadConfig();
199 Lang.reloadLang();
200 this.registerDatabase();
201 this.registerManager();
202 this.registerListener();
203 this.registerTasks();
204 registerCommand();
205 CraftingUtil.registerRecipe();
206 }
207
208 public void onDisable() {
209 this.unTab();
210 Bukkit.getScheduler().cancelTasks((Plugin)this);
211 for (final Player p : Bukkit.getOnlinePlayers()) {
212 CombatManager.removeCombat(p);
213 }
214 Bukkit.savePlayers();
215 for (final World w : Bukkit.getWorlds()) {
216 w.save();
217 }
218 try {
219 Thread.sleep(2000L);
220 }
221 catch (InterruptedException e) {
222 e.printStackTrace();
223 }
224 if (GuildPlugin.store != null && GuildPlugin.store.isConnected()) {
225 GuildPlugin.store.disconnect();
226 }
227 GuildPlugin.plugin = null;
228 }
229
230 public static GuildPlugin getPlugin() {
231 return GuildPlugin.plugin;
232 }
233
234 protected boolean registerDatabase() {
235 switch (StoreMode.getByName(Config.DATABASE_MODE)) {
236 case MYSQL: {
237 GuildPlugin.store = new StoreMySQL(Config.DATABASE_MYSQL_HOST, Config.DATABASE_MYSQL_PORT, Config.DATABASE_MYSQL_USER, Config.DATABASE_MYSQL_PASS, Config.DATABASE_MYSQL_NAME, Config.DATABASE_TABLEPREFIX);
238 break;
239 }
240 case SQLITE: {
241 GuildPlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
242 break;
243 }
244 default: {
245 Logger.warning("Value of databse mode is not valid! Using SQLITE as database!");
246 GuildPlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
247 break;
248 }
249 }
250 final boolean conn = GuildPlugin.store.connect();
251 if (conn) {
252 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}users` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`points` int(11) NOT NULL, `kills` int(11) NOT NULL, `deaths` int(11) NOT NULL, `asyst` int(11) NOT NULL, `logout` int(11) NOT NULL, `firstIP` varchar(64) NOT NULL, `lastIP` varchar(64) NOT NULL, `firstJoin` bigint(22) NOT NULL, `kit_start` bigint(64) NOT NULL, `kit_yt` bigint(22) NOT NULL, `kit_tw` bigint(22) NOT NULL, `kit_vip` bigint(22) NOT NULL, `kit_svip` bigint(22) NOT NULL, `turboDrop` bigint(22) NOT NULL, `turboExp` bigint(22) NOT NULL,`home` varchar(255) NOT NULL, `lastKill` varchar(32) NOT NULL, `lastKillTime` bigint(22) NOT NULL, `god` int(1) NOT NULL, `lvl` int(11) NOT NULL, `exp` int(11) NOT NULL);");
253 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}guilds` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`tag` varchar(5) NOT NULL, `name` varchar(32) NOT NULL, `owner` varchar(64) NOT NULL, `leader` varchar(64) NOT NULL, `cuboidX` int(11) NOT NULL, `cuboidZ` int(11) NOT NULL, `cuboidSize` int(11) NOT NULL, `life` int(11) NOT NULL, `lifeLastAttack` bigint(22) NOT NULL, `prolong` bigint(22) NOT NULL, `pvp` int(2) NOT NULL, `createTime` bigint(22) NOT NULL, `homeX` double NOT NULL, `homeY` double NOT NULL, `homeZ` double NOT NULL, `ally` varchar(255) NOT NULL, `points` int(11) NOT NULL, `kills` int(11) NOT NULL, `deaths` int(11) NOT NULL, `pvpAlly` int(1) NOT NULL);");
254 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}members` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`tag` varchar(5) NOT NULL);");
255 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bans` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`time` bigint(22) NOT NULL, `reason` text NOT NULL, `admin` varchar(32) NOT NULL, `start` BIGINT(22) NOT NULL);");
256 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bansip` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`ip` varchar(32) NOT NULL,`time` bigint(22) NOT NULL, `reason` text NOT NULL, `admin` varchar(32) NOT NULL, `start` BIGINT(22) NOT NULL);");
257 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}backups` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`time` bigint(22) NOT NULL, `killer` varchar(32) NOT NULL, `ping` int(11) NOT NULL, `inventory` text NOT NULL, `armor` text NOT NULL, `enderchest` text NOT NULL);");
258 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}warp` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`location` text NOT NULL, `group` varchar(32) NOT NULL NOT NULL);");
259 GuildPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}deathbans` (" + ((GuildPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`name` varchar(32) NOT NULL,`mode` int(1) NOT NULL, `time` bigint(11) NOT NULL NOT NULL);");
260 return conn;
261 }
262 return conn;
263 }
264
265 public static void registerCommand(final Command command) {
266 CommandManager.register(command);
267 }
268
269 public static void registerListener(final Plugin plugin, final Listener... listeners) {
270 if (GuildPlugin.pluginManager == null) {
271 GuildPlugin.pluginManager = Bukkit.getPluginManager();
272 }
273 for (final Listener listener : listeners) {
274 GuildPlugin.pluginManager.registerEvents(listener, plugin);
275 }
276 }
277
278 private boolean setupChat() {
279 if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
280 return false;
281 }
282 final RegisteredServiceProvider<Chat> rsp = (RegisteredServiceProvider<Chat>)this.getServer().getServicesManager().getRegistration((Class)Chat.class);
283 GuildPlugin.chat = (Chat)rsp.getProvider();
284 return GuildPlugin.chat != null;
285 }
286
287 public static Chat getChat() {
288 return GuildPlugin.chat;
289 }
290
291 public static Store getStore() {
292 return GuildPlugin.store;
293 }
294
295 public static void registerCommand() {
296 registerCommand(new ListCommand());
297 registerCommand(new RankingCommand());
298 registerCommand(new GodCommand());
299 registerCommand(new BanCommand());
300 registerCommand(new UnBanCommand());
301 registerCommand(new UnBanIpCommand());
302 registerCommand(new ChatCommand());
303 registerCommand(new GamemodeCommand());
304 registerCommand(new FlyCommand());
305 registerCommand(new SpawnCommand());
306 registerCommand(new MuteCommand());
307 registerCommand(new SetSpawnCommand());
308 registerCommand(new KitCommand());
309 registerCommand(new TpacceptCommand());
310 registerCommand(new TpdenyCommmand());
311 registerCommand(new TpaCommand());
312 registerCommand(new ClearCommand());
313 registerCommand(new EnchantCommand());
314 registerCommand(new GcCommand());
315 registerCommand(new ItemCommand());
316 registerCommand(new GiveCommand());
317 registerCommand(new HeadCommand());
318 registerCommand(new HealCommand());
319 registerCommand(new HelpOpCommand());
320 registerCommand(new HomeCommand());
321 registerCommand(new KickAllCommand());
322 registerCommand(new KickCommand());
323 registerCommand(new ListCommand());
324 registerCommand(new SetHomeCommand());
325 registerCommand(new RepairCommand());
326 registerCommand(new TellCommand());
327 registerCommand(new ReplyCommand());
328 registerCommand(new SlotCommand());
329 registerCommand(new SlowmodeCommand());
330 registerCommand(new StpCommand());
331 registerCommand(new StreamerCommand());
332 registerCommand(new VipCommand());
333 registerCommand(new YouTubeCommand());
334 registerCommand(new CraftCommand());
335 registerCommand(new SmietnikCommand());
336 registerCommand(new BroadcastCommand());
337 registerCommand(new TpaCommand());
338 registerCommand(new WhiteListCommand());
339 registerCommand(new WhoIsCommand());
340 registerCommand(new StoneCommand());
341 registerCommand(new TeleportCommand());
342 registerCommand(new BackupCommand());
343 registerCommand(new SsCommand());
344 registerCommand(new SvipCommand());
345 registerCommand(new BanIPCommand());
346 registerCommand(new RenameCommand());
347 registerCommand(new BoyFamerCommand());
348 registerCommand(new IsCommand());
349 registerCommand(new CobblexCommand());
350 registerCommand(new WorkBenchCommand());
351 registerCommand(new EnderchestCommand());
352 registerCommand(new SpeedCommand());
353 registerCommand(new BuyCommand());
354 registerCommand(new LevelCommand());
355 registerCommand(new TurboCommand());
356 registerCommand(new StatsCommand());
357 registerCommand(new CaseCommand());
358 registerCommand(new CobblexCommand());
359 registerCommand(new HcCommand());
360 registerCommand(new DayCommand());
361 registerCommand(new NightCommand());
362 registerCommand(new SetWarpCommand());
363 registerCommand(new DelWarpCommand());
364 registerCommand(new NetherCommand());
365 registerCommand(new EnableCommand());
366 registerCommand(new ConfigCommand());
367 registerCommand(new ClearEnderchestCommand());
368 registerCommand(new GaCommand());
369 registerCommand(new AllyCommand());
370 registerCommand(new CreateCommand());
371 registerCommand(new DeleteCommand());
372 registerCommand(new EnlargeCommand());
373 registerCommand(new GuildSetHomeCommand());
374 registerCommand(new GuildHomeCommand());
375 registerCommand(new InfoCommand());
376 registerCommand(new InviteCommand());
377 registerCommand(new pl.kopara.guild.commands.guild.ItemCommand());
378 registerCommand(new JoinCommand());
379 registerCommand(new pl.kopara.guild.commands.guild.KickCommand());
380 registerCommand(new LeaderCommand());
381 registerCommand(new OwnerCommand());
382 registerCommand(new ProlongCommand());
383 registerCommand(new PvpCommand());
384 registerCommand(new AutoMsgCommand());
385 registerCommand(new LeaveCommand());
386 registerCommand(new HelpCommand());
387 registerCommand(new GuildHelpCommand());
388 registerCommand(new SniezkaHelpCommand());
389 registerCommand(new SkrzynkaCommand());
390 registerCommand(new SniezkaCommand());
391 }
392
393 public void registerTasks() {
394 new CheckValidityTask().runTaskTimer((Plugin)this, 2400L, 2400L);
395 new CombatTask().runTaskTimerAsynchronously((Plugin)this, 40L, 20L);
396 new LimitTask().runTaskTimer((Plugin)this, 300L, 300L);
397 new AutoMsgTask().runTaskTimerAsynchronously((Plugin)this, 1200L, 1200L);
398 }
399
400 public void registerManager() {
401 NameTagManager.enable();
402 DropFile.saveDefaultConfig();
403 DropManager.setup();
404 UserManager.loadUsers();
405 GuildManager.loadGuilds();
406 DeathBanManager.loadDeathsBans();
407 BanManager.loadBans();
408 BanIPManager.loadBans();
409 }
410
411 private void initTab() {
412 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new PointsVariable("points"));
413 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new KillsVariable("kills"));
414 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new DeathsVariable("deaths"));
415 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildVariable("guild"));
416 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildPointsVariable("gpoints"));
417 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildKillsVariable("gkills"));
418 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildDeathsVariable("gdeaths"));
419 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildSizeVariable("gsize"));
420 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildLifeVariable("glife"));
421 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildLimitVariable("gonline"));
422 for (int i = 1; i < 16; ++i) {
423 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopVariable("top" + i, i));
424 }
425 for (int i = 1; i < 16; ++i) {
426 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopGuildVariable("gtop" + i, i));
427 }
428 }
429
430 private void unTab() {
431 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new PointsVariable("points"));
432 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new KillsVariable("kills"));
433 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new DeathsVariable("deaths"));
434 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildVariable("guild"));
435 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildPointsVariable("gpoints"));
436 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildKillsVariable("gkills"));
437 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildDeathsVariable("gdeaths"));
438 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildSizeVariable("gsize"));
439 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildLifeVariable("glife"));
440 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildLimitVariable("gonline"));
441 for (int i = 1; i < 16; ++i) {
442 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopVariable("top" + i, i));
443 }
444 for (int i = 1; i < 16; ++i) {
445 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopGuildVariable("gtop" + i, i));
446 }
447 }
448
449 public void registerListener() {
450 registerListener((Plugin)this, new InventoryClickListener(), new DiamondCraftingBlocker(), new BlokowanieListener(), new PlayerQuitJoinListener(), new PlayerJoinListener(), new TimerManager(), new AsyncPlayerChatListener(), new ChatGuildsListener(), new PlayerMoveListener(), new BlockBreakListener(), new BlockPlaceListener(), new PlayerBucketEmptyListener(), new PlayerBucketFillListener(), new GuildExplodeListener(), new EntityDamageByEntityListener(), new EntityDamageListener(), new PlayerDeathListener(), new InCommbatInGuildListener(), new TakeCrystalListener(), new InventoryListener(), new InventoryClickListener(), new CheckLoginListener(), new BoyListener(), new PlayerInteractListener(), new PunchPotyListener(), new DropBlockBreakListener(), new EntityDeathListener(), new InventoryClickListener(), new OpenInventoryListener(), new SignChangeListener(), new CaseDropListener(), new CaseKickQuitListener(), new magiccase.listeners.InventoryClickListener(), new CobblexListener());
451 }
452
453 static {
454 GuildPlugin.chat = null;
455 }
456}