· 5 years ago · Feb 15, 2020, 07:02 PM
1//
2// Decompiled by Procyon v0.5.30
3//
4
5package pl.karas.api;
6
7import java.sql.ResultSet;
8import java.sql.SQLException;
9
10
11import org.bukkit.Bukkit;
12import org.bukkit.World;
13import org.bukkit.entity.Player;
14import org.bukkit.event.Listener;
15import org.bukkit.plugin.Plugin;
16import org.bukkit.plugin.PluginManager;
17import org.bukkit.plugin.java.JavaPlugin;
18
19import pl.karas.api.Config;
20import pl.karas.api.commands.Command;
21import pl.karas.api.commands.CommandManager;
22import pl.karas.api.commands.cmd.AEventCommand;
23import pl.karas.api.commands.cmd.ANagrodaCommand;
24import pl.karas.api.commands.cmd.AntyCheatCommand;
25import pl.karas.api.commands.cmd.AutoMsgCommand;
26import pl.karas.api.commands.cmd.BackupCommand;
27import pl.karas.api.commands.cmd.BanCommand;
28import pl.karas.api.commands.cmd.BanIPCommand;
29import pl.karas.api.commands.cmd.BlokiCommand;
30import pl.karas.api.commands.cmd.BorderCommand;
31import pl.karas.api.commands.cmd.BroadcastCommand;
32import pl.karas.api.commands.cmd.BroadcastTitleCommand;
33import pl.karas.api.commands.cmd.ChatCommand;
34import pl.karas.api.commands.cmd.ClearCommand;
35import pl.karas.api.commands.cmd.NaprawKilofCommand;
36import pl.karas.api.commands.cmd.ClearEnderchestCommand;
37import pl.karas.api.commands.cmd.ConfigCommand;
38import pl.karas.api.commands.cmd.EnderchestCommand;
39import pl.karas.api.commands.cmd.CraftCommand;
40import pl.karas.api.commands.cmd.DayCommand;
41import pl.karas.api.commands.cmd.DcCommand;
42import pl.karas.api.commands.cmd.DiscoCommand;
43import pl.karas.api.commands.cmd.EfektyCommand;
44import pl.karas.api.commands.cmd.EnableCommand;
45import pl.karas.api.commands.cmd.EnchantCommand;
46import pl.karas.api.commands.cmd.FlyCommand;
47import pl.karas.api.commands.cmd.GamemodeCommand;
48import pl.karas.api.commands.cmd.GcCommand;
49import pl.karas.api.commands.cmd.GiveCommand;
50import pl.karas.api.commands.cmd.GiveYTCommand;
51import pl.karas.api.commands.cmd.GodCommand;
52import pl.karas.api.commands.cmd.GuildItemCommand;
53import pl.karas.api.commands.cmd.HcCommand;
54import pl.karas.api.commands.cmd.HealCommand;
55import pl.karas.api.commands.cmd.HelpCommand;
56import pl.karas.api.commands.cmd.HelpOpCommand;
57import pl.karas.api.commands.cmd.HomeCommand;
58import pl.karas.api.commands.cmd.IgnoreCommand;
59import pl.karas.api.commands.cmd.InvCommand;
60import pl.karas.api.commands.cmd.IsCommand;
61import pl.karas.api.commands.cmd.ItemCommand;
62import pl.karas.api.commands.cmd.KickAllCommand;
63import pl.karas.api.commands.cmd.KickCommand;
64import pl.karas.api.commands.cmd.KitCommand;
65import pl.karas.api.commands.cmd.KsiazkiCommand;
66import pl.karas.api.commands.cmd.LevelCommand;
67import pl.karas.api.commands.cmd.ListCommand;
68import pl.karas.api.commands.cmd.MVipCommand;
69import pl.karas.api.commands.cmd.MarmurCommand;
70import pl.karas.api.commands.cmd.MoreCommand;
71import pl.karas.api.commands.cmd.MuteCommand;
72import pl.karas.api.commands.cmd.NagrodaCommand;
73import pl.karas.api.commands.cmd.NetherCommand;
74import pl.karas.api.commands.cmd.NightCommand;
75import pl.karas.api.commands.cmd.OtchlanCommand;
76import pl.karas.api.commands.cmd.PaczkaCommand;
77import pl.karas.api.commands.cmd.PayCommand;
78import pl.karas.api.commands.cmd.RankingCommand;
79import pl.karas.api.commands.cmd.RenameCommand;
80import pl.karas.api.commands.cmd.RepairCommand;
81import pl.karas.api.commands.cmd.ReplyCommand;
82import pl.karas.api.commands.cmd.ResetRankingCommand;
83import pl.karas.api.commands.cmd.SVipCommand;
84import pl.karas.api.commands.cmd.SchowekCommand;
85import pl.karas.api.commands.cmd.SetHomeCommand;
86import pl.karas.api.commands.cmd.SetSpawnCommand;
87import pl.karas.api.commands.cmd.SetWarpCommand;
88import pl.karas.api.commands.cmd.SklepCommand;
89import pl.karas.api.commands.cmd.SlotCommand;
90import pl.karas.api.commands.cmd.SlowmodeCommand;
91import pl.karas.api.commands.cmd.SmietnikCommand;
92import pl.karas.api.commands.cmd.SpawnCommand;
93import pl.karas.api.commands.cmd.SpeedCommand;
94import pl.karas.api.commands.cmd.StatsCommand;
95import pl.karas.api.commands.cmd.StatystykiCommand;
96import pl.karas.api.commands.cmd.StoneCommand;
97import pl.karas.api.commands.cmd.StpCommand;
98import pl.karas.api.commands.cmd.TeleportCommand;
99import pl.karas.api.commands.cmd.TellCommand;
100import pl.karas.api.commands.cmd.TpaCommand;
101import pl.karas.api.commands.cmd.TpacceptCommand;
102import pl.karas.api.commands.cmd.TpdenyCommmand;
103import pl.karas.api.commands.cmd.TurboCommand;
104import pl.karas.api.commands.cmd.UnBanCommand;
105import pl.karas.api.commands.cmd.UnBanIpCommand;
106import pl.karas.api.commands.cmd.UnMuteCommand;
107import pl.karas.api.commands.cmd.VipCommand;
108import pl.karas.api.commands.cmd.VoucherCommand;
109import pl.karas.api.commands.cmd.WarpCommand;
110import pl.karas.api.commands.cmd.WhiteListCommand;
111import pl.karas.api.commands.cmd.WiadomosciCommand;
112import pl.karas.api.commands.cmd.WorkBenchCommand;
113import pl.karas.api.commands.cmd.WymianaCommand;
114import pl.karas.api.commands.cmd.YouTubeCommand;
115import pl.karas.api.commands.cmd.ZnakiCommand;
116import pl.karas.api.commands.guild.AllyCommand;
117import pl.karas.api.commands.guild.CreateCommand;
118import pl.karas.api.commands.guild.DeleteCommand;
119import pl.karas.api.commands.guild.EnlargeCommand;
120import pl.karas.api.commands.guild.GuildAdminCommand;
121import pl.karas.api.commands.guild.GuildHelpCommand;
122import pl.karas.api.commands.guild.GuildHomeCommand;
123import pl.karas.api.commands.guild.GuildManageCommand;
124import pl.karas.api.commands.guild.GuildSetHomeCommand;
125import pl.karas.api.commands.guild.InfoCommand;
126import pl.karas.api.commands.guild.InviteCommand;
127import pl.karas.api.commands.guild.ItemkiCommand;
128import pl.karas.api.commands.guild.JoinCommand;
129import pl.karas.api.commands.guild.LeaderCommand;
130import pl.karas.api.commands.guild.LeaveCommand;
131import pl.karas.api.commands.guild.OwnerCommand;
132import pl.karas.api.commands.guild.ProlongCommand;
133import pl.karas.api.commands.guild.PvpCommand;
134import pl.karas.api.data.base.Combat;
135import pl.karas.api.data.base.guild.Guild;
136import pl.karas.api.gui.action.CustomEnchantInventoryListener;
137import pl.karas.api.gui.action.PlayerInteraktListener;
138import pl.karas.api.listeners.AntiLagListener;
139import pl.karas.api.listeners.AsyncPlayerChatListener;
140import pl.karas.api.listeners.BlockCraftingListener;
141import pl.karas.api.listeners.BlockDebilListener;
142import pl.karas.api.listeners.BlockListener;
143import pl.karas.api.listeners.BlokowanieListener;
144import pl.karas.api.listeners.BorderMapListener;
145import pl.karas.api.listeners.BoyListener;
146import pl.karas.api.listeners.ChatGuildsListener;
147import pl.karas.api.listeners.CheckLoginListener;
148import pl.karas.api.listeners.RedstoneListener;
149import pl.karas.api.listeners.DropBlockBreakListener;
150import pl.karas.api.listeners.EfektyListener;
151import pl.karas.api.listeners.EnchantItemListener;
152import pl.karas.api.listeners.EnderChestListener;
153import pl.karas.api.listeners.EntityDamageByEntityListener;
154import pl.karas.api.listeners.EntityDamageListener;
155import pl.karas.api.listeners.EntityDeathListener;
156import pl.karas.api.listeners.EventyListener;
157import pl.karas.api.listeners.FarmeryListener;
158import pl.karas.api.listeners.GrupoweListener;
159import pl.karas.api.listeners.GuildExplodeListener;
160import pl.karas.api.listeners.InCommbatInGuildListener;
161import pl.karas.api.listeners.InventoryClickListener;
162import pl.karas.api.listeners.InventoryListener;
163import pl.karas.api.listeners.KoxBlockedListener;
164import pl.karas.api.listeners.MarmurListener;
165import pl.karas.api.listeners.Nether;
166import pl.karas.disco.listeners.EntityDiscoListener;
167import pl.karas.disco.listeners.InventoryDiscoListener;
168import pl.karas.disco.listeners.ToggleListener;
169import pl.karas.api.listeners.OpenInventoryListener;
170import pl.karas.api.listeners.PlayerCommandPreprocessListener;
171import pl.karas.api.listeners.PlayerDeathListener;
172import pl.karas.api.listeners.PlayerInteractListener;
173import pl.karas.api.listeners.PlayerJoinListener;
174import pl.karas.api.listeners.PlayerMoveListener;
175import pl.karas.api.listeners.PlayerQuitJoinListener;
176import pl.karas.api.listeners.PunchPotyListener;
177import pl.karas.tools.data.base.disco.DataManager;
178import pl.karas.tools.data.base.disco.DiscoTask;
179import pl.karas.tools.data.base.disco.PacketEquipment;
180import pl.karas.api.listeners.RainStartListener;
181import pl.karas.api.listeners.SignChangeListener;
182import pl.karas.api.listeners.TakeCrystalListener;
183import pl.karas.api.listeners.TntDamage;
184import pl.karas.api.listeners.TntEvent;
185import pl.karas.api.listeners.WymianaListener;
186import pl.karas.api.listeners.action.BlockBreakListener;
187import pl.karas.api.listeners.action.BlockPlaceListener;
188import pl.karas.api.listeners.action.BorderBreakListener;
189import pl.karas.api.listeners.action.BorderPlaceListener;
190import pl.karas.api.listeners.action.PlayerBucketEmptyListener;
191import pl.karas.api.listeners.action.PlayerBucketFillListener;
192import pl.karas.api.managers.BanIPManager;
193import pl.karas.api.managers.BanManager;
194import pl.karas.api.managers.CombatManager;
195import pl.karas.api.managers.DropFile;
196import pl.karas.api.managers.DropManager;
197import pl.karas.api.managers.GuildManager;
198import pl.karas.api.managers.MuteManager;
199import pl.karas.api.managers.NameTagManager;
200import pl.karas.api.managers.TimerManager;
201import pl.karas.api.managers.UserManager;
202import pl.karas.api.managers.WarpManager;
203import pl.karas.api.mysql.store.Store;
204import pl.karas.api.mysql.store.modes.StoreMode;
205import pl.karas.api.mysql.store.modes.StoreMySQL;
206import pl.karas.api.mysql.store.modes.StoreSQLITE;
207import pl.karas.api.rank.variable.guild.GuildDeathsVariable;
208import pl.karas.api.rank.variable.guild.GuildHpVariable;
209import pl.karas.api.rank.variable.guild.GuildOnlineVartible;
210import pl.karas.api.rank.variable.guild.GuildKdVariable;
211import pl.karas.api.rank.variable.guild.GuildKillsVariable;
212import pl.karas.api.rank.variable.guild.GuildPointsVariable;
213import pl.karas.api.rank.variable.guild.GuildVariable;
214import pl.karas.api.rank.variable.tops.TopAssistsVariable;
215import pl.karas.api.rank.variable.tops.TopCoinsVariable;
216import pl.karas.api.rank.variable.tops.TopDeathsVariable;
217import pl.karas.api.rank.variable.tops.TopGuildPointsVariable;
218import pl.karas.api.rank.variable.tops.TopKillsVariable;
219import pl.karas.api.rank.variable.tops.TopPointsVariable;
220import pl.karas.api.rank.variable.user.AssistsVariable;
221import pl.karas.api.rank.variable.user.CoinsVariable;
222import pl.karas.api.rank.variable.user.DeathsVariable;
223import pl.karas.api.rank.variable.user.KDVariable;
224import pl.karas.api.rank.variable.user.KillsVariable;
225import pl.karas.api.rank.variable.user.LvlVariable;
226import pl.karas.api.rank.variable.user.PointsVariable;
227import pl.karas.api.rank.variable.user.WykopanyStoneVariable;
228import pl.karas.api.tasks.AutoMsgTask;
229import pl.karas.api.tasks.AbbysTask;
230import pl.karas.api.tasks.CheckValidityTask;
231import pl.karas.api.tasks.CombatTask;
232import pl.karas.api.tasks.LimitTask;
233import pl.karas.api.tasks.TabFreshRunnable;
234import pl.karas.api.utils.CraftingUtil;
235import pl.karas.api.utils.Logger;
236import pl.karas.api.utils.Ticking;
237import codecrafter47.bungeetablistplus.api.bukkit.BungeeTabListPlusBukkitAPI;
238import codecrafter47.bungeetablistplus.api.bukkit.Variable;
239
240public class ServerPlugin extends JavaPlugin
241{
242 private static ServerPlugin plugin;
243 private static Store store;
244 private static PluginManager pluginManager;
245
246 public void onLoad() {
247 ServerPlugin.plugin = this;
248 }
249
250 public void onEnable() {
251 this.initTab();
252 for (final Player p : Bukkit.getOnlinePlayers()) {
253 final Combat c = CombatManager.getCombat(p);
254 if (c == null) {
255 CombatManager.createCombat(p);
256 }
257 }
258 BorderMapListener.setBorder();
259 new Ticking().start();
260 this.registerDatabase();
261 this.registerManager();
262 this.registerListener();
263 this.registerTasks();
264 registerCommand();
265 CraftingUtil.registerRecipe();
266 }
267
268 public void onDisable() {
269 this.unTab();
270 Bukkit.getScheduler().cancelTasks((Plugin)this);
271 final ResultSet rs = getStore().query("SELECT * FROM `{P}guilds`");
272 try {
273 while (rs.next()) {
274 final Guild g = GuildManager.getGuild(rs.getNString(0));
275 getStore().update(false, "UPDATE `{P}guilds` SET `hp` = '" + g.getHp() + "' WHERE `tag` ='" + g.getTag() + "';");
276 }
277 for (final Player player : Bukkit.getOnlinePlayers()) {
278 if (DataManager.getDisco().containsKey(player.getName())) {
279 player.setSneaking(false);
280 for (int i = 0; i < 4; ++i) {
281 for (final Player online : Bukkit.getOnlinePlayers()) {
282 if (!online.getName().equals(player.getName())) {
283 PacketEquipment.sendEquipment(online, player
284 .getEntityId(), 1 + i, player
285 .getInventory().getArmorContents()[i]);
286 }
287 }
288 }
289 DataManager.getDisco().remove(player.getName());
290 DataManager.getLastColor().remove(player.getName());
291 DataManager.getShiftArmor().remove(player.getName());
292 }
293 }
294 DataManager.getDisco().clear();
295 DataManager.getShiftArmor().clear();
296 DataManager.getLastColor().clear();
297 }
298 catch (SQLException e1) {
299 e1.printStackTrace();
300 }
301 for (final Player p : Bukkit.getOnlinePlayers()) {
302 CombatManager.removeCombat(p);
303 }
304 Bukkit.savePlayers();
305 for (final World w : Bukkit.getWorlds()) {
306 w.save();
307 }
308 try {
309 Thread.sleep(2000L);
310 }
311 catch (InterruptedException e2) {
312 e2.printStackTrace();
313 }
314 if (ServerPlugin.store != null && ServerPlugin.store.isConnected()) {
315 ServerPlugin.store.disconnect();
316 }
317 ServerPlugin.plugin = null;
318 }
319
320
321 public static ServerPlugin getPlugin() {
322 return ServerPlugin.plugin;
323 }
324
325 protected boolean registerDatabase() {
326 switch (StoreMode.getByName(Config.DATABASE_MODE)) {
327 case MYSQL: {
328 ServerPlugin.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);
329 break;
330 }
331 case SQLITE: {
332 ServerPlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
333 break;
334 }
335 default: {
336 Logger.warning("Value of databse mode is not valid! Using SQLITE as database!");
337 ServerPlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
338 break;
339 }
340 }
341 final boolean conn = ServerPlugin.store.connect();
342 if (conn) {
343 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}users` (" + ((ServerPlugin.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, `wykstone` int(11) NOT NULL, `logout` int(11) NOT NULL, `kox` int(11) NOT NULL, `koxeat` int(11) NOT NULL, `refil` int(11) NOT NULL, `refileat` int(11) NOT NULL, `perly` int(11) NOT NULL, `perlycyk` int(11) NOT NULL, `strzaly` int(11) NOT NULL, `caseopen` text NOT NULL, `jajopen` int(11) NOT NULL, `zdrapkaopen` int(11) NOT NULL, `cobblexopen` int(11) NOT NULL, `join` int(11) NOT NULL, `time` bigint(22) NOT NULL, `timelast` bigint(22) 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);");
344 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}guilds` (" + ((ServerPlugin.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, `hp` int(11) NOT NULL, " + "`hpLastAttack` bigint(22) 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, `sojusz` int(11) NOT NULL, `coins` int(11) NOT NULL, `kills` int(11) NOT NULL, `deaths` int(11) NOT NULL, `turboDrop` bigint(22) NOT NULL, `turboExp` bigint(22) NOT NULL, `exp` int(11) NOT NULL, `pvpAlly` int(1) NOT NULL);");
345 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}members` (" + ((ServerPlugin.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);");
346 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bans` (" + ((ServerPlugin.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);");
347 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bansip` (" + ((ServerPlugin.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);");
348 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}mutes` (" + ((ServerPlugin.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);");
349 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}backups` (" + ((ServerPlugin.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);");
350 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}warp` (" + ((ServerPlugin.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, `pex` varchar(32) NOT NULL NOT NULL);");
351 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}deathbans` (" + ((ServerPlugin.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);");
352 ServerPlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}sejfs` (" + ((ServerPlugin.store.getStoreMode() == StoreMode.MYSQL) ? "`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT," : "`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,") + "`owner` varchar(32) NOT NULL, `opis` varchar(32) NOT NULL, `itemy` text NOT NULL);");
353 return conn;
354 }
355 return conn;
356 }
357
358 public static void registerCommand(final Command command) {
359 CommandManager.register(command);
360 }
361
362 public static void registerListener(final Plugin plugin, final Listener... listeners) {
363 if (ServerPlugin.pluginManager == null) {
364 ServerPlugin.pluginManager = Bukkit.getPluginManager();
365 }
366 for (final Listener listener : listeners) {
367 ServerPlugin.pluginManager.registerEvents(listener, plugin);
368 }
369 }
370
371 public static Store getStore() {
372 return ServerPlugin.store;
373 }
374
375 public static void registerCommand() {
376 registerCommand(new AEventCommand());
377 registerCommand(new ListCommand());
378 registerCommand(new RankingCommand());
379 registerCommand(new GodCommand());
380 registerCommand(new BanIPCommand());
381 registerCommand(new BanCommand());
382 registerCommand(new UnBanCommand());
383 registerCommand(new MoreCommand());
384 registerCommand(new UnBanIpCommand());
385 registerCommand(new ChatCommand());
386 registerCommand(new GamemodeCommand());
387 registerCommand(new FlyCommand());
388 registerCommand(new SpawnCommand());
389 registerCommand(new SetSpawnCommand());
390 registerCommand(new KitCommand());
391 registerCommand(new TpacceptCommand());
392 registerCommand(new TpdenyCommmand());
393 registerCommand(new ClearCommand());
394 registerCommand(new EnchantCommand());
395 registerCommand(new GcCommand());
396 registerCommand(new ItemCommand());
397 registerCommand(new GiveCommand());
398 registerCommand(new HealCommand());
399 registerCommand(new HelpOpCommand());
400 registerCommand(new HomeCommand());
401 registerCommand(new KickAllCommand());
402 registerCommand(new KickCommand());
403 registerCommand(new SetHomeCommand());
404 registerCommand(new RepairCommand());
405 registerCommand(new ResetRankingCommand());
406 registerCommand(new TellCommand());
407 registerCommand(new ReplyCommand());
408 registerCommand(new SlotCommand());
409 registerCommand(new SlowmodeCommand());
410 registerCommand(new StpCommand());
411 registerCommand(new VipCommand());
412 registerCommand(new SVipCommand());
413 registerCommand(new MVipCommand());
414 registerCommand(new YouTubeCommand());
415 registerCommand(new CraftCommand());
416 registerCommand(new SmietnikCommand());
417 registerCommand(new BroadcastCommand());
418 registerCommand(new BroadcastTitleCommand());
419 registerCommand(new TpaCommand());
420 registerCommand(new WhiteListCommand());
421 registerCommand(new SchowekCommand());
422 registerCommand(new StoneCommand());
423 registerCommand(new NaprawKilofCommand());
424 registerCommand(new TeleportCommand());
425 registerCommand(new BackupCommand());
426 registerCommand(new RenameCommand());
427 registerCommand(new IsCommand());
428 registerCommand(new MarmurCommand());
429 registerCommand(new WorkBenchCommand());
430 registerCommand(new SpeedCommand());
431 registerCommand(new LevelCommand());
432 registerCommand(new TurboCommand());
433 registerCommand(new EnableCommand());
434 registerCommand(new ItemkiCommand());
435 registerCommand(new StatsCommand());
436 registerCommand(new GuildItemCommand());
437 registerCommand(new NagrodaCommand());
438 registerCommand(new HcCommand());
439 registerCommand(new DayCommand());
440 registerCommand(new NightCommand());
441 registerCommand(new NetherCommand());
442 registerCommand(new EnderchestCommand());
443 registerCommand(new ConfigCommand());
444 registerCommand(new ClearEnderchestCommand());
445 registerCommand(new GuildAdminCommand());
446 registerCommand(new AllyCommand());
447 registerCommand(new CreateCommand());
448 registerCommand(new DeleteCommand());
449 registerCommand(new EnlargeCommand());
450 registerCommand(new GuildSetHomeCommand());
451 registerCommand(new EfektyCommand());
452 registerCommand(new GuildHomeCommand());
453 registerCommand(new DcCommand());
454 registerCommand(new InfoCommand());
455 registerCommand(new InviteCommand());
456 registerCommand(new AntyCheatCommand());
457 registerCommand(new JoinCommand());
458 registerCommand(new pl.karas.api.commands.guild.KickCommand());
459 registerCommand(new pl.karas.api.commands.guild.ItemCommand());
460 registerCommand(new LeaderCommand());
461 registerCommand(new OwnerCommand());
462 registerCommand(new ProlongCommand());
463 registerCommand(new PvpCommand());
464 registerCommand(new AutoMsgCommand());
465 registerCommand(new LeaveCommand());
466 registerCommand(new HelpCommand());
467 registerCommand(new GuildHelpCommand());
468 registerCommand(new GiveYTCommand());
469 registerCommand(new PaczkaCommand());
470 registerCommand(new ANagrodaCommand());
471 registerCommand(new InvCommand());
472 registerCommand(new DiscoCommand());
473 registerCommand(new BorderCommand());
474 registerCommand(new SklepCommand());
475 registerCommand(new OtchlanCommand());
476 registerCommand(new WiadomosciCommand());
477 registerCommand(new IgnoreCommand());
478 registerCommand(new PayCommand());
479 registerCommand(new WymianaCommand());
480 registerCommand(new MuteCommand());
481 registerCommand(new SetWarpCommand());
482 registerCommand(new KsiazkiCommand());
483 registerCommand(new WarpCommand());
484 registerCommand(new UnMuteCommand());
485 registerCommand(new VoucherCommand());
486 registerCommand(new GuildManageCommand());
487 registerCommand(new StatystykiCommand());
488 registerCommand(new BlokiCommand());
489 registerCommand(new ZnakiCommand());
490 }
491
492 public void registerTasks() {
493 new CheckValidityTask().runTaskTimer((Plugin)this, 2400L, 2400L);
494 new CombatTask().runTaskTimerAsynchronously((Plugin)this, 40L, 20L);
495 new LimitTask().runTaskTimer((Plugin)this, 200L, 200L);
496 new AutoMsgTask().runTaskTimerAsynchronously((Plugin)this, 1200L, 1200L);
497 new TabFreshRunnable().runTaskTimerAsynchronously((Plugin)this, 500L, 500L);
498 Bukkit.getScheduler().runTaskTimer((Plugin) this,
499 (Runnable) new DiscoTask(), 20L, 10L);
500 new AbbysTask();
501 AbbysTask.startTask();
502 }
503
504 public void registerManager() {
505 NameTagManager.enable();
506 DropFile.saveDefaultConfig();
507 DropManager.setup();
508 UserManager.loadUsers();
509 GuildManager.loadGuilds();
510 BanManager.loadBans();
511 BanIPManager.loadBans();
512 MuteManager.loadMutes();
513 WarpManager.loadWarp();
514 }
515
516 private void initTab() {
517 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new PointsVariable("points"));
518 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new KillsVariable("kills"));
519 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new DeathsVariable("deaths"));
520 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new AssistsVariable("assists"));
521 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new KDVariable("kd"));
522 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new LvlVariable("lvl"));
523 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new CoinsVariable("coins"));
524 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new WykopanyStoneVariable("stone"));
525 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildVariable("guild"));
526 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildPointsVariable("gpoints"));
527 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildKillsVariable("gkills"));
528 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildDeathsVariable("gdeaths"));
529 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildHpVariable("ghp"));
530 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildKdVariable("gkd"));
531 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildOnlineVartible("gonline"));
532
533 for (int i = 1; i < 16; ++i) {
534 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopPointsVariable("pointstop" + i, i));
535 }
536 for (int i = 1; i < 16; ++i) {
537 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopKillsVariable("killstop" + i, i));
538 }
539 for (int i = 1; i < 16; ++i) {
540 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopDeathsVariable("deathstop" + i, i));
541 }
542 for (int i = 1; i < 16; ++i) {
543 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopAssistsVariable("assiststop" + i, i));
544 }
545 for (int i = 1; i < 16; ++i) {
546 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopCoinsVariable("coinsstop" + i, i));
547 }
548 for (int i = 1; i < 16; ++i) {
549 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopGuildPointsVariable("gpointstop" + i, i));
550 }
551 }
552
553 private void unTab() {
554 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new PointsVariable("points"));
555 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new KillsVariable("kills"));
556 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new DeathsVariable("deaths"));
557 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new AssistsVariable("assists"));
558 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new KDVariable("kd"));
559 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new LvlVariable("lvl"));
560 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new CoinsVariable("coins"));
561 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new WykopanyStoneVariable("stone"));
562 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildVariable("guild"));
563 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildPointsVariable("gpoints"));
564 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildKillsVariable("gkills"));
565 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildDeathsVariable("gdeaths"));
566 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildHpVariable("ghp"));
567 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new GuildKdVariable("gkd"));
568 for (int i = 1; i < 16; ++i) {
569 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopPointsVariable("pointstop" + i, i));
570 }
571 for (int i = 1; i < 16; ++i) {
572 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopKillsVariable("killstop" + i, i));
573 }
574 for (int i = 1; i < 16; ++i) {
575 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopDeathsVariable("deathstop" + i, i));
576 }
577 for (int i = 1; i < 16; ++i) {
578 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopAssistsVariable("assiststop" + i, i));
579 }
580 for (int i = 1; i < 16; ++i) {
581 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopCoinsVariable("coinsstop" + i, i));
582 }
583 for (int i = 1; i < 16; ++i) {
584 BungeeTabListPlusBukkitAPI.unregisterVariable((Variable)new TopGuildPointsVariable("gpointstop" + i, i));
585 }
586 }
587
588 public void registerListener() {
589 registerListener((Plugin)this, new InventoryClickListener(), new EnderChestListener(),new CustomEnchantInventoryListener(),new ToggleListener(), new PlayerInteraktListener(), new InventoryDiscoListener(),new BlockDebilListener(),new RedstoneListener(), new EntityDiscoListener(), new PlayerCommandPreprocessListener(),new KoxBlockedListener(), new AntiLagListener(), new WymianaListener(), new PlayerQuitJoinListener(), new EfektyListener(), new PlayerJoinListener(), new TimerManager(), new AsyncPlayerChatListener(), new BlockListener(), new FarmeryListener(), new ChatGuildsListener(), new PlayerMoveListener(), new GrupoweListener(), new BlockBreakListener(), new BlockPlaceListener(), new PlayerBucketEmptyListener(), new PlayerBucketFillListener(), new GuildExplodeListener(), new EntityDamageByEntityListener(), new EntityDamageListener(), new PlayerDeathListener(), new InCommbatInGuildListener(), new TakeCrystalListener(), new CheckLoginListener(), new Nether(), new BoyListener(), new EnchantItemListener(), new PlayerInteractListener(), new PunchPotyListener(), new DropBlockBreakListener(), new EntityDeathListener(), new BorderMapListener(), new RainStartListener(), new TntEvent(), new TntDamage(), new BlokowanieListener(), new EventyListener(), new BorderBreakListener(), new BorderPlaceListener(), new BlockCraftingListener(), new InventoryListener(), new OpenInventoryListener(), new SignChangeListener(), new MarmurListener());
590 }
591}