mirror of
https://github.com/Updated-NoCheatPlus/NoCheatPlus.git
synced 2026-11-08 09:35:18 -05:00
Compare commits
434
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
009c8d00c6 | ||
|
|
aee5ed158e | ||
|
|
39e2ac9d71 | ||
|
|
33c9a60d6e | ||
|
|
06562f7109 | ||
|
|
670b12e5b5 | ||
|
|
03c889619a | ||
|
|
732b4aadc2 | ||
|
|
17675e4d46 | ||
|
|
b2d015adc8 | ||
|
|
fb52e44fe4 | ||
|
|
b789af5665 | ||
|
|
df1241dd0b | ||
|
|
4ad4a4e5fc | ||
|
|
b6b1c67277 | ||
|
|
4ab7fdfbbe | ||
|
|
52e6920bce | ||
|
|
9a77cbef0b | ||
|
|
447385f6e1 | ||
|
|
33a3764bbf | ||
|
|
21cd344ddb | ||
|
|
baf251defe | ||
|
|
d270be233e | ||
|
|
1a8b79fc36 | ||
|
|
2c252c8384 | ||
|
|
4a637f86fb | ||
|
|
0b1588b0c8 | ||
|
|
69bdb60ce5 | ||
|
|
b484d4fb23 | ||
|
|
d07dd10c93 | ||
|
|
b7de72ab27 | ||
|
|
f5fe83b0ed | ||
|
|
1d4c126785 | ||
|
|
aa0333bdf4 | ||
|
|
d629fbd6f9 | ||
|
|
547b9d11b6 | ||
|
|
722169edb0 | ||
|
|
3923b500dd | ||
|
|
b7489407c5 | ||
|
|
4403723ac5 | ||
|
|
7b4da789bb | ||
|
|
23842e1b75 | ||
|
|
2e8ae828b5 | ||
|
|
9089bd7cbf | ||
|
|
365fdac2c4 | ||
|
|
bcf0fc4a8f | ||
|
|
6d5c8ec4a2 | ||
|
|
2f752f7219 | ||
|
|
4c54b0e15e | ||
|
|
b8a94ee458 | ||
|
|
f2ce81bf8b | ||
|
|
4be10fb890 | ||
|
|
a77205007c | ||
|
|
1a29c99b9f | ||
|
|
d96610e752 | ||
|
|
dc1f705ed6 | ||
|
|
f96008ea3a | ||
|
|
795609fe23 | ||
|
|
0e22f6bf7c | ||
|
|
eb7115bd71 | ||
|
|
4844837775 | ||
|
|
77a2dd97b0 | ||
|
|
b74b66b869 | ||
|
|
2703135cc0 | ||
|
|
3723bef21c | ||
|
|
2373174ba0 | ||
|
|
2cd1922dc3 | ||
|
|
1287d0e811 | ||
|
|
401f5f87dd | ||
|
|
44eac16b13 | ||
|
|
f4d62900e1 | ||
|
|
920e5e15e7 | ||
|
|
698b5cc56a | ||
|
|
2dc45a01b4 | ||
|
|
7d873f5e01 | ||
|
|
7ef74117d7 | ||
|
|
efbabce522 | ||
|
|
effb084924 | ||
|
|
51d8efd250 | ||
|
|
deb1bd56a8 | ||
|
|
33207d4660 | ||
|
|
4c9df98e14 | ||
|
|
b4e282758f | ||
|
|
afe95ebb63 | ||
|
|
8d1a639b65 | ||
|
|
a2ea05806e | ||
|
|
0d4ac78b79 | ||
|
|
e98f8851e4 | ||
|
|
f99936f885 | ||
|
|
8e45a98bee | ||
|
|
e5424e121e | ||
|
|
5624aff987 | ||
|
|
fb45e3b798 | ||
|
|
bc36036556 | ||
|
|
09214d70f1 | ||
|
|
760df0833e | ||
|
|
d3196c7d60 | ||
|
|
92a9f664fd | ||
|
|
27bf8b8286 | ||
|
|
6598084cba | ||
|
|
57df2668b3 | ||
|
|
d10b419a6f | ||
|
|
9aba4269e0 | ||
|
|
8a6cf17694 | ||
|
|
d3181cc5eb | ||
|
|
259224cace | ||
|
|
84a028769f | ||
|
|
a5a2edd6db | ||
|
|
670ee03204 | ||
|
|
1aab5373af | ||
|
|
400e243187 | ||
|
|
4ad490abfa | ||
|
|
77da69bb7e | ||
|
|
deb18487cb | ||
|
|
147122f861 | ||
|
|
6f48befc93 | ||
|
|
8a74478763 | ||
|
|
c2676cd232 | ||
|
|
df88a2c2c7 | ||
|
|
96047b8e98 | ||
|
|
4d91509a43 | ||
|
|
1e04f50538 | ||
|
|
fa9e276e20 | ||
|
|
e7ed68c0c7 | ||
|
|
280a72d02d | ||
|
|
f1ec6fc408 | ||
|
|
6076d31418 | ||
|
|
ed4f3c4b36 | ||
|
|
1b67972766 | ||
|
|
5780c62e96 | ||
|
|
92ddd08b83 | ||
|
|
eb55d00b55 | ||
|
|
477e8669f0 | ||
|
|
a2f405c1a8 | ||
|
|
9cf9f14b23 | ||
|
|
8dc3066538 | ||
|
|
249297fe35 | ||
|
|
1819e42e68 | ||
|
|
7d35ed49a3 | ||
|
|
e6391dc370 | ||
|
|
03e05d84d8 | ||
|
|
dfdb9690aa | ||
|
|
844c2d6713 | ||
|
|
79b530c0fb | ||
|
|
163ba53660 | ||
|
|
ad816bacd7 | ||
|
|
99bc68b30a | ||
|
|
2b5820cd19 | ||
|
|
bb706b7391 | ||
|
|
fe11c9d1a8 | ||
|
|
8173938a16 | ||
|
|
8210643615 | ||
|
|
2ebf5b2334 | ||
|
|
c7a2c6a1e0 | ||
|
|
0c93ad1310 | ||
|
|
520a1986b4 | ||
|
|
363353ba34 | ||
|
|
bb7406dd58 | ||
|
|
078d16014b | ||
|
|
a94246f43f | ||
|
|
d42f1d11f2 | ||
|
|
e14c9a0f5d | ||
|
|
27bab89272 | ||
|
|
33daf6803a | ||
|
|
1d9d415b40 | ||
|
|
76fbb0b204 | ||
|
|
1392afb735 | ||
|
|
432b4b0a0a | ||
|
|
e5930d300d | ||
|
|
9396d10a43 | ||
|
|
b5e3525425 | ||
|
|
58a678e65c | ||
|
|
dba3d6d21d | ||
|
|
a9e79ca0c2 | ||
|
|
ba5ed1723b | ||
|
|
e7cc8e66bb | ||
|
|
4eeacda376 | ||
|
|
b0985fed7a | ||
|
|
932b8572ef | ||
|
|
b8336a93a6 | ||
|
|
bd26244017 | ||
|
|
b41de9364a | ||
|
|
a0cb3869a9 | ||
|
|
be8b6f79f0 | ||
|
|
631d6ee33c | ||
|
|
188d32e205 | ||
|
|
0fb3084664 | ||
|
|
b30eaaa747 | ||
|
|
de135cb63e | ||
|
|
4c50fd1df7 | ||
|
|
765188057b | ||
|
|
72f26af2df | ||
|
|
1aee48a853 | ||
|
|
7e0d7e3a7e | ||
|
|
6c5e1f7764 | ||
|
|
921af4dd31 | ||
|
|
295478a5ff | ||
|
|
b3e0c1738b | ||
|
|
fac8a1a73e | ||
|
|
1b77786920 | ||
|
|
03d307af2f | ||
|
|
c2473b1ed1 | ||
|
|
7f10889d39 | ||
|
|
4666291b73 | ||
|
|
f437ced44f | ||
|
|
ccd77773b5 | ||
|
|
64bb2bc278 | ||
|
|
9ceafc002b | ||
|
|
0b54230d48 | ||
|
|
8a4e2e2dfb | ||
|
|
ca43bbe550 | ||
|
|
6309766916 | ||
|
|
880217785e | ||
|
|
f8564980d0 | ||
|
|
f99afbdb1d | ||
|
|
0a7848db0f | ||
|
|
e0ee784d22 | ||
|
|
0a3b9a7829 | ||
|
|
53439f7e8a | ||
|
|
90570420b5 | ||
|
|
2bd0bd8992 | ||
|
|
540259d4aa | ||
|
|
4c85fee6f9 | ||
|
|
eb4202b5b5 | ||
|
|
3a64a90f42 | ||
|
|
69276a1315 | ||
|
|
c4331e1ffd | ||
|
|
95fb0d2494 | ||
|
|
7d421b5289 | ||
|
|
c155042a75 | ||
|
|
56af2482de | ||
|
|
5129a2df0a | ||
|
|
e5eec8905a | ||
|
|
71ba3ee690 | ||
|
|
3ecc4a89f1 | ||
|
|
0ac72f653a | ||
|
|
9fd079f24a | ||
|
|
aafb786518 | ||
|
|
1475915222 | ||
|
|
b2e62180bd | ||
|
|
b71c113440 | ||
|
|
1ba40eb66c | ||
|
|
713af9fd47 | ||
|
|
3137ce938d | ||
|
|
1dc8bcff71 | ||
|
|
f6fab19e99 | ||
|
|
141bb548a5 | ||
|
|
16465bff7f | ||
|
|
0e9f1f6ba3 | ||
|
|
d16be6b8db | ||
|
|
8433a983c0 | ||
|
|
cafa7d1015 | ||
|
|
187ee39e31 | ||
|
|
f8ecb8b8e8 | ||
|
|
8c192a0be9 | ||
|
|
eaee221150 | ||
|
|
72bd9483cb | ||
|
|
8daea7978c | ||
|
|
97522875e1 | ||
|
|
40daa9bb19 | ||
|
|
01eb504cde | ||
|
|
74a6a1ffc2 | ||
|
|
6f557b58fc | ||
|
|
0ba9540700 | ||
|
|
e7abf96e4b | ||
|
|
6f748c2fd1 | ||
|
|
b891313f80 | ||
|
|
097e36f50e | ||
|
|
4a19cd6b22 | ||
|
|
77559a7b5f | ||
|
|
e377abe342 | ||
|
|
f22055bf81 | ||
|
|
90d9aa740f | ||
|
|
ae980a1936 | ||
|
|
78190886d8 | ||
|
|
0b885f1061 | ||
|
|
bec522d41b | ||
|
|
5050724f6f | ||
|
|
97fdd00a18 | ||
|
|
77eeb66d7e | ||
|
|
8771c894bf | ||
|
|
fc2d86d87d | ||
|
|
73c14dda4d | ||
|
|
1ddfa28470 | ||
|
|
2e4cfe5957 | ||
|
|
4138b346bf | ||
|
|
18da617e05 | ||
|
|
282ef7c6be | ||
|
|
7910f6c771 | ||
|
|
9af10564b2 | ||
|
|
7dcf8e4333 | ||
|
|
a78b7833c6 | ||
|
|
7053d0a0c7 | ||
|
|
f5c7d7adc6 | ||
|
|
5527a65288 | ||
|
|
7c83c8af36 | ||
|
|
133f480a7b | ||
|
|
d9ed26a45f | ||
|
|
9828c7e2be | ||
|
|
68f187e38c | ||
|
|
5116bdbdb3 | ||
|
|
ac6b3dbe43 | ||
|
|
49d3a119f7 | ||
|
|
61b1227596 | ||
|
|
d2a2687b83 | ||
|
|
e90d8306a4 | ||
|
|
c84966bbd4 | ||
|
|
83426ab04f | ||
|
|
39e0f10019 | ||
|
|
008f1a7a7e | ||
|
|
55b9590a52 | ||
|
|
a73ad559df | ||
|
|
0bbd26dd9b | ||
|
|
b39f8e0bf4 | ||
|
|
c2512bc014 | ||
|
|
f588275d37 | ||
|
|
3034c8db7a | ||
|
|
d3be5af828 | ||
|
|
17d2c3245d | ||
|
|
41bf0cc684 | ||
|
|
0a973ff745 | ||
|
|
c7137ff5b6 | ||
|
|
e1357e96f2 | ||
|
|
2b313d70fa | ||
|
|
517e4be891 | ||
|
|
08b2f47404 | ||
|
|
9a2473029f | ||
|
|
f6a1d2bed7 | ||
|
|
f5ad1d36ae | ||
|
|
7d41589529 | ||
|
|
ab4d0a9004 | ||
|
|
a823f1e6e8 | ||
|
|
4736f75563 | ||
|
|
3ea26bf0cb | ||
|
|
eb52a3c516 | ||
|
|
e770a09342 | ||
|
|
6bd529cc40 | ||
|
|
07aed9bb6c | ||
|
|
38ff02682a | ||
|
|
43195a3a8d | ||
|
|
9500b491f0 | ||
|
|
b91bceaf38 | ||
|
|
7473559e6f | ||
|
|
2a1678dcb5 | ||
|
|
3822f69fe3 | ||
|
|
bda7cc7742 | ||
|
|
1e3e2b0842 | ||
|
|
83a391d15d | ||
|
|
2e26c51988 | ||
|
|
d640a702d6 | ||
|
|
eee2eab5ce | ||
|
|
1822366c87 | ||
|
|
bc6b9e548f | ||
|
|
77d9a806cc | ||
|
|
c5ccf0c237 | ||
|
|
d1b6bc0ac2 | ||
|
|
0f57ca23a6 | ||
|
|
5b6d0475da | ||
|
|
36af146c10 | ||
|
|
263ec46f19 | ||
|
|
df58970cd9 | ||
|
|
3e2a99e2e5 | ||
|
|
c24346708d | ||
|
|
94ed22789c | ||
|
|
2e41d0273d | ||
|
|
e47260d5c7 | ||
|
|
8286810566 | ||
|
|
63c9e403e4 | ||
|
|
b4e4999803 | ||
|
|
20fc013b6e | ||
|
|
b3143bc432 | ||
|
|
cc96d90199 | ||
|
|
b3da6cf1af | ||
|
|
50d5fdffb6 | ||
|
|
e746ba5c92 | ||
|
|
7d01b45e93 | ||
|
|
f0d22a110d | ||
|
|
e1b11c367c | ||
|
|
2ada6d74cc | ||
|
|
7b8d285c83 | ||
|
|
35cc00b3b2 | ||
|
|
60a8b7db9d | ||
|
|
ff0497ec62 | ||
|
|
9a32beb9ba | ||
|
|
b880e5ddd2 | ||
|
|
bf431db516 | ||
|
|
110de1eef3 | ||
|
|
15d2923407 | ||
|
|
528cf5e5e1 | ||
|
|
90d0f41824 | ||
|
|
2dca31bf63 | ||
|
|
f287974765 | ||
|
|
a5021c5bdb | ||
|
|
3d7f20bb29 | ||
|
|
2e05c37f25 | ||
|
|
b069c6c494 | ||
|
|
1f6bc2694a | ||
|
|
e72929d87b | ||
|
|
e4569977e9 | ||
|
|
de08c6d400 | ||
|
|
55263ce969 | ||
|
|
327be7b302 | ||
|
|
2537611620 | ||
|
|
7c9a081a63 | ||
|
|
7da9bde43f | ||
|
|
52e3ea1556 | ||
|
|
f599946e3c | ||
|
|
693789a448 | ||
|
|
485f4d2e82 | ||
|
|
e1b554edd0 | ||
|
|
bd46085c46 | ||
|
|
6d4dbb28e8 | ||
|
|
4a192f3a1b | ||
|
|
a3b3d4a482 | ||
|
|
e44da6266f | ||
|
|
d737693787 | ||
|
|
b7b684917e | ||
|
|
3e0af41412 | ||
|
|
a8060ff3d2 | ||
|
|
cd5444b794 | ||
|
|
770b0b9322 | ||
|
|
47f2e0267c | ||
|
|
361c1e8355 | ||
|
|
cbcef74a54 | ||
|
|
6bb4f682e9 | ||
|
|
b638d0dff9 | ||
|
|
9961dc99b7 | ||
|
|
5d32ce87af | ||
|
|
e4761ef731 | ||
|
|
682a5717f5 | ||
|
|
c9787ac81b | ||
|
|
1cfab2ee1a | ||
|
|
fb114c3532 | ||
|
|
5f89bbf462 |
No files matched your search
+86
@@ -0,0 +1,86 @@
|
||||
# Git
|
||||
*.orig
|
||||
!.gitignore
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
*.stackdump
|
||||
[Dd]esktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.lnk
|
||||
|
||||
# Linux
|
||||
*~
|
||||
.fuse_hidden*
|
||||
.directory
|
||||
.Trash-*
|
||||
.nfs*
|
||||
|
||||
# MacOS
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
._*
|
||||
|
||||
# Java
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
hs_err_pid*
|
||||
|
||||
# Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
*.java___jb_tmp___
|
||||
.idea/*
|
||||
*.ipr
|
||||
*.iws
|
||||
/out/
|
||||
.idea_modules/
|
||||
|
||||
# Eclipse
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.project
|
||||
.externalToolBuilders/
|
||||
*.launch
|
||||
.cproject
|
||||
.classpath
|
||||
.buildpath
|
||||
.target
|
||||
|
||||
# NetBeans
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
.nb-gradle/
|
||||
+33
-44
@@ -1,51 +1,40 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPBuildBase</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<description>Very basic dependencies that have to be built before commons, no use of Bukkit.
|
||||
</description>
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>../NCPBuildBase/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>BuildParameters.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<name>NCPBuildBase</name>
|
||||
<description>Very basic dependencies that have to be built before commons, no use of Bukkit.</description>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</build>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>../NCPBuildBase/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>BuildParameters.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+27
-39
@@ -1,44 +1,32 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCommons</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<description>Common data structures and other, no use of Bukkit.
|
||||
</description>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<name>NCPCommons</name>
|
||||
<description>Common data structures and other, no use of Bukkit.</description>
|
||||
|
||||
</project>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+26
-39
@@ -1,46 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatBukkit</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatbukkit</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for using the Bukkit API only.
|
||||
</description>
|
||||
<name>NCPCompatBukkit</name>
|
||||
<description>Compatibility for using the Bukkit API only.</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+6
-3
@@ -20,7 +20,9 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
||||
public class BlockCacheBukkit extends BlockCache {
|
||||
|
||||
@@ -38,6 +40,7 @@ public class BlockCacheBukkit extends BlockCache {
|
||||
this.world = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.minBlockY = BlockProperties.getMinWorldY();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -52,7 +55,7 @@ public class BlockCacheBukkit extends BlockCache {
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
// TODO: consider setting type id and data at once.
|
||||
return world.getBlockAt(x, y, z).getData();
|
||||
return Bridge1_13.hasIsSwimming() ? 0 : world.getBlockAt(x, y, z).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +73,7 @@ public class BlockCacheBukkit extends BlockCache {
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
for (final Entity other : entity.getNearbyEntities(2.0, 2.0, 2.0)){
|
||||
final EntityType type = other.getType();
|
||||
if (type != EntityType.BOAT){ // && !(other instanceof Minecart))
|
||||
if (type != EntityType.BOAT && type != EntityType.SHULKER){ // && !(other instanceof Minecart))
|
||||
continue;
|
||||
}
|
||||
final double locY = entity.getLocation(useLoc).getY();
|
||||
@@ -97,4 +100,4 @@ public class BlockCacheBukkit extends BlockCache {
|
||||
world = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -116,7 +116,7 @@ public class MCAccessBukkitBase implements MCAccess {
|
||||
public String getMCVersion() {
|
||||
// Bukkit API.
|
||||
// TODO: maybe output something else.
|
||||
return "1.4.6-1.11.2|?"; // uh oh
|
||||
return "1.4.6-1.15.2|?"; // uh oh
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,7 +200,6 @@ public class MCAccessBukkitBase implements MCAccess {
|
||||
return 0.5f;
|
||||
case PLAYER: // FAST RETURN
|
||||
case ZOMBIE:
|
||||
case PIG_ZOMBIE:
|
||||
case SKELETON:
|
||||
case CREEPER:
|
||||
case ENDERMAN:
|
||||
@@ -377,6 +376,11 @@ public class MCAccessBukkitBase implements MCAccess {
|
||||
return AlmostBoolean.NO; // Assumption.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false; // Assumption.
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(Player player) {
|
||||
// // TODO: Consider using reflection (detect CraftPlayer, access EntityPlayer + check if possible (!), use flags for if valid or invalid.)
|
||||
|
||||
+223
-64
@@ -18,25 +18,18 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitChorusPlant;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitCocoa;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDirectionalCentered;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDoor;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitEndPortalFrame;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSeaPickle;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShulkerBox;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSlab;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStairs;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStatic;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitTrapDoor;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitTurtleEgg;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.*;
|
||||
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectBase;
|
||||
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectDamageSource;
|
||||
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectLivingEntity;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
@@ -44,8 +37,38 @@ import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
|
||||
|
||||
public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
|
||||
protected ReflectBase reflectBase = null;
|
||||
protected ReflectDamageSource reflectDamageSource = null;
|
||||
protected ReflectLivingEntity reflectLivingEntity = null;
|
||||
|
||||
protected final Map<Material, BukkitShapeModel> shapeModels = new HashMap<Material, BukkitShapeModel>();
|
||||
|
||||
// Blocks that can automatic fetch bounding box from API
|
||||
private static final BukkitShapeModel MODEL_AUTO_FETCH = new BukkitFetchableBound();
|
||||
|
||||
// Blocks that form from multi-bounds
|
||||
private static final BukkitShapeModel MODEL_BREWING_STAND = new BukkitStatic(
|
||||
// Bottom rod
|
||||
0.0625, 0.0, 0.0625, 0.9375, 0.125, 0.9375,
|
||||
// Rod
|
||||
0.4375, 0.125, 0.4375, 0.5625, 0.8749, 0.5625);
|
||||
|
||||
private static final BukkitShapeModel MODEL_CANDLE_CAKE = new BukkitStatic(
|
||||
// Cake
|
||||
0.0625, 0.0, 0.0625, 0.9375, 0.5, 0.9375,
|
||||
// Candle
|
||||
0.4375, 0.5, 0.4375, 0.5625, 0.875, 0.5625);
|
||||
private static final BukkitShapeModel MODEL_LECTERN = new BukkitStatic(
|
||||
0.0, 0.0, 0.0, 1.0, 0.125, 1.0,
|
||||
0.25, 0.125, 0.25, 0.75, 0.875, 0.75);
|
||||
|
||||
private static final BukkitShapeModel MODEL_HOPPER = new BukkitHopper();
|
||||
private static final BukkitShapeModel MODEL_CAULDRON = new BukkitCauldron(0.1875, 0.125, 0.8125, 0.0625);
|
||||
private static final BukkitShapeModel MODEL_COMPOSTER = new BukkitCauldron(0.0, 0.125, 1.0, 0.125);
|
||||
private static final BukkitShapeModel MODEL_PISTON_HEAD = new BukkitPistonHead();
|
||||
private static final BukkitShapeModel MODEL_BELL = new BukkitBell();
|
||||
private static final BukkitShapeModel MODEL_ANVIL = new BukkitAnvil();
|
||||
|
||||
// Blocks that change shape based on interaction or redstone.
|
||||
private static final BukkitShapeModel MODEL_DOOR = new BukkitDoor();
|
||||
private static final BukkitShapeModel MODEL_TRAP_DOOR = new BukkitTrapDoor();
|
||||
@@ -61,8 +84,13 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
private static final BukkitShapeModel MODEL_TURTLE_EGG = new BukkitTurtleEgg();
|
||||
|
||||
// Blocks that have a different shape, based on how they have been placed.
|
||||
private static final BukkitShapeModel MODEL_CAKE = new BukkitCake();
|
||||
private static final BukkitShapeModel MODEL_SLAB = new BukkitSlab();
|
||||
private static final BukkitShapeModel MODEL_STAIRS= new BukkitStairs();
|
||||
private static final BukkitShapeModel MODEL_STAIRS = new BukkitStairs();
|
||||
private static final BukkitShapeModel MODEL_PISTON = new BukkitPiston();
|
||||
private static final BukkitShapeModel MODEL_LEVELLED = new BukkitLevelled();
|
||||
private static final BukkitShapeModel MODEL_LADDER = new BukkitLadder();
|
||||
private static final BukkitShapeModel MODEL_RAIL = new BukkitRail();
|
||||
private static final BukkitShapeModel MODEL_END_ROD = new BukkitDirectionalCentered(
|
||||
0.375, 1.0, false);
|
||||
|
||||
@@ -71,26 +99,28 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
0.4375, 1.0);
|
||||
private static final BukkitShapeModel MODEL_THICK_FENCE = new BukkitFence(
|
||||
0.375, 1.5);
|
||||
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitFence(
|
||||
0.25, 1.5);
|
||||
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitWall(
|
||||
0.25, 1.5, 0.3125);
|
||||
// .75 .25 0 max: .25 .75 .5
|
||||
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitStatic(
|
||||
0.75, 0.25, 0.0, 0.25, 0.75, 0.5);
|
||||
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
|
||||
|
||||
|
||||
// Static blocks (various height and inset values).
|
||||
private static final BukkitShapeModel MODEL_CAMPFIRE = new BukkitStatic(0.0, 0.4375);
|
||||
private static final BukkitShapeModel MODEL_BAMBOO = new BukkitBamboo();
|
||||
private static final BukkitShapeModel MODEL_LILY_PAD = new BukkitStatic(
|
||||
0.09375);
|
||||
private static final BukkitShapeModel MODEL_FLOWER_POT = new BukkitStatic(
|
||||
0.33, 0.375); // TODO: XZ really?
|
||||
private static final BukkitShapeModel MODEL_LANTERN = new BukkitStatic(
|
||||
0.33, 0.5625); // TODO: XZ really?
|
||||
private static final BukkitShapeModel MODEL_LANTERN = new BukkitLantern();
|
||||
private static final BukkitShapeModel MODEL_CONDUIT = new BukkitStatic(
|
||||
0.33, 0.6875);
|
||||
private static final BukkitShapeModel MODEL_GROUND_HEAD= new BukkitStatic(
|
||||
0.25, 0.5); // TODO: XZ-really? 275 ?
|
||||
private static final BukkitShapeModel MODEL_SINGLE_CHEST = new BukkitStatic(
|
||||
0.062, .875); // TODO: 0.0625?
|
||||
0.0625, 0.875);
|
||||
private static final BukkitShapeModel MODEL_HONEY_BLOCK = new BukkitStatic(
|
||||
0.0625, 0.9375);
|
||||
|
||||
// Static blocks with full height sorted by inset.
|
||||
private static final BukkitShapeModel MODEL_INSET16_1_HEIGHT100 = new BukkitStatic(
|
||||
@@ -108,33 +138,31 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
0.5625);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT4_3 = new BukkitStatic(
|
||||
0.75);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_7 = new BukkitStatic(
|
||||
0.875);
|
||||
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_15 = new BukkitStatic(
|
||||
0.9375);
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* LADDER,
|
||||
* CONDUIT,
|
||||
* CHORUS_FLOWER, CHORUS_PLANT, COCOA,
|
||||
* TURTLE_EGG, SEA_PICKLE,
|
||||
* VINE,
|
||||
* CAKE,
|
||||
* CONDUIT
|
||||
*/
|
||||
// TODO: anvils, dead coral fans
|
||||
// TODO: Liquid (all leveled).
|
||||
|
||||
public MCAccessBukkitModern() {
|
||||
super();
|
||||
// TODO: Generic setup via Bukkit interface existence/relations, +- fetching methods.
|
||||
BlockInit.assertMaterialExists("OAK_LOG");
|
||||
BlockInit.assertMaterialExists("CAVE_AIR");
|
||||
try {
|
||||
this.reflectBase = new ReflectBase();
|
||||
this.reflectDamageSource = new ReflectDamageSource(this.reflectBase);
|
||||
this.reflectLivingEntity = new ReflectLivingEntity(this.reflectBase, null, this.reflectDamageSource);
|
||||
} catch(ClassNotFoundException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
return "1.13.2-1.14|?";
|
||||
return "1.13-1.17|?";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,49 +181,90 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
// TODO: Also consider removing flags (passable_x4 etc).
|
||||
|
||||
// Variables for repeated flags (Temporary flags, these should be fixed later so that they are not added here)
|
||||
final long headFlags = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
|
||||
final long blockFix = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
|
||||
final long blockFix = BlockFlags.SOLID_GROUND;
|
||||
// Adjust flags for individual blocks.
|
||||
BlockProperties.setBlockFlags(Material.CAULDRON,
|
||||
BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT
|
||||
| BlockProperties.F_MIN_HEIGHT4_1);
|
||||
BlockProperties.setBlockFlags(Material.COCOA, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.TURTLE_EGG, BlockProperties.F_IGN_PASSABLE | BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND | BlockProperties.F_XZ100);
|
||||
BlockProperties.setBlockFlags(Material.TURTLE_EGG, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.CHORUS_PLANT, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, headFlags);
|
||||
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, blockFix);
|
||||
|
||||
// Directly keep blocks as is.
|
||||
for (final Material mat : new Material[] {
|
||||
Material.CAULDRON,
|
||||
BridgeMaterial.COBWEB,
|
||||
Material.HOPPER,
|
||||
BridgeMaterial.MOVING_PISTON,
|
||||
Material.SNOW,
|
||||
Material.CAKE,
|
||||
Material.BEACON,
|
||||
Material.LADDER,
|
||||
Material.VINE,
|
||||
Material.ANVIL,
|
||||
Material.CHIPPED_ANVIL,
|
||||
Material.DAMAGED_ANVIL,
|
||||
Material.CHORUS_FLOWER
|
||||
}) {
|
||||
processedBlocks.add(mat);
|
||||
}
|
||||
|
||||
// Candle
|
||||
for (Material mat : MaterialUtil.ALL_CANDLES) {
|
||||
addModel(mat, MODEL_AUTO_FETCH);
|
||||
}
|
||||
|
||||
// Amethyst
|
||||
for (Material mat : MaterialUtil.AMETHYST) {
|
||||
addModel(mat, MODEL_AUTO_FETCH);
|
||||
}
|
||||
|
||||
// new flower, and others
|
||||
for (Material mat : BridgeMaterial.getAllBlocks(
|
||||
"azalea", "flowering_azalea",
|
||||
"big_dripleaf", "sculk_sensor", "pointed_dripstone",
|
||||
"stonecutter", "chain"
|
||||
)) {
|
||||
addModel(mat, MODEL_AUTO_FETCH);
|
||||
}
|
||||
|
||||
// Camp fire
|
||||
for (Material mat : BridgeMaterial.getAllBlocks(
|
||||
"campfire", "soul_campfire"
|
||||
)) {
|
||||
addModel(mat, MODEL_CAMPFIRE);
|
||||
}
|
||||
|
||||
// Cauldron
|
||||
for (Material mat : MaterialUtil.CAULDRON) {
|
||||
BlockProperties.setBlockFlags(mat, BlockFlags.SOLID_GROUND);
|
||||
addModel(mat, MODEL_CAULDRON);
|
||||
}
|
||||
|
||||
//Anvil
|
||||
for (Material mat : new Material[] {
|
||||
Material.ANVIL,
|
||||
Material.CHIPPED_ANVIL,
|
||||
Material.DAMAGED_ANVIL
|
||||
}) {
|
||||
addModel(mat, MODEL_ANVIL);
|
||||
}
|
||||
|
||||
// Lily pad
|
||||
addModel(BridgeMaterial.LILY_PAD, MODEL_LILY_PAD);
|
||||
|
||||
// End portal frame.
|
||||
addModel(BridgeMaterial.END_PORTAL_FRAME, MODEL_END_PORTAL_FRAME);
|
||||
|
||||
// End rod.
|
||||
addModel(Material.END_ROD, MODEL_END_ROD);
|
||||
// Cake
|
||||
addModel(BridgeMaterial.CAKE, MODEL_CAKE);
|
||||
|
||||
// End Rod / Lightning Rod.
|
||||
for (Material mat : MaterialUtil.RODS) {
|
||||
addModel(mat, MODEL_END_ROD);
|
||||
}
|
||||
|
||||
// Hoppers - min height changed in 1.13+
|
||||
addModel(Material.HOPPER, MODEL_HOPPER);
|
||||
|
||||
// Ladder
|
||||
addModel(Material.LADDER, MODEL_LADDER);
|
||||
|
||||
// 1/16 inset at full height.
|
||||
for (Material mat : new Material[] {
|
||||
@@ -227,16 +296,20 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
addModel(mat, MODEL_XZ100_HEIGHT4_3);
|
||||
}
|
||||
|
||||
for (Material mat : MaterialUtil.ALL_CANDLE_CAKE) {
|
||||
addModel(mat, MODEL_CANDLE_CAKE);
|
||||
}
|
||||
|
||||
// 7/8 height.
|
||||
for (Material mat : new Material[] {
|
||||
Material.BREWING_STAND // TODO: base is 1/8, center 0.875 - needs multi-cuboid.
|
||||
Material.BREWING_STAND
|
||||
}) {
|
||||
addModel(mat, MODEL_XZ100_HEIGHT8_7);
|
||||
addModel(mat, MODEL_BREWING_STAND);
|
||||
}
|
||||
|
||||
// 16/15 height, full xz bounds.
|
||||
for (Material mat : new Material[] {
|
||||
Material.GRASS_PATH, BridgeMaterial.FARMLAND
|
||||
BridgeMaterial.GRASS_PATH, BridgeMaterial.FARMLAND
|
||||
}) {
|
||||
addModel(mat, MODEL_XZ100_HEIGHT16_15);
|
||||
}
|
||||
@@ -335,9 +408,59 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
}
|
||||
|
||||
//Lantern
|
||||
Material mt = Material.getMaterial("LANTERN");
|
||||
if (mt != null) addModel(mt, MODEL_LANTERN);
|
||||
for (Material mat : BridgeMaterial.getAllBlocks(
|
||||
"lantern", "soul_lantern"
|
||||
)) {
|
||||
addModel(mat, MODEL_LANTERN);
|
||||
}
|
||||
|
||||
// Piston
|
||||
for (Material mat : BridgeMaterial.getAllBlocks(
|
||||
"piston", "sticky_piston", "piston_base", "piston_sticky_base"
|
||||
)) {
|
||||
addModel(mat, MODEL_PISTON);
|
||||
}
|
||||
|
||||
// Piston Head
|
||||
addModel(BridgeMaterial.PISTON_HEAD, MODEL_PISTON_HEAD);
|
||||
|
||||
// Levelled blocks
|
||||
for (Material mat : BridgeMaterial.getAllBlocks(
|
||||
"snow", "water", "lava"
|
||||
)) {
|
||||
addModel(mat, MODEL_LEVELLED);
|
||||
}
|
||||
|
||||
// Rails
|
||||
for (final Material mat : MaterialUtil.RAILS) {
|
||||
addModel(mat, MODEL_RAIL);
|
||||
}
|
||||
|
||||
// Walls
|
||||
for (Material mat : MaterialUtil.ALL_WALLS) {
|
||||
addModel(mat, MODEL_THICK_FENCE2);
|
||||
}
|
||||
|
||||
// Lectern
|
||||
Material mt = BridgeMaterial.getBlock("lectern");
|
||||
if (mt != null) addModel(mt, MODEL_LECTERN);
|
||||
|
||||
// Bamboo
|
||||
mt = BridgeMaterial.getBlock("bamboo");
|
||||
if (mt != null) addModel(mt, MODEL_BAMBOO);
|
||||
|
||||
// Bell
|
||||
mt = BridgeMaterial.getBlock("bell");
|
||||
if (mt != null) addModel(mt, MODEL_BELL);
|
||||
|
||||
// Composter
|
||||
mt = BridgeMaterial.getBlock("composter");
|
||||
if (mt != null) addModel(mt, MODEL_COMPOSTER);
|
||||
|
||||
// Honey Block
|
||||
mt = BridgeMaterial.getBlock("honey_block");
|
||||
if (mt != null) addModel(mt, MODEL_HONEY_BLOCK);
|
||||
|
||||
// Sort to processed by flags.
|
||||
for (final Material mat : Material.values()) {
|
||||
final long flags = BlockProperties.getBlockFlags(mat);
|
||||
@@ -355,13 +478,49 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
addModel(mat, MODEL_THICK_FENCE);
|
||||
}
|
||||
}
|
||||
// Walls
|
||||
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_THICK_FENCE2)) {
|
||||
addModel(mat, MODEL_THICK_FENCE2);
|
||||
}
|
||||
}
|
||||
|
||||
super.setupBlockProperties(worldConfigProvider);
|
||||
}
|
||||
|
||||
private Object getHandle(Player player) {
|
||||
// TODO: CraftPlayer check (isAssignableFrom)?
|
||||
if (this.reflectLivingEntity == null || this.reflectLivingEntity.obcGetHandle == null) {
|
||||
return null;
|
||||
}
|
||||
Object handle = ReflectionUtil.invokeMethodNoArgs(this.reflectLivingEntity.obcGetHandle, player);
|
||||
return handle;
|
||||
}
|
||||
|
||||
private boolean canDealFallDamage() {
|
||||
return this.reflectLivingEntity != null && this.reflectLivingEntity.nmsDamageEntity != null && this.reflectDamageSource.nmsFALL != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return canDealFallDamage() ? AlmostBoolean.YES : AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(Player player, double damage) {
|
||||
if (canDealFallDamage()) {
|
||||
Object handle = getHandle(player);
|
||||
|
||||
if (handle != null)
|
||||
ReflectionUtil.invokeMethod(this.reflectLivingEntity.nmsDamageEntity, handle, this.reflectDamageSource.nmsFALL, (float) damage);
|
||||
} else BridgeHealth.damage(player, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
if (this.reflectLivingEntity != null && this.reflectLivingEntity.nmsclearActiveItem != null) {
|
||||
Object handle = getHandle(player);
|
||||
if (handle != null) {
|
||||
ReflectionUtil.invokeMethodNoArgs(this.reflectLivingEntity.nmsclearActiveItem, handle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitAnvil implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {
|
||||
// Bottom
|
||||
0.125, 0.0, 0.125, 0.875, 0.25, 0.875,
|
||||
// Top
|
||||
0.1875, 0.625, 0.0, 0.8125, 1.0, 1.0
|
||||
// Body... maybe not need
|
||||
};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {
|
||||
// Bottom
|
||||
0.125, 0.0, 0.125, 0.875, 0.25, 0.875,
|
||||
// Top
|
||||
0.0, 0.625, 0.1875, 1.0, 1.0, 0.8125
|
||||
// Body... maybe not need
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitBamboo implements BukkitShapeModel {
|
||||
//private DecimalFormat df = new DecimalFormat("#.000");
|
||||
//private final double xz = 0.375;
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
//final Block block = world.getBlockAt(x, y, z);
|
||||
|
||||
//double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
|
||||
//double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
|
||||
|
||||
//minX = Double.parseDouble(df.format(minX));
|
||||
//minZ = Double.parseDouble(df.format(minZ));
|
||||
|
||||
//return new double[] {1.0 - minX + 0.09, 0.0, minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, minZ + xz - 0.09}; (1)
|
||||
//return new double[] {minX + 0.09, 0.0, 1.0 - minZ + 0.09, minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09}; (2)
|
||||
// (1) + (2) =>
|
||||
//return new double[] {1.0 - minX + 0.09, 0.0, 1.0 - minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09};
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Bell;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitBell implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Bell) {
|
||||
Bell b = (Bell) blockData;
|
||||
BlockFace face = b.getFacing();
|
||||
switch (b.getAttachment()) {
|
||||
case CEILING: return new double[] {0.25, 1-0.75, 0.25, 0.75, 1.0, 0.75};
|
||||
case DOUBLE_WALL:
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.4375, 0.8125, 0.0, 0.5625, 0.9375, 1.0
|
||||
//0.0, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
|
||||
};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.0, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FLOOR:
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {0.0, 0.0, 0.25, 1.0, 1.0, 0.75};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {0.25, 0.0, 0.0, 0.75, 1.0, 1.0};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SINGLE_WALL:
|
||||
switch (face) {
|
||||
case NORTH: return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.4375, 0.8125, 0.0, 0.5625, 0.9375, 0.8125
|
||||
};
|
||||
case SOUTH: return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.4375, 0.8125, 0.1875, 0.5625, 0.9375, 1.0
|
||||
};
|
||||
case WEST: return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.0, 0.8125, 0.4375, 0.8125, 0.9375, 0.5625
|
||||
};
|
||||
case EAST: return new double[] {
|
||||
// Bottom bell
|
||||
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
|
||||
// Body
|
||||
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
|
||||
// Stick hold the bell
|
||||
0.1875, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Cake;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitCake implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockData blockData = block.getState().getBlockData();
|
||||
|
||||
if (blockData instanceof Cake) {
|
||||
final Cake cake = (Cake) blockData;
|
||||
return new double[] {0.0625 + cake.getBites() * 0.125, 0.0, 0.0625, 0.9375, 0.5, 0.9375};
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitCauldron implements BukkitShapeModel {
|
||||
private final double[] bounds;
|
||||
|
||||
public BukkitCauldron(double minY, double sideWidth, double sideHeight, double coreHeight) {
|
||||
bounds = new double[] {
|
||||
// Core
|
||||
sideWidth, minY, sideWidth, 1 - sideWidth, minY + coreHeight, 1 - sideWidth,
|
||||
// 4 side
|
||||
0.0, minY, 0.0, 1.0, minY + sideHeight, sideWidth,
|
||||
0.0, minY, 1.0 - sideWidth, 1.0, minY + sideHeight, 1.0,
|
||||
0.0, minY, 0.0, sideWidth, minY + sideHeight, 1.0,
|
||||
1.0 - sideWidth, minY, 0.0, 1.0, minY + sideHeight, 1.0
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+36
-12
@@ -14,15 +14,14 @@
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitChorusPlant implements BukkitShapeModel {
|
||||
@@ -32,16 +31,41 @@ public class BukkitChorusPlant implements BukkitShapeModel {
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, 0.1875, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockData blockData = block.getBlockData();
|
||||
double[] res = new double[] {0.187, 0.188, 0.187, 1.0 - 0.187, 0.8125, 1.0 - 0.187};
|
||||
if (blockData instanceof MultipleFacing) {
|
||||
final MultipleFacing chorusplant = (MultipleFacing) blockData;
|
||||
for (final BlockFace face : chorusplant.getFaces()) {
|
||||
switch (face) {
|
||||
//case DOWN:
|
||||
// res[1]=0.0;
|
||||
// break;
|
||||
case UP:
|
||||
res[4]=1.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
res[5]=1.0;
|
||||
break;
|
||||
case NORTH:
|
||||
res[2]=0.0;
|
||||
break;
|
||||
case WEST:
|
||||
res[0]=0.0;
|
||||
break;
|
||||
case EAST:
|
||||
res[3]=1.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
|
||||
double minY = Math.abs(block.getBoundingBox().getMinY()) - Math.abs((int) block.getBoundingBox().getMinY());
|
||||
double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
|
||||
|
||||
double maxX = Math.abs(block.getBoundingBox().getMaxX()) - Math.abs((int) block.getBoundingBox().getMaxX());
|
||||
double maxY = Math.abs(block.getBoundingBox().getMaxY()) - Math.abs((int) block.getBoundingBox().getMaxY());
|
||||
double maxZ = Math.abs(block.getBoundingBox().getMaxZ()) - Math.abs((int) block.getBoundingBox().getMaxZ());
|
||||
|
||||
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+49
-7
@@ -16,10 +16,14 @@ package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.type.Cocoa;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitCocoa implements BukkitShapeModel {
|
||||
@@ -28,20 +32,58 @@ public class BukkitCocoa implements BukkitShapeModel {
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof Cocoa) {
|
||||
if (blockData instanceof Cocoa && blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
final Cocoa cocoa = (Cocoa) blockData;
|
||||
switch (cocoa.getAge()) {
|
||||
case 0: // .625 .4375 .0625 max: .375 .75 .3125
|
||||
return new double[] {0.625, 0.4375, 0.0625, 0.375, 0.75, 0.3125};
|
||||
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
|
||||
return new double[] {0.6875, 0.3125, 0.0625, 0.3125, 0.75, 0.4375};
|
||||
case 2: // .75 .1875 .0625 max: .25 .75 .5625
|
||||
return new double[] {0.75, 0.1875, 0.0625, 0.25, 0.75, 0.5625};
|
||||
default:
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.375, 0.4375, 0.0, 0.625, 0.75, 0.315};
|
||||
case SOUTH:
|
||||
return new double[] {0.375, 0.4375, 0.685, 0.625, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.4375, 0.375, 0.315, 0.75, 0.625};
|
||||
case EAST:
|
||||
return new double[] {0.685, 0.4375, 0.375, 1.0, 0.75, 0.625};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.3125, 0.3125, 0.0, 0.6875, 0.75, 0.4375};
|
||||
case SOUTH:
|
||||
return new double[] {0.3125, 0.3125, 0.5625, 0.6875, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.3125, 0.3125, 0.4375, 0.75, 0.6875};
|
||||
case EAST:
|
||||
return new double[] {0.5625, 0.3125, 0.3125, 1.0, 0.75, 0.6875};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: // .75 .1875 .0625 max: .25 .75 .5625
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.25, 0.1875, 0.0, 0.75, 0.75, 0.5625};
|
||||
case SOUTH:
|
||||
return new double[] {0.25, 0.1875, 0.4375, 0.75, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.1875, 0.25, 0.5625, 0.75, 0.75};
|
||||
case EAST:
|
||||
return new double[] {0.4375, 0.1875, 0.25, 1.0, 0.75, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitFetchableBound implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
BoundingBox box = block.getBoundingBox();
|
||||
return new double[] {box.getMinX()-x, box.getMinY()-y, box.getMinZ()-z, box.getMaxX()-x, box.getMaxY()-y, box.getMaxZ()-z};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitHopper implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
Directional b = (Directional) blockData;
|
||||
BlockFace face = b.getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {
|
||||
// Standing inside
|
||||
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
|
||||
// Middle
|
||||
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
|
||||
// Bottom
|
||||
0.375, 0.25, 0.0, 0.625, 0.5, 0.25,
|
||||
// Top
|
||||
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
|
||||
// 4 sides of hopper (top)
|
||||
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
|
||||
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
|
||||
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
|
||||
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
|
||||
};
|
||||
case SOUTH:
|
||||
return new double[] {
|
||||
// Standing inside
|
||||
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
|
||||
// Middle
|
||||
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
|
||||
// Bottom
|
||||
0.375, 0.25, 0.75, 0.625, 0.5, 1.0,
|
||||
// Top
|
||||
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
|
||||
// 4 sides of hopper (top)
|
||||
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
|
||||
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
|
||||
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
|
||||
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
|
||||
};
|
||||
case WEST:
|
||||
return new double[] {
|
||||
// Standing inside
|
||||
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
|
||||
// Middle
|
||||
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
|
||||
// Bottom
|
||||
0.0, 0.25, 0.375, 0.25, 0.5, 0.625,
|
||||
// Top
|
||||
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
|
||||
// 4 sides of hopper (top)
|
||||
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
|
||||
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
|
||||
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
|
||||
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
|
||||
};
|
||||
case EAST:
|
||||
return new double[] {
|
||||
// Standing inside
|
||||
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
|
||||
// Middle
|
||||
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
|
||||
// Bottom
|
||||
0.75, 0.25, 0.375, 1.0, 0.5, 0.625,
|
||||
// Top
|
||||
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
|
||||
// 4 sides of hopper (top)
|
||||
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
|
||||
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
|
||||
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
|
||||
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
|
||||
};
|
||||
case DOWN:
|
||||
return new double[] {
|
||||
// Standing inside
|
||||
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
|
||||
// Middle
|
||||
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
|
||||
// Bottom
|
||||
0.375, 0.0, 0.375, 0.625, 0.25, 0.625,
|
||||
// Top
|
||||
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
|
||||
// 4 sides of hopper (top)
|
||||
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
|
||||
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
|
||||
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
|
||||
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitLadder implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
final Directional ladder = (Directional) blockData;
|
||||
switch(ladder.getFacing()) {
|
||||
case EAST:
|
||||
return 5;
|
||||
case NORTH:
|
||||
return 6;
|
||||
case SOUTH:
|
||||
return 3;
|
||||
case WEST:
|
||||
return 4;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Lantern;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitLantern implements BukkitShapeModel {
|
||||
|
||||
private double xz = 0.3125;
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Lantern) {
|
||||
Lantern lantern = (Lantern) blockData;
|
||||
if (lantern.isHanging()) return new double[] {
|
||||
xz, 0.0625, xz, 1-xz, 0.5, 1-xz,
|
||||
0.375, 0.5, 0.375, 0.625, 0.625, 0.625};
|
||||
}
|
||||
return new double[] {xz, 0.0, xz, 1.0-xz, 0.4375, 1.0-xz,
|
||||
0.375, 0.4375, 0.375, 0.625, 0.5625, 0.625};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.block.data.type.Snow;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitLevelled implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof Snow) {
|
||||
return ((Snow)blockData).getLayers() - 1;
|
||||
}
|
||||
if (blockData instanceof Levelled) {
|
||||
return ((Levelled)blockData).getLevel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Piston;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitPiston implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
double[] res = new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
if (blockData instanceof Piston) {
|
||||
final Piston piston = (Piston) blockData;
|
||||
if (!piston.isExtended()) return res;
|
||||
final BlockFace face = piston.getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
res[2] = 0.25;
|
||||
break;
|
||||
case SOUTH:
|
||||
res[5] = 0.75;
|
||||
break;
|
||||
case WEST:
|
||||
res[0] = 0.25;
|
||||
break;
|
||||
case EAST:
|
||||
res[3] = 0.75;
|
||||
break;
|
||||
case UP:
|
||||
res[4] = 0.75;
|
||||
break;
|
||||
case DOWN:
|
||||
res[1] = 0.25;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitPistonHead implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
Directional b = (Directional) blockData;
|
||||
BlockFace face = b.getFacing();
|
||||
switch (face) {
|
||||
case UP: return new double[] {
|
||||
// Shaft
|
||||
0.375, 0.0, 0.375, 0.625, 1.0, 0.625,
|
||||
// Plank
|
||||
0.0, 0.75, 0.0, 1.0, 1.0, 1.0
|
||||
};
|
||||
case DOWN: return new double[] {
|
||||
// Shaft
|
||||
0.375, 0.0, 0.375, 0.625, 1.0, 0.625,
|
||||
// Plank
|
||||
0.0, 0.0, 0.0, 1.0, 0.25, 1.0
|
||||
};
|
||||
case NORTH: return new double[] {
|
||||
// Shaft
|
||||
0.375, 0.375, 0.0, 0.625, 0.625, 1.0,
|
||||
// Plank
|
||||
0.0, 0.0, 0.0, 1.0, 1.0, 0.25
|
||||
};
|
||||
case SOUTH: return new double[] {
|
||||
// Shaft
|
||||
0.375, 0.375, 0.0, 0.625, 0.625, 1.0,
|
||||
// Plank
|
||||
0.0, 0.0, 0.75, 1.0, 1.0, 1.0
|
||||
};
|
||||
case WEST: return new double[] {
|
||||
// Shaft
|
||||
0.0, 0.375, 0.375, 1.0, 0.625, 0.625,
|
||||
// Plank
|
||||
0.0, 0.0, 0.0, 0.25, 1.0, 1.0
|
||||
};
|
||||
case EAST: return new double[] {
|
||||
// Shaft
|
||||
0.0, 0.375, 0.375, 1.0, 0.625, 0.625,
|
||||
// Plank
|
||||
0.75, 0.0, 0.0, 1.0, 1.0, 1.0
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Rail;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitRail implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof Rail) {
|
||||
return ((Rail)blockData).getShape().name().startsWith("ASCENDING") ? 2 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+14
-8
@@ -19,7 +19,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.SeaPickle;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitSeaPickle implements BukkitShapeModel {
|
||||
@@ -28,20 +30,24 @@ public class BukkitSeaPickle implements BukkitShapeModel {
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof SeaPickle) {
|
||||
final SeaPickle pick = (SeaPickle) blockData;
|
||||
switch (pick.getPickles()) {
|
||||
case 1: // .625 , 0 , .375 max: .375 , 375 , .625
|
||||
return new double[] {0.625, 0.0, 0.375, 0.375, 0.375, 0.625};
|
||||
case 2: // .8125 , 0 , .1875 max: .1875 , .375 , .8125
|
||||
return new double[] {0.8125, 0.0, 0.1875, 0.1875, 0.375, 0.8125};
|
||||
case 3: // .875 0 .125 max: .125 .375 .875
|
||||
return new double[] {0.875, 0.0, 0.125, 0.125, 0.375, 0.875};
|
||||
case 4: // .875 0 .125 max: .125 .4375 .875
|
||||
return new double[] {0.875, 0.0, 0.125, 0.125, 0.4375, 0.875};
|
||||
case 1: // .375 , 0 , .375 max: .625 , 375 , .625
|
||||
return new double[] {0.375, 0.0, 0.375, 0.625, 0.375, 0.625};
|
||||
case 2: // .1875 , 0 , .1875 max: .8125 , .375 , .8125
|
||||
return new double[] {0.1875, 0.0, 0.1875, 0.8125, 0.375, 0.8125};
|
||||
case 3: // .125 0 .125 max: .875 .375 .875
|
||||
return new double[] {0.125, 0.0, 0.125, 0.875, 0.375, 0.875};
|
||||
case 4: // .125 0 .125 max: .875 .4375 .875
|
||||
return new double[] {0.125, 0.0, 0.125, 0.875, 0.4375, 0.875};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+11
-15
@@ -20,12 +20,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitStatic implements BukkitShapeModel {
|
||||
|
||||
private final double minX;
|
||||
private final double minY;
|
||||
private final double minZ;
|
||||
private final double maxX;
|
||||
private final double maxY;
|
||||
private final double maxZ;
|
||||
private final double[] bounds;
|
||||
|
||||
/**
|
||||
* Initialize with the given height and with full xz-bounds.
|
||||
@@ -46,21 +41,22 @@ public class BukkitStatic implements BukkitShapeModel {
|
||||
this(xzInset, 0.0, xzInset, 1.0 - xzInset, height, 1.0 - xzInset);
|
||||
}
|
||||
|
||||
public BukkitStatic(double minX, double minY, double minZ,
|
||||
double maxX, double maxY, double maxZ) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
/**
|
||||
* Initialize with the given bounds
|
||||
*
|
||||
*/
|
||||
public BukkitStatic(double ...bounds) {
|
||||
if (bounds.length % 6 != 0) {
|
||||
throw new IllegalArgumentException("The length must be a multiple of 6");
|
||||
}
|
||||
this.bounds = bounds;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+17
-7
@@ -19,7 +19,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.Bisected.Half;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Openable;
|
||||
import org.bukkit.block.data.type.TrapDoor;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
@@ -67,12 +66,23 @@ public class BukkitTrapDoor implements BukkitShapeModel {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof Openable) {
|
||||
return ((Openable) blockData).isOpen() ? 0x4 : 0;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
if (blockData instanceof TrapDoor) {
|
||||
final TrapDoor trapDoor = (TrapDoor) blockData;
|
||||
if (trapDoor.isOpen()) {
|
||||
switch(trapDoor.getFacing()) {
|
||||
case EAST:
|
||||
return 3;
|
||||
case NORTH:
|
||||
return 4;
|
||||
case SOUTH:
|
||||
return 5;
|
||||
case WEST:
|
||||
return 6;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+8
-2
@@ -19,7 +19,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.TurtleEgg;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitTurtleEgg implements BukkitShapeModel {
|
||||
@@ -28,6 +30,10 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
if (Bridge1_13.hasBoundingBox()) {
|
||||
BoundingBox bd = block.getBoundingBox();
|
||||
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
|
||||
}
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
@@ -35,11 +41,11 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
|
||||
final TurtleEgg egg = (TurtleEgg) blockData;
|
||||
switch (egg.getEggs()) {
|
||||
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
|
||||
return new double[] {0.8125, 0.0, 0.1875, 0.25, 0.4375, 0.75};
|
||||
return new double[] {0.23, 0.0, 0.23, 0.75, 0.4375, 0.75};
|
||||
case 2: // .9375 .0 .0625 max: 0.0625 .4375 .9375
|
||||
case 3:
|
||||
case 4:
|
||||
return new double[] {0.9375, 0.0, 0.0625, 0.0625, 0.4375, 0.9375};
|
||||
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.type.Wall;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitWall implements BukkitShapeModel {
|
||||
|
||||
private final double minXZ;
|
||||
private final double maxXZ;
|
||||
private final double height;
|
||||
private final double sideInset;
|
||||
private final double[] east;
|
||||
private final double[] north;
|
||||
private final double[] west;
|
||||
private final double[] south;
|
||||
|
||||
public BukkitWall(double inset, double height) {
|
||||
this(inset, 1.0 - inset, height, 0.0);
|
||||
}
|
||||
|
||||
public BukkitWall(double inset, double height, double sideInset) {
|
||||
this(inset, 1.0 - inset, height, sideInset);
|
||||
}
|
||||
|
||||
public BukkitWall(double minXZ, double maxXZ, double height, double sideInset) {
|
||||
this.minXZ = minXZ;
|
||||
this.maxXZ = maxXZ;
|
||||
this.height = height;
|
||||
this.sideInset = sideInset;
|
||||
east = new double[] {maxXZ, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
|
||||
north = new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, minXZ};
|
||||
west = new double[] {0.0, 0.0, sideInset, minXZ, height, 1.0 - sideInset};
|
||||
south = new double[] {sideInset, 0.0, maxXZ, 1.0 - sideInset, height, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
if (blockData instanceof MultipleFacing) {
|
||||
final MultipleFacing fence = (MultipleFacing) blockData;
|
||||
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
|
||||
final Set<BlockFace> a = fence.getFaces();
|
||||
if (!a.contains(BlockFace.UP) && a.size() == 2) {
|
||||
if (a.contains(BlockFace.SOUTH)) {
|
||||
return new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 1.0};
|
||||
}
|
||||
if (a.contains(BlockFace.WEST)) {
|
||||
return new double[] {0.0, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
|
||||
}
|
||||
}
|
||||
for (final BlockFace face : fence.getFaces()) {
|
||||
switch (face) {
|
||||
case EAST:
|
||||
res = add(res, east);
|
||||
break;
|
||||
case NORTH:
|
||||
res = add(res, north);
|
||||
break;
|
||||
case WEST:
|
||||
res = add(res, west);
|
||||
break;
|
||||
case SOUTH:
|
||||
res = add(res, south);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else if (blockData instanceof Wall) {
|
||||
final Wall wall = (Wall) blockData;
|
||||
if (wall.isUp()) {
|
||||
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
|
||||
if (!wall.getHeight(BlockFace.WEST).equals(Wall.Height.NONE)) res = add(res, west);
|
||||
if (!wall.getHeight(BlockFace.EAST).equals(Wall.Height.NONE)) res = add(res, east);
|
||||
if (!wall.getHeight(BlockFace.NORTH).equals(Wall.Height.NONE)) res = add(res, north);
|
||||
if (!wall.getHeight(BlockFace.SOUTH).equals(Wall.Height.NONE)) res = add(res, south);
|
||||
return res;
|
||||
} else {
|
||||
if (!wall.getHeight(BlockFace.WEST).equals(Wall.Height.NONE) && !wall.getHeight(BlockFace.EAST).equals(Wall.Height.NONE)) {
|
||||
return new double[] {0.0, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
|
||||
}
|
||||
if (!wall.getHeight(BlockFace.NORTH).equals(Wall.Height.NONE) && !wall.getHeight(BlockFace.SOUTH).equals(Wall.Height.NONE)) {
|
||||
return new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 1.0};
|
||||
}
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private double[] add(final double[] array1, final double[] array2) {
|
||||
final double[] newArray = new double[array1.length + array2.length];
|
||||
System.arraycopy(array1, 0, newArray, 0, array1.length);
|
||||
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
|
||||
return newArray;
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitWallHead implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.25, 0.25, 0.5, 0.75, 0.75, 1.0};
|
||||
case SOUTH:
|
||||
return new double[] {0.25, 0.25, 0.0, 0.75, 0.75, 0.5};
|
||||
case WEST:
|
||||
return new double[] {0.5, 0.25, 0.25, 1.0, 0.75, 0.75};
|
||||
case EAST:
|
||||
return new double[] {0.0, 0.25, 0.25, 0.5, 0.75, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -53,7 +53,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be older than what Compat-CB-Reflect can support.");
|
||||
this.knownSupportedVersion = false;
|
||||
}
|
||||
else if (GenericVersion.compareVersions(mcVersion, "1.12.2") > 0) {
|
||||
else if (GenericVersion.compareVersions(mcVersion, "1.14.4") > 0) {
|
||||
this.knownSupportedVersion = false;
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be more recent than the one Compat-CB-Reflect has been built with - this might work, but there could be incompatibilities.");
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// Potentially all :p.
|
||||
return "1.4.5-1.13|?";
|
||||
return "1.7-1.14.4|?";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class ReflectBase {
|
||||
clazz = ServerVersion.getNMSMinecraftServer().getClass();
|
||||
name = clazz.getPackage().getName();
|
||||
if (name.equals("net.minecraft.server") || name.indexOf("net.") == 0 && name.indexOf(".minecraft.") != -1 && name.indexOf(".server.") != -1) {
|
||||
nmsPackageName = name;
|
||||
nmsPackageName = name.contains("v1_") ? name : "net.minecraft.world.entity";
|
||||
} else {
|
||||
nmsPackageName = null;
|
||||
}
|
||||
|
||||
+13
-6
@@ -20,15 +20,22 @@ import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
|
||||
public class ReflectDamageSource {
|
||||
|
||||
public final Class<?> nmsClass;
|
||||
public Class<?> nmsClass;
|
||||
|
||||
public final Object nmsFALL;
|
||||
public Object nmsFALL;
|
||||
|
||||
public ReflectDamageSource(ReflectBase base) throws ClassNotFoundException {
|
||||
Class<?> nmsClass = Class.forName(base.nmsPackageName + ".DamageSource");
|
||||
this.nmsClass = nmsClass;
|
||||
Field field = ReflectionUtil.getField(nmsClass, "FALL", nmsClass);
|
||||
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
|
||||
try {
|
||||
Class<?> nmsClass = Class.forName(base.nmsPackageName + ".DamageSource");
|
||||
this.nmsClass = nmsClass;
|
||||
Field field = ReflectionUtil.getField(nmsClass, "FALL", nmsClass);
|
||||
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Class<?> nmsClass = Class.forName("net.minecraft.world.damagesource.DamageSource");
|
||||
this.nmsClass = nmsClass;
|
||||
Field field = ReflectionUtil.getField(nmsClass, "k", nmsClass);
|
||||
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -40,6 +40,9 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
|
||||
|
||||
public final Method nmsDamageEntity;
|
||||
|
||||
@MostlyHarmless()
|
||||
public final Method nmsclearActiveItem;
|
||||
|
||||
public final boolean nmsDamageEntityInt;
|
||||
|
||||
public ReflectEntity(ReflectBase base, ReflectAxisAlignedBB reflectAxisAlignedBB, ReflectDamageSource damageSource) throws ClassNotFoundException {
|
||||
@@ -66,6 +69,7 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
|
||||
} else {
|
||||
nmsDamageEntityInt = true; // Uncertain.
|
||||
}
|
||||
nmsclearActiveItem = ReflectionUtil.getMethodNoArgs(nmsClass, "clearActiveItem");
|
||||
|
||||
// getBoundingBox
|
||||
if (reflectAxisAlignedBB == null) {
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompataggregated</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>NCPCompatAggregated</name>
|
||||
<description>Aggregator for the NMS compat modules.</description>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>all</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- Legacy, usupported
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- Legacy, unsupported
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
-->
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
+5
@@ -187,4 +187,9 @@ public class MCAccessCB2794 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -188,4 +188,9 @@ public class MCAccessCB2808 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -189,4 +189,9 @@ public class MCAccessCB2882 implements MCAccess{
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB2922</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.2-R0.4-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for CB2922 (MC 1.7.2).
|
||||
</description>
|
||||
<name>NCPCompatCB2922</name>
|
||||
<description>Compatibility for CB2922 (MC 1.7.2).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.2-R0.4-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+5
@@ -189,4 +189,9 @@ public class MCAccessCB2922 implements MCAccess{
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB3026</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for CB3026 (MC 1.7.5).
|
||||
</description>
|
||||
<name>NCPCompatCB3026</name>
|
||||
<description>Compatibility for CB3026 (MC 1.7.5).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+5
@@ -189,4 +189,9 @@ public class MCAccessCB3026 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB3043</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.9-R0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for CB3043 (MC 1.7.10).
|
||||
</description>
|
||||
<name>NCPCompatCB3043</name>
|
||||
<description>Compatibility for CB3043 (MC 1.7.9).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.9-R0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+5
@@ -208,4 +208,9 @@ public class MCAccessCB3043 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB3100</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for CraftBukkit build 3100 (MC 1.7.10).
|
||||
</description>
|
||||
<name>NCPCompatCB3100</name>
|
||||
<description>Compatibility for CraftBukkit build 3100 (MC 1.7.10).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -214,4 +214,10 @@ public class MCAccessCB3100 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bA();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +1,43 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCBDev</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for the development version (latest of the supported Minecraft versions).
|
||||
<name>NCPCompatCBDev</name>
|
||||
<description>
|
||||
Compatibility for the development version (latest of the supported Minecraft versions).
|
||||
|
||||
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
|
||||
AttributeAccessFactory).
|
||||
</description>
|
||||
|
||||
</project>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+6
@@ -275,4 +275,10 @@ public class MCAccessCBDev implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().clearActiveItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_10_R1</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for SpigotCB1_10_R1.
|
||||
<name>NCPCompatSpigotCB1_10_R1</name>
|
||||
<description>Compatibility for SpigotCB1_10_R1.</description>
|
||||
|
||||
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -270,4 +270,10 @@ public class MCAccessSpigotCB1_10_R1 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().clearActiveItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_11_R1</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for SpigotCB1_11_R1.
|
||||
<name>NCPCompatSpigotCB1_11_R1</name>
|
||||
<description>Compatibility for SpigotCB1_11_R1.</description>
|
||||
|
||||
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -275,4 +275,10 @@ public class MCAccessSpigotCB1_11_R1 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().clearActiveItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_8_R1</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1).</description>
|
||||
<name>NCPCompatSpigotCB1_8_R1</name>
|
||||
<description>Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -214,4 +214,10 @@ public class MCAccessSpigotCB1_8_R1 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bU();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_8_R2</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2).</description>
|
||||
<name>NCPCompatSpigotCB1_8_R2</name>
|
||||
<description>Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -214,4 +214,10 @@ public class MCAccessSpigotCB1_8_R2 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bU();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_8_R3</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
|
||||
</project>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_8_R3</name>
|
||||
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+6
@@ -234,4 +234,10 @@ public class MCAccessSpigotCB1_8_R3 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bU();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_9_R1</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1).</description>
|
||||
<name>NCPCompatSpigotCB1_9_R1</name>
|
||||
<description>Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -268,4 +268,10 @@ public class MCAccessSpigotCB1_9_R1 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().clearActiveItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,33 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatSpigotCB1_9_R2</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2).</description>
|
||||
<name>NCPCompatSpigotCB1_9_R2</name>
|
||||
<description>Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2).</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+6
@@ -270,4 +270,10 @@ public class MCAccessSpigotCB1_9_R2 implements MCAccess {
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().clearActiveItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+151
-381
@@ -1,381 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<name>NCPCompatNonFree</name>
|
||||
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence "NonFree".
|
||||
|
||||
To add a new compat module:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>all</id>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
<module>NCPCompatCB3100</module>
|
||||
<module>NCPCompatSpigotCB1_8_R1</module>
|
||||
<module>NCPCompatSpigotCB1_8_R2</module>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
<!-- ... -->
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB3100</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>NCPCompatNonFree</name>
|
||||
<description>
|
||||
Combine compatibility modules with dependencies that can't be obtained from a public maven repository,
|
||||
such as CraftBukkit or Spigot builds, hence "NonFree".
|
||||
|
||||
To add a new compat module:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
|
||||
AttributeAccessFactory).
|
||||
</description>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatAggregated</module>
|
||||
</modules>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>all</id>
|
||||
<modules>
|
||||
<!-- Legacy, unsupported
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
-->
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
<module>NCPCompatCB3100</module>
|
||||
<module>NCPCompatSpigotCB1_8_R1</module>
|
||||
<module>NCPCompatSpigotCB1_8_R2</module>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
<!-- Latest -->
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB3100</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<!-- Legacy, unsupported
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
</modules>
|
||||
</profile>
|
||||
-->
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nms-repo</id>
|
||||
<url>https://repo.codemc.org/repository/nms/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfreejar</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<name>NCPCompatNonFreeJar</name>
|
||||
<description>Create a jar from NCPCompatNonFree.</description>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Profile based activation of jar file build -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>nonfree_build</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>md_5-releases</id>
|
||||
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<!-- Building -->
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<directory>../../target</directory> <!-- Build it two levels up, because it is the one we care about -->
|
||||
<finalName>NCPCompatNonFree</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>fr.neatmonster:*</include>
|
||||
</includes>
|
||||
<!-- Clearly not sure about excludes... -->
|
||||
<!-- <excludes> <exclude>fr.neatmonster:nocheatplus-parent</exclude>
|
||||
</excludes> -->
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- <skip>true</skip> -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,59 +1,49 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatprotocollib</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatProtocolLib</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<artifactId>ncpcompatprotocollib</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.12-pre2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib-API</artifactId>
|
||||
<version>4.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<name>NCPCompatProtocolLib</name>
|
||||
<description>
|
||||
Features using the plugin ProtocolLib:
|
||||
https://dev.bukkit.org/bukkit-plugins/protocollib/
|
||||
</description>
|
||||
|
||||
<description>Features using the plugin ProtocolLib:
|
||||
https://dev.bukkit.org/bukkit-plugins/protocollib/</description>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
+3
@@ -68,6 +68,9 @@ public class CatchAllAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {}
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ public class DebugAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
final Player player = event.getPlayer();
|
||||
if (DataManager.getPlayerDataSafe(player).isDebugActive(CheckType.NET)) {
|
||||
debug(player, "packet: " + event.getPacketType());
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.net.protocollib;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
|
||||
public class Fight extends BaseAdapter{
|
||||
private static PacketType[] initPacketTypes() {
|
||||
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
|
||||
//PacketType.Play.Client.ARM_ANIMATION,
|
||||
PacketType.Play.Server.EXPLOSION
|
||||
));
|
||||
return types.toArray(new PacketType[types.size()]);
|
||||
}
|
||||
|
||||
public Fight(Plugin plugin) {
|
||||
super(plugin, ListenerPriority.MONITOR, initPacketTypes());
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void onPacketReceiving(final PacketEvent event) {
|
||||
// handleAnmationPacket(event);
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(final PacketEvent event) {
|
||||
handleVelocityPacket(event);
|
||||
}
|
||||
|
||||
private void handleVelocityPacket(PacketEvent event) {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
if (event.getPacketType() != PacketType.Play.Server.EXPLOSION) return;
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
final PacketContainer packet = event.getPacket();
|
||||
final StructureModifier<Float> floats = packet.getFloat();
|
||||
|
||||
if (floats.size() != 4) {
|
||||
// TODO : Warning
|
||||
return;
|
||||
}
|
||||
|
||||
//final Float strength = floats.read(0);
|
||||
|
||||
final Float velX = floats.read(1);
|
||||
final Float velY = floats.read(2);
|
||||
final Float velZ = floats.read(3);
|
||||
if (Math.abs(velX) == 0.0 && Math.abs(velZ) == 0.0 && Math.abs(velY) == 0.0) return;
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
if (!pData.isCheckActive(CheckType.MOVING, player)) return;
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
// Process velocity.
|
||||
data.shouldApplyExplosionVelocity = true;
|
||||
data.explosionVelAxisX += velX;
|
||||
data.explosionVelAxisY += velY;
|
||||
data.explosionVelAxisZ+= velZ;
|
||||
}
|
||||
|
||||
//public void handleAnmationPacket(final PacketEvent event) {
|
||||
|
||||
// final Player player = event.getPlayer();
|
||||
// final FightData data = DataManager.getGenericInstance(player, FightData.class);
|
||||
// TODO: Count temporary player as well?
|
||||
// if (event.isPlayerTemporary()) return;
|
||||
// if (event.getPacketType() != PacketType.Play.Client.ARM_ANIMATION) {
|
||||
//data.noSwingPacket = false;
|
||||
//data.noSwingArmSwung = false;
|
||||
// return;
|
||||
// }
|
||||
// if (player == null) {
|
||||
// counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
// return;
|
||||
// }
|
||||
// data.noSwingPacket = true;
|
||||
// data.noSwingArmSwung = true;
|
||||
//}
|
||||
}
|
||||
+5
-1
@@ -57,7 +57,10 @@ public class KeepAliveAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
final long time = System.currentTimeMillis();
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {}
|
||||
final long time = System.currentTimeMillis();
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
@@ -66,6 +69,7 @@ public class KeepAliveAdapter extends BaseAdapter {
|
||||
}
|
||||
// Always update last received time.
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
|
||||
if (pData == null) return;
|
||||
final NetData data = pData.getGenericInstance(NetData.class);
|
||||
data.lastKeepAliveTime = time;
|
||||
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
|
||||
|
||||
+57
-3
@@ -21,6 +21,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -34,6 +35,7 @@ import com.comphenix.protocol.reflect.StructureModifier;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.checks.net.FlyingFrequency;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
@@ -41,6 +43,7 @@ import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying.PACKET_CONTENT;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.TeleportQueue.AckReference;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.logging.Streams;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
@@ -50,6 +53,7 @@ import fr.neatmonster.nocheatplus.utilities.CheckUtils;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.TrigUtil;
|
||||
import fr.neatmonster.nocheatplus.worlds.IWorldData;
|
||||
|
||||
/**
|
||||
@@ -72,6 +76,8 @@ public class MovingFlying extends BaseAdapter {
|
||||
public static final int indexStance = 3;
|
||||
public static final int indexYaw = 0;
|
||||
public static final int indexPitch = 1;
|
||||
|
||||
private final Plugin plugin = Bukkit.getPluginManager().getPlugin("NoCheatPlus");
|
||||
|
||||
private static PacketType[] initPacketTypes() {
|
||||
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
|
||||
@@ -82,7 +88,7 @@ public class MovingFlying extends BaseAdapter {
|
||||
));
|
||||
// Add confirm teleport.
|
||||
// PacketPlayInTeleportAccept
|
||||
PacketType confirmType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "PacketPlayInTeleportAccept");
|
||||
PacketType confirmType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "TeleportAccept");
|
||||
if (confirmType != null) {
|
||||
StaticLog.logInfo("Confirm teleport packet available (via name): " + confirmType);
|
||||
types.add(confirmType);
|
||||
@@ -105,7 +111,7 @@ public class MovingFlying extends BaseAdapter {
|
||||
private long packetMismatchLogFrequency = 60000; // Every minute max, good for updating :).
|
||||
|
||||
private final HashSet<PACKET_CONTENT> validContent = new LinkedHashSet<PACKET_CONTENT>();
|
||||
private final PacketType confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "PacketPlayInTeleportAccept");
|
||||
private final PacketType confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "TeleportAccept");
|
||||
private boolean acceptConfirmTeleportPackets = confirmTeleportType != null;
|
||||
|
||||
public MovingFlying(Plugin plugin) {
|
||||
@@ -123,7 +129,12 @@ public class MovingFlying extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {
|
||||
if (event.getPlayer() == null) return;
|
||||
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
|
||||
}
|
||||
if (event.getPacketType().equals(confirmTeleportType)) {
|
||||
if (acceptConfirmTeleportPackets) {
|
||||
onConfirmTeleportPacket(event);
|
||||
@@ -223,6 +234,49 @@ public class MovingFlying extends BaseAdapter {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Should let it here?
|
||||
// Work as ExtremeMove but for packet sent!
|
||||
if (packetData.hasPos) {
|
||||
final MovingData Mdata = pData.getGenericInstance(MovingData.class);
|
||||
final Location loc1 = player.getLocation();
|
||||
final Location loc2 = new Location(null, packetData.getX(), packetData.getY(), packetData.getZ());
|
||||
final double xzdist = TrigUtil.distance(loc1, loc2);
|
||||
final double ydist = Math.abs(loc1.getY() - loc2.getY());
|
||||
|
||||
// Vertical move.
|
||||
if (ydist > 100.0) {
|
||||
++data.diffpacketVLs;
|
||||
}
|
||||
// Horizontal move.
|
||||
else if (xzdist > 100.0) {
|
||||
++data.diffpacketVLs;
|
||||
} else data.diffpacketVLs *= 0.98;
|
||||
|
||||
if (data.diffpacketVLs > 7) {
|
||||
cancel = true;
|
||||
}
|
||||
if (data.diffpacketVLs > 15) {
|
||||
// Player might be freezed by canceling, set back might turn it to normal
|
||||
|
||||
data.diffpacketVLs = 0.0;
|
||||
int task = -1;
|
||||
task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
|
||||
(Runnable)new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Mask player teleport as a set back.
|
||||
Mdata.prepareSetBack(loc1);
|
||||
player.teleport(LocUtil.clone(loc1),
|
||||
BridgeMisc.TELEPORT_CAUSE_CORRECTION_OF_POSITION);
|
||||
}
|
||||
});
|
||||
if (task == -1) {
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.STATUS, "Failed to schedule set back task. Player: " + player.getName() + " , set back: " + loc1);
|
||||
}
|
||||
Mdata.resetTeleported(); // Cleanup, just in case.
|
||||
}
|
||||
}
|
||||
switch(data.teleportQueue.processAck(packetData)) {
|
||||
case WAITING: {
|
||||
if (pData.isDebugActive(this.checkType)) {
|
||||
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.net.protocollib;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
|
||||
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
||||
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;
|
||||
import fr.neatmonster.nocheatplus.event.mini.MiniListener;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.InventoryUtil;
|
||||
|
||||
public class NoSlow extends BaseAdapter {
|
||||
private final static String dftag = "system.nocheatplus.noslow";
|
||||
private final static MiniListener<?>[] miniListeners = new MiniListener<?>[] {
|
||||
new MiniListener<PlayerItemConsumeEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerItemConsumeEvent event) {
|
||||
onItemConsume(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<PlayerInteractEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerInteractEvent event) {
|
||||
onItemInteract(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<InventoryOpenEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final InventoryOpenEvent event) {
|
||||
onInventoryOpen(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<PlayerItemHeldEvent>() {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerItemHeldEvent event) {
|
||||
onChangeSlot(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<BlockPlaceEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final BlockPlaceEvent event) {
|
||||
onPlace(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static int timeBetweenRL = 70;
|
||||
private static PacketType[] initPacketTypes() {
|
||||
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
|
||||
PacketType.Play.Client.BLOCK_DIG
|
||||
));
|
||||
return types.toArray(new PacketType[types.size()]);
|
||||
}
|
||||
|
||||
public NoSlow(Plugin plugin) {
|
||||
super(plugin, ListenerPriority.LOW, initPacketTypes());
|
||||
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
|
||||
for (final MiniListener<?> listener : miniListeners) {
|
||||
api.addComponent(listener, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
handleDiggingPacket(event);
|
||||
}
|
||||
|
||||
private static void onItemConsume(final PlayerItemConsumeEvent e){
|
||||
final Player p = e.getPlayer();
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onInventoryOpen(final InventoryOpenEvent e){
|
||||
if (e.isCancelled()) return;
|
||||
final Player p = (Player) e.getPlayer();
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onItemInteract(final PlayerInteractEvent e){
|
||||
// TODO: Add trident (Check for rain and verify if the player is exposed to it at all, might not be worth doing it...)
|
||||
if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
final Player p = e.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
// Reset
|
||||
data.offhanduse = false;
|
||||
Block b = e.getClickedBlock();
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
data.isusingitem = false;
|
||||
return;
|
||||
}
|
||||
if (b != null && (
|
||||
b.getType().toString().endsWith("DOOR")
|
||||
|| b.getType().toString().endsWith("GATE")
|
||||
|| b.getType().toString().endsWith("BUTTON")
|
||||
|| b.getType().toString().endsWith("LEVER")
|
||||
|| (b.getType().name().startsWith("SWEET_BERRY_BUSH") && ((Ageable) b.getBlockData()).getAge() > 1)
|
||||
)) {
|
||||
data.isusingitem = false;
|
||||
return;
|
||||
}
|
||||
if (e.hasItem()) {
|
||||
ItemStack item = e.getItem();
|
||||
Material m = item.getType();
|
||||
if (Bridge1_9.hasElytra() && p.hasCooldown(m)) return;
|
||||
if (InventoryUtil.isConsumable(item)) {
|
||||
// pre1.9 splash potion
|
||||
if (!Bridge1_9.hasElytra() && item.getDurability() > 16384) return;
|
||||
if (m == Material.POTION || m == Material.MILK_BUCKET || m.toString().endsWith("_APPLE") || m.name().startsWith("HONEY_BOTTLE")) {
|
||||
data.isusingitem = true;
|
||||
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
|
||||
return;
|
||||
}
|
||||
if (item.getType().isEdible() && p.getFoodLevel() < 20) {
|
||||
data.isusingitem = true;
|
||||
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m.toString().equals("BOW") && hasArrow(p.getInventory())) {
|
||||
data.isusingitem = true;
|
||||
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
|
||||
return;
|
||||
}
|
||||
if (m.name().equals("SHIELD")) {
|
||||
data.offhanduse = e.getHand() == EquipmentSlot.OFF_HAND;
|
||||
return;
|
||||
}
|
||||
if (m.toString().equals("CROSSBOW")) {
|
||||
if (item.getItemMeta().serialize().get("charged").equals(false) && hasArrow(p.getInventory())) {
|
||||
data.isusingitem = true;
|
||||
data.offhanduse = e.getHand() == EquipmentSlot.OFF_HAND;
|
||||
}
|
||||
}
|
||||
} else data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onChangeSlot(final PlayerItemHeldEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
if (data.changeslot) {
|
||||
p.getInventory().setHeldItemSlot(data.olditemslot);
|
||||
data.changeslot = false;
|
||||
}
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onPlace(final BlockPlaceEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
if (InventoryUtil.isConsumable(e.getItemInHand())) data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static boolean hasArrow(PlayerInventory i) {
|
||||
if (Bridge1_9.hasElytra()) {
|
||||
Material m = i.getItemInOffHand().getType();
|
||||
return i.contains(Material.ARROW) || m.toString().endsWith("ARROW") || i.contains(Material.TIPPED_ARROW) || i.contains(Material.SPECTRAL_ARROW);
|
||||
}
|
||||
return i.contains(Material.ARROW);
|
||||
}
|
||||
|
||||
private void handleDiggingPacket(PacketEvent event)
|
||||
{
|
||||
if(event.getPacketType() != PacketType.Play.Client.BLOCK_DIG) return;
|
||||
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (p == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(p);
|
||||
if (pData == null) {
|
||||
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + p.toString());
|
||||
return;
|
||||
}
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
PlayerDigType digtype = event.getPacket().getPlayerDigTypes().read(0);
|
||||
// DROP_ALL_ITEMS when dead?
|
||||
if (digtype == PlayerDigType.DROP_ALL_ITEMS || digtype == PlayerDigType.DROP_ITEM) data.isusingitem = false;
|
||||
|
||||
//Advanced check
|
||||
if(digtype == PlayerDigType.RELEASE_USE_ITEM) {
|
||||
data.isusingitem = false;
|
||||
long now = System.currentTimeMillis();
|
||||
if (data.time_rl_item != 0) {
|
||||
if (now < data.time_rl_item) {
|
||||
data.time_rl_item = now;
|
||||
return;
|
||||
}
|
||||
if (data.time_rl_item + timeBetweenRL > now) {
|
||||
data.isHackingRI = true;
|
||||
}
|
||||
}
|
||||
data.time_rl_item = now;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Minimum time between RELEASE_USE_ITEM packet is sent.
|
||||
* If time lower this value, A check will flag
|
||||
* Should be set from 51-100. Larger number, more protection more false-positive
|
||||
*
|
||||
* @param milliseconds
|
||||
*/
|
||||
public static void setuseRLThreshold(int time) {
|
||||
timeBetweenRL = time;
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -27,6 +27,7 @@ import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.CountableLocation;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.logging.Streams;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
@@ -53,12 +54,23 @@ public class OutgoingPosition extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {}
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
final long time = System.currentTimeMillis();
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
|
||||
if (pData == null) {
|
||||
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + player.toString());
|
||||
return;
|
||||
}
|
||||
// TODO: In future multiple checks might use this (!)
|
||||
if (pData.isCheckActive(CheckType.NET_FLYINGFREQUENCY, player)) {
|
||||
interpretPacket(player, event.getPacket(), time,
|
||||
|
||||
+32
-3
@@ -87,7 +87,7 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
|
||||
|
||||
// INSTANCE ----
|
||||
|
||||
private final List<PacketAdapter> registeredPacketAdapters = new LinkedList<PacketAdapter>();
|
||||
private static final List<PacketAdapter> registeredPacketAdapters = new LinkedList<PacketAdapter>();
|
||||
|
||||
public ProtocolLibComponent(Plugin plugin) {
|
||||
register(plugin);
|
||||
@@ -98,8 +98,12 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
|
||||
}
|
||||
|
||||
private void register(Plugin plugin) {
|
||||
StaticLog.logInfo("Adding packet level hooks for ProtocolLib (MC " + ProtocolLibrary.getProtocolManager().getMinecraftVersion().getVersion() + ")...");
|
||||
final IWorldDataManager worldMan = NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager();
|
||||
if (!worldMan.isActiveAnywhere(CheckType.NET)) {
|
||||
StaticLog.logInfo("No packet level checks activated.");
|
||||
return;
|
||||
}
|
||||
StaticLog.logInfo("Adding packet level hooks for ProtocolLib (MC " + ProtocolLibrary.getProtocolManager().getMinecraftVersion().getVersion() + ")...");
|
||||
//Special purpose.
|
||||
if (ConfigManager.isTrueForAnyConfig(ConfPaths.NET + ConfPaths.SUB_DEBUG) || ConfigManager.isTrueForAnyConfig(ConfPaths.CHECKS_DEBUG) ) {
|
||||
// (Debug logging. Only activates if debug is set for checks or checks.net, not on the fly.)
|
||||
@@ -127,12 +131,19 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
|
||||
if (worldMan.isActiveAnywhere(CheckType.NET_SOUNDDISTANCE)) {
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.SoundDistance", plugin);
|
||||
}
|
||||
if (worldMan.isActiveAnywhere(CheckType.NET_WRONGTURN)) {
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.WrongTurnAdapter", plugin);
|
||||
}
|
||||
if (ServerVersion.compareMinecraftVersion("1.9") < 0) {
|
||||
if (worldMan.isActiveAnywhere(CheckType.NET_PACKETFREQUENCY)) {
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.CatchAllAdapter", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (ServerVersion.compareMinecraftVersion("1.8") >= 0) {
|
||||
if (ConfigManager.isTrueForAnyConfig(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_NOSLOW))
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.NoSlow", plugin);
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.Fight", plugin);
|
||||
}
|
||||
if (!registeredPacketAdapters.isEmpty()) {
|
||||
List<String> names = new ArrayList<String>(registeredPacketAdapters.size());
|
||||
for (PacketAdapter adapter : registeredPacketAdapters) {
|
||||
@@ -203,6 +214,24 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
|
||||
registeredPacketAdapters.clear();
|
||||
}
|
||||
|
||||
protected static void unregister(PacketAdapter adapter) {
|
||||
final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
|
||||
try {
|
||||
protocolManager.removePacketListener(adapter);
|
||||
api.removeComponent(adapter); // Bit heavy, but consistent.
|
||||
registeredPacketAdapters.remove(adapter);
|
||||
List<String> names = new ArrayList<String>(registeredPacketAdapters.size());
|
||||
for (PacketAdapter adaptern : registeredPacketAdapters) {
|
||||
names.add(adaptern.getClass().getSimpleName());
|
||||
}
|
||||
api.setFeatureTags("packet-listeners", names);
|
||||
StaticLog.logInfo("Unregistered packet level hook:" + adapter.getClass().getName());
|
||||
} catch (Throwable t) {
|
||||
StaticLog.logWarning("Failed to unregister packet level hook: " + adapter.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerJoins(final Player player) {
|
||||
if (!registeredPacketAdapters.isEmpty()) {
|
||||
|
||||
+17
-2
@@ -140,8 +140,13 @@ public class SoundDistance extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(final PacketEvent event) {
|
||||
private void handleSoundPacket(final PacketEvent event) {
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {
|
||||
if (event.getPlayer() == null) return;
|
||||
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
|
||||
}
|
||||
final PacketContainer packetContainer = event.getPacket();
|
||||
|
||||
// Compare sound effect name.
|
||||
@@ -169,5 +174,15 @@ public class SoundDistance extends BaseAdapter {
|
||||
}
|
||||
useLoc.setWorld(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(final PacketEvent event) {
|
||||
try {
|
||||
handleSoundPacket(event);
|
||||
} catch(Throwable t) {
|
||||
t.printStackTrace();
|
||||
ProtocolLibComponent.unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+8
-5
@@ -45,7 +45,7 @@ public class UseEntityAdapter extends BaseAdapter {
|
||||
final Method methodName_legacy;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param versionDetail
|
||||
* @throws RuntimeException
|
||||
* if not matching/supported.
|
||||
@@ -123,18 +123,21 @@ public class UseEntityAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {}
|
||||
final long time = System.currentTimeMillis();
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
// TODO: Warn once?
|
||||
return;
|
||||
}
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
|
||||
if (pData == null) return;
|
||||
|
||||
final NetData data = pData.getGenericInstance(NetData.class);
|
||||
// Always set last received time.
|
||||
data.lastKeepAliveTime = time;
|
||||
data.lastHitLocation = player.getLocation();
|
||||
|
||||
// Quick return, if no checks are active.
|
||||
if (!pData.isCheckActive(CheckType.NET_ATTACKFREQUENCY, player)) {
|
||||
@@ -183,7 +186,7 @@ public class UseEntityAdapter extends BaseAdapter {
|
||||
// AttackFrequency
|
||||
if (isAttack) {
|
||||
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
|
||||
if (attackFrequency.isEnabled(player, pData)
|
||||
if (attackFrequency.isEnabled(player, pData)
|
||||
&& attackFrequency.check(player, time, data, cc, pData)) {
|
||||
cancel = true;
|
||||
}
|
||||
@@ -201,4 +204,4 @@ public class UseEntityAdapter extends BaseAdapter {
|
||||
return actionName == null ? 0 : (INTERPRETED | ("ATTACK".equals(actionName) ? ATTACK : 0));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.net.protocollib;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.reflect.StructureModifier;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
import fr.neatmonster.nocheatplus.checks.net.WrongTurn;
|
||||
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
||||
import fr.neatmonster.nocheatplus.config.ConfigManager;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
|
||||
public class WrongTurnAdapter extends BaseAdapter {
|
||||
|
||||
private final WrongTurn wrongTurn = new WrongTurn();
|
||||
|
||||
public WrongTurnAdapter(Plugin plugin) {
|
||||
super(plugin, ListenerPriority.LOW, PacketType.Play.Client.LOOK, PacketType.Play.Client.POSITION_LOOK);
|
||||
if (ConfigManager.isTrueForAnyConfig(ConfPaths.NET_WRONGTURN_ACTIVE)) {
|
||||
NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags("checks", Arrays.asList(WrongTurn.class.getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
try {
|
||||
if (event.isPlayerTemporary()) return;
|
||||
} catch(NoSuchMethodError e) {
|
||||
if (player == null) return;
|
||||
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
|
||||
}
|
||||
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
final StructureModifier<Float> floats = event.getPacket().getFloat();
|
||||
final float pitch = floats.read(1);
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final NetData data = pData.getGenericInstance(NetData.class);
|
||||
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
|
||||
|
||||
if (pData.isCheckActive(CheckType.NET_WRONGTURN, player) && wrongTurn.check(player, pitch, data, cc)) {
|
||||
event.setCancelled(true); // Is it a good idea to cancel or should we just reset the players pitch?
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+35
-38
@@ -1,45 +1,42 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCore</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<description>Core components and checks implementations. This contains about everything, just not the component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use check-specific classes to be added in the factories on NCPPlugin level.
|
||||
</description>
|
||||
<name>NCPCore</name>
|
||||
<description>
|
||||
Core components and checks implementations. This contains about everything, just not the
|
||||
component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use
|
||||
check-specific classes to be added in the factories on NCPPlugin level.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -37,7 +37,8 @@ public enum ParameterName {
|
||||
TAGS("tags"),
|
||||
UUID("uuid"),
|
||||
VIOLATIONS("violations"),
|
||||
WORLD("world");
|
||||
WORLD("world"),
|
||||
MODEL("model");
|
||||
|
||||
/**
|
||||
* Gets the parameter associated to the text.
|
||||
|
||||
@@ -72,15 +72,16 @@ public enum CheckType {
|
||||
|
||||
FIGHT(CheckTypeType.CHECK, CheckType.ALL, Permissions.FIGHT),
|
||||
FIGHT_ANGLE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_ANGLE),
|
||||
FIGHT_CLICKPATTERN(CheckTypeType.CHECK, FIGHT),
|
||||
FIGHT_CRITICAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_CRITICAL),
|
||||
FIGHT_DIRECTION(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_DIRECTION),
|
||||
FIGHT_FASTHEAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_FASTHEAL),
|
||||
FIGHT_GODMODE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_GODMODE),
|
||||
FIGHT_HITBOX(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_DIRECTION),
|
||||
FIGHT_NOSWING(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_NOSWING),
|
||||
FIGHT_REACH(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_REACH),
|
||||
FIGHT_SELFHIT(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_SELFHIT),
|
||||
FIGHT_SPEED(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_SPEED),
|
||||
FIGHT_VISIBLE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_VISIBLE),
|
||||
FIGHT_WRONGTURN(CheckTypeType.CHECK, FIGHT, null),
|
||||
|
||||
INVENTORY(CheckTypeType.GROUP, CheckType.ALL, Permissions.INVENTORY),
|
||||
@@ -90,7 +91,8 @@ public enum CheckType {
|
||||
INVENTORY_GUTENBERG(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_GUTENBERG),
|
||||
INVENTORY_INSTANTBOW(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INSTANTBOW),
|
||||
INVENTORY_INSTANTEAT(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INSTANTEAT),
|
||||
INVENTORY_MOVE(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_MOVE),
|
||||
INVENTORY_INVENTORYMOVE(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INVENTORYMOVE),
|
||||
INVENTORY_MOREINVENTORY(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_MOREINVENTORY),
|
||||
INVENTORY_ITEMS(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_ITEMS),
|
||||
INVENTORY_OPEN(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_OPEN),
|
||||
|
||||
@@ -106,11 +108,11 @@ public enum CheckType {
|
||||
|
||||
NET(CheckTypeType.GROUP, CheckType.ALL, Permissions.NET),
|
||||
NET_ATTACKFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_ATTACKFREQUENCY),
|
||||
NET_FIGHTSYNC(CheckTypeType.CHECK, NET, Permissions.NET_FLYINGFREQUENCY),
|
||||
NET_FLYINGFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_FLYINGFREQUENCY),
|
||||
NET_KEEPALIVEFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_KEEPALIVEFREQUENCY),
|
||||
NET_PACKETFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_PACKETFREQUENCY),
|
||||
NET_SOUNDDISTANCE(CheckTypeType.CHECK, NET), // Can not exempt players from this one.
|
||||
NET_WRONGTURN(CheckTypeType.CHECK, NET, Permissions.NET_WRONGTURN),
|
||||
|
||||
;
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class BlockBreakData extends ACheckData implements IDataOnReload {
|
||||
public int frequencyShortTermTick;
|
||||
|
||||
// Data of the no swing check.
|
||||
public boolean noSwingArmSwung = true;
|
||||
public int noSwingCount = 0;
|
||||
|
||||
// Data of the reach check.
|
||||
public double reachDistance;
|
||||
|
||||
+17
-5
@@ -132,6 +132,8 @@ public class BlockBreakListener extends CheckListener {
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.BLOCKBREAK, player)) return;
|
||||
|
||||
// Illegal enchantments hotfix check.
|
||||
// TODO: Legacy / encapsulate fully there.
|
||||
if (Items.checkIllegalEnchantmentsAllHands(player, pData)) {
|
||||
@@ -153,7 +155,7 @@ public class BlockBreakListener extends CheckListener {
|
||||
|
||||
final Block block = event.getBlock();
|
||||
boolean cancelled = false;
|
||||
|
||||
if (BlockProperties.isScaffolding(block.getType())) return;
|
||||
// Do the actual checks, if still needed. It's a good idea to make computationally cheap checks first, because
|
||||
// it may save us from doing the computationally expensive checks.
|
||||
|
||||
@@ -220,7 +222,7 @@ public class BlockBreakListener extends CheckListener {
|
||||
|| bdata.isPassedCheck(CheckType.BLOCKINTERACT_VISIBLE))) {
|
||||
skippedRedundantChecks ++;
|
||||
}
|
||||
else if (directionEnabled && direction.check(player, loc, eyeHeight, block,
|
||||
else if (directionEnabled && direction.check(player, loc, eyeHeight, block, null,
|
||||
flyingHandle, data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
@@ -232,7 +234,7 @@ public class BlockBreakListener extends CheckListener {
|
||||
}
|
||||
|
||||
// Destroying liquid blocks.
|
||||
if (!cancelled && BlockProperties.isLiquid(block.getType())
|
||||
if (!cancelled && BlockProperties.isLiquid(block.getType()) && !BlockProperties.isNewLiq(block.getType())
|
||||
&& !pData.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID, player)
|
||||
&& !NCPExemptionManager.isExempted(player, CheckType.BLOCKBREAK_BREAK)){
|
||||
cancelled = true;
|
||||
@@ -300,7 +302,8 @@ public class BlockBreakListener extends CheckListener {
|
||||
public void onPlayerAnimation(final PlayerAnimationEvent event) {
|
||||
// Just set a flag to true when the arm was swung.
|
||||
// debug(player, "Animation");
|
||||
DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class).noSwingArmSwung = true;
|
||||
final BlockBreakData data = DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class);
|
||||
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,6 +321,9 @@ public class BlockBreakListener extends CheckListener {
|
||||
|
||||
// Return if it is not left clicking a block.
|
||||
// (Allows right click to be ignored.)
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
|
||||
|
||||
isInstaBreak = AlmostBoolean.NO;
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
|
||||
return;
|
||||
@@ -343,6 +349,9 @@ public class BlockBreakListener extends CheckListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
|
||||
public void onBlockDamage(final BlockDamageEvent event) {
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
|
||||
|
||||
if (!event.isCancelled() && event.getInstaBreak()) {
|
||||
// Keep MAYBE.
|
||||
if (isInstaBreak != AlmostBoolean.MAYBE) {
|
||||
@@ -400,6 +409,9 @@ public class BlockBreakListener extends CheckListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
|
||||
public void onItemHeld(final PlayerItemHeldEvent event) {
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
|
||||
|
||||
// Reset clicked block.
|
||||
// TODO: Not for 1.5.2 and before?
|
||||
final Player player = event.getPlayer();
|
||||
@@ -409,4 +421,4 @@ public class BlockBreakListener extends CheckListener {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,13 +45,12 @@ public class NoSwing extends Check {
|
||||
boolean cancel = false;
|
||||
|
||||
// Did they swing their arm before?
|
||||
if (data.noSwingArmSwung) {
|
||||
// "Consume" the flag.
|
||||
data.noSwingArmSwung = false;
|
||||
if (++data.noSwingCount <= 1) {
|
||||
// Reward with lowering of the violation level.
|
||||
data.noSwingVL *= 0.9D;
|
||||
} else {
|
||||
// They failed, increase violation level.
|
||||
data.noSwingCount = 0;
|
||||
data.noSwingVL += 1D;
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
|
||||
+19
-5
@@ -34,6 +34,7 @@ import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
@@ -145,6 +146,9 @@ public class BlockInteractListener extends CheckListener {
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final BlockInteractData data = pData.getGenericInstance(BlockInteractData.class);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.BLOCKINTERACT, player)) return;
|
||||
|
||||
data.resetLastBlock();
|
||||
// Early cancel for interact events with dead players and other.
|
||||
final int cancelId;
|
||||
@@ -186,7 +190,10 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (block == null) {
|
||||
data.resetLastBlock();
|
||||
blockChecks = false;
|
||||
}
|
||||
}
|
||||
// else if (BlockProperties.isScaffolding(block.getType())) { // null check included in BlockProperties.
|
||||
// blockChecks = false;
|
||||
// }
|
||||
else {
|
||||
data.setLastBlock(block, action);
|
||||
}
|
||||
@@ -205,6 +212,9 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (stack != null && stack.getType() == Material.ENDER_PEARL) {
|
||||
checkEnderPearlRightClickBlock(player, block, face, event, previousLastTick, data, pData);
|
||||
}
|
||||
if (BlockProperties.isScaffolding(stack.getType())) {
|
||||
blockChecks = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
data.setPlayerInteractEventResolution(event);
|
||||
@@ -249,7 +259,7 @@ public class BlockInteractListener extends CheckListener {
|
||||
|
||||
// Second the direction check
|
||||
if (!cancelled && direction.isEnabled(player, pData)
|
||||
&& direction.check(player, loc, eyeHeight, block, flyingHandle,
|
||||
&& direction.check(player, loc, eyeHeight, block, face, flyingHandle,
|
||||
data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
@@ -345,6 +355,9 @@ public class BlockInteractListener extends CheckListener {
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final BlockInteractData data = pData.getGenericInstance(BlockInteractData.class);
|
||||
data.setPlayerInteractEventResolution(event);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.MOVING, player)) return;
|
||||
|
||||
/*
|
||||
* TODO: BlockDamageEvent fires before BlockInteract/MONITOR level,
|
||||
* BlockBreak after (!). Thus resolution is set on LOWEST already,
|
||||
@@ -373,8 +386,9 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (stack != null && BridgeMisc.maybeElytraBoost(player, stack.getType())) {
|
||||
final int power = BridgeMisc.getFireworksPower(stack);
|
||||
final MovingData mData = pData.getGenericInstance(MovingData.class);
|
||||
final int ticks = Math.max((1 + power) * 20, 30);
|
||||
final int ticks = Math.max((1 + power) * (power < 2 ? 20 : 15), 30);
|
||||
mData.fireworksBoostDuration = ticks;
|
||||
mData.fireworksBoostTickNeedCheck = ticks - 1;
|
||||
// Expiration tick: not general latency, rather a minimum margin for sudden congestion.
|
||||
mData.fireworksBoostTickExpire = TickTask.getTick() + ticks;
|
||||
// TODO: Invalidation mechanics: by tick/time well ?
|
||||
@@ -422,7 +436,7 @@ public class BlockInteractListener extends CheckListener {
|
||||
builder.append(") block: ");
|
||||
builder.append(block.getWorld().getName() + "/" + LocUtil.simpleFormat(block));
|
||||
builder.append(" type: " + block.getType());
|
||||
builder.append(" data: " + BlockProperties.getData(block));
|
||||
if (!Bridge1_13.hasIsSwimming()) builder.append(" data: " + BlockProperties.getData(block));
|
||||
builder.append(" face: " + face);
|
||||
}
|
||||
|
||||
@@ -433,4 +447,4 @@ public class BlockInteractListener extends CheckListener {
|
||||
debug(player, builder.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@ import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
||||
|
||||
/**
|
||||
* Check if the placing is legitimate in terms of surrounding materials.
|
||||
* @author mc_dev
|
||||
@@ -35,57 +37,81 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
*/
|
||||
public class Against extends Check {
|
||||
|
||||
|
||||
/**
|
||||
* Instanties a new Against check.
|
||||
*
|
||||
*/
|
||||
public Against() {
|
||||
super(CheckType.BLOCKPLACE_AGAINST);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks a player
|
||||
* @param player
|
||||
* @param block
|
||||
* @param placedMat the material placed.
|
||||
* @param blockAgainst
|
||||
* @param isInteractBlock
|
||||
* @param data
|
||||
* @param cc
|
||||
* @param pData
|
||||
*
|
||||
*/
|
||||
public boolean check(final Player player, final Block block, final Material placedMat,
|
||||
final Block blockAgainst, final boolean isInteractBlock,
|
||||
final BlockPlaceData data, final BlockPlaceConfig cc, final IPlayerData pData) {
|
||||
final Block blockAgainst, final boolean isInteractBlock,
|
||||
final BlockPlaceData data, final BlockPlaceConfig cc, final IPlayerData pData) {
|
||||
|
||||
boolean violation = false;
|
||||
/*
|
||||
* TODO: Make more precise (workarounds like BridgeMisc.LILY_PAD,
|
||||
* general points, such as action?).
|
||||
*/
|
||||
// Workaround for signs on cactus and similar.
|
||||
final BlockInteractData bdata = pData.getGenericInstance(BlockInteractData.class); // TODO: pass as argument.
|
||||
final BlockInteractData bIData = pData.getGenericInstance(BlockInteractData.class); // TODO: pass as argument.
|
||||
final Material againstType = blockAgainst.getType();
|
||||
if (bdata.isConsumedCheck(this.type) && !bdata.isPassedCheck(this.type)) {
|
||||
final Material matAgainst = bIData.getLastType();
|
||||
|
||||
if (pData.isDebugActive(type)) {
|
||||
debug(player, "Player placed (" + placedMat + ") against (" + blockAgainst.toString() +"/"+ matAgainst + "). againstType: " + againstType);
|
||||
}
|
||||
|
||||
if (bIData.isConsumedCheck(this.type) && !bIData.isPassedCheck(this.type)) {
|
||||
// TODO: Awareness of repeated violation probably is to be implemented below somewhere.
|
||||
violation = true;
|
||||
if (pData.isDebugActive(type)) {
|
||||
debug(player, "Cancel due to block having been consumed by this check.");
|
||||
}
|
||||
}
|
||||
else if (BlockProperties.isAir(againstType)) {
|
||||
// Attempt to workaround blocks like cactus.
|
||||
final Material matAgainst = bdata.getLastType();
|
||||
if (isInteractBlock && !BlockProperties.isAir(matAgainst) && ! BlockProperties.isLiquid(matAgainst)) {
|
||||
else if (BlockProperties.isActuallyAir(matAgainst)) {
|
||||
if (isInteractBlock && !BlockProperties.isAir(matAgainst) && !BlockProperties.isLiquid(matAgainst)) {
|
||||
// Block was placed against something (e.g. cactus), allow it.
|
||||
}
|
||||
else if (!pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR, player)) {
|
||||
else if (!pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR, player)
|
||||
&& placedMat != BridgeMaterial.LILY_PAD) {
|
||||
violation = true;
|
||||
}
|
||||
}
|
||||
else if (BlockProperties.isLiquid(againstType)) {
|
||||
// TODO: F_PLACE_AGAINST_WATER|LIQUID...
|
||||
else if (BlockProperties.isLiquid(matAgainst)) {
|
||||
if ((placedMat != BridgeMaterial.LILY_PAD
|
||||
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
|
||||
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS, player)) {
|
||||
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
|
||||
&& !BlockProperties.isNewLiq(bIData.getLastType())
|
||||
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS, player)) {
|
||||
violation = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle violation and return.
|
||||
bdata.addConsumedCheck(this.type);
|
||||
bIData.addConsumedCheck(this.type);
|
||||
if (violation) {
|
||||
data.againstVL += 1.0;
|
||||
final ViolationData vd = new ViolationData(this, player, data.againstVL, 1, cc.againstActions);
|
||||
vd.setParameter(ParameterName.BLOCK_TYPE, placedMat.toString());
|
||||
vd.setParameter(ParameterName.BLOCK_TYPE, matAgainst == null ? null : matAgainst.toString());
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
else {
|
||||
data.againstVL *= 0.99; // Assume one false positive every 100 blocks.
|
||||
bdata.addPassedCheck(this.type);
|
||||
bIData.addPassedCheck(this.type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,9 @@ public class AutoSign extends Check {
|
||||
s = s.replace("WALL_", "");
|
||||
mat = Material.getMaterial(s);
|
||||
}
|
||||
|
||||
if (s.equals("SIGN_POST")) {
|
||||
mat = Material.getMaterial("SIGN");
|
||||
}
|
||||
if (data.autoSignPlacedHash != BlockPlaceListener.getBlockPlaceHash(block, mat)){
|
||||
tags.add("block_mismatch");
|
||||
return handleViolation(player, maxEditTime, data, cc);
|
||||
|
||||
+17
-3
@@ -50,8 +50,15 @@ public class BlockPlaceConfig extends ACheckConfig {
|
||||
public final ActionList noSwingActions;
|
||||
|
||||
public final ActionList reachActions;
|
||||
|
||||
|
||||
public final ActionList scaffoldActions;
|
||||
public final boolean scaffoldAngle;
|
||||
public final boolean scaffoldTime;
|
||||
public final int scaffoldTimeAvg;
|
||||
public final boolean scaffoldSprint;
|
||||
public final boolean scaffoldRotate;
|
||||
public final int scaffoldRotateDiff;
|
||||
public final boolean scaffoldToolSwitch;
|
||||
|
||||
public final long speedInterval;
|
||||
public final boolean speedImprobableFeedOnly;
|
||||
@@ -90,8 +97,15 @@ public class BlockPlaceConfig extends ACheckConfig {
|
||||
noSwingActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, Permissions.BLOCKPLACE_NOSWING);
|
||||
|
||||
reachActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_REACH_ACTIONS, Permissions.BLOCKPLACE_REACH);
|
||||
|
||||
|
||||
scaffoldActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_SCAFFOLD_ACTIONS, Permissions.BLOCKPLACE_REACH);
|
||||
scaffoldAngle = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_ANGLE);
|
||||
scaffoldTime = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_TIME_ACTIVE);
|
||||
scaffoldTimeAvg = config.getInt(ConfPaths.BLOCKPLACE_SCAFFOLD_TIME_AVG);
|
||||
scaffoldSprint = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_SPRINT);
|
||||
scaffoldRotate = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_ROTATE_ACTIVE);
|
||||
scaffoldRotateDiff = config.getInt(ConfPaths.BLOCKPLACE_SCAFFOLD_ROTATE_DIFFERENCE);
|
||||
scaffoldToolSwitch = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_TOOLSWITCH);
|
||||
|
||||
speedInterval = config.getLong(ConfPaths.BLOCKPLACE_SPEED_INTERVAL);
|
||||
speedImprobableFeedOnly = config.getBoolean(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_FEEDONLY);
|
||||
@@ -108,4 +122,4 @@ public class BlockPlaceConfig extends ACheckConfig {
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -14,6 +14,9 @@
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.blockplace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
|
||||
|
||||
@@ -37,13 +40,22 @@ public class BlockPlaceData extends ACheckData {
|
||||
/** Using Material.SIGN . */
|
||||
public long autoSignPlacedHash = 0;
|
||||
|
||||
// Scaffold data
|
||||
public List<Long> placeTick = new ArrayList<>();
|
||||
public long sneakTime = 0;
|
||||
public long sprintTime = 0;
|
||||
public float lastYaw = 0;
|
||||
public int lastSlot = 0;
|
||||
public long currentTick = 0;
|
||||
public boolean cancelNextPlace = false;
|
||||
|
||||
// Data of the fast place check.
|
||||
public final ActionFrequency fastPlaceBuckets = new ActionFrequency(2, 1000);
|
||||
public int fastPlaceShortTermTick = 0;
|
||||
public int fastPlaceShortTermCount = 0;
|
||||
|
||||
// Data of the no swing check.
|
||||
public boolean noSwingArmSwung = true;
|
||||
public int noSwingCount = 0;
|
||||
|
||||
// Data of the reach check.
|
||||
public double reachDistance;
|
||||
@@ -52,4 +64,4 @@ public class BlockPlaceData extends ACheckData {
|
||||
public boolean speedLastRefused;
|
||||
public long speedLastTime;
|
||||
|
||||
}
|
||||
}
|
||||
+101
-79
@@ -14,9 +14,7 @@
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.blockplace;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -34,20 +32,19 @@ import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckListener;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractData;
|
||||
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;
|
||||
import fr.neatmonster.nocheatplus.checks.combined.Combined;
|
||||
import fr.neatmonster.nocheatplus.checks.combined.CombinedConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
||||
@@ -65,6 +62,9 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
|
||||
import fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Central location to listen to events that are relevant for the block place checks.
|
||||
*
|
||||
@@ -111,10 +111,10 @@ public class BlockPlaceListener extends CheckListener {
|
||||
/** The reach check. */
|
||||
private final Reach reach = addCheck(new Reach());
|
||||
|
||||
/** The scaffold check. */
|
||||
/** The scaffold check. */
|
||||
private final Scaffold Scaffold = addCheck(new Scaffold());
|
||||
|
||||
/** The speed check. */
|
||||
|
||||
/** The speed check. */
|
||||
private final Speed speed = addCheck(new Speed());
|
||||
|
||||
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
|
||||
@@ -126,11 +126,13 @@ public class BlockPlaceListener extends CheckListener {
|
||||
|
||||
private final Class<?> blockMultiPlaceEvent = ReflectionUtil.getClass("org.bukkit.event.block.BlockMultiPlaceEvent");
|
||||
private final boolean hasGetReplacedState = ReflectionUtil.getMethodNoArgs(BlockPlaceEvent.class, "getReplacedState", BlockState.class) != null;
|
||||
public final List<BlockFace> faces;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BlockPlaceListener() {
|
||||
super(CheckType.BLOCKPLACE);
|
||||
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
|
||||
faces = Arrays.asList(new BlockFace[] {BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH});
|
||||
api.register(api.newRegistrationContext()
|
||||
// BlockPlaceConfig
|
||||
.registerConfigWorld(BlockPlaceConfig.class)
|
||||
@@ -162,10 +164,11 @@ public class BlockPlaceListener extends CheckListener {
|
||||
* @param event
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(
|
||||
ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
|
||||
|
||||
final Block block = event.getBlockPlaced();
|
||||
final Block blockAgainst = event.getBlockAgainst();
|
||||
// Skip any null blocks.
|
||||
@@ -185,9 +188,8 @@ public class BlockPlaceListener extends CheckListener {
|
||||
final ItemStack stack = event.getItemInHand();
|
||||
placedMat = BlockProperties.isAir(stack) ? Material.AIR : stack.getType();
|
||||
}
|
||||
else {
|
||||
placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.
|
||||
}
|
||||
else placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.
|
||||
|
||||
boolean cancelled = false;
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(player); // TODO: Use for data + config getting etc.
|
||||
@@ -199,11 +201,14 @@ public class BlockPlaceListener extends CheckListener {
|
||||
final boolean isInteractBlock = !bdata.getLastIsCancelled() && bdata.matchesLastBlock(tick, blockAgainst);
|
||||
int skippedRedundantChecks = 0;
|
||||
final boolean debug = pData.isDebugActive(CheckType.BLOCKPLACE);
|
||||
|
||||
final BlockFace placedFace = event.getBlock().getFace(blockAgainst);
|
||||
final Block blockPlaced = event.getBlockPlaced();
|
||||
final double distance = player.getLocation().distance(blockPlaced.getLocation());
|
||||
boolean shouldCheck;
|
||||
final boolean shouldSkipSome;
|
||||
|
||||
if (blockMultiPlaceEvent != null && event.getClass() == blockMultiPlaceEvent) {
|
||||
if (placedMat == Material.BEDROCK
|
||||
|| Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {
|
||||
if (placedMat == Material.BEDROCK || Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {
|
||||
shouldSkipSome = true;
|
||||
}
|
||||
else {
|
||||
@@ -212,9 +217,9 @@ public class BlockPlaceListener extends CheckListener {
|
||||
}
|
||||
shouldSkipSome = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
shouldSkipSome = false;
|
||||
shouldSkipSome = BlockProperties.isScaffolding(placedMat);
|
||||
}
|
||||
|
||||
if (placedMat.toString().endsWith("SIGN")) {
|
||||
@@ -225,34 +230,55 @@ public class BlockPlaceListener extends CheckListener {
|
||||
}
|
||||
|
||||
// Don't run checks, if a set back is scheduled.
|
||||
if (!cancelled && pData.isPlayerSetBackScheduled()) {
|
||||
if (pData.isPlayerSetBackScheduled()) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// Fast place check.
|
||||
if (!cancelled && fastPlace.isEnabled(player, pData)) {
|
||||
|
||||
if (fastPlace.check(player, block, tick, data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
else if (cc.fastPlaceImprobableWeight > 0.0f) {
|
||||
if (cc.fastPlaceImprobableFeedOnly) {
|
||||
Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
|
||||
} else if (Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), "blockplace.fastplace", pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (cc.fastPlaceImprobableFeedOnly) {
|
||||
Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
|
||||
}
|
||||
else if (Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), "blockplace.fastplace", pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No swing check (player doesn't swing their arm when placing a lily pad).
|
||||
if (!cancelled && !cc.noSwingExceptions.contains(placedMat)
|
||||
&& noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
|
||||
&& noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
|
||||
// Consider skipping all insta placables or using simplified version (true or true within time frame).
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// Scaffold Check
|
||||
// Null check because I guess it can return null sometimes?
|
||||
if (Scaffold.isEnabled(player, pData) && placedFace != null) {
|
||||
MovingData mData = pData.getGenericInstance(MovingData.class);
|
||||
|
||||
if (faces.contains(placedFace) && player.getLocation().getY() - blockPlaced.getY() < 2D
|
||||
&& player.getLocation().getY() - blockPlaced.getY() >= 1D
|
||||
&& blockPlaced.getType().isSolid() && distance < 2D) {
|
||||
|
||||
cancelled = data.cancelNextPlace && (Math.abs(data.currentTick - TickTask.getTick()) < 10)
|
||||
|| Scaffold.check(player, placedFace, pData, data, cc, event.isCancelled(),
|
||||
mData.playerMoves.getCurrentMove().yDistance, mData.sfJumpPhase);
|
||||
if (!cancelled) data.scaffoldVL *= 0.98;
|
||||
}
|
||||
data.cancelNextPlace = false;
|
||||
}
|
||||
|
||||
final FlyingQueueHandle flyingHandle;
|
||||
final boolean reachCheck = pData.isCheckActive(CheckType.BLOCKPLACE_REACH, player);
|
||||
final boolean directionCheck = pData.isCheckActive(CheckType.BLOCKPLACE_DIRECTION, player);
|
||||
|
||||
if (reachCheck || directionCheck) {
|
||||
flyingHandle = new FlyingQueueHandle(pData);
|
||||
final Location loc = player.getLocation(useLoc);
|
||||
@@ -260,35 +286,34 @@ public class BlockPlaceListener extends CheckListener {
|
||||
// Reach check (distance).
|
||||
if (!cancelled && !shouldSkipSome) {
|
||||
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {
|
||||
skippedRedundantChecks ++;
|
||||
skippedRedundantChecks++;
|
||||
}
|
||||
else if (reachCheck && reach.check(player, eyeHeight, block, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Direction check.
|
||||
if (!cancelled && !shouldSkipSome) {
|
||||
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {
|
||||
skippedRedundantChecks ++;
|
||||
skippedRedundantChecks++;
|
||||
}
|
||||
else if (directionCheck) {
|
||||
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
|
||||
}
|
||||
else if (direction.check(player, loc, eyeHeight, block, flyingHandle, data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
|
||||
// Ignore
|
||||
}
|
||||
else if (direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
useLoc.setWorld(null);
|
||||
}
|
||||
else {
|
||||
flyingHandle = null;
|
||||
}
|
||||
|
||||
// Surrounding material.
|
||||
if (!cancelled && against.isEnabled(player, pData) && against.check(player, block, placedMat, blockAgainst,
|
||||
isInteractBlock, data, cc, pData)) {
|
||||
if (!cancelled && against.isEnabled(player, pData) && !BlockProperties.isScaffolding(placedMat)
|
||||
&& against.check(player, block, placedMat, blockAgainst, isInteractBlock, data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
@@ -296,7 +321,7 @@ public class BlockPlaceListener extends CheckListener {
|
||||
if (cancelled) {
|
||||
event.setCancelled(cancelled);
|
||||
}
|
||||
// Debug check breaks when checking blockAgainst is equal to something, disabled for now
|
||||
// Debug check breaks when checking blockAgainst is equal to something, disabled for now
|
||||
/* else {
|
||||
// Debug log (only if not cancelled, to avoid spam).
|
||||
if (debug) {
|
||||
@@ -331,6 +356,9 @@ public class BlockPlaceListener extends CheckListener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSignChange(final SignChangeEvent event) {
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
|
||||
|
||||
if (event.getClass() != SignChangeEvent.class) {
|
||||
// Built in plugin compatibility.
|
||||
// TODO: Don't understand why two consecutive events editing the same block are a problem.
|
||||
@@ -360,7 +388,8 @@ public class BlockPlaceListener extends CheckListener {
|
||||
priority = EventPriority.MONITOR)
|
||||
public void onPlayerAnimation(final PlayerAnimationEvent event) {
|
||||
// Just set a flag to true when the arm was swung.
|
||||
DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockPlaceData.class).noSwingArmSwung = true;
|
||||
final BlockPlaceData data = DataManager.getGenericInstance(event.getPlayer(), BlockPlaceData.class);
|
||||
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,6 +400,9 @@ public class BlockPlaceListener extends CheckListener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
|
||||
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||
|
||||
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
|
||||
|
||||
if (event.isCancelled()) {
|
||||
// TODO: Might run checks if (event.useInteractedBlock()) ...
|
||||
return;
|
||||
@@ -392,7 +424,7 @@ public class BlockPlaceListener extends CheckListener {
|
||||
if (cc.preventBoatsAnywhere) {
|
||||
// TODO: Alter config (activation, allow on top of ground).
|
||||
// TODO: Version/plugin specific alteration for 'default'.
|
||||
checkBoatsAnywhere(player, event, cc, pData);
|
||||
checkBoatsAnywhere(player, event, pData);
|
||||
}
|
||||
}
|
||||
else if (MaterialUtil.isSpawnEgg(type)) {
|
||||
@@ -403,34 +435,8 @@ public class BlockPlaceListener extends CheckListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens for PlayerInteract events to check for their target block face vs their
|
||||
* attempted block face. This is used for the scaffold check.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void placeBlock(PlayerInteractEvent event) {
|
||||
if (!Scaffold.isEnabled(event.getPlayer())) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block targetBlock = player.getTargetBlock((Set<Material>) null, 7);
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.isBlockInHand() || player.isFlying() && player.getAllowFlight() || targetBlock.isLiquid() || player.isSneaking()) return;
|
||||
|
||||
List<Block> lastTarget = player.getLastTwoTargetBlocks((Set<Material>) null, 7);
|
||||
BlockFace blockFace = event.getBlockFace();
|
||||
|
||||
if (targetBlock.getY() != player.getLocation().subtract(0, 1, 0).getY()) return;
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
|
||||
if (Scaffold.check(player, targetBlock, lastTarget, blockFace, pData, data)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBoatsAnywhere(final Player player, final PlayerInteractEvent event,
|
||||
final BlockPlaceConfig cc, final IPlayerData pData) {
|
||||
private void checkBoatsAnywhere(final Player player, final PlayerInteractEvent event, final IPlayerData pData) {
|
||||
// Check boats-anywhere.
|
||||
final Block block = event.getClickedBlock();
|
||||
final Material mat = block.getType();
|
||||
@@ -476,6 +482,8 @@ public class BlockPlaceListener extends CheckListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DataManager.getPlayerData(player).isCheckActive(CheckType.BLOCKPLACE, player)) return;
|
||||
|
||||
if (MovingUtil.hasScheduledPlayerSetBack(player)) {
|
||||
// TODO: Should log.
|
||||
event.setCancelled(true);
|
||||
@@ -486,15 +494,10 @@ public class BlockPlaceListener extends CheckListener {
|
||||
EntityType type = event.getEntityType();
|
||||
switch (type) {
|
||||
case ENDER_PEARL:
|
||||
break;
|
||||
case ENDER_SIGNAL:
|
||||
break;
|
||||
case EGG:
|
||||
break;
|
||||
case SNOWBALL:
|
||||
break;
|
||||
case THROWN_EXP_BOTTLE:
|
||||
break;
|
||||
case SPLASH_POTION:
|
||||
break;
|
||||
default:
|
||||
@@ -517,11 +520,12 @@ public class BlockPlaceListener extends CheckListener {
|
||||
cancel = true;
|
||||
}
|
||||
else if (cc.speedImprobableWeight > 0.0f) {
|
||||
if (cc.speedImprobableFeedOnly) {
|
||||
Improbable.feed(player, cc.speedImprobableWeight, now);
|
||||
} else if (Improbable.check(player, cc.speedImprobableWeight, now, "blockplace.speed", pData)) {
|
||||
cancel = true;
|
||||
}
|
||||
if (cc.speedImprobableFeedOnly) {
|
||||
Improbable.feed(player, cc.speedImprobableWeight, now);
|
||||
}
|
||||
else if (Improbable.check(player, cc.speedImprobableWeight, now, "blockplace.speed", pData)) {
|
||||
cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,7 +537,7 @@ public class BlockPlaceListener extends CheckListener {
|
||||
}
|
||||
else if (!BlockProperties.isPassable(projectile.getLocation(useLoc))) {
|
||||
// Launch into a block.
|
||||
// TODO: This might be a general check later.
|
||||
// TODO: This might be a general check later.
|
||||
cancel = true;
|
||||
}
|
||||
else {
|
||||
@@ -568,4 +572,22 @@ public class BlockPlaceListener extends CheckListener {
|
||||
// Cleanup.
|
||||
useLoc.setWorld(null);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove this
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.BLOCKPLACE, player)) return;
|
||||
|
||||
if (player.isSprinting()) {
|
||||
data.sprintTime = TickTask.getTick();
|
||||
} else if (player.isSneaking()) {
|
||||
data.sneakTime = TickTask.getTick();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,13 +45,12 @@ public class NoSwing extends Check {
|
||||
boolean cancel = false;
|
||||
|
||||
// Did they swing their arm before?
|
||||
if (data.noSwingArmSwung) {
|
||||
// "Consume" the flag.
|
||||
data.noSwingArmSwung = false;
|
||||
if (++data.noSwingCount <= 1) {
|
||||
// Reward with lowering of the violation level.
|
||||
data.noSwingVL *= 0.9D;
|
||||
} else {
|
||||
// They failed, increase violation level.
|
||||
data.noSwingCount = 0;
|
||||
data.noSwingVL += 1D;
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
|
||||
@@ -1,34 +1,194 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.blockplace;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import fr.neatmonster.nocheatplus.components.registry.feature.TickListener;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
|
||||
/**
|
||||
* Check for common behavior from a client using the "Scaffold" cheat.
|
||||
* Each sub-check should cover areas that one sub-check may not cover.
|
||||
* If the cheat does not flag any other sub-checks, the time sub-check
|
||||
* Should enforce realistic time between block placements.
|
||||
*/
|
||||
public class Scaffold extends Check {
|
||||
|
||||
public Scaffold() {
|
||||
|
||||
final static double MAX_ANGLE = Math.toRadians(90);
|
||||
public List<String> tags = new LinkedList<>();
|
||||
|
||||
/*
|
||||
* Instanties a new Scaffold check
|
||||
*
|
||||
*/
|
||||
public Scaffold() {
|
||||
super(CheckType.BLOCKPLACE_SCAFFOLD);
|
||||
}
|
||||
|
||||
public boolean check(Player player, Block targetBlock, List<Block> lastTarget, BlockFace blockFace, final IPlayerData pData, final BlockPlaceData data) {
|
||||
BlockFace face = null;
|
||||
boolean cancel = false;
|
||||
|
||||
if (lastTarget.size() > 1) {
|
||||
face = lastTarget.get(1).getFace(lastTarget.get(0));
|
||||
}
|
||||
/**
|
||||
* Check the player for Scaffold cheats
|
||||
*
|
||||
* @param player the player
|
||||
* @param placedFace blockface player placed against
|
||||
* @param pData player data
|
||||
* @param data block place data
|
||||
* @param cc block place config
|
||||
* @param isCancelled is the event cancelled
|
||||
* @param yDistance players current yDistance for this move
|
||||
* @param jumpPhase players jump phase
|
||||
* @return
|
||||
*/
|
||||
public boolean check(final Player player, final BlockFace placedFace, final IPlayerData pData,
|
||||
final BlockPlaceData data, final BlockPlaceConfig cc, final boolean isCancelled,
|
||||
final double yDistance, final int jumpPhase) {
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
if (blockFace != face) {
|
||||
cancel = executeActions(player, data.scaffoldVL, 1D, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions).willCancel();
|
||||
data.scaffoldVL += 1D;
|
||||
}
|
||||
return cancel;
|
||||
}
|
||||
// Update sneakTime since the player may have unsneaked after the last move.
|
||||
if (player.isSneaking()) {
|
||||
data.sneakTime = data.currentTick;
|
||||
}
|
||||
|
||||
data.currentTick = TickTask.getTick();
|
||||
|
||||
// Angle Check - Check if the player is looking at the block (Should already be covered by BlockInteract.Direction)
|
||||
if (cc.scaffoldAngle) {
|
||||
final Vector placedVector = new Vector(placedFace.getModX(), placedFace.getModY(), placedFace.getModZ());
|
||||
float placedAngle = player.getLocation().getDirection().angle(placedVector);
|
||||
|
||||
if (placedAngle > MAX_ANGLE) cancel = violation("Angle", Math.min(Math.max(1, (int) (placedAngle - MAX_ANGLE) * 10), 10), player, data, pData);
|
||||
}
|
||||
|
||||
// Time Check - A FastPlace check but for Scaffold type block placements. If all other sub-checks fail to detect the cheat this
|
||||
// Should ensure the player cannot quickly place blocks below themselves.
|
||||
if (cc.scaffoldTime && !isCancelled && Math.abs(player.getLocation().getPitch()) > 70
|
||||
&& (data.currentTick - data.sneakTime) > 3
|
||||
&& !player.hasPotionEffect(PotionEffectType.SPEED)
|
||||
) {
|
||||
|
||||
data.placeTick.add(data.currentTick);
|
||||
if (data.placeTick.size() > 2) {
|
||||
long sum = 0;
|
||||
long lastTick = 0;
|
||||
for (int i = 0; i < data.placeTick.size(); i++) {
|
||||
long tick = data.placeTick.get(i);
|
||||
|
||||
if (lastTick != 0) {
|
||||
sum += (tick - lastTick);
|
||||
}
|
||||
lastTick = tick;
|
||||
|
||||
}
|
||||
|
||||
double avg = sum / data.placeTick.size();
|
||||
if (avg < cc.scaffoldTimeAvg) {
|
||||
cancel = violation("Time", Math.min((cc.scaffoldTimeAvg - (int) avg), 5), player, data, pData);
|
||||
if (data.placeTick.size() > 20) data.placeTick.clear(); // Clear if it gets too big to prevent players being unable to place blocks
|
||||
}
|
||||
else {
|
||||
data.placeTick.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sprint check - Prevent players from sprinting while placing blocks below them
|
||||
long diff = data.currentTick - data.sprintTime;
|
||||
if (cc.scaffoldSprint && Math.abs(player.getLocation().getPitch()) > 70
|
||||
&& diff < 8 && yDistance < 0.1 && jumpPhase < 4) {
|
||||
|
||||
cancel = violation("Sprint", 1, player, data, pData);
|
||||
}
|
||||
|
||||
// Rotate Check - Check for large changes in rotation between block placements
|
||||
if (cc.scaffoldRotate) {
|
||||
data.lastYaw = player.getLocation().getYaw();
|
||||
TickListener pitchTick = new TickListener() {
|
||||
@Override
|
||||
public void onTick(int tick, long timeLast) {
|
||||
// Needs to be run on the next tick
|
||||
// Most likely better way to to this with TickTask but this works as well
|
||||
if (TickTask.getTick() != data.currentTick) {
|
||||
float diff = Math.abs(data.lastYaw - player.getLocation().getYaw());
|
||||
|
||||
if (diff > cc.scaffoldRotateDiff) {
|
||||
data.cancelNextPlace = violation("Rotate", Math.min((int) (diff - cc.scaffoldRotateDiff) / 10, 5), player, data, pData);
|
||||
tags.clear();
|
||||
}
|
||||
TickTask.removeTickListener(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
TickTask.addTickListener(pitchTick);
|
||||
}
|
||||
|
||||
// Tool Switch - Check if the player is quickly switching inventory slots between block placements
|
||||
if (cc.scaffoldToolSwitch) {
|
||||
|
||||
data.lastSlot = player.getInventory().getHeldItemSlot();
|
||||
TickListener toolSwitchTick = new TickListener() {
|
||||
@Override
|
||||
public void onTick(int tick, long timeLast) {
|
||||
// Needs to be run on the next tick
|
||||
// Most likely better way to to this with TickTask but this works as well
|
||||
if (data.currentTick != TickTask.getTick()) {
|
||||
if (data.lastSlot != player.getInventory().getHeldItemSlot()) {
|
||||
data.cancelNextPlace = violation("ToolSwitch", 1, player, data, pData);
|
||||
tags.clear();
|
||||
}
|
||||
TickTask.removeTickListener(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
TickTask.addTickListener(toolSwitchTick);
|
||||
}
|
||||
|
||||
tags.clear();
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a violation for Scaffold
|
||||
*
|
||||
* @param addTags
|
||||
* @param weight
|
||||
* @param player
|
||||
* @param data
|
||||
* @param pData
|
||||
* @return
|
||||
*/
|
||||
public boolean violation(final String addTags, final int weight, final Player player,
|
||||
final BlockPlaceData data, final IPlayerData pData) {
|
||||
|
||||
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, weight, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
|
||||
tags.add(addTags);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
data.scaffoldVL += weight;
|
||||
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,8 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
|
||||
final Player player = event.getPlayer();
|
||||
final boolean alreadyCancelled = event.isCancelled();
|
||||
|
||||
if (!DataManager.getPlayerData(player).isCheckActive(CheckType.CHAT, player)) return;
|
||||
|
||||
// Tell TickTask to update cached permissions.
|
||||
// (Might omit this if already cancelled.)
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
@@ -276,6 +278,9 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
|
||||
if (event.getResult() != Result.ALLOWED) return;
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.CHAT, player)) return;
|
||||
|
||||
final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);
|
||||
final ChatData data = pData.getGenericInstance(ChatData.class);
|
||||
|
||||
|
||||
@@ -100,6 +100,9 @@ public class CombinedListener extends CheckListener {
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.COMBINED, player)) return;
|
||||
|
||||
final CombinedData data = pData.getGenericInstance(CombinedData.class);
|
||||
final CombinedConfig cc = pData.getGenericInstance(CombinedConfig.class);
|
||||
|
||||
@@ -124,6 +127,9 @@ public class CombinedListener extends CheckListener {
|
||||
if (!(entity instanceof Player)) return;
|
||||
final Player player = (Player) entity;
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
|
||||
if (!pData.isCheckActive(CheckType.COMBINED, player)) return;
|
||||
|
||||
final CombinedConfig cc = pData.getGenericInstance(CombinedConfig.class);
|
||||
if (!cc.invulnerableCheck) return;
|
||||
final DamageCause cause = event.getCause();
|
||||
|
||||
@@ -41,8 +41,10 @@ import org.bukkit.ChatColor;
|
||||
* Thanks @asofold for the original idea!
|
||||
*/
|
||||
public class Angle extends Check {
|
||||
|
||||
private final List<String> tags = new LinkedList<String>();
|
||||
|
||||
|
||||
private final List<String> tags = new LinkedList<String>();
|
||||
|
||||
|
||||
public static class AttackLocation {
|
||||
public final double x, y, z;
|
||||
@@ -80,8 +82,10 @@ public class Angle extends Check {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static long maxTimeDiff = 1000L;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new angle check.
|
||||
*/
|
||||
@@ -89,6 +93,7 @@ public class Angle extends Check {
|
||||
super(CheckType.FIGHT_ANGLE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Angle check.
|
||||
* @param player
|
||||
@@ -99,12 +104,10 @@ public class Angle extends Check {
|
||||
* @return
|
||||
*/
|
||||
public boolean check(final Player player, final Location loc,
|
||||
final Entity damagedEntity, final boolean worldChanged,
|
||||
final FightData data, final FightConfig cc, final IPlayerData pData) {
|
||||
final Entity damagedEntity, final boolean worldChanged,
|
||||
final FightData data, final FightConfig cc, final IPlayerData pData) {
|
||||
|
||||
if (worldChanged){
|
||||
data.angleHits.clear();
|
||||
}
|
||||
if (worldChanged) data.angleHits.clear();
|
||||
|
||||
boolean cancel = false;
|
||||
tags.clear();
|
||||
@@ -163,101 +166,86 @@ public class Angle extends Check {
|
||||
|
||||
// Declare the variables.
|
||||
double violation = 0.0;
|
||||
double violationone = 0.0;
|
||||
double violationtwo = 0.0;
|
||||
double violationthree = 0.0;
|
||||
double violationfour = 0.0;
|
||||
double violationMove = 0.0;
|
||||
double violationTime = 0.0;
|
||||
double violationYaw = 0.0;
|
||||
double violationSwitchSpeed = 0.0;
|
||||
|
||||
// If the average move is between 0 and 0.2 block(s), add it to the violation.
|
||||
if (averageMove >= 0.0 && averageMove < 0.2D) {
|
||||
violationone += 20.0 * (0.2 - averageMove) / 0.2;
|
||||
tags.add("Average_move");
|
||||
violationMove += 20.0 * (0.2 - averageMove) / 0.2;
|
||||
tags.add("avgmove");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationone + "/" + cc.angleMove);
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationMove + "/" + cc.angleMove);
|
||||
}
|
||||
}
|
||||
|
||||
// If the average time elapsed is between 0 and 150 millisecond(s), add it to the violation.
|
||||
if (averageTime >= 0.0 && averageTime < 150.0) {
|
||||
violationtwo += 30.0 * (150.0 - averageTime) / 150.0;
|
||||
tags.add("Average_time");
|
||||
violationTime += 30.0 * (150.0 - averageTime) / 150.0;
|
||||
tags.add("avgtime");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationtwo + "/" + cc.angleTime);
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationTime + "/" + cc.angleTime);
|
||||
}
|
||||
}
|
||||
|
||||
// If the average difference of yaw is superior to 50 degrees, add it to the violation.
|
||||
if (averageYaw > 50.0) {
|
||||
violationthree += 30.0 * averageYaw / 180.0;
|
||||
tags.add("Average_yaw");
|
||||
violationYaw += 30.0 * averageYaw / 180.0;
|
||||
tags.add("avgyaw");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationthree + "/" + cc.angleYaw);
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationYaw + "/" + cc.angleYaw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for too quick target switch speed
|
||||
if (averageSwitching > 0.0) {
|
||||
violationfour += 20.0 * averageSwitching;
|
||||
tags.add("SwitchSpeed");
|
||||
violationSwitchSpeed += 20.0 * averageSwitching;
|
||||
tags.add("switchspeed");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationfour + "/" + cc.angleSwitch);
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationSwitchSpeed + "/" + cc.angleSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
// Is the violation is superior to the threshold defined in the configuration?
|
||||
if (violationone > cc.angleMove) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationone;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
|
||||
if (violationMove > cc.angleMove) {
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
violation = violationMove;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
cancel = executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationtwo > cc.angleTime) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationtwo;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
else if (violationTime > cc.angleTime) {
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
violation = violationTime;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
cancel = executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationthree > cc.angleYaw) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationthree;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
else if (violationYaw > cc.angleYaw) {
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
violation = violationYaw;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
cancel = executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationfour > cc.angleSwitch) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationfour;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
else if (violationSwitchSpeed > cc.angleSwitch) {
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
violation = violationSwitchSpeed;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
cancel = executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Reward the player by lowering their violation level.
|
||||
// Reward the player by lowering their violation level.
|
||||
data.angleVL *= 0.98D;
|
||||
}
|
||||
return cancel;
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
package fr.neatmonster.nocheatplus.checks.fight;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
// import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
// import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
|
||||
public class ClickPattern extends Check {
|
||||
|
||||
/**
|
||||
* Instantiates a new click pattern check.
|
||||
*/
|
||||
public ClickPattern() {
|
||||
super(CheckType.FIGHT_CLICKPATTERN);
|
||||
}
|
||||
|
||||
/*public int getPing(Player p) {
|
||||
CraftPlayer cp = (CraftPlayer) p; EntityPlayer ep = cp.getHandle(); return ep.ping;
|
||||
} */
|
||||
|
||||
HashMap<String, Long> clickData = new HashMap<String, Long>();
|
||||
|
||||
// Resets the click times to check for another click difference
|
||||
private void resetClickTime(HashMap<String, Long> clickData) {
|
||||
clickData.put("thisAttackTime", 0L);
|
||||
clickData.put("lastAttackTime", 0L);
|
||||
}
|
||||
|
||||
// Resets all the attack times once the check has been finished
|
||||
private void resetAllTimes(HashMap<String, Long> clickData) {
|
||||
clickData.put("thisAttackTime", 0L);
|
||||
clickData.put("lastAttackTime", 0L);
|
||||
clickData.put("thisClickDifference", 0L);
|
||||
clickData.put("lastClickDifference", 0L);
|
||||
}
|
||||
|
||||
/*
|
||||
* This check compares the players time between each click, and attempts to find a pattern,
|
||||
* Right now, this is bare-bone version, and more testing/fixing needs to be done to improve it.
|
||||
* This can detect AutoClickers or KillAuras that do not allow aps ranges.
|
||||
*
|
||||
*/
|
||||
public boolean check(final Player player, final FightData data, final IPlayerData pData, final FightConfig cc) {
|
||||
|
||||
boolean cancel = false;
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
// Adds the HashMap if it has not already been added
|
||||
if (clickData.isEmpty()) {
|
||||
clickData.putIfAbsent("lastAttackTime", 0L);
|
||||
clickData.putIfAbsent("thisAttackTime", 0L);
|
||||
clickData.putIfAbsent("lastClickDifference", 0L);
|
||||
clickData.putIfAbsent("thisClickDifference", 0L);
|
||||
}
|
||||
|
||||
// Skip the player if they are lagging
|
||||
if (TickTask.getLag(1000, true) > 1.3f) return false;
|
||||
|
||||
// Setting the attack times
|
||||
else if (clickData.get("lastAttackTime").equals(0L)) {
|
||||
clickData.put("lastAttackTime", now);
|
||||
}
|
||||
else if (clickData.get("thisAttackTime").equals(0L)) {
|
||||
clickData.put("thisAttackTime", now);
|
||||
}
|
||||
|
||||
// Calculating the difference
|
||||
if (!clickData.get("lastAttackTime").equals(0L) && !clickData.get("thisAttackTime").equals(0L)) {
|
||||
if (clickData.get("lastClickDifference").equals(0L)) {
|
||||
clickData.put("lastClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
|
||||
resetClickTime(clickData);
|
||||
} else if (clickData.get("thisClickDifference").equals(0L)) {
|
||||
clickData.put("thisClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
|
||||
if (clickData.get("thisClickDifference") == clickData.get("lastClickDifference") || cc.clickRange > Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference"))) {
|
||||
cancel = executeActions(player, data.clickPatternVL, 1D, pData.getGenericInstance(FightConfig.class).clickActions).willCancel();
|
||||
data.clickPatternVL += 1D;
|
||||
} else {
|
||||
data.clickPatternVL *= 0.86D;
|
||||
}
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
|
||||
player.sendMessage(ChatColor.RED + "NCP Debug: " + ChatColor.RESET + "ThisClick Difference: " + clickData.get("thisClickDifference") + " Last Click Differnce: " + clickData.get("lastClickDifference") + ChatColor.RED + " false");
|
||||
}
|
||||
resetAllTimes(clickData);
|
||||
}
|
||||
}
|
||||
if (cancel) {
|
||||
data.clicPatPenalty.applyPenalty(cc.clickPen);
|
||||
}
|
||||
return cancel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to be touched up/fixed later, and the effectiveness of this check needs to be tested.
|
||||
* This part would get the average of their click difference and attempt to find a pattern there.
|
||||
* Could be useful to attempt to eliminate false positives with the click difference check.
|
||||
* Requires Java 8 to calculate the average, but a for method could be used to keep cross compatibility
|
||||
*
|
||||
* if (avgData.size() >= 8) {
|
||||
* player.sendMessage("Calculating avg:");
|
||||
* if (calcAvg(avgData) <= 25) {
|
||||
* player.sendMessage("Avg is " + ChatColor.GREEN + "true " + avgData);
|
||||
* } else {
|
||||
* player.sendMessage("Avg is " + ChatColor.RED + "false " + avgData);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* avgData.add(Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference")));
|
||||
*
|
||||
* private double calcAvg(ArrayList <Long> avgData) {
|
||||
* double avg = avgData.stream().mapToInt(Long::intValue).average().getAsDouble();
|
||||
* int size = avgData.size();
|
||||
* Bukkit.getLogger().info("[NoCheatPlus] avg: " + avg + " size " + size);
|
||||
*
|
||||
* return avg / size;
|
||||
* }
|
||||
*
|
||||
* ArrayList<Long> avgData = new ArrayList<Long>();
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveInfo;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.AuxMoving;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
@@ -42,8 +42,10 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
*/
|
||||
public class Critical extends Check {
|
||||
|
||||
|
||||
private final AuxMoving auxMoving = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(AuxMoving.class);
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new critical check.
|
||||
*/
|
||||
@@ -51,6 +53,7 @@ public class Critical extends Check {
|
||||
super(CheckType.FIGHT_CRITICAL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks a player.
|
||||
*
|
||||
@@ -58,58 +61,108 @@ public class Critical extends Check {
|
||||
* the player
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean check(final Player player, final Location loc,
|
||||
final FightData data, final FightConfig cc,
|
||||
final IPlayerData pData, final IPenaltyList penaltyList) {
|
||||
boolean cancel = false;
|
||||
public boolean check(final Player player, final Location loc, final FightData data, final FightConfig cc,
|
||||
final IPlayerData pData, final IPenaltyList penaltyList) {
|
||||
|
||||
boolean cancel = false;
|
||||
boolean violation = false;
|
||||
final List<String> tags = new ArrayList<String>();
|
||||
final double mcFallDistance = (double) player.getFallDistance();
|
||||
final MovingData mData = pData.getGenericInstance(MovingData.class);
|
||||
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
|
||||
final PlayerMoveData thisMove = mData.playerMoves.getCurrentMove();
|
||||
final double fallDistDiff = Math.abs(mData.noFallFallDistance - mcFallDistance);
|
||||
|
||||
|
||||
// Check if the hit was a critical hit (very small fall-distance, not on ladder,
|
||||
// not in liquid, not in vehicle, and without blindness effect).
|
||||
if (mcFallDistance > 0.0 && !player.isInsideVehicle()
|
||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)) {
|
||||
if (mcFallDistance > 0.0 && !player.isInsideVehicle() && !player.hasPotionEffect(PotionEffectType.BLINDNESS)) {
|
||||
|
||||
if (pData.isDebugActive(type)) {
|
||||
debug(player, "y=" + loc.getY() + " mcfalldist=" + mcFallDistance);
|
||||
debug(player, "y=" + loc.getY() + " mcfalldist=" + mcFallDistance
|
||||
+ " jumpphase: " + mData.sfJumpPhase
|
||||
+ " noFallDist: " + mData.noFallFallDistance + " lowjump: " + mData.sfLowJump
|
||||
+ " toGround: " + thisMove.to.onGround + " fromGround: " + thisMove.from.onGround);
|
||||
}
|
||||
|
||||
|
||||
// Might be a violation.
|
||||
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
|
||||
final MovingData dataM = pData.getGenericInstance(MovingData.class);
|
||||
/*
|
||||
* TODO: NoFall data max y. (past moves too perhaps - low jump,
|
||||
* number split moves without reason)
|
||||
*/
|
||||
// Detect silent jumping (might be redundant with the mismatch check below)
|
||||
if (fallDistDiff > cc.criticalFallDistLeniency
|
||||
&& mcFallDistance <= cc.criticalFallDistance
|
||||
&& mData.sfJumpPhase <= 1
|
||||
&& !BlockProperties.isResetCond(player, loc, mcc.yOnGround)
|
||||
) {
|
||||
tags.add("silent_jump");
|
||||
violation = true;
|
||||
}
|
||||
// Detect lowjumping
|
||||
else if (mData.sfLowJump) {
|
||||
tags.add("low_jump");
|
||||
// False positives with lowJump when the player jumps on/off a block while attacking an entity
|
||||
if (fallDistDiff < cc.criticalFallDistLeniency) {
|
||||
if (mcFallDistance > cc.criticalFallDistance) {
|
||||
if (!thisMove.to.onGround || !thisMove.from.onGround) {
|
||||
violation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!thisMove.to.onGround || !thisMove.from.onGround) {
|
||||
if (fallDistDiff > cc.criticalFallDistLeniency) {
|
||||
violation = false;
|
||||
}
|
||||
}
|
||||
else violation = true;
|
||||
}
|
||||
// As a last resort, ensure that Minecraft's fall distance is on par with our fall distance if the move is fully grounded.
|
||||
else if (mData.noFallFallDistance != mcFallDistance && thisMove.from.onGround && thisMove.to.onGround) {
|
||||
tags.add("falldist_mismatch");
|
||||
violation = true;
|
||||
}
|
||||
|
||||
// Handle violations
|
||||
if (violation) {
|
||||
|
||||
// TODO: Skip near the highest jump height (needs check if head collided with something solid, which also detects low jump).
|
||||
if (!dataM.isVelocityJumpPhase() &&
|
||||
(dataM.sfLowJump && !dataM.sfNoLowJump && dataM.liftOffEnvelope == LiftOffEnvelope.NORMAL
|
||||
|| mcFallDistance < cc.criticalFallDistance && !BlockProperties.isResetCond(player, loc, mcc.yOnGround))) {
|
||||
// TODO: Use past move tracking to check for SurvivalFly and the like?
|
||||
final PlayerMoveInfo moveInfo = auxMoving.usePlayerMoveInfo();
|
||||
moveInfo.set(player, loc, null, mcc.yOnGround);
|
||||
if (MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, dataM, mcc, pData)) {
|
||||
data.criticalVL += 1.0;
|
||||
// Execute whatever actions are associated with this check and
|
||||
// the violation level and find out if we should cancel the event.
|
||||
final ViolationData vd = new ViolationData(this, player, data.criticalVL, 1.0, cc.criticalActions);
|
||||
if (vd.needsParameters()) {
|
||||
final List<String> tags = new ArrayList<String>();
|
||||
if (dataM.sfLowJump) {
|
||||
tags.add("lowjump");
|
||||
}
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
cancel = executeActions(vd).willCancel();
|
||||
// TODO: Introduce penalty instead of cancel.
|
||||
|
||||
// False positives with medium counts reset all nofall data when nearby boat
|
||||
// TODO: Fix isOnGroundDueToStandingOnAnEntity() to work on entity not nearby
|
||||
if (MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, moveInfo.to, mData, mcc, pData) && !moveInfo.from.isOnGroundDueToStandingOnAnEntity()) {
|
||||
moveInfo.from.collectBlockFlags(0.4);
|
||||
|
||||
// TODO: maybe these require a fix/modification with NoFall? For now, exempt the player.
|
||||
// Don't think its possible to fake a crit in these situations either (except for being onGround in a web/water, which is checked for before being exempt) ... or at least from my testing?
|
||||
if (thisMove.from.onClimbable || thisMove.to.onClimbable) {
|
||||
// Ignore climbables
|
||||
}
|
||||
else if ((thisMove.from.inLiquid | thisMove.to.inLiquid) && thisMove.from.onGround && thisMove.to.onGround) {
|
||||
// Ignore liquids
|
||||
}
|
||||
else if ((thisMove.from.inWeb | thisMove.to.inWeb) & !thisMove.to.onGround) {
|
||||
// Ignore webs
|
||||
}
|
||||
else if ((moveInfo.from.getBlockFlags() & BlockProperties.F_BOUNCE25) != 0 && !thisMove.from.onGround && !thisMove.to.onGround) {
|
||||
// Slime blocks
|
||||
}
|
||||
else {
|
||||
|
||||
data.criticalVL += 1.0;
|
||||
// Execute whatever actions are associated with this check and
|
||||
// the violation level and find out if we should cancel the event.
|
||||
final ViolationData vd = new ViolationData(this, player, data.criticalVL, 1.0, cc.criticalActions);
|
||||
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
cancel = executeActions(vd).willCancel();
|
||||
// TODO: Introduce penalty instead of cancel.
|
||||
}
|
||||
auxMoving.returnPlayerMoveInfo(moveInfo);
|
||||
}
|
||||
auxMoving.returnPlayerMoveInfo(moveInfo);
|
||||
}
|
||||
|
||||
if (!cancel) {
|
||||
data.criticalVL *= 0.96D;
|
||||
}
|
||||
}
|
||||
|
||||
return cancel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public class Direction extends Check {
|
||||
|
||||
// entity.height is broken and will always be 0, therefore. Calculate height instead based on boundingBox.
|
||||
final double height = damagedIsFake ? (damaged instanceof LivingEntity ? ((LivingEntity) damaged).getEyeHeight() : 1.75) : mcAccess.getHeight(damaged);
|
||||
|
||||
final boolean isPlayer = damaged instanceof Player ? true : false;
|
||||
|
||||
// TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
|
||||
|
||||
@@ -74,13 +76,14 @@ public class Direction extends Check {
|
||||
final Vector direction = loc.getDirection();
|
||||
|
||||
final double off;
|
||||
if (cc.directionStrict){
|
||||
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION, 80.0);
|
||||
off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
|
||||
/*if (cc.directionStrict){
|
||||
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION, 80.0, isPlayer);
|
||||
}
|
||||
else{
|
||||
// Also take into account the angle.
|
||||
off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
|
||||
}
|
||||
} */
|
||||
|
||||
if (off > 0.1) {
|
||||
// Player failed the check. Let's try to guess how far they were from looking directly to the entity...
|
||||
@@ -156,6 +159,7 @@ public class Direction extends Check {
|
||||
return false;
|
||||
}
|
||||
boolean cancel = false;
|
||||
boolean isPlayer = damaged instanceof Player ? true : false;
|
||||
|
||||
// TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
|
||||
|
||||
@@ -165,7 +169,7 @@ public class Direction extends Check {
|
||||
final double damagedBoxMarginVertical = dLoc.getBoxMarginVertical();
|
||||
final double off;
|
||||
if (cc.directionStrict){
|
||||
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), context.direction, dLoc.getX(), dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, TrigUtil.DIRECTION_LOOP_PRECISION, 80.0);
|
||||
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), context.direction, dLoc.getX(), dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, cc.directionloopprecision, cc.directionangleprecision, isPlayer);
|
||||
}
|
||||
else{
|
||||
// Also take into account the angle.
|
||||
@@ -173,7 +177,7 @@ public class Direction extends Check {
|
||||
context.direction, dLoc.getX(),
|
||||
dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(),
|
||||
damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical,
|
||||
TrigUtil.DIRECTION_LOOP_PRECISION);
|
||||
cc.directionloopprecision);
|
||||
}
|
||||
|
||||
if (off > 0.0) {
|
||||
@@ -191,7 +195,7 @@ public class Direction extends Check {
|
||||
}
|
||||
context.minResult = Math.min(context.minResult, off);
|
||||
}
|
||||
}
|
||||
} else if (cc.directionFailAll) context.minResult = 0.0;
|
||||
|
||||
return cancel;
|
||||
}
|
||||
@@ -234,4 +238,4 @@ public class Direction extends Check {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.fight;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.actions.ActionList;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.access.ACheckConfig;
|
||||
@@ -37,17 +38,17 @@ public class FightConfig extends ACheckConfig {
|
||||
public final double angleSwitch;
|
||||
public final double angleTime;
|
||||
public final ActionList angleActions;
|
||||
|
||||
public final int clickRange;
|
||||
public long clickPen;
|
||||
public final ActionList clickActions;
|
||||
|
||||
public final long toolChangeAttackPenalty;
|
||||
|
||||
public final double criticalFallDistance;
|
||||
public final double criticalFallDistLeniency;
|
||||
public final ActionList criticalActions;
|
||||
|
||||
public final boolean directionStrict;
|
||||
public final boolean directionStrict;
|
||||
public final boolean directionFailAll;
|
||||
public final double directionloopprecision;
|
||||
public final double directionangleprecision;
|
||||
public final long directionPenalty;
|
||||
public final ActionList directionActions;
|
||||
|
||||
@@ -85,14 +86,17 @@ public class FightConfig extends ACheckConfig {
|
||||
public final float speedImprobableWeight;
|
||||
public final ActionList speedActions;
|
||||
|
||||
public final ActionList wrongTurnActions;
|
||||
public final ActionList visibleActions;
|
||||
|
||||
public final double hitBoxHorizontalExpansion;
|
||||
public final double hitBoxVerticalExpansion;
|
||||
|
||||
// Special flags:
|
||||
public final boolean cancelDead;
|
||||
public final boolean knockBackVelocityPvP;
|
||||
|
||||
/** Maximum latency counted in ticks for the loop checks (reach, direction). */
|
||||
public final long loopMaxLatencyTicks = 15; // TODO: Configurable, sections for players and entities.
|
||||
/** Maximum latency counted in ms for the loop checks (reach, direction). */
|
||||
public final int loopMaxLatencyMs; // TODO: Configurable, sections for players and entities.
|
||||
|
||||
/**
|
||||
* Instantiates a new fight configuration.
|
||||
@@ -108,24 +112,35 @@ public class FightConfig extends ACheckConfig {
|
||||
angleYaw = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW);
|
||||
angleTime = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_TIME);
|
||||
angleActions = config.getOptimizedActionList(ConfPaths.FIGHT_ANGLE_ACTIONS, Permissions.FIGHT_ANGLE);
|
||||
|
||||
clickRange = config.getInt(ConfPaths.FIGHT_CLICKPATTERN_RANGE);
|
||||
clickPen = config.getLong(ConfPaths.FIGHT_CLICKPATTERN_PENALTY);
|
||||
clickActions = config.getOptimizedActionList(ConfPaths.FIGHT_CLICKPATTERN_ACTIONS, Permissions.FIGHT_SPEED);
|
||||
|
||||
toolChangeAttackPenalty = config.getLong(ConfPaths.FIGHT_TOOLCHANGEPENALTY);
|
||||
|
||||
criticalFallDistance = config.getDouble(ConfPaths.FIGHT_CRITICAL_FALLDISTANCE);
|
||||
criticalFallDistLeniency = config.getDouble(ConfPaths.FIGHT_CRITICAL_FALLDISTLENIENCY);
|
||||
criticalActions = config.getOptimizedActionList(ConfPaths.FIGHT_CRITICAL_ACTIONS, Permissions.FIGHT_CRITICAL);
|
||||
|
||||
directionStrict = config.getBoolean(ConfPaths.FIGHT_DIRECTION_STRICT);
|
||||
directionFailAll = config.getBoolean(ConfPaths.FIGHT_DIRECTION_FAILALL);
|
||||
directionangleprecision = config.getDouble(ConfPaths.FIGHT_DIRECTION_STRICTANGLEPRECISION, 50.0, 100.0, 80.0);
|
||||
directionloopprecision = config.getDouble(ConfPaths.FIGHT_DIRECTION_LOOPPRECISION, 0.0, 2.0, 0.5);
|
||||
directionPenalty = config.getLong(ConfPaths.FIGHT_DIRECTION_PENALTY);
|
||||
directionActions = config.getOptimizedActionList(ConfPaths.FIGHT_DIRECTION_ACTIONS, Permissions.FIGHT_DIRECTION);
|
||||
|
||||
if (ServerVersion.compareMinecraftVersion("1.9") >= 0) {
|
||||
worldData.overrideCheckActivation(CheckType.FIGHT_FASTHEAL,
|
||||
AlmostBoolean.NO, OverrideType.PERMANENT,
|
||||
true);
|
||||
/** Note: Disable check should use
|
||||
* NCPAPIProvider#getNoCheatPlusAPI()#getWorldDataManager()#overrideCheckActivation()
|
||||
* to actually disable from all worlds.
|
||||
* Using worldData from config will only affect
|
||||
* on world they are staying on join; And on other worlds still remain unchanged.
|
||||
*/
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation(
|
||||
CheckType.FIGHT_FASTHEAL, AlmostBoolean.NO,
|
||||
OverrideType.PERMANENT, true);
|
||||
}
|
||||
if (ServerVersion.compareMinecraftVersion("1.8") >= 0) {
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation(
|
||||
CheckType.FIGHT_SELFHIT, AlmostBoolean.NO,
|
||||
OverrideType.PERMANENT, true);
|
||||
}
|
||||
fastHealInterval = config.getLong(ConfPaths.FIGHT_FASTHEAL_INTERVAL);
|
||||
fastHealBuffer = config.getLong(ConfPaths.FIGHT_FASTHEAL_BUFFER);
|
||||
@@ -137,7 +152,10 @@ public class FightConfig extends ACheckConfig {
|
||||
|
||||
noSwingActions = config.getOptimizedActionList(ConfPaths.FIGHT_NOSWING_ACTIONS, Permissions.FIGHT_NOSWING);
|
||||
|
||||
reachSurvivalDistance = config.getDouble(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 3.5, 6.0, 4.4);
|
||||
hitBoxHorizontalExpansion = config.getDouble(ConfPaths.FIGHT_HITBOX_HORIZONTAL_EXPAND, 0.125);
|
||||
hitBoxVerticalExpansion = config.getDouble(ConfPaths.FIGHT_HITBOX_VERTICAL_EXPAND, 0.125);
|
||||
|
||||
reachSurvivalDistance = config.getDouble(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 3.0, 6.0, 4.4);
|
||||
reachPenalty = config.getLong(ConfPaths.FIGHT_REACH_PENALTY);
|
||||
reachPrecision = config.getBoolean(ConfPaths.FIGHT_REACH_PRECISION);
|
||||
reachReduce = config.getBoolean(ConfPaths.FIGHT_REACH_REDUCE);
|
||||
@@ -159,11 +177,10 @@ public class FightConfig extends ACheckConfig {
|
||||
speedImprobableWeight = (float) config.getDouble(ConfPaths.FIGHT_SPEED_IMPROBABLE_WEIGHT);
|
||||
speedActions = config.getOptimizedActionList(ConfPaths.FIGHT_SPEED_ACTIONS, Permissions.FIGHT_SPEED);
|
||||
|
||||
wrongTurnActions = config.getOptimizedActionList(ConfPaths.FIGHT_WRONGTURN_ACTIONS,
|
||||
CheckType.FIGHT_WRONGTURN.getPermission());
|
||||
|
||||
visibleActions = config.getOptimizedActionList(ConfPaths.FIGHT_VISIBLE_ACTIONS, Permissions.FIGHT_VISIBLE);
|
||||
|
||||
cancelDead = config.getBoolean(ConfPaths.FIGHT_CANCELDEAD);
|
||||
loopMaxLatencyMs = config.getInt(ConfPaths.FIGHT_MAXLOOPLETENCYMS, 500);
|
||||
AlmostBoolean ref = config.getAlmostBoolean(ConfPaths.FIGHT_PVP_KNOCKBACKVELOCITY, AlmostBoolean.MAYBE);
|
||||
knockBackVelocityPvP = ref == AlmostBoolean.MAYBE ? Bugs.shouldPvpKnockBackVelocity() : ref.decide();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
|
||||
// Violation levels.
|
||||
public double angleVL;
|
||||
public double clickPatternVL;
|
||||
public double criticalVL;
|
||||
public double directionVL;
|
||||
public double fastHealVL;
|
||||
@@ -43,7 +42,7 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
public double noSwingVL;
|
||||
public double reachVL;
|
||||
public double speedVL;
|
||||
public double wrongTurnVL;
|
||||
public double visibleVL;
|
||||
|
||||
// Shared
|
||||
public String lastWorld = "";
|
||||
@@ -95,8 +94,8 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
public int godModeAcc = 0;
|
||||
|
||||
// Data of the no swing check.
|
||||
public boolean noSwingArmSwung = true; // TODO: First is free for now, 1.12.2, other?
|
||||
public boolean exemptArmSwing = true;
|
||||
public int noSwingCount = 0;
|
||||
public boolean exemptArmSwing = false;
|
||||
|
||||
// Data of the reach check.
|
||||
public double reachMod = 1.0;
|
||||
@@ -129,6 +128,14 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
for (final CheckType checkType : checkTypes) {
|
||||
switch(checkType) {
|
||||
// TODO: case FIGHT: ...
|
||||
case FIGHT_HITBOX:
|
||||
directionVL = 0;
|
||||
visibleVL = 0;
|
||||
reachVL = 0;
|
||||
break;
|
||||
case FIGHT_VISIBLE:
|
||||
visibleVL = 0;
|
||||
break;
|
||||
case FIGHT_DIRECTION:
|
||||
directionVL = 0;
|
||||
break;
|
||||
@@ -140,8 +147,6 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
angleVL = 0;
|
||||
angleHits.clear();
|
||||
break;
|
||||
case FIGHT_CLICKPATTERN:
|
||||
clickPatternVL = 0;
|
||||
case FIGHT_SPEED:
|
||||
speedVL = 0;
|
||||
speedBuckets.clear(System.currentTimeMillis());
|
||||
|
||||
+161
-117
@@ -19,7 +19,6 @@ import java.util.Iterator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -52,8 +51,6 @@ import fr.neatmonster.nocheatplus.checks.moving.player.UnusedVelocity;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.AuxMoving;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.velocity.VelocityFlags;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
|
||||
@@ -91,8 +88,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
|
||||
/** The critical check. */
|
||||
private final Critical critical = addCheck(new Critical());
|
||||
|
||||
private final ClickPattern clickpat = addCheck(new ClickPattern());
|
||||
|
||||
/** The direction check. */
|
||||
private final Direction direction = addCheck(new Direction());
|
||||
@@ -103,10 +98,11 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
/** The god mode check. */
|
||||
private final GodMode godMode = addCheck(new GodMode());
|
||||
|
||||
/** THe hit box check. */
|
||||
private final HitBox hitBox = addCheck(new HitBox());
|
||||
|
||||
/** The no swing check. */
|
||||
private final NoSwing noSwing = addCheck(new NoSwing());
|
||||
|
||||
private final FightSync FightSync = addCheck(new FightSync());
|
||||
|
||||
/** The reach check. */
|
||||
private final Reach reach = addCheck(new Reach());
|
||||
@@ -117,8 +113,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
/** The speed check. */
|
||||
private final Speed speed = addCheck(new Speed());
|
||||
|
||||
/** WrongTurn: clearly invalid data on Bukkit side. */
|
||||
private final WrongTurn wrongTurn = addCheck(new WrongTurn());
|
||||
/** The visible check. */
|
||||
private final Visible visible = addCheck(new Visible());
|
||||
|
||||
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
|
||||
private final Location useLoc1 = new Location(null, 0, 0, 0);
|
||||
@@ -184,6 +180,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
final IPenaltyList penaltyList) {
|
||||
|
||||
final FightConfig cc = pData.getGenericInstance(FightConfig.class);
|
||||
final MovingConfig mCc = pData.getGenericInstance(MovingConfig.class);
|
||||
final MovingData mData = pData.getGenericInstance(MovingData.class);
|
||||
|
||||
// Hotfix attempt for enchanted books.
|
||||
// TODO: maybe a generalized version for the future...
|
||||
@@ -254,12 +252,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
// Get+update the damaged players.
|
||||
// TODO: Problem with NPCs: data stays (not a big problem).
|
||||
// (This is done even if the event has already been cancelled, to keep track, if the player is on a horse.)
|
||||
damagedTrace = DataManager.getPlayerData(damagedPlayer).getGenericInstance(
|
||||
MovingData.class
|
||||
).updateTrace(
|
||||
damagedPlayer, damagedLoc, tick,
|
||||
damagedIsFake ? null : mcAccess.getHandle()
|
||||
);
|
||||
damagedTrace = DataManager.getPlayerData(damagedPlayer).getGenericInstance(MovingData.class)
|
||||
.updateTrace(damagedPlayer, damagedLoc, now, damagedIsFake ? null : mcAccess.getHandle()); //.getTrace(damagedPlayer);
|
||||
}
|
||||
else {
|
||||
damagedPlayer = null; // TODO: This is a temporary workaround.
|
||||
@@ -320,18 +314,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
data.thornsId = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
// TODO: Add as real check.
|
||||
// TODO: Add something on packet level already.
|
||||
if (pData.isCheckActive(CheckType.FIGHT_WRONGTURN, player)
|
||||
&& wrongTurn.check(player, loc, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// ClickPatern check
|
||||
if (clickpat.check(player, data, pData, cc) && clickpat.isEnabled(player, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// Run through the main checks.
|
||||
if (!cancelled && speed.isEnabled(player, pData)) {
|
||||
if (speed.check(player, now, data, cc, pData)) {
|
||||
@@ -348,20 +330,20 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
else {
|
||||
if (cc.speedImprobableWeight > 0.0f) {
|
||||
Improbable.feed(player, cc.speedImprobableWeight, now);
|
||||
}
|
||||
}
|
||||
// Improbable.feed(player, 2f, now);
|
||||
}
|
||||
// Improbable.feed(player, 2f, now);
|
||||
}
|
||||
}
|
||||
else if (normalizedMove > 2.0) { // && Improbable.check(player, 1f, now, "fight.speed", pData)) {
|
||||
if (cc.speedImprobableWeight > 0.0f) {
|
||||
if (!cc.speedImprobableFeedOnly && Improbable.check(player, cc.speedImprobableWeight, now, "fight.speed", pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
else if (normalizedMove > 2.0) { // && Improbable.check(player, 1f, now, "fight.speed", pData)) {
|
||||
if (cc.speedImprobableWeight > 0.0f) {
|
||||
if (!cc.speedImprobableFeedOnly && Improbable.check(player, cc.speedImprobableWeight, now, "fight.speed", pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
// Feed improbable in case of ok-moves too.
|
||||
// TODO: consider only feeding if attacking with higher average speed (!)
|
||||
}
|
||||
}
|
||||
// TODO: Consider to always check improbable (first?). At least if config.always or speed or net.attackfrequency are enabled.
|
||||
|
||||
if (!cancelled && critical.isEnabled(player, pData)
|
||||
@@ -370,35 +352,47 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (!cancelled && noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
|
||||
if (!cancelled && mData.timeRiptiding + 3000 < now && noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (!cancelled && player.isBlocking()
|
||||
&& !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_BLOCKING, player)) {
|
||||
// TODO: Permission ?
|
||||
cancelled = true;
|
||||
if (mCc.survivalFlyResetItem && mcAccess.getHandle().resetActiveItem(player)) {
|
||||
|
||||
}
|
||||
else cancelled = true;
|
||||
}
|
||||
|
||||
if (!cancelled) {
|
||||
final boolean reachEnabled = reach.isEnabled(player, pData);
|
||||
final boolean directionEnabled = direction.isEnabled(player, pData);
|
||||
if (reachEnabled || directionEnabled) {
|
||||
final boolean directionEnabled = direction.isEnabled(player, pData) && mData.timeRiptiding + 3000 < now;
|
||||
final boolean visibleEnabled = visible.isEnabled(player, pData);
|
||||
final boolean hitboxEnabled = hitBox.isEnabled(player, pData);
|
||||
if (reachEnabled || directionEnabled || visibleEnabled) {
|
||||
if (damagedTrace != null) {
|
||||
// Checks that use the LocationTrace instance of the attacked entity/player.
|
||||
cancelled = locationTraceChecks(player, loc, data, cc, pData,
|
||||
damaged, damagedIsFake, damagedLoc, damagedTrace, tick, now, debug,
|
||||
reachEnabled, directionEnabled);
|
||||
reachEnabled, directionEnabled, visibleEnabled, hitboxEnabled);
|
||||
}
|
||||
else {
|
||||
// Still use the classic methods for non-players. maybe[]
|
||||
if (reachEnabled && reach.check(player, loc, damaged, damagedIsFake, damagedLoc,
|
||||
data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
if (directionEnabled && hitboxEnabled) {
|
||||
if (hitBox.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc, pData,
|
||||
reachEnabled, visibleEnabled)) {
|
||||
cancelled = true;
|
||||
}
|
||||
} else {
|
||||
if (reachEnabled && reach.check(player, loc, damaged, damagedIsFake, damagedLoc,
|
||||
data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (directionEnabled && direction.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc)) {
|
||||
cancelled = true;
|
||||
if (directionEnabled && direction.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,18 +434,16 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
// TODO: Confine further with simple pre-conditions.
|
||||
// TODO: Evaluate if moving traces can help here.
|
||||
if (!cancelled && TrigUtil.distance(loc.getX(), loc.getZ(), damagedLoc.getX(), damagedLoc.getZ()) < 4.5) {
|
||||
final MovingData mData = pData.getGenericInstance(MovingData.class);
|
||||
// Check if fly checks is an issue at all, re-check "real sprinting".
|
||||
final PlayerMoveData lastMove = mData.playerMoves.getFirstPastMove();
|
||||
if (lastMove.valid && mData.liftOffEnvelope == LiftOffEnvelope.NORMAL) {
|
||||
final double hDist = TrigUtil.xzDistance(loc, lastMove.from);
|
||||
if (hDist >= 0.23) {
|
||||
// TODO: Might need to check hDist relative to speed / modifiers.
|
||||
final MovingConfig mCc = pData.getGenericInstance(MovingConfig.class);
|
||||
final PlayerMoveInfo moveInfo = auxMoving.usePlayerMoveInfo();
|
||||
moveInfo.set(player, loc, null, mCc.yOnGround);
|
||||
if (now <= mData.timeSprinting + mCc.sprintingGrace
|
||||
&& MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, mData, mCc, pData)) {
|
||||
&& MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, moveInfo.to, mData, mCc, pData)) {
|
||||
// Judge as "lost sprint" problem.
|
||||
// TODO: What would mData.lostSprintCount > 0 mean here?
|
||||
mData.lostSprintCount = 7;
|
||||
@@ -494,6 +486,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
* @param tick
|
||||
* @param reachEnabled
|
||||
* @param directionEnabled
|
||||
* @param hitboxEnabled
|
||||
* @param visibleEnabled
|
||||
* @return If to cancel (true) or not (false).
|
||||
*/
|
||||
private boolean locationTraceChecks(final Player player, final Location loc,
|
||||
@@ -501,7 +495,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
final Entity damaged, final boolean damagedIsFake,
|
||||
final Location damagedLoc, LocationTrace damagedTrace,
|
||||
final long tick, final long now, final boolean debug,
|
||||
final boolean reachEnabled, final boolean directionEnabled) {
|
||||
final boolean reachEnabled, final boolean directionEnabled,
|
||||
final boolean visibleEnabled, final boolean hitboxEnabled) {
|
||||
// TODO: Order / splitting off generic stuff.
|
||||
/*
|
||||
* TODO: Abstract: interface with common setup/loop/post routine, only
|
||||
@@ -514,8 +509,9 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
// (Might pass generic context to factories, for shared + heavy properties.)
|
||||
final ReachContext reachContext = reachEnabled ? reach.getContext(player, loc, damaged, damagedLoc, data, cc) : null;
|
||||
final DirectionContext directionContext = directionEnabled ? direction.getContext(player, loc, damaged, damagedIsFake, damagedLoc, data, cc) : null;
|
||||
final VisibleContext visibleContext = visibleEnabled ? visible.getContext(player, loc, damaged, damagedLoc, data, cc) : null;
|
||||
|
||||
final long traceOldest = tick - cc.loopMaxLatencyTicks; // TODO: Set by latency-window.
|
||||
final long traceOldest = now - cc.loopMaxLatencyMs; // TODO: Set by latency-window.
|
||||
// TODO: Iterating direction, which, static/dynamic choice.
|
||||
final Iterator<ITraceEntry> traceIt = damagedTrace.maxAgeIterator(traceOldest);
|
||||
|
||||
@@ -531,23 +527,32 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
// Simplistic just check both until end or hit.
|
||||
// TODO: Other default distances/tolerances.
|
||||
boolean thisPassed = true;
|
||||
if (reachEnabled) {
|
||||
if (reach.loopCheck(player, loc, damaged, entry, reachContext, data, cc)) {
|
||||
if (directionEnabled && hitboxEnabled) {
|
||||
if (hitBox.loopCheck(player, loc, entry,
|
||||
directionContext, reachContext, visibleContext, data, cc,
|
||||
directionEnabled, reachEnabled, visibleEnabled)) {
|
||||
thisPassed = false;
|
||||
}
|
||||
else {
|
||||
reachPassed = true;
|
||||
}
|
||||
}
|
||||
// TODO: Efficiency: don't check at all, if strict and !thisPassed.
|
||||
if (directionEnabled && (reachPassed || !directionPassed)) {
|
||||
if (direction.loopCheck(player, loc, damaged, entry, directionContext, data, cc)) {
|
||||
thisPassed = false;
|
||||
}
|
||||
else {
|
||||
directionPassed = true;
|
||||
} else {
|
||||
if (reachEnabled) {
|
||||
if (reach.loopCheck(player, loc, damaged, entry, reachContext, data, cc)) {
|
||||
thisPassed = false;
|
||||
}
|
||||
else {
|
||||
reachPassed = true;
|
||||
}
|
||||
}
|
||||
// TODO: Efficiency: don't check at all, if strict and !thisPassed.
|
||||
if (directionEnabled && (reachPassed || !directionPassed)) {
|
||||
if (direction.loopCheck(player, loc, damaged, entry, directionContext, data, cc)) {
|
||||
thisPassed = false;
|
||||
}
|
||||
else {
|
||||
directionPassed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thisPassed) {
|
||||
// TODO: Log/set estimated latency.
|
||||
violation = false;
|
||||
@@ -556,20 +561,29 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// TODO: How to treat mixed state: violation && reachPassed && directionPassed [current: use min violation // thinkable: silent cancel, if actions have cancel (!)]
|
||||
// TODO: Adapt according to strictness settings?
|
||||
// TODO: violation vs. reachPassed + directionPassed (current: fail one = fail all).
|
||||
if (reachEnabled) {
|
||||
// TODO: Might ignore if already cancelled by mixed/silent cancel.
|
||||
if (reach.loopFinish(player, loc, damaged, reachContext, successEntry, violation,
|
||||
data, cc, pData)) {
|
||||
if (directionEnabled && hitboxEnabled) {
|
||||
if (hitBox.loopFinish(player, loc, damaged,
|
||||
reachContext, directionContext, visibleContext,
|
||||
successEntry, violation, data, cc,
|
||||
reachEnabled, visibleEnabled, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
if (directionEnabled) {
|
||||
// TODO: Might ignore if already cancelled.
|
||||
if (direction.loopFinish(player, loc, damaged, directionContext, violation, data, cc)) {
|
||||
cancelled = true;
|
||||
} else {
|
||||
// TODO: How to treat mixed state: violation && reachPassed && directionPassed [current: use min violation // thinkable: silent cancel, if actions have cancel (!)]
|
||||
// TODO: Adapt according to strictness settings?
|
||||
// TODO: violation vs. reachPassed + directionPassed (current: fail one = fail all).
|
||||
if (reachEnabled) {
|
||||
// TODO: Might ignore if already cancelled by mixed/silent cancel.
|
||||
if (reach.loopFinish(player, loc, damaged, reachContext, successEntry, violation,
|
||||
data, cc, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
if (directionEnabled) {
|
||||
// TODO: Might ignore if already cancelled.
|
||||
if (direction.loopFinish(player, loc, damaged, directionContext, violation, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Log exact state, probably record min/max latency (individually).
|
||||
@@ -594,6 +608,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
final boolean damagedIsDead = damaged.isDead();
|
||||
final boolean damagedIsFake = !crossPlugin.getHandle().isNativeEntity(damaged);
|
||||
IPenaltyList penaltyList = null;
|
||||
|
||||
if (damagedPlayer != null) {
|
||||
final IPlayerData damagedPData = DataManager.getPlayerData(damagedPlayer);
|
||||
damagedData = damagedPData.getGenericInstance(FightData.class);
|
||||
@@ -638,7 +653,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
if (penaltyList == null) {
|
||||
penaltyList = new DefaultPenaltyList();
|
||||
}
|
||||
onEntityDamageByEntity(damaged, damagedPlayer, damagedIsDead, damagedIsFake,
|
||||
onEntityDamageByEntity(damaged, damagedPlayer, damagedIsDead, damagedIsFake,
|
||||
damagedData, (EntityDamageByEntityEvent) event,
|
||||
penaltyList);
|
||||
}
|
||||
@@ -662,6 +677,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
final boolean damagedIsDead, final boolean damagedIsFake,
|
||||
final FightData damagedData, final EntityDamageByEntityEvent event,
|
||||
final IPenaltyList penaltyList) {
|
||||
|
||||
final Entity damager = event.getDamager();
|
||||
final int tick = TickTask.getTick();
|
||||
if (damagedPlayer != null && !damagedIsDead) {
|
||||
@@ -688,6 +704,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
attacker = (Player) source;
|
||||
}
|
||||
}
|
||||
|
||||
final FightData attackerData;
|
||||
final IPlayerData attackerPData = attacker == null ? null : DataManager.getPlayerData(attacker);
|
||||
if (attacker != null) {
|
||||
@@ -741,12 +758,14 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onEntityDamageMonitor(final EntityDamageEvent event) {
|
||||
|
||||
final Entity damaged = event.getEntity();
|
||||
if (damaged instanceof Player) {
|
||||
final Player damagedPlayer = (Player) damaged;
|
||||
final IPlayerData damagedPData = DataManager.getPlayerData(damagedPlayer);
|
||||
final FightData damagedData = damagedPData.getGenericInstance(FightData.class);
|
||||
final int ndt = damagedPlayer.getNoDamageTicks();
|
||||
|
||||
if (damagedData.lastDamageTick == TickTask.getTick() && damagedData.lastNoDamageTicks != ndt) {
|
||||
// Plugin compatibility thing.
|
||||
damagedData.lastNoDamageTicks = ndt;
|
||||
@@ -777,14 +796,16 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
*/
|
||||
private void applyKnockBack(final Player attacker, final Player damagedPlayer,
|
||||
final FightData damagedData, final IPlayerData pData) {
|
||||
|
||||
final double level = getKnockBackLevel(attacker);
|
||||
final MovingData mdata = pData.getGenericInstance(MovingData.class);
|
||||
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
|
||||
// TODO: How is the direction really calculated?
|
||||
// Aim at sqrt(vx * vx + vz * vz, 2), not the exact direction.
|
||||
final double vx = level / Math.sqrt(8.0);
|
||||
final double vz = vx;
|
||||
final double vy = 0.462; // TODO: (0.365) Needs other workarounds, to allow more when moving off ground (vel + GRAVITY_MAX or max jump gain + little?).
|
||||
final double[] vel2Dvec = calculateVelocity(attacker, damagedPlayer);
|
||||
final double vx = vel2Dvec[0];
|
||||
final double vz = vel2Dvec[2];
|
||||
final double vy = vel2Dvec[1];
|
||||
useLoc1.setWorld(null); // Cleanup.
|
||||
if (pData.isDebugActive(checkType) || pData.isDebugActive(CheckType.MOVING)) {
|
||||
debug(damagedPlayer, "Received knockback level: " + level);
|
||||
@@ -802,6 +823,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
* @return
|
||||
*/
|
||||
private double getKnockBackLevel(final Player player) {
|
||||
|
||||
double level = 1.0; // 1.0 is the minimum knock-back value.
|
||||
// TODO: Get the RELEVANT item (...).
|
||||
final ItemStack stack = Bridge1_9.getItemInMainHand(player);
|
||||
@@ -816,6 +838,57 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
return Math.min(20.0, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Better method to calculate velocity including direction!
|
||||
*
|
||||
* @param attacker
|
||||
* @param damagedPlayer
|
||||
* @return velocityX, velocityY, velocityZ
|
||||
*/
|
||||
private double[] calculateVelocity(final Player attacker, final Player damagedPlayer) {
|
||||
|
||||
final Location aloc = attacker.getLocation();
|
||||
final Location dloc = damagedPlayer.getLocation();
|
||||
final double Xdiff = dloc.getX() - aloc.getX();
|
||||
final double Zdiff = dloc.getZ() - aloc.getZ();
|
||||
final double diffdist = Math.sqrt(Xdiff * Xdiff + Zdiff * Zdiff);
|
||||
double vx = 0.0;
|
||||
double vz = 0.0;
|
||||
int incknockbacklevel = 0;
|
||||
// TODO: Get the RELEVANT item (...).
|
||||
final ItemStack stack = Bridge1_9.getItemInMainHand(attacker);
|
||||
if (!BlockProperties.isAir(stack)) {
|
||||
incknockbacklevel = stack.getEnchantmentLevel(Enchantment.KNOCKBACK);
|
||||
}
|
||||
if (attacker.isSprinting()) {
|
||||
// TODO: Lost sprint?
|
||||
incknockbacklevel++;
|
||||
}
|
||||
// Cap the level to something reasonable. TODO: Config / cap the velocity anyway.
|
||||
incknockbacklevel = Math.min(20, incknockbacklevel);
|
||||
|
||||
if (Math.sqrt(Xdiff * Xdiff + Zdiff * Zdiff) < 1.0E-4D) {
|
||||
if (incknockbacklevel <= 0) incknockbacklevel = -~0;
|
||||
vx = vz = incknockbacklevel / Math.sqrt(8.0);
|
||||
final double vy = incknockbacklevel > 0 ? 0.465 : 0.365;
|
||||
return new double[] {vx, vy, vz};
|
||||
} else {
|
||||
vx = Xdiff / diffdist * 0.4;
|
||||
vz = Zdiff / diffdist * 0.4;
|
||||
}
|
||||
|
||||
if (incknockbacklevel > 0) {
|
||||
vx *= 1.0 + 1.25 * incknockbacklevel;
|
||||
vz *= 1.0 + 1.25 * incknockbacklevel;
|
||||
// Still not exact direction since yaw difference between packet and Location#getYaw();
|
||||
// with incknockbacklevel = 0, it still the precise direction
|
||||
//vx -= Math.sin(aloc.getYaw() * Math.PI / 180.0F) * incknockbacklevel * 0.5F;
|
||||
//vz += Math.cos(aloc.getYaw() * Math.PI / 180.0F) * incknockbacklevel * 0.5F;
|
||||
}
|
||||
final double vy = incknockbacklevel > 0 ? 0.465 : 0.365;
|
||||
return new double[] {vx, vy, vz};
|
||||
}
|
||||
|
||||
/**
|
||||
* We listen to death events to prevent a very specific method of doing godmode.
|
||||
*
|
||||
@@ -843,17 +916,14 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerAnimation(final PlayerAnimationEvent event) {
|
||||
// Set a flag telling us that the arm has been swung.
|
||||
/*
|
||||
* TODO: First one always fails: Packet inversion on 1.12.2? This could
|
||||
* be moved to packet level (register either).
|
||||
*/
|
||||
DataManager.getGenericInstance(event.getPlayer(),
|
||||
FightData.class).noSwingArmSwung = true;
|
||||
final FightData data = DataManager.getGenericInstance(event.getPlayer(), FightData.class);
|
||||
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onEntityRegainHealthLow(final EntityRegainHealthEvent event) {
|
||||
|
||||
final Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) {
|
||||
return;
|
||||
@@ -880,6 +950,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityRegainHealth(final EntityRegainHealthEvent event) {
|
||||
|
||||
final Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) {
|
||||
return;
|
||||
@@ -900,12 +971,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
Entity entity = e.getRightClicked();
|
||||
final Player player = e.getPlayer();
|
||||
final FightData data = DataManager.getGenericInstance(player, FightData.class);
|
||||
|
||||
if (entity instanceof Parrot) {
|
||||
data.exemptArmSwing = true;
|
||||
} else {
|
||||
data.exemptArmSwing = false;
|
||||
}
|
||||
|
||||
data.exemptArmSwing = entity != null && entity.getType().name().equals("PARROT") ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -920,6 +987,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
|
||||
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
|
||||
public void onItemHeld(final PlayerItemHeldEvent event) {
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final long penalty = pData.getGenericInstance(FightConfig.class).toolChangeAttackPenalty;
|
||||
@@ -927,29 +995,5 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
pData.getGenericInstance(FightData.class).attackPenalty.applyPenalty(penalty);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityDamage(EntityDamageByEntityEvent event) {
|
||||
if (!(event.getDamager() instanceof Player)) return;
|
||||
Player player = (Player) event.getDamager();
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
final NetData data = pData.getGenericInstance(NetData.class);
|
||||
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
|
||||
if (!pData.isCheckActive(CheckType.NET_FIGHTSYNC, player)) return;
|
||||
if (data.fightSyncCount >= cc.fightSyncResetCount) {
|
||||
data.fightSyncCount = 0;
|
||||
data.fightSyncReset = 0;
|
||||
data.fightSyncVL *= 0.99D;
|
||||
}
|
||||
data.fightSyncReset += 1;
|
||||
Location packet = data.lastHitLocation, eventLoc = player.getLocation();
|
||||
|
||||
if (FightSync.check(player, pData, data, packet, eventLoc, cc)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user