· 8 years ago · Jan 02, 2018, 03:50 PM
1package pl.endrju.ytcore;
2
3import codecrafter47.bungeetablistplus.api.bukkit.BungeeTabListPlusBukkitAPI;
4import magiccase.command.CaseCommand;
5import magiccase.listeners.CaseDropListener;
6import magiccase.listeners.CaseKickQuitListener;
7import magiccase.listeners.CasePlaceListener;
8import net.milkbowl.vault.chat.Chat;
9import org.bukkit.Bukkit;
10import org.bukkit.Server;
11import org.bukkit.World;
12import org.bukkit.entity.Player;
13import org.bukkit.event.Listener;
14import org.bukkit.plugin.Plugin;
15import org.bukkit.plugin.PluginManager;
16import org.bukkit.plugin.RegisteredServiceProvider;
17import org.bukkit.plugin.ServicesManager;
18import org.bukkit.plugin.java.JavaPlugin;
19import org.bukkit.scheduler.BukkitScheduler;
20import pl.SunnyTM.api.Config;
21import pl.endrju.ytcore.commands.Command;
22import pl.endrju.ytcore.commands.CommandManager;
23import pl.endrju.ytcore.commands.cmd.AutoMsgCommand;
24import pl.endrju.ytcore.commands.cmd.BackupCommand;
25import pl.endrju.ytcore.commands.cmd.BanCommand;
26import pl.endrju.ytcore.commands.cmd.BanIPCommand;
27import pl.endrju.ytcore.commands.cmd.BorderCommand;
28import pl.endrju.ytcore.commands.cmd.BoyFamerCommand;
29import pl.endrju.ytcore.commands.cmd.BroadcastCommand;
30import pl.endrju.ytcore.commands.cmd.CMDListCommand;
31import pl.endrju.ytcore.commands.cmd.ChatCommand;
32import pl.endrju.ytcore.commands.cmd.ClearCommand;
33import pl.endrju.ytcore.commands.cmd.ClearEnderchestCommand;
34import pl.endrju.ytcore.commands.cmd.CobblexCommand;
35import pl.endrju.ytcore.commands.cmd.ConfigCommand;
36import pl.endrju.ytcore.commands.cmd.CraftCommand;
37import pl.endrju.ytcore.commands.cmd.DayCommand;
38import pl.endrju.ytcore.commands.cmd.EnableCommand;
39import pl.endrju.ytcore.commands.cmd.EnchantCommand;
40import pl.endrju.ytcore.commands.cmd.EnderchestCommand;
41import pl.endrju.ytcore.commands.cmd.FlyCommand;
42import pl.endrju.ytcore.commands.cmd.GamemodeCommand;
43import pl.endrju.ytcore.commands.cmd.GcCommand;
44import pl.endrju.ytcore.commands.cmd.GiveCommand;
45import pl.endrju.ytcore.commands.cmd.GodCommand;
46import pl.endrju.ytcore.commands.cmd.HcCommand;
47import pl.endrju.ytcore.commands.cmd.HeadCommand;
48import pl.endrju.ytcore.commands.cmd.HealCommand;
49import pl.endrju.ytcore.commands.cmd.HelpCommand;
50import pl.endrju.ytcore.commands.cmd.HelpOpCommand;
51import pl.endrju.ytcore.commands.cmd.HelperCommand;
52import pl.endrju.ytcore.commands.cmd.HomeCommand;
53import pl.endrju.ytcore.commands.cmd.IgnoreCommand;
54import pl.endrju.ytcore.commands.cmd.InvCommand;
55import pl.endrju.ytcore.commands.cmd.IsCommand;
56import pl.endrju.ytcore.commands.cmd.KickAllCommand;
57import pl.endrju.ytcore.commands.cmd.KitCommand;
58import pl.endrju.ytcore.commands.cmd.LevelCommand;
59import pl.endrju.ytcore.commands.cmd.ListCommand;
60import pl.endrju.ytcore.commands.cmd.MuteCommand;
61import pl.endrju.ytcore.commands.cmd.NadajCommand;
62import pl.endrju.ytcore.commands.cmd.NetherCommand;
63import pl.endrju.ytcore.commands.cmd.NightCommand;
64import pl.endrju.ytcore.commands.cmd.PayCommand;
65import pl.endrju.ytcore.commands.cmd.RankingCommand;
66import pl.endrju.ytcore.commands.cmd.RenameCommand;
67import pl.endrju.ytcore.commands.cmd.RepairCommand;
68import pl.endrju.ytcore.commands.cmd.ReplyCommand;
69import pl.endrju.ytcore.commands.cmd.SetHomeCommand;
70import pl.endrju.ytcore.commands.cmd.SetSpawnCommand;
71import pl.endrju.ytcore.commands.cmd.SklepCommand;
72import pl.endrju.ytcore.commands.cmd.SlotCommand;
73import pl.endrju.ytcore.commands.cmd.SlowmodeCommand;
74import pl.endrju.ytcore.commands.cmd.SmietnikCommand;
75import pl.endrju.ytcore.commands.cmd.SniezkaCommand;
76import pl.endrju.ytcore.commands.cmd.SpawnCommand;
77import pl.endrju.ytcore.commands.cmd.SpeedCommand;
78import pl.endrju.ytcore.commands.cmd.StatsCommand;
79import pl.endrju.ytcore.commands.cmd.StoneCommand;
80import pl.endrju.ytcore.commands.cmd.StoniarkaCommand;
81import pl.endrju.ytcore.commands.cmd.StpCommand;
82import pl.endrju.ytcore.commands.cmd.StreamerCommand;
83import pl.endrju.ytcore.commands.cmd.TeleportCommand;
84import pl.endrju.ytcore.commands.cmd.TellCommand;
85import pl.endrju.ytcore.commands.cmd.TpaCommand;
86import pl.endrju.ytcore.commands.cmd.TpacceptCommand;
87import pl.endrju.ytcore.commands.cmd.TpdenyCommmand;
88import pl.endrju.ytcore.commands.cmd.TurboCommand;
89import pl.endrju.ytcore.commands.cmd.UnBanCommand;
90import pl.endrju.ytcore.commands.cmd.UnBanIpCommand;
91import pl.endrju.ytcore.commands.cmd.UnMuteCommand;
92import pl.endrju.ytcore.commands.cmd.VanishCommand;
93import pl.endrju.ytcore.commands.cmd.VipCommand;
94import pl.endrju.ytcore.commands.cmd.VoucherCommand;
95import pl.endrju.ytcore.commands.cmd.WhiteListCommand;
96import pl.endrju.ytcore.commands.cmd.WhoIsCommand;
97import pl.endrju.ytcore.commands.cmd.WiadomosciCommand;
98import pl.endrju.ytcore.commands.cmd.WorkBenchCommand;
99import pl.endrju.ytcore.commands.cmd.YouTubeCommand;
100import pl.endrju.ytcore.commands.cmd.ZdrapkaDajCommand;
101import pl.endrju.ytcore.commands.guild.AllyCommand;
102import pl.endrju.ytcore.commands.guild.CreateCommand;
103import pl.endrju.ytcore.commands.guild.DeleteCommand;
104import pl.endrju.ytcore.commands.guild.EnlargeCommand;
105import pl.endrju.ytcore.commands.guild.GEfektCommand;
106import pl.endrju.ytcore.commands.guild.GaCommand;
107import pl.endrju.ytcore.commands.guild.GuildHelpCommand;
108import pl.endrju.ytcore.commands.guild.GuildHomeCommand;
109import pl.endrju.ytcore.commands.guild.GuildSetHomeCommand;
110import pl.endrju.ytcore.commands.guild.InfoCommand;
111import pl.endrju.ytcore.commands.guild.InviteCommand;
112import pl.endrju.ytcore.commands.guild.ItemCommand;
113import pl.endrju.ytcore.commands.guild.JoinCommand;
114import pl.endrju.ytcore.commands.guild.LeaderCommand;
115import pl.endrju.ytcore.commands.guild.LeaveCommand;
116import pl.endrju.ytcore.commands.guild.OpisCommand;
117import pl.endrju.ytcore.commands.guild.OwnerCommand;
118import pl.endrju.ytcore.commands.guild.ProlongCommand;
119import pl.endrju.ytcore.commands.guild.PvpCommand;
120import pl.endrju.ytcore.listeners.AsyncPlayerChatListener;
121import pl.endrju.ytcore.listeners.BlokowanieListener;
122import pl.endrju.ytcore.listeners.BorderMapListener;
123import pl.endrju.ytcore.listeners.BoyListener;
124import pl.endrju.ytcore.listeners.ChatGuildsListener;
125import pl.endrju.ytcore.listeners.CheckLoginListener;
126import pl.endrju.ytcore.listeners.CobblexListener;
127import pl.endrju.ytcore.listeners.DropBlockBreakListener;
128import pl.endrju.ytcore.listeners.EntityDamageByEntityListener;
129import pl.endrju.ytcore.listeners.EntityDamageListener;
130import pl.endrju.ytcore.listeners.EntityDeathListener;
131import pl.endrju.ytcore.listeners.GuildExplodeListener;
132import pl.endrju.ytcore.listeners.InCommbatInGuildListener;
133import pl.endrju.ytcore.listeners.InventoryListener;
134import pl.endrju.ytcore.listeners.OpenInventoryListener;
135import pl.endrju.ytcore.listeners.PlayerDeathListener;
136import pl.endrju.ytcore.listeners.PlayerInteractListener;
137import pl.endrju.ytcore.listeners.PlayerJoinListener;
138import pl.endrju.ytcore.listeners.PlayerMoveListener;
139import pl.endrju.ytcore.listeners.PlayerQuitJoinListener;
140import pl.endrju.ytcore.listeners.PunchPotyListener;
141import pl.endrju.ytcore.listeners.RainStartListener;
142import pl.endrju.ytcore.listeners.SignChangeListener;
143import pl.endrju.ytcore.listeners.SprawdzUseListener;
144import pl.endrju.ytcore.listeners.TakeCrystalListener;
145import pl.endrju.ytcore.listeners.TntEvent;
146import pl.endrju.ytcore.listeners.action.BlockBreakListener;
147import pl.endrju.ytcore.listeners.action.BlockPlaceListener;
148import pl.endrju.ytcore.listeners.action.BorderBreakListener;
149import pl.endrju.ytcore.listeners.action.BorderPlaceListener;
150import pl.endrju.ytcore.listeners.action.PlayerBucketEmptyListener;
151import pl.endrju.ytcore.listeners.action.PlayerBucketFillListener;
152import pl.endrju.ytcore.managers.BanIPManager;
153import pl.endrju.ytcore.managers.BanManager;
154import pl.endrju.ytcore.managers.CombatManager;
155import pl.endrju.ytcore.managers.DeathBanManager;
156import pl.endrju.ytcore.managers.DropFile;
157import pl.endrju.ytcore.managers.DropManager;
158import pl.endrju.ytcore.managers.GuildManager;
159import pl.endrju.ytcore.managers.MuteManager;
160import pl.endrju.ytcore.managers.NameTagManager;
161import pl.endrju.ytcore.managers.TimerManager;
162import pl.endrju.ytcore.managers.UserManager;
163import pl.endrju.ytcore.mysql.store.Store;
164import pl.endrju.ytcore.mysql.store.modes.StoreMode;
165import pl.endrju.ytcore.mysql.store.modes.StoreMySQL;
166import pl.endrju.ytcore.mysql.store.modes.StoreSQLITE;
167import pl.endrju.ytcore.rank.TabThread;
168import pl.endrju.ytcore.rank.variable.AssistTopVariable;
169import pl.endrju.ytcore.rank.variable.AsystsVariable;
170import pl.endrju.ytcore.rank.variable.CoinsTopVariable;
171import pl.endrju.ytcore.rank.variable.DeathsTopVariable;
172import pl.endrju.ytcore.rank.variable.DeathsVariable;
173import pl.endrju.ytcore.rank.variable.GuildDeathsVariable;
174import pl.endrju.ytcore.rank.variable.GuildKDVariable;
175import pl.endrju.ytcore.rank.variable.GuildKillsVariable;
176import pl.endrju.ytcore.rank.variable.GuildLiderVariable;
177import pl.endrju.ytcore.rank.variable.GuildLifeVariable;
178import pl.endrju.ytcore.rank.variable.GuildLimitVariable;
179import pl.endrju.ytcore.rank.variable.GuildPointsVariable;
180import pl.endrju.ytcore.rank.variable.GuildSizeVariable;
181import pl.endrju.ytcore.rank.variable.GuildVariable;
182import pl.endrju.ytcore.rank.variable.GuildZastepcaVariable;
183import pl.endrju.ytcore.rank.variable.KDVariable;
184import pl.endrju.ytcore.rank.variable.KillsTopVariable;
185import pl.endrju.ytcore.rank.variable.KillsVariable;
186import pl.endrju.ytcore.rank.variable.LogoutVariable;
187import pl.endrju.ytcore.rank.variable.LvlTopVariable;
188import pl.endrju.ytcore.rank.variable.LvlVariable;
189import pl.endrju.ytcore.rank.variable.NameVariable;
190import pl.endrju.ytcore.rank.variable.OnlineVariable;
191import pl.endrju.ytcore.rank.variable.PointsVariable;
192import pl.endrju.ytcore.rank.variable.PozycjaVariable;
193import pl.endrju.ytcore.rank.variable.RolaVariable;
194import pl.endrju.ytcore.rank.variable.TopGuildVariable;
195import pl.endrju.ytcore.rank.variable.TopVariable;
196import pl.endrju.ytcore.tasks.AutoMsgTask;
197import pl.endrju.ytcore.tasks.CheckValidityTask;
198import pl.endrju.ytcore.tasks.CombatTask;
199import pl.endrju.ytcore.tasks.LimitTask;
200import pl.endrju.ytcore.tasks.TabFreshRunnable;
201import pl.endrju.ytcore.utils.CraftingUtil;
202import pl.endrju.ytcore.utils.Logger;
203import pl.endrju.ytcore.utils.Ticking;
204
205public class GuildPlugin
206 extends JavaPlugin
207{
208 private static GuildPlugin plugin;
209 private static Store store;
210
211 public void onLoad()
212 {
213 plugin = this;
214 }
215
216 private static Chat chat = null;
217 private static PluginManager pluginManager;
218
219 public void onEnable()
220 {
221 initTab();
222 for (Player p : Bukkit.getOnlinePlayers())
223 {
224 Combat c = CombatManager.getCombat(p);
225 if (c == null) {
226 CombatManager.createCombat(p);
227 }
228 }
229 new Ticking().start();
230 new TabThread();
231 registerDatabase();
232 registerManager();
233 registerListener();
234 registerTasks();
235 registerCommand();
236 CraftingUtil.registerRecipe();
237 }
238
239 public void onDisable()
240 {
241 unTab();
242 Bukkit.getScheduler().cancelTasks(this);
243 for (Player p : Bukkit.getOnlinePlayers()) {
244 CombatManager.removeCombat(p);
245 }
246 Bukkit.savePlayers();
247 for (World w : Bukkit.getWorlds()) {
248 w.save();
249 }
250 try
251 {
252 Thread.sleep(2000L);
253 }
254 catch (InterruptedException e)
255 {
256 e.printStackTrace();
257 }
258 if ((store != null) && (store.isConnected())) {
259 store.disconnect();
260 }
261 plugin = null;
262 }
263
264 public static GuildPlugin getPlugin()
265 {
266 return plugin;
267 }
268
269 protected boolean registerDatabase()
270 {
271 switch (StoreMode.getByName(Config.DATABASE_MODE))
272 {
273 case SQLITE:
274 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);
275 break;
276 case MYSQL:
277 store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
278 break;
279 default:
280 Logger.warning(new String[] {"Value of databse mode is not valid! Using SQLITE as database!" });
281 store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
282 }
283 boolean conn = store.connect();
284 if (conn)
285 {
286 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}users` (" + (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,`coins` 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);");
287 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}guilds` (" + (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, `description` varchar(64) 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);");
288 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}members` (" + (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);");
289 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bans` (" + (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);");
290 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bansip` (" + (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);");
291 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}mutes` (" + (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);");
292 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}backups` (" + (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);");
293 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}warp` (" + (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);");
294 store.update(true, "CREATE TABLE IF NOT EXISTS `{P}deathbans` (" + (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);");
295 return conn;
296 }
297 return conn;
298 }
299
300 public static void registerCommand(Command command)
301 {
302 CommandManager.register(command);
303 }
304
305 public static void registerListener(Plugin plugin, Listener... listeners)
306 {
307 if (pluginManager == null) {
308 pluginManager = Bukkit.getPluginManager();
309 }
310 Listener[] arrayOfListener;
311 int j = (arrayOfListener = listeners).length;
312 for (int i = 0; i < j; i++)
313 {
314 Listener listener = arrayOfListener[i];
315 pluginManager.registerEvents(listener, plugin);
316 }
317 }
318
319 private boolean setupChat()
320 {
321 if (getServer().getPluginManager().getPlugin("Vault") == null) {
322 return false;
323 }
324 RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
325 chat = (Chat)rsp.getProvider();
326 return chat != null;
327 }
328
329 public static Chat getChat()
330 {
331 return chat;
332 }
333
334 public static Store getStore()
335 {
336 return store;
337 }
338
339 public static void registerCommand()
340 {
341 registerCommand(new ListCommand());
342 registerCommand(new RankingCommand());
343 registerCommand(new GodCommand());
344 registerCommand(new BanIPCommand());
345 registerCommand(new BanCommand());
346 registerCommand(new UnBanCommand());
347 registerCommand(new UnBanIpCommand());
348 registerCommand(new ChatCommand());
349 registerCommand(new GamemodeCommand());
350 registerCommand(new FlyCommand());
351 registerCommand(new SpawnCommand());
352 registerCommand(new SetSpawnCommand());
353 registerCommand(new KitCommand());
354 registerCommand(new TpacceptCommand());
355 registerCommand(new TpdenyCommmand());
356 registerCommand(new TpaCommand());
357 registerCommand(new ClearCommand());
358 registerCommand(new EnchantCommand());
359 registerCommand(new GcCommand());
360 registerCommand(new ItemCommand());
361 registerCommand(new GiveCommand());
362 registerCommand(new HeadCommand());
363 registerCommand(new HealCommand());
364 registerCommand(new HelpOpCommand());
365 registerCommand(new HomeCommand());
366 registerCommand(new KickAllCommand());
367 registerCommand(new pl.endrju.ytcore.commands.cmd.KickCommand());
368 registerCommand(new ListCommand());
369 registerCommand(new SetHomeCommand());
370 registerCommand(new RepairCommand());
371 registerCommand(new TellCommand());
372 registerCommand(new ReplyCommand());
373 registerCommand(new SlotCommand());
374 registerCommand(new SlowmodeCommand());
375 registerCommand(new StpCommand());
376 registerCommand(new StreamerCommand());
377 registerCommand(new VipCommand());
378 registerCommand(new YouTubeCommand());
379 registerCommand(new CraftCommand());
380 registerCommand(new SmietnikCommand());
381 registerCommand(new BroadcastCommand());
382 registerCommand(new TpaCommand());
383 registerCommand(new WhiteListCommand());
384 registerCommand(new WhoIsCommand());
385 registerCommand(new StoneCommand());
386 registerCommand(new TeleportCommand());
387 registerCommand(new BackupCommand());
388 registerCommand(new RenameCommand());
389 registerCommand(new BoyFamerCommand());
390 registerCommand(new IsCommand());
391 registerCommand(new CobblexCommand());
392 registerCommand(new WorkBenchCommand());
393 registerCommand(new EnderchestCommand());
394 registerCommand(new SpeedCommand());
395 registerCommand(new LevelCommand());
396 registerCommand(new TurboCommand());
397 registerCommand(new StatsCommand());
398 registerCommand(new CaseCommand());
399 registerCommand(new CobblexCommand());
400 registerCommand(new HcCommand());
401 registerCommand(new DayCommand());
402 registerCommand(new NightCommand());
403 registerCommand(new NetherCommand());
404 registerCommand(new EnableCommand());
405 registerCommand(new ConfigCommand());
406 registerCommand(new ClearEnderchestCommand());
407 registerCommand(new GaCommand());
408 registerCommand(new AllyCommand());
409 registerCommand(new CreateCommand());
410 registerCommand(new DeleteCommand());
411 registerCommand(new EnlargeCommand());
412 registerCommand(new GuildSetHomeCommand());
413 registerCommand(new GuildHomeCommand());
414 registerCommand(new InfoCommand());
415 registerCommand(new InviteCommand());
416 registerCommand(new ItemCommand());
417 registerCommand(new JoinCommand());
418 registerCommand(new pl.endrju.ytcore.commands.guild.KickCommand());
419 registerCommand(new pl.endrju.ytcore.commands.cmd.KickCommand());
420 registerCommand(new LeaderCommand());
421 registerCommand(new OwnerCommand());
422 registerCommand(new ProlongCommand());
423 registerCommand(new PvpCommand());
424 registerCommand(new AutoMsgCommand());
425 registerCommand(new LeaveCommand());
426 registerCommand(new HelpCommand());
427 registerCommand(new GuildHelpCommand());
428 registerCommand(new SniezkaCommand());
429 registerCommand(new NadajCommand());
430 registerCommand(new InvCommand());
431 registerCommand(new ZdrapkaDajCommand());
432 registerCommand(new HelperCommand());
433 registerCommand(new BorderCommand());
434 registerCommand(new CMDListCommand());
435 registerCommand(new StoniarkaCommand());
436 registerCommand(new GEfektCommand());
437 registerCommand(new SklepCommand());
438 registerCommand(new WiadomosciCommand());
439 registerCommand(new IgnoreCommand());
440 registerCommand(new PayCommand());
441 registerCommand(new OpisCommand());
442 registerCommand(new MuteCommand());
443 registerCommand(new UnMuteCommand());
444 registerCommand(new VoucherCommand());
445 registerCommand(new VanishCommand());
446 }
447
448 public void registerTasks()
449 {
450 new CheckValidityTask().runTaskTimer(this, 2400L, 2400L);
451 new CombatTask().runTaskTimerAsynchronously(this, 40L, 20L);
452 new LimitTask().runTaskTimer(this, 300L, 300L);
453 new AutoMsgTask().runTaskTimerAsynchronously(this, 1200L, 1200L);
454 new TabFreshRunnable().runTaskTimerAsynchronously(this, 600L, 600L);
455 }
456
457 public void registerManager()
458 {
459 NameTagManager.enable();
460 DropFile.saveDefaultConfig();
461 DropManager.setup();
462 UserManager.loadUsers();
463 GuildManager.loadGuilds();
464 DeathBanManager.loadDeathsBans();
465 BanManager.loadBans();
466 BanIPManager.loadBans();
467 MuteManager.loadMutes();
468 }
469
470 private void initTab()
471 {
472 BungeeTabListPlusBukkitAPI.registerVariable(this, new PointsVariable("points"));
473 BungeeTabListPlusBukkitAPI.registerVariable(this, new LvlVariable("lvl"));
474 BungeeTabListPlusBukkitAPI.registerVariable(this, new AsystsVariable("asist"));
475 BungeeTabListPlusBukkitAPI.registerVariable(this, new KillsVariable("kills"));
476 BungeeTabListPlusBukkitAPI.registerVariable(this, new DeathsVariable("deaths"));
477 BungeeTabListPlusBukkitAPI.registerVariable(this, new LogoutVariable("logout"));
478 BungeeTabListPlusBukkitAPI.registerVariable(this, new KDVariable("kd"));
479 BungeeTabListPlusBukkitAPI.registerVariable(this, new PozycjaVariable("pos"));
480 BungeeTabListPlusBukkitAPI.registerVariable(this, new NameVariable("name"));
481 BungeeTabListPlusBukkitAPI.registerVariable(this, new RolaVariable("rola"));
482 BungeeTabListPlusBukkitAPI.registerVariable(this, new OnlineVariable("online"));
483
484 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildVariable("guild"));
485 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildPointsVariable("gpoints"));
486 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildKillsVariable("gkills"));
487 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildDeathsVariable("gdeaths"));
488 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildSizeVariable("gsize"));
489 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildLifeVariable("glife"));
490 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildLimitVariable("gonline"));
491 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildKDVariable("gkd"));
492 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildLiderVariable("lider"));
493 BungeeTabListPlusBukkitAPI.registerVariable(this, new GuildZastepcaVariable("zastepca"));
494 for (int i = 1; i < 16; i++) {
495 BungeeTabListPlusBukkitAPI.registerVariable(this, new TopVariable("top" + i, i));
496 }
497 for (int i = 1; i < 16; i++) {
498 BungeeTabListPlusBukkitAPI.registerVariable(this, new AssistTopVariable("atop" + i, i));
499 }
500 for (int i = 1; i < 16; i++) {
501 BungeeTabListPlusBukkitAPI.registerVariable(this, new DeathsTopVariable("dtop" + i, i));
502 }
503 for (int i = 1; i < 16; i++) {
504 BungeeTabListPlusBukkitAPI.registerVariable(this, new KillsTopVariable("ktop" + i, i));
505 }
506 for (int i = 1; i < 16; i++) {
507 BungeeTabListPlusBukkitAPI.registerVariable(this, new LvlTopVariable("ltop" + i, i));
508 }
509 for (int i = 1; i < 16; i++) {
510 BungeeTabListPlusBukkitAPI.registerVariable(this, new CoinsTopVariable("ctop" + i, i));
511 }
512 for (int i = 1; i < 16; i++) {
513 BungeeTabListPlusBukkitAPI.registerVariable(this, new TopGuildVariable("gtop" + i, i));
514 }
515 }
516
517 private void unTab()
518 {
519 BungeeTabListPlusBukkitAPI.unregisterVariable(new PointsVariable("points"));
520 BungeeTabListPlusBukkitAPI.unregisterVariable(new KillsVariable("kills"));
521 BungeeTabListPlusBukkitAPI.registerVariable(this, new AsystsVariable("asist"));
522 BungeeTabListPlusBukkitAPI.registerVariable(this, new LvlVariable("lvl"));
523 BungeeTabListPlusBukkitAPI.unregisterVariable(new DeathsVariable("deaths"));
524 BungeeTabListPlusBukkitAPI.unregisterVariable(new LogoutVariable("logout"));
525 BungeeTabListPlusBukkitAPI.unregisterVariable(new KDVariable("kd"));
526 BungeeTabListPlusBukkitAPI.unregisterVariable(new PozycjaVariable("pos"));
527 BungeeTabListPlusBukkitAPI.unregisterVariable(new NameVariable("name"));
528 BungeeTabListPlusBukkitAPI.unregisterVariable(new RolaVariable("rola"));
529 BungeeTabListPlusBukkitAPI.unregisterVariable(new OnlineVariable("online"));
530
531 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildVariable("guild"));
532 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildPointsVariable("gpoints"));
533 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildKillsVariable("gkills"));
534 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildDeathsVariable("gdeaths"));
535 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildSizeVariable("gsize"));
536 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildLifeVariable("glife"));
537 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildLiderVariable("lider"));
538 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildZastepcaVariable("zastepca"));
539 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildKDVariable("gkd"));
540
541 BungeeTabListPlusBukkitAPI.unregisterVariable(new GuildLimitVariable("gonline"));
542 for (int i = 1; i < 16; i++) {
543 BungeeTabListPlusBukkitAPI.unregisterVariable(new TopVariable("top" + i, i));
544 }
545 for (int i = 1; i < 16; i++) {
546 BungeeTabListPlusBukkitAPI.unregisterVariable(new TopGuildVariable("gtop" + i, i));
547 }
548 }
549
550 public void registerListener()
551 {
552 registerListener(this, new Listener[] {
553 new pl.endrju.ytcore.listeners.InventoryClickListener(),
554 new PlayerQuitJoinListener(),
555 new PlayerJoinListener(),
556 new TimerManager(),
557 new AsyncPlayerChatListener(),
558 new ChatGuildsListener(),
559 new PlayerMoveListener(),
560 new BlockBreakListener(),
561 new BlockPlaceListener(),
562 new PlayerBucketEmptyListener(),
563 new PlayerBucketFillListener(),
564 new GuildExplodeListener(),
565 new EntityDamageByEntityListener(),
566 new EntityDamageListener(),
567 new PlayerDeathListener(),
568 new InCommbatInGuildListener(),
569 new TakeCrystalListener(),
570 new CheckLoginListener(),
571 new BoyListener(),
572 new PlayerInteractListener(),
573 new PunchPotyListener(),
574 new DropBlockBreakListener(),
575 new EntityDeathListener(),
576 new BorderMapListener(),
577 new RainStartListener(),
578 new TntEvent(),
579 new SprawdzUseListener(),
580 new BlokowanieListener(),
581 new BorderBreakListener(),
582 new BorderPlaceListener(),
583
584 new InventoryListener(),
585 new OpenInventoryListener(),
586 new SignChangeListener(),
587 new CaseDropListener(),
588 new CasePlaceListener(),
589 new CaseKickQuitListener(),
590 new magiccase.listeners.InventoryClickListener(),
591
592 new CobblexListener() });
593 }
594}