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