Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
391 commits
Select commit Hold shift + click to select a range
3db86d6
Remove unused variables
linsaftw May 8, 2021
d3ff20b
Clear punishments done each second
linsaftw May 8, 2021
240d9d6
Register login event
linsaftw May 8, 2021
2be0cea
Fix player registering
linsaftw May 8, 2021
05cb22e
Change resource path
linsaftw May 8, 2021
01ed777
Bump version number
linsaftw May 8, 2021
6bfa1a2
Update config.yml
linsaftw May 9, 2021
ec48a9e
Update plugin.yml
linsaftw May 9, 2021
79c0fe4
Fix false positives with plugins
linsaftw May 12, 2021
e41ced6
Improve default config
linsaftw May 12, 2021
948031a
Fixed checkBook NPE
HiKingsFR May 12, 2021
450d9ab
Merge pull request #62 from HiKingsFR/patch-1
linsaftw May 13, 2021
fbea1e9
Merge branch 'master' of https://github.com/2lstudios-mc/exploitfixer
linsaftw May 13, 2021
b8966c8
Update plugin.yml
linsaftw May 14, 2021
8c95663
Fix compilation issues
linsaftw May 14, 2021
33af2c4
Bump pom.xml version
linsaftw May 14, 2021
3158a6c
Added Korean language
Kuass May 15, 2021
9301de1
Added missing languages
May 15, 2021
d31c044
Merge pull request #66 from GeGrieftGames/GeGrieftGames-patch-language
linsaftw May 15, 2021
b3bd719
Use Collection#contains
terrarier2111 May 16, 2021
d3b1d64
Merge pull request #67 from terrarier2111/patch-1
linsaftw May 16, 2021
b94052f
Improved German translation
May 18, 2021
4dd58d5
Improved German translation 2
May 18, 2021
921dd52
Improved German translation 3
May 18, 2021
1effeac
Merge pull request #68 from GeGrieftGames/master
linsaftw May 18, 2021
dde35a8
Bump version number
linsaftw May 21, 2021
345b56a
Use SNAPSHOT on pom.xml
linsaftw May 21, 2021
33d9900
Merge pull request #65 from Kuass/master
linsaftw May 21, 2021
6b35b38
Improved german language (typos, grammar)
NoJokeFNA May 22, 2021
02d432c
Merge pull request #69 from NoJokeFNA/patch-1
linsaftw May 22, 2021
1fc5a73
Missing Thai language
Hazuki-san May 23, 2021
5289203
Merge pull request #71 from Hazuki-san/patch-1
linsaftw May 23, 2021
d3e6a1d
Romanian Language
DoubleNico May 24, 2021
f5de455
Improved german language (grammar)
May 24, 2021
492f967
Update de.yml
May 24, 2021
b560e32
Merge pull request #73 from GeGrieftGames/master
linsaftw May 25, 2021
1ca6e51
Merge pull request #72 from DoubleNico/patch-1
linsaftw May 25, 2021
65092d7
Reordered language initialization
linsaftw May 25, 2021
af65521
Improve locale handling
linsaftw May 25, 2021
2a05f39
Update german translation
terrarier2111 Jun 7, 2021
5a99f35
Merge pull request #75 from terrarier2111/patch-1
linsaftw Jun 7, 2021
97701b1
update pom.xml
linsaftw Jun 10, 2021
053c124
check for invalid numbers
linsaftw Jun 10, 2021
3fe9990
Update plugin.yml
linsaftw Jun 10, 2021
43c1c8f
Packet level tab complete protection.
hakanguzelgulgen Jun 16, 2021
d01e090
reuse logic to avoid redundancy
linsaftw Jun 16, 2021
61e62b7
update command listeners
linsaftw Jun 16, 2021
d0304c6
Merge pull request #76 from HakanGulgen/master
linsaftw Jun 16, 2021
243aca8
Update pom.xml
linsaftw Jun 16, 2021
840b045
merge interfaces with plugin
linsaftw Jun 16, 2021
3ffc253
organize exploitfixer command
linsaftw Jun 16, 2021
caa2c35
separate notifications command on a file
linsaftw Jun 16, 2021
5c03aec
separate stats command on a file
linsaftw Jun 16, 2021
c91620b
separate reload command in a file
linsaftw Jun 16, 2021
374c845
separate help command in a file
linsaftw Jun 16, 2021
411df04
reorder stuff
linsaftw Jun 16, 2021
898f6bc
clean imports
linsaftw Jun 16, 2021
a12051f
Update plugin.yml
linsaftw Jun 16, 2021
15ba6ec
Chinese Traditional translation
flandretw Jun 23, 2021
15e9083
Update zhtw.yml
flandretw Jun 23, 2021
2f72af3
Merge pull request #77 from gregman98/patch-1
linsaftw Jun 23, 2021
ebb0563
update pom.xml
linsaftw Jun 26, 2021
573f319
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Jun 26, 2021
ee5937f
Create LICENSE
linsaftw Jul 2, 2021
7ba05ef
add packet blacklist system
linsaftw Jul 10, 2021
32527dd
improve packet blacklist system
linsaftw Jul 11, 2021
e30eea9
Update plugin.yml
linsaftw Jul 11, 2021
9906f7e
A minor cleanup for PacketDecodeListener
terrarier2111 Jul 14, 2021
55fbea0
Update PacketDecodeListener.java
linsaftw Jul 14, 2021
a09169f
Merge pull request #82 from terrarier2111/patch-2
linsaftw Jul 14, 2021
f8647ab
Improving portuguese translation to match the english one.
lucaazalim Jul 28, 2021
2dd3c9f
Merge pull request #85 from lucaazalim/master
linsaftw Jul 28, 2021
b7946b8
Changed local reference for HamsterAPI to a remote repository
sammwyy Aug 14, 2021
3815c4f
Bump netty to latest version
Aug 21, 2021
9d75965
Merge pull request #87 from LewUwU/patch-5
linsaftw Aug 21, 2021
c20b8dd
Fix dependencies issue, bump versions
xism4 Nov 11, 2021
d4daec3
Remove IDE addons
xism4 Nov 11, 2021
3ca2cf8
Merge pull request #91 from xIsm4/master
linsaftw Nov 13, 2021
baf6379
ExploitFixer cannot spell its name & Grammar change
BlockyTheDev Jan 6, 2022
fa36c99
Remove redundant casts
BlockyTheDev Jan 6, 2022
64a58e0
Merge pull request #92 from Blocky38/master
linsaftw Feb 12, 2022
dfea11e
Bump dependencies
xism4 Feb 23, 2022
8d741ae
Added Japanese translation
cosmos223 Mar 6, 2022
e8083b7
Merge pull request #97 from cosmos223/japanese-translation
linsaftw Mar 6, 2022
57a0378
Update pom.xml
linsaftw Apr 5, 2022
f990df5
Vl Multiplier Data Option
linsaftw Apr 14, 2022
5a5047b
1.18 Compatibility Support
linsaftw Apr 14, 2022
c4ce731
1.6.3
linsaftw Apr 14, 2022
ed42192
Lectern Exploit Fix
linsaftw Apr 14, 2022
deea62f
Disable Map Tracking
linsaftw Apr 14, 2022
3ad3ac6
Remove Logger
linsaftw Apr 14, 2022
89a3b85
Merge pull request #96 from xIsm4/patch-1
linsaftw Apr 23, 2022
3a85055
Fix Creative False Positives
linsaftw Apr 24, 2022
fd8dbba
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Apr 24, 2022
5fb6694
Prevent CommandBlock Payload exploits
Apr 28, 2022
d8b2ee8
Merge pull request #106 from LewUwU/patch-7
linsaftw Apr 30, 2022
4c7643d
Fix some issues
Apr 30, 2022
ef71fec
Merge pull request #107 from LewUwU/patch-8
linsaftw Apr 30, 2022
8778b0e
Bump dependencies
xism4 May 10, 2022
b3765ad
Improved Map Tracking Disabler
linsaftw May 13, 2022
b6c4080
1.6.4
linsaftw May 15, 2022
c86250d
fix: fixed #108
NoJokeFNA May 17, 2022
457f776
remove: removed stupid 1.18.2 check.. lol
NoJokeFNA May 17, 2022
bc8ae7a
Added Dutch (NL) translation
stijnb1234 May 19, 2022
027a85b
Updated credits
stijnb1234 May 19, 2022
253b810
Fix spelling mistakes in config.yml.
invalid-email-address Jun 4, 2022
1687f7e
Add documentation for the new Placeholders
invalid-email-address Jun 4, 2022
fe45314
Add code to support new placeholders: ping, check & violations.
invalid-email-address Jun 4, 2022
e94e728
fix: don't check for lectern exploit if the server version is 1.18.2 …
NoJokeFNA Jun 9, 2022
ba41eaf
change: changed manual checks by cached value
NoJokeFNA Jun 10, 2022
2615a79
Merge pull request #113 from Scot-Survivor/add-new-placeholders
linsaftw Jul 2, 2022
53468e2
Merge pull request #111 from stijnb1234/patch-1
linsaftw Jul 2, 2022
84df114
Only check specific versions
linsaftw Jul 2, 2022
704d193
Merge pull request #110 from NoJokeFNA/master
linsaftw Jul 2, 2022
ba9e6a5
Update netty
linsaftw Jul 2, 2022
f04d002
Merge pull request #109 from xIsm4/patch-1
linsaftw Jul 2, 2022
7d73902
Detect new exploits
linsaftw Jul 22, 2022
126320d
1.6.5
linsaftw Jul 22, 2022
3aa752b
prevent crashes from invalid items
linsaftw Jul 30, 2022
9de47cb
ignore keep alive on packet decode
linsaftw Aug 7, 2022
d7ce59c
1.6.6
linsaftw Aug 7, 2022
0023d60
security checks for packets
linsaftw Aug 8, 2022
03e40ba
1.6.7
linsaftw Aug 8, 2022
a96e45c
disable extreme debug
linsaftw Aug 8, 2022
8ff7b5e
check fireworks
linsaftw Aug 8, 2022
e0763e0
1.6.8
linsaftw Aug 8, 2022
c3d76a8
check if firework has effects before checking
linsaftw Aug 8, 2022
aedb0fc
better number checks
linsaftw Aug 8, 2022
b0abe42
Reduce object allocation from creative item check
Aug 8, 2022
55f1f92
Add missing return
Aug 8, 2022
5a33d59
Merge pull request #119 from LewUwU/patch-10
linsaftw Aug 8, 2022
dab9e6f
Merge pull request #118 from LewUwU/patch-9
linsaftw Aug 8, 2022
ebbfff4
better notification module
linsaftw Aug 11, 2022
dac612d
update project workflow
linsaftw Aug 11, 2022
4697439
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Aug 11, 2022
db68eea
delete old configs
linsaftw Aug 11, 2022
09271b6
1.6.9
linsaftw Aug 11, 2022
0c47bdc
fix filtering of plugin.yml
linsaftw Aug 11, 2022
8de62f8
check if numbers are nan
linsaftw Aug 11, 2022
0cec41d
fis packetplayinuseitem false positive
linsaftw Aug 11, 2022
b09074e
Improved float number checking
Aug 11, 2022
04f0724
Check for double too
Aug 11, 2022
b13cad9
Merge pull request #122 from LewUwU/patch-11
linsaftw Aug 11, 2022
c78a752
1.7.0
linsaftw Aug 11, 2022
a26f63e
Prevent sending a " " as Payload TAG
Aug 23, 2022
0cf8d4c
Added Russian (RU) translation
GreenL1nk Aug 24, 2022
41074ab
Support for CustomModelData & Added exempt for materials in ItemFix
ItzGuy Aug 29, 2022
91471a9
Hebrew Translation
ItzGuy Aug 30, 2022
c5b2097
Merge pull request #133 from ItzGuy/patch-1
linsaftw Aug 31, 2022
3b2ef1a
Merge pull request #125 from GreenL1nk/master
linsaftw Aug 31, 2022
e9693ee
Merge pull request #124 from LewUwU/patch-12
linsaftw Aug 31, 2022
f4da46e
remove exempt function of itemsfix
linsaftw Aug 31, 2022
060a028
Merge pull request #132 from ItzGuy/master
linsaftw Aug 31, 2022
18d7439
fix mapview error on 1.12
linsaftw Sep 1, 2022
89284e3
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Sep 1, 2022
38bf747
improvements for map disable tracking
linsaftw Sep 1, 2022
f5f91e7
reduce settings packet false positives
linsaftw Sep 1, 2022
e6eb647
prevent end portal break
linsaftw Sep 1, 2022
9a7e3af
option for ender portal break
linsaftw Sep 2, 2022
fb6e343
1.7.1
linsaftw Sep 2, 2022
4c404fa
fix 1.8 exception
linsaftw Sep 3, 2022
99e3ed8
1.7.2
linsaftw Sep 3, 2022
adb1577
generate new languages
linsaftw Sep 3, 2022
82ffcdb
generate russian language
linsaftw Sep 3, 2022
83ec302
fixed locales not working
linsaftw Sep 3, 2022
74fb554
prevent dispenser crashers
linsaftw Sep 4, 2022
c438e7c
use compiled regex to improve performance
linsaftw Sep 5, 2022
27474f5
limit portal teleports
linsaftw Sep 5, 2022
f26215d
big performance improvements (reflection cache)
linsaftw Sep 6, 2022
4b54add
increase settings vls a little
linsaftw Sep 6, 2022
2486253
1.7.3
linsaftw Sep 6, 2022
c50e0c6
use reflection util
linsaftw Sep 6, 2022
6c56b9f
1.7.4
linsaftw Sep 6, 2022
e09460a
properly ignore level restriction
linsaftw Sep 6, 2022
97b8e5f
feat: Improved reflection performance with static MethodHandles
Adrian3d04 Sep 6, 2022
dbe437f
fix error on 1.12 and lower servers
linsaftw Sep 12, 2022
af12612
Merge pull request #136 from 4drian3d/perf/methodhandles
linsaftw Sep 12, 2022
fd69c43
1.7.5
linsaftw Sep 13, 2022
2a07672
Block dispense fix by Rayzs_YT
linsaftw Nov 16, 2022
01f1e71
1.7.6
linsaftw Nov 16, 2022
071c237
Adding note about disable_tracking option, small typo
RedstoneFuture Nov 16, 2022
0ecde1a
Properly reset readerindex
linsaftw Nov 20, 2022
2af215d
Improved configuration
linsaftw Nov 23, 2022
d7dfa06
1.7.7
linsaftw Nov 23, 2022
580fc43
Improved Command Checking
linsaftw Dec 6, 2022
cb1fc5b
1.7.8
linsaftw Dec 6, 2022
f7f2604
Fix GhostBlock By Fast Break
linsaftw Dec 6, 2022
e68ac81
Merge pull request #142 from RedstoneFuture/master
linsaftw Dec 6, 2022
5f93208
bypass permission for itemsfix module
linsaftw Dec 7, 2022
5f11f53
1.7.9
linsaftw Dec 7, 2022
d9880d4
Fix command check
linsaftw Dec 17, 2022
21ef21c
Better Firework Check
linsaftw Dec 31, 2022
435f232
Update config.yml
IndianBartonka Jan 1, 2023
4964af1
Merge pull request #153 from IndianBartonka/patch-1
linsaftw Jan 1, 2023
cfcac4d
1.8.0
linsaftw Jan 1, 2023
adf8aef
Better Debug & Configurable Firework Checks
linsaftw Jan 2, 2023
adf6e4b
Limit Tags Per Packet
linsaftw Jan 3, 2023
0fe961f
Improved Debug With Vls Categories
linsaftw Jan 3, 2023
7509b52
Better Configuration Organization
linsaftw Jan 3, 2023
1e49725
Apply Cooldown to Shears
linsaftw Jan 7, 2023
9da5e4e
2.0.0
linsaftw Jan 7, 2023
11110f6
Fix double prefix
linsaftw Jan 7, 2023
fc47580
Prevent Bow Velocity Crasher
linsaftw Jan 10, 2023
5e7050f
Packets Bypass Permission
linsaftw Jan 10, 2023
6375e44
Register new listeners
linsaftw Jan 10, 2023
7e0bb1e
2.0.1
linsaftw Jan 10, 2023
72af5de
Update README.md
linsaftw Jan 12, 2023
30a4742
Do Not Check Already Created Items
linsaftw Jan 14, 2023
1546a7f
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Jan 14, 2023
1c96ab1
2.0.2
linsaftw Jan 14, 2023
162363f
Update README.md
linsaftw Jan 14, 2023
ec418ce
Fixed WindowClick Slot Exploit
linsaftw Jan 16, 2023
3bda023
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Jan 16, 2023
140a2b8
2.0.3
linsaftw Jan 16, 2023
30af401
Fixed Lectern Anti-Exploit only working on 1.18
linsaftw Jan 16, 2023
d70a807
2.0.4
linsaftw Jan 16, 2023
69ec18b
Update README.md
linsaftw Jan 17, 2023
556945f
Bypass permission for commands check
linsaftw Jan 17, 2023
40d1642
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Jan 17, 2023
3a5fc90
2.0.5
linsaftw Jan 17, 2023
dd8034d
Update README.md
Jan 18, 2023
8a1d389
Merge pull request #159 from GDMgmer3992/master
linsaftw Jan 19, 2023
4a63d0a
Prevent commands while dead/offline
linsaftw Jan 20, 2023
23ac718
Merge branch 'master' of https://github.com/2lstudios-mc/ExploitFixer
linsaftw Jan 20, 2023
c8db362
remove debug message
linsaftw Jan 20, 2023
bb17531
2.0.6
linsaftw Jan 21, 2023
40d97dd
Show received packets list
linsaftw Jan 22, 2023
2af2bf5
2.0.7
linsaftw Jan 23, 2023
bbcc49e
Fix error clicking outside Creative inventories
linsaftw Jan 26, 2023
aa82e31
2.0.8
linsaftw Jan 26, 2023
e2ae39f
Better code for Window Click checks
linsaftw Feb 8, 2023
4fe9400
2.0.9
linsaftw Feb 8, 2023
17ef059
Make uncompilable due to abuse
linsaftw Feb 9, 2023
baca150
Fixed errors during Invalid Slot exploit
linsaftw Feb 10, 2023
aaf3dd9
Fixed detecting -1 and -999 as exploit
linsaftw Feb 10, 2023
9178fe6
Change LICENSE to GPLv3
linsaftw Feb 10, 2023
dc1626c
!
QuanTrieuPCYT Feb 11, 2023
31193f5
Merge pull request #164 from QuanTrieuPCYT/patch-1
linsaftw Feb 12, 2023
157ddc7
2.1.0
linsaftw Feb 14, 2023
b337732
space pom.xml ignore
linsaftw Feb 14, 2023
19b3c65
Fix minecart & shulkers false positives
linsaftw Feb 15, 2023
f97167a
Fix kick messages not showing
linsaftw Feb 15, 2023
05d7d29
2.1.1
linsaftw Feb 15, 2023
50e0332
Fix inventory duplication exploit
linsaftw Feb 16, 2023
d3f466b
Fixed inventoryExploit config
linsaftw Feb 16, 2023
fd85693
Fix incorrect punishment count
linsaftw Feb 20, 2023
8eb6f51
Better info about offline packet block
linsaftw Feb 20, 2023
4c09ea2
Update README.md
LuciaNishimiya Feb 22, 2023
0aa3367
Update README.md
LuciaNishimiya Feb 22, 2023
e2903f5
Add files via upload
LuciaNishimiya Feb 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://paypal.me/LinsaFTW']
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.project
.vscode
.settings
.factorypath
.classpath
/target

pom.xml
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# ExploitFixer
Advanced plugin to maintain your server safe from multiple exploits.
# AkarinFixerExploit

AkarinFixerExploit is a high performance packet filter that prevents many kinds of crashers, laggers and exploits from being used in your Spigot/Paper server.

You can download the prebuilt jar binaries in the link below.

## Links

discord
https://discord.gg/PeS8h8eJZJ

download
https://github.com/LuciaNishimiya/AkarinFixerExploits/releases

## How To (Server Admins)

Download a copy of ExploitFixer. https://github.com/LuciaNishimiya/AkarinFixerExploits/releases
Install in your Spigot/Paper plugins folder.

This plugin requires HamsterAPI installed in your Spigot/paper servers. This is a custom High Performance packet listener.
https://www.spigotmc.org/resources/2ls-hamsterapi.78831/updates



## How To (Compiling From Source)

To compile ExploitFixer, you need [JDK8](https://adoptopenjdk.net/releases.html), [maven](https://maven.apache.org/download.cgi), and an internet connection.

Clone this repo, run ```mvn clean install``` from *bash*.
80 changes: 80 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<project>
<modelVersion>4.0.0</modelVersion>

<groupId>dev._2lstudios</groupId>
<artifactId>ExploitFixer</artifactId>
<packaging>jar</packaging>

<name>ExploitFixer</name>
<description>Advanced anti-exploit security plugin for Spigot servers.</description>
<version>2.0.8</version>
<url>https://www.spigotmc.org/resources/62842/</url>

<properties>
<author>2LS</author>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>2lstudios</id>
<url>https://ci.2lstudios.dev/plugin/repository/everything/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.2lstudios-mc</groupId>
<artifactId>HamsterAPI</artifactId>
<version>e3215bcc5a</version>
</dependency>
</dependencies>

<build>
<finalName>${artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>clean install</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>plugin.yml</include>
<include>bungee.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>plugin.yml</exclude>
<exclude>bungee.yml</exclude>
</excludes>
</resource>
</resources>

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
9 changes: 0 additions & 9 deletions src/bungee.yml

This file was deleted.

107 changes: 0 additions & 107 deletions src/config.yml

This file was deleted.

115 changes: 115 additions & 0 deletions src/main/java/dev/_2lstudios/exploitfixer/ExploitFixer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package dev._2lstudios.exploitfixer;

import java.util.logging.Logger;

import org.bukkit.Server;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;

import dev._2lstudios.exploitfixer.commands.ExploitFixerCommand;
import dev._2lstudios.exploitfixer.configuration.IConfiguration;
import dev._2lstudios.exploitfixer.listener.ListenerInitializer;
import dev._2lstudios.exploitfixer.managers.ModuleManager;
import dev._2lstudios.exploitfixer.tasks.ExploitFixerRepeatingTask;
import dev._2lstudios.exploitfixer.utils.BukkitConfigurationUtil;

public class ExploitFixer extends JavaPlugin {
private static ExploitFixer instance;
private BukkitConfigurationUtil configurationUtil;
private ModuleManager moduleManager;
private ListenerInitializer listenerInitializer;

public static synchronized ExploitFixer getInstance() {
return instance;
}

public static synchronized void setInstance(ExploitFixer exploitFixer) {
ExploitFixer.instance = exploitFixer;
}

@Override
public void onEnable() {
setInstance(this);

if (!checkHamsterAPI()) {
throw new IllegalStateException(
"ExploitFixer requires HamsterAPI to listen to packets and block exploits! Download: https://www.spigotmc.org/resources/78831/");
}

configurationUtil = new BukkitConfigurationUtil(this);

createConfigurations();

IConfiguration configYml = configurationUtil.get("%datafolder%/config.yml");

moduleManager = new ModuleManager(configurationUtil, this);
moduleManager.reload(configYml);
listenerInitializer = new ListenerInitializer(this, moduleManager);

register();
}

@Override
public void onDisable() {
unregister();
}

public void reload() {
createConfigurations();

IConfiguration configYml = configurationUtil.get("%datafolder%/config.yml");

moduleManager.reload(configYml);

unregister();
register();
}

private boolean checkHamsterAPI() {
Server server = this.getServer();
PluginManager pluginManager = server.getPluginManager();

return pluginManager.isPluginEnabled("HamsterAPI");
}

private void createConfigurations() {
configurationUtil.create("%datafolder%/config.yml", "config.yml");
}

public void unregister() {
Server server = this.getServer();
BukkitScheduler scheduler = server.getScheduler();

scheduler.cancelTasks(this);
server.getMessenger().unregisterIncomingPluginChannel(this);

if (this.listenerInitializer != null) {
this.listenerInitializer.unregister();
}
}

private void register() {
Server server = this.getServer();
BukkitScheduler scheduler = server.getScheduler();
Logger logger = this.getLogger();

getCommand("exploitfixer").setExecutor(new ExploitFixerCommand(this, moduleManager));

logger.info("Successfully registered commands!");

if (this.listenerInitializer.isRegistered()) {
this.listenerInitializer.unregister();
}

this.listenerInitializer.register();

logger.info("Successfully registered listeners!");
logger.info("Successfully hooked with HamsterAPI!");

scheduler.runTaskTimerAsynchronously(this,
new ExploitFixerRepeatingTask(moduleManager.getNotificationsModule()), 20L, 20L);

logger.info("Successfully registered tasks!");
}
}
Loading