· 6 years ago · Jul 24, 2019, 07:36 PM
1//
2// Decompiled by Procyon v0.5.30
3//
4
5package eu.fastcore.core;
6
7import eu.fastcore.core.commands.*;
8import eu.fastcore.core.commands.cmd.*;
9import eu.fastcore.core.commands.cmd.KickCommand;
10import eu.fastcore.core.commands.guild.*;
11import eu.fastcore.core.configuration.*;
12import eu.fastcore.core.gui.*;
13import eu.fastcore.core.listeners.*;
14import eu.fastcore.core.listeners.action.*;
15import eu.fastcore.core.managers.*;
16import eu.fastcore.core.objects.*;
17import eu.fastcore.core.objects.drops.*;
18import eu.fastcore.core.objects.drops.data.*;
19import eu.fastcore.core.objects.guild.*;
20import eu.fastcore.core.objects.user.*;
21import eu.fastcore.core.packets.*;
22import eu.fastcore.core.packets.out.*;
23import eu.fastcore.core.rank.*;
24import eu.fastcore.core.rank.tops.*;
25import eu.fastcore.core.rank.variable.guild.*;
26import eu.fastcore.core.rank.variable.tops.*;
27import eu.fastcore.core.rank.variable.user.*;
28import eu.fastcore.core.store.*;
29import eu.fastcore.core.store.modes.*;
30import eu.fastcore.core.tasks.*;
31import eu.fastcore.core.utils.*;
32import org.bukkit.event.Listener;
33import java.sql.ResultSet;
34import org.bukkit.World;
35import java.sql.SQLException;
36import org.bukkit.plugin.Plugin;
37import java.util.Iterator;
38import org.bukkit.entity.Player;
39import org.bukkit.Bukkit;
40import org.bukkit.plugin.PluginManager;
41import org.bukkit.plugin.java.JavaPlugin;
42import codecrafter47.bungeetablistplus.api.bukkit.*;
43
44public class CorePlugin extends JavaPlugin
45{
46 private static CorePlugin plugin;
47 private static Store store;
48 private static PluginManager pluginManager;
49
50 public void onLoad() {
51 CorePlugin.plugin = this;
52 }
53
54 public void onEnable() {
55 Config.reloadConfig();
56 Lang.reloadLang();
57 this.initTab();
58 BorderMapListener.setBorder();
59 new Ticking().start();
60 this.registerDatabase();
61 this.registerManager();
62 this.registerListener();
63 this.registerTasks();
64 registerCommand();
65 TagUtil.init();
66 CraftingUtil.registerRecipe();
67 for (final Player p : Bukkit.getOnlinePlayers()) {
68 CombatManager.getCombat(p);
69 }
70 }
71
72 public void onDisable() {
73 Bukkit.getScheduler().cancelTasks((Plugin)this);
74 final ResultSet rs = getStore().query("SELECT * FROM `{P}guilds`");
75 try {
76 while (rs.next()) {
77 final Guild g = GuildManager.getGuild(rs.getNString(0));
78 getStore().update(false, "UPDATE `{P}guilds` SET `hp` = '" + g.getHp() + "' WHERE `tag` ='" + g.getTag() + "';");
79 }
80 }
81 catch (SQLException e1) {
82 e1.printStackTrace();
83 }
84 for (final Player p : Bukkit.getOnlinePlayers()) {
85 CombatManager.removeCombat(p);
86 }
87 Bukkit.savePlayers();
88 for (final World w : Bukkit.getWorlds()) {
89 w.save();
90 }
91 try {
92 Thread.sleep(2000L);
93 }
94 catch (InterruptedException e2) {
95 e2.printStackTrace();
96 }
97 if (CorePlugin.store != null && CorePlugin.store.isConnected()) {
98 CorePlugin.store.disconnect();
99 }
100 CorePlugin.plugin = null;
101 }
102
103 public static CorePlugin getPlugin() {
104 return CorePlugin.plugin;
105 }
106
107 public static Store getStore() {
108 return CorePlugin.store;
109 }
110
111 protected boolean registerDatabase() {
112 switch (StoreMode.getByName(Config.DATABASE_MODE)) {
113 case MYSQL: {
114 CorePlugin.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);
115 break;
116 }
117 case SQLITE: {
118 CorePlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
119 break;
120 }
121 default: {
122 Logger.warning("Value of databse mode is not valid! Using SQLITE as database!");
123 CorePlugin.store = new StoreSQLITE(Config.DATABASE_SQLITE_NAME, Config.DATABASE_TABLEPREFIX);
124 break;
125 }
126 }
127 final boolean conn = CorePlugin.store.connect();
128 if (conn) {
129 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}users` (" + ((CorePlugin.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, `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` int(11) NOT NULL, `jajopen` int(11) NOT NULL, `zdrapkaopen` int(11) NOT NULL, `cobblexopen` int(11) NOT NULL, `breakstone` 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);");
130 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}guilds` (" + ((CorePlugin.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);");
131 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}members` (" + ((CorePlugin.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);");
132 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bans` (" + ((CorePlugin.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);");
133 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}bansip` (" + ((CorePlugin.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);");
134 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}mutes` (" + ((CorePlugin.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);");
135 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}backups` (" + ((CorePlugin.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);");
136 CorePlugin.store.update(true, "CREATE TABLE IF NOT EXISTS `{P}warp` (" + ((CorePlugin.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);");
137 return conn;
138 }
139 return conn;
140 }
141
142 public static void registerCommand(final Command command) {
143 CommandManager.register(command);
144 }
145
146 public static void registerListener(final Plugin plugin, final Listener... listeners) {
147 if (CorePlugin.pluginManager == null) {
148 CorePlugin.pluginManager = Bukkit.getPluginManager();
149 }
150 for (final Listener listener : listeners) {
151 CorePlugin.pluginManager.registerEvents(listener, plugin);
152 }
153 }
154
155 public static void registerCommand() {
156 registerCommand(new ListCommand());
157 registerCommand(new OtchlanCommand());
158 registerCommand(new EnderchestCommand());
159 registerCommand(new RepairAllCommand());
160 registerCommand(new RankingCommand());
161 registerCommand(new GodCommand());
162 registerCommand(new BanIPCommand());
163 registerCommand(new BanCommand());
164 registerCommand(new UnBanCommand());
165 registerCommand(new UnBanIpCommand());
166 registerCommand(new ChatCommand());
167 registerCommand(new GamemodeCommand());
168 registerCommand(new FlyCommand());
169 registerCommand(new SpawnCommand());
170 registerCommand(new SetSpawnCommand());
171 registerCommand(new KitCommand());
172 registerCommand(new TpacceptCommand());
173 registerCommand(new TpdenyCommmand());
174 registerCommand(new ClearCommand());
175 registerCommand(new EnchantCommand());
176 registerCommand(new GcCommand());
177 registerCommand(new ItemGiveCommand());
178 registerCommand(new GiveCommand());
179 registerCommand(new HeadCommand());
180 registerCommand(new HealCommand());
181 registerCommand(new HelpOpCommand());
182 registerCommand(new HomeCommand());
183 registerCommand(new KickCommand());
184 registerCommand(new SetHomeCommand());
185 registerCommand(new RepairCommand());
186 registerCommand(new TellCommand());
187 registerCommand(new ReplyCommand());
188 registerCommand(new SlotCommand());
189 registerCommand(new SlowmodeCommand());
190 registerCommand(new StpCommand());
191 registerCommand(new VipCommand());
192 registerCommand(new YouTubeCommand());
193 registerCommand(new CraftCommand());
194 registerCommand(new SmietnikCommand());
195 registerCommand(new BroadcastCommand());
196 registerCommand(new TitleCommand());
197 registerCommand(new TpaCommand());
198 registerCommand(new WhiteListCommand());
199 registerCommand(new WhoIsCommand());
200 registerCommand(new SchowekCommand());
201 registerCommand(new StoneCommand());
202 registerCommand(new TeleportCommand());
203 registerCommand(new BackupCommand());
204 registerCommand(new IsCommand());
205 registerCommand(new CobblexCommand());
206 registerCommand(new WorkBenchCommand());
207 registerCommand(new SpeedCommand());
208 registerCommand(new LevelCommand());
209 registerCommand(new TurboCommand());
210 registerCommand(new CoinsCommand());
211 registerCommand(new StatsCommand());
212 registerCommand(new CaseCommand());
213 registerCommand(new BanInfoCommand());
214 registerCommand(new DayCommand());
215 registerCommand(new NetherCommand());
216 registerCommand(new EnableCommand());
217 registerCommand(new ConfigCommand());
218 registerCommand(new GaCommand());
219 registerCommand(new AllyCommand());
220 registerCommand(new CreateCommand());
221 registerCommand(new DeleteCommand());
222 registerCommand(new EnlargeCommand());
223 registerCommand(new GuildSetHomeCommand());
224 registerCommand(new GuildHomeCommand());
225 registerCommand(new InfoCommand());
226 registerCommand(new InviteCommand());
227 registerCommand(new JoinCommand());
228 registerCommand(new KickCommand());
229 registerCommand(new LeaderCommand());
230 registerCommand(new OwnerCommand());
231 registerCommand(new ProlongCommand());
232 registerCommand(new PvpCommand());
233 registerCommand(new LeaveCommand());
234 registerCommand(new HelpCommand());
235 registerCommand(new GuildHelpCommand());
236 registerCommand(new NadajCommand());
237 registerCommand(new InvCommand());
238 registerCommand(new BorderCommand());
239 registerCommand(new GEfektCommand());
240 registerCommand(new SklepCommand());
241 registerCommand(new WiadomosciCommand());
242 registerCommand(new IgnoreCommand());
243 registerCommand(new PayCommand());
244 registerCommand(new OpisCommand());
245 registerCommand(new MuteCommand());
246 registerCommand(new SetWarpCommand());
247 registerCommand(new DelWarpCommand());
248 registerCommand(new WarpCommand());
249 registerCommand(new UnMuteCommand());
250 registerCommand(new VanishCommand());
251 registerCommand(new PanelCommand());
252 registerCommand(new SVipCommand());
253 registerCommand(new SocialSpyCommand());
254 registerCommand(new LiveCommand());
255 registerCommand(new ZglosCommand());
256 registerCommand(new AdminChatCommand());
257 registerCommand(new TreasureCommand());
258 registerCommand(new ItemCommand());
259 registerCommand(new TopsCommand());
260 registerCommand(new CheckCommand());
261 registerCommand(new CheaterCommand());
262 registerCommand(new CzystyCommand());
263 registerCommand(new SideBarCommand());
264 registerCommand(new PandoraCommand());
265 registerCommand(new TntCommand());
266 registerCommand(new PremiumCaseCommand());
267 }
268
269 public void registerTasks() {
270 new CheckValidityTask().runTaskTimer((Plugin)this, 2400L, 2400L);
271 new CombatTask().runTaskTimerAsynchronously((Plugin)this, 40L, 20L);
272 new LimitTask().runTaskTimer((Plugin)this, 300L, 300L);
273 new AbyssTask().runTaskTimerAsynchronously((Plugin)this, 20L, 200L);
274 new ScoreBoardTask().runTaskTimerAsynchronously((Plugin)this, 40L, 20L);
275 new AutoMsgTask().runTaskTimerAsynchronously((Plugin)this, 1200L, 1200L);
276 new TabFreshRunnable().runTaskTimerAsynchronously((Plugin)this, 500L, 500L);
277 }
278
279 public void registerManager() {
280 DropFile.saveDefaultConfig();
281 DropManager.setup();
282 UserManager.loadUsers();
283 GuildManager.loadGuilds();
284 BanManager.loadBans();
285 BanIPManager.loadBans();
286 MuteManager.loadMutes();
287 WarpManager.loadWarp();
288 }
289
290 private void initTab() {
291 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new PointsVariable("points"));
292 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new KillsVariable("kills"));
293 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new DeathsVariable("deaths"));
294 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new AssistsVariable("assists"));
295 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new KDVariable("kd"));
296 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new LvlVariable("lvl"));
297 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new CoinsVariable("coins"));
298 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildVariable("guild"));
299 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildPointsVariable("gpoints"));
300 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildKillsVariable("gkills"));
301 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildDeathsVariable("gdeaths"));
302 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildHpVariable("ghp"));
303 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildLivesVariable("glives"));
304 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new GuildKdVariable("gkd"));
305 for (int i = 1; i < 16; ++i) {
306 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopPointsVariable("pointstop" + i, i));
307 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopKillsVariable("killstop" + i, i));
308 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopDeathsVariable("deathstop" + i, i));
309 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopAssistsVariable("assiststop" + i, i));
310 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopCoinsVariable("coinsstop" + i, i));
311 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopGuildPointsVariable("gpointstop" + i, i));
312 BungeeTabListPlusBukkitAPI.registerVariable((Plugin)this, (Variable)new TopBreakVariable("breakstonetop" + i, i));
313 }
314 }
315
316 public void registerListener() {
317 registerListener((Plugin)this, new InventoryClickListener());
318 registerListener((Plugin)this, new PlayerQuitJoinListener());
319 registerListener((Plugin)this, new PlayerJoinListener());
320 registerListener((Plugin)this, new TimerManager());
321 registerListener((Plugin)this, new AsyncPlayerChatListener());
322 registerListener((Plugin)this, new ChatGuildsListener());
323 registerListener((Plugin)this, new PlayerMoveListener());
324 registerListener((Plugin)this, new BlockBreakListener());
325 registerListener((Plugin)this, new BlockPlaceListener());
326 registerListener((Plugin)this, new PlayerBucketEmptyListener());
327 registerListener((Plugin)this, new PlayerBucketFillListener());
328 registerListener((Plugin)this, new GuildExplodeListener());
329 registerListener((Plugin)this, new EntityDamageByEntityListener());
330 registerListener((Plugin)this, new EntityDamageListener());
331 registerListener((Plugin)this, new MrocznaSkrzyniaInteractListener());
332 registerListener((Plugin)this, new PlayerDeathListener());
333 registerListener((Plugin)this, new InCommbatInGuildListener());
334 registerListener((Plugin)this, new TakeCrystalListener());
335 registerListener((Plugin)this, new CheckLoginListener());
336 registerListener((Plugin)this, new BoyListener());
337 registerListener((Plugin)this, new PlayerInteractListener());
338 registerListener((Plugin)this, new DropBlockBreakListener());
339 registerListener((Plugin)this, new EntityDeathListener());
340 registerListener((Plugin)this, new BorderMapListener());
341 registerListener((Plugin)this, new RainStartListener());
342 registerListener((Plugin)this, new BlokowanieListener());
343 registerListener((Plugin)this, new BorderBreakListener());
344 registerListener((Plugin)this, new BorderPlaceListener());
345 registerListener((Plugin)this, new BlockCraftingListener());
346 registerListener((Plugin)this, new InventoryListener());
347 registerListener((Plugin)this, new OpenInventoryListener());
348 registerListener((Plugin)this, new SignChangeListener());
349 registerListener((Plugin)this, new CaseDropListener());
350 registerListener((Plugin)this, new CaseKickQuitListener());
351 registerListener((Plugin)this, new PlayerInteractEntityListener());
352 registerListener((Plugin)this, new UnkownCommandListener());
353 registerListener((Plugin)this, new PlayerQuitOnCheckListener());
354 registerListener((Plugin)this, new PhisicListener());
355 registerListener((Plugin)this, new CobblexListener());
356 registerListener((Plugin)this, new CommandPreprocessListener());
357 registerListener((Plugin)this, new PremiumCaseListener());
358 }
359}