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