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